; This is for the FC series 4 ECU message "Parsing Symbol File" cpu 6303 numformat C org 0xC000 message "Parsing vectors" ;reset and interrupt vectors ; Reset vector 0xFFFE reset_vector Reset ; NMI vector 0xFFFC nmi_vector NMI_Entry ; SWI instruction vector 0xFFFA swi_vector SWI_Entry ; IRQ1 interrupt strobe 3 vector 0xFFF8 irq3_vector Int3_Entry ; IRQ2 timer input capture vector 0xFFF6 timer_in_vector Timer_In_Int_Entry ; IRQ2 timer output compare vector 0xFFF4 timer_out_vector Timer_Out_Int_Entry ; IRQ2 timer overflow vector 0xFFF2 timer_of_vector Timer_Of_Entry ; IRQ2 serial I/O vector 0xFFF0 serial_vector Serial_Entry ; Invalid OpCode vector 0xFFEE trap_vector Trap_Entry ;============================================================================= ; ; General ECU hardware definitions ; message "Parsing Memory Ranges" ; Internal RAM range 0x80 - 0xFF ; Addresses 0x20 - 0x7F can be filled by external memory ; RAM and ROM start addresses ;symbol 0x4000 RAMstart symbol 0xC000 ROM_Low symbol 0xE000 ROM_High ;============================================================================= ; ; 6303 CPU Internal Peripherals message "Parsing 6303 CPU Internal Peripherals" ; Two internal parallel ports: ; Port 1 is 8 bits: P10 - P17, can be used as A0-A7. ; Bit 1 can bs P11 or the output of the second OCR??? ; Port 2 is 5 bits: P20 - P24 with a confouding array of uses ; Bits 0-2 set the CPU mode on reset - they are latched into the upper ; 3 bits of the port 2 data register (which are read-only). ; Bit 0 can be P20 or the timer edge input, ; Bit 1 can be P21 or the timer output, ; Bit 2 can be P22 or the serial (SCI) port clock ; Bit 3 can be P23 or the serial input, ; Bit 4 cab be P24 or the serial output. ; The direction registers: 1 means output, 0 means output. ; The code writes 0x2606 to the DDR register pair: port 1 bits 1, 2 & 5 are ; outputs, and port 2 bits 1 & 2 are output. ; Bit 4 (0x10) is looped on until low in self test symbol 0x0000 CPU_Port1_DDR symbol 0x0001 CPU_Port2_DDR symbol 0x0002 CPU_Port1_Data ; Port 1 Assignments (with Henrik Christensen) ; P17 (I) = Neutral Switch (Pin 1G) ; P16 (I) = 20,000 Mile Switch (Pin 1O) ; P15 (O) = Shift-Up Indicator (Pin 1K) ; P14 (I) = Water Temp Switch (Pin 1H) ; P13 (I) = 5th Gear/Over the top switch (Pin 1I) ; P12 (O) = Related to BAC/Primary injector outputs ; P11 (O) = Related to trailing ignition (Pin X) ; P10 (I) symbol 0x0003 CPU_Port2_Data ; Upper 3 bits are a CPU ID code. In order for this ; code to execute, it must find 0x40 in the upper 3 bits ; Port 2 Assignments (with Henrik Christensen) ; P27 (RO)= 0 ; P26 (RO)= 1 ; P25 (RO)= 0 ; P24 (I) ; P23 (I) = IC100-14 (related to CAS) ; P22 (O) = Clock input related to IRQ1 trigger ; P21 (O) = [CPU Timer Out] connected to IC302-12 ; P20 (I) = Power Steering Switch (Pin 1R) ; Timer control & status register byte 0x0008 CPU_Timer_CSR_1 ; Bit 7 ICF - Input Capture Flag ; Bit 6 OCF1 - Output Compare Flag ; Bit 5 TOF - Timer Overflow Flag ; Bit 4 EICI - Enable Input Capture Interrupt ; Bit 3 EOCI1 - Enable Output Compare 1 Interrupt ; Bit 2 ETOI - Enable Timer Overflow Interrupt ; Bit 1 IEDG - Input Edge select ; Bit 0 OLVL1 - Output Level clocked out on next output compare word 0x0009 CPU_Timer_Data symbol 0x000A CPU_Timer_Data_LSB ; Output compare register number 1 word 0x000B CPU_Timer_OCR_1 byte 0x000C CPU_Timer_OCR_1_LSB ; Input compare register word 0x000D CPU_Timer_ICR_1 byte 0x000E CPU_Timer_ICR_1_LSB ; Rate and mode control register - set to 0x0B, 244.1 baud internal clock ; 1/4096, NRZ. clock output on port 2 bit 2 symbol 0x0010 CPU_Sci_Mode_Control ; ; Transmit rate and control register - disabled (0x00) symbol 0x0011 CPU_Sci_TRCS ; Bit 7 RDRF - Receiver Data Register Full ; Bit 6 ORFE - Overrun Framing Error ; Bit 5 TDRE - Transmit Data Register Empty ; Bit 4 RIE - Receiver Interrupt Enable ; Bit 3 RE - Receiver Enable ; Bit 2 TIE - Transmit Interrupt Enable ; Bit 1 TE - Transmit Enable ; Bit 0 WU - Wake Up on next message ; Receive and Transmit data registers symbol 0x0012 CPU_Sci_Rx_Data symbol 0x0013 CPU_Sci_Tx_Data ; Bit 7 is Standby Power, Bit 6 is the RAM Enable; set to 0x40 symbol 0x0014 CPU_Ram_Control ; Bytes 0x15 - 0x1F are reserved in the real 6303 ; The following are educated guesses about additional hardware that may ; be present in the ND version of the microcontroller. byte 0x0018 CPU_Timer_CSR_2 ; This is from the 6303X: ; Bit 7 ICF - Input Capture Flag ; Bit 6 OCF1 - Output Compare Flag for OCR1 ; Bit 5 OCF2 - Output Compare Flag for OCR2 ; Bit 4 N/A - (would be EICI - Enable Input Capture Interrupt) ; Bit 3 EOCI2 - Enable Output Compare Interrupt ; Bit 2 OLVL2 - Output Level clocked out on next output compare ; Bit 1 OE2 - Output Enable 2 ; Bit 0 OE1 - Output Enable 1 ; This is my gues from the firmware: ; Bit 7 ICF - Input Capture Flag ; Bit 6 OCF2 - Output Compare Flag for OCR2 ; Bit 5 ; Bit 4 ; Bit 3 EOCI2 - Enable Output Compare 2 Interrupt ; Bit 2 ; Bit 1 ; Bit 0 OLVL2 - Output Level clocked out on next output compare word 0x001B CPU_Timer_OCR_2 byte 0x001C CPU_Timer_OCR_2_LSB word 0x001D CPU_Timer_ICR_2 byte 0x001E CPU_Timer_ICR_2_LSB ;============================================================================= ; ; External Peripherals ; message "Parsing External Peripherals" ; --------------------- ; ; Hitachi HD46508 Analog data acquisition unit - conversion <= 40 inst. ; ; Control Reg 0: (R/W) To start conversion, register 0 is written with 0x00 symbol 0x1000 ADC_Control_Reg_0 ; Bit 7 IE - Enable IRQ bit ; Bit 6 CD - Clock Divisor: set CLK/2, clear CLK ; Bit 5 ST - Settling time (set) ; Bit 4 - 2 N/A ; Bit 1 G1 - Gain Sel. Mode selects (depends on GS) ; Bit 0 G0 - ; G1 G0 ; 0 0 Sample & Hold ; 0 1 Autorange x2 ; 1 0 Autorange x4 ; 1 1 Programmable gain control ; ; Control Reg 1: (R/W) symbol 0x1001 ADC_Control_Reg_1 ; Bit 7 SC - Short Cycle: (set) 8 bits, (clear) 10 bits ; Bit 6 GS - Gain Sel Enable: (set) Gain Sel Enabled ; Bit 5 PC - Prog. Comp. Mode ; Bit 4 MI - MPX Inhibit ; Bit 3 D3 - MPX Channel selects AD0 - AD15 ; Bit 2 D2 ; Bit 1 D1 ; Bit 0 D0 ; ; Data and Status register: (R/W) symbol 0x1002 ADC_Data_Status ; Bit 7 IRQ - IRQ requested if set ; Bit 6 BSY - Busy (set), conversion complete (clear) ; Bit 5 PCO - Prog. Comp. Out: (set) Vin > Vp, Vin < Vp (clear) ; Bit 4 N/A ; Bit 3 OV - Over-range, V out of range (set) ; Bit 2 DW - Data Weight, valid in autorange gain sel ; Bit 1 C9 - Two MSBs for 10 bit conversions ; Bit 0 C8 - ; ; A/D Data Register: (RO) Eight LSBs of A/D conversion ; PC Data Register: (WO) Data for programable voltage comparison symbol 0x1003 ADC_Data_LSB ; ; Mapping of Analog inputs to the ADC, with Henrik Christensen: ; ; Ain0 = ATP Sensor (Pin 2H) ; Ain1 = AFR Sensor (Pin 2D) ; Ain2 = AFM Sensor (Pin 2E) ; Ain3 = Variable Resistor (Pin 2F) ; Ain4 = Intake Air Temp Sensor (Pin 2L) ; Ain5 = Water Thermo Sensor (Pin 2I) ; Ain6 = AFM Air Temp Sensor (Pin 2J) ; Ain7 = Battery voltage (scaled 1/4) ; Ain8 = TPS Sensor (Pin 2G) ; Ain9 = Vref- (0V) ; Ain10 = Clutch Switch [+5V on/0V off] (Pin 1L) ; Ain11 = A/C Switch [+5V on/0V off] (Pin 1E) ; Ain12 = Initial Set (Pin 1J) ; Ain13 = Boost Sensor (Pin 2B) ; Ain14 = Starter [3V on/0.7V off] (Pin 3B) ; Ain15 = Heat Hazard Switch [0V on/5V off] (Pin 1W) ; ; --------------------- ; ; HD46821P PIO/PIA Parallel I/O (Assignments from Henrik) ; symbol 0x2000 PIA_A_Data ; And Direction - 0: input, 1: output ; PIA Port A assignments [Initial self test outputs] ; Initialized to all outputs at Reset, 0x39 ; When Bit 2 of PIA_A_Control is 0, this is the Data Direction ; Register; when it is 1, these are the I/O bits ; Bit 7 - PA7 = Secondary injector enable? ; Bit 6 - PA6 = PRCV Solenoid (Pin 2M) ; Bit 5 - PA5 = Split Air Solenoid (Pin 2K) ; Bit 4 - PA4 = Digital Code Checker 1 (Pin 1A) [Set if int mem test failed] ; Bit 3 - PA3 = Digital Code Checker 2 (Pin 1B) [Set if ext mem test failed] ; Bit 2 - PA2 = AFR sensor Rich/Lean (Pin 1D) [Set if checksum test failed] ; Bit 1 - PA1 = IC100-15 (related to CAS) ; Bit 0 - PA0 = 6303 IRQ1 trigger enable ; ; CA1 = IgF (Pin 1M) (trailing ignition, front rotor, feedback) ; CA2 = IgF (Pin 1M) ; symbol 0x2001 PIA_A_Control ; Bit 7 - CA1 interrupt status (0 = idle, 1 = request) RO ; Bit 6 - CA2 interrupt status (0 = idle, 1 = request) RO ; Bit 5 - CA2 direction (0 = input, 1 = output) RW ; Bit 4 - CA2 mode (0 = 1->0, 1 = 0->1 or 'follow') RW ; Bit 3 - CA2 int enable (0 = disable, 1 = enable) RW ; Bit 2 - PDR/DDR select (0 = DDR, 1 = PDR) RW ; Bit 1 - CA1 mode (0 = 1->0, 1 = 0->1) RW ; Bit 0 - CA1 int enable (0 = disable, 1 = enable) RW ; ; CA2 modes ; B5 B4 B3 ; 0 0 0 In: Interrupt on falling edge, disabled ; 0 0 1 In: Interrupt on falling edge, enabled ; 0 1 0 In: Interrupt on rising edge, disabled ; 0 1 1 In: Interrupt on rising edge, enabled ; 1 0 0 In: CPU Handshake In ; 1 0 1 Out: Pulse on reading Data A ; 1 1 0 Out: Set CA2 output low ; 1 1 1 Out: Set CA2 output high ; symbol 0x2002 PIA_B_Data ; And Direction - 0: input, 1: output ; Initialized to all outputs at Reset, 0x7F ; When Bit 2 of PIA_B_Control is 0, this is the Data Direction ; Register; when it is 1, these are the I/O bits ; PIA Port B assignments ; Bit 7 - PB7 = Ignition, trailing inhibit? ; Bit 6 - PB6 = Input into IC302 ; Bit 5 - PB5 = Switching Solenoid (Pin 2O) ; Bit 4 - PB4 = Relief Solenoid (Pin 2P) ; Bit 3 - PB3 = Port Air Solenoid (Pin 1S) ; Bit 2 - PB2 = EGR Solenoid (Pin 2N) ; Bit 1 - PB1 = Air Cond cutout (Pin 1F) ; Bit 0 - PB0 = Air Bypass Solenoid (Pin 1C) ; ; CB1 = Unused ; CB2 = Unused ; symbol 0x2003 PIA_B_Control ; Bit 7 - CB1 interrupt status (0 = idle, 1 = request) RO ; Bit 6 - CB2 interrupt status (0 = idle, 1 = request) RO ; Bit 5 - CB2 direction (0 = input, 1 = output) RW ; Bit 4 - CB2 mode (0 = 1->0, 1 = 0->1 or 'follow') RW ; Bit 3 - CB2 int enable (0 = disable, 1 = enable) RW ; Bit 2 - PDR/DDR select (0 = DDR, 1 = PDR) RW ; Bit 1 - CB1 mode (0 = 1->0, 1 = 0->1) RW ; Bit 0 - CB1 int enable (0 = disable, 1 = enable) RW ; ; CB2 modes ; B5 B4 B3 ; 0 0 0 In: Interrupt on falling edge, disabled ; 0 0 1 In: Interrupt on falling edge, enabled ; 0 1 0 In: Interrupt on rising edge, disabled ; 0 1 1 In: Interrupt on rising edge, enabled ; 1 0 0 In: CPU Handshake Out ; 1 0 1 Out: Pulse on writing Data B ; 1 1 0 Out: Set CB2 output low ; 1 1 1 Out: Set CB2 output high ; ; ; --------------------- ; ; HD6840P Timer ; symbol 0x3000 timer_13_control symbol 0x3001 timer_2_control symbol 0x3002 timer_MSB_buffer symbol 0x3003 timer_1_latches symbol 0x3004 timer_2_read symbol 0x3005 timer_2_latches symbol 0x3006 timer_3_read symbol 0x3007 timer_3_latches ; ; O1 = front secondary injector ; O2 = rear secondary injector ; ;============================================================================= ; ; ECU variables in internal RAM ; message "Parsing ECU variables in internal RAM" byte 0x0040 sub_02_flags_1 ; 10 : If clear, the clear sub_42_value_1 byte 0x0041 sub_42_flags_1 byte 0x0042 sub_02_flags_2 ;byte 0x0043 chan_1_flags_1 byte 0x0043 AFR_flags_1 byte 0x0044 sub_02_flags_3 byte 0x0045 sub_02_flags_4 byte 0x0046 intakeTemp_thresh_bits byte 0x0047 sub_02_flags_5 byte 0x0048 sub_02_flags_6 byte 0x004C sub_02_flags_7 ; Flags bits ; 20 : Masks AC Switch when set byte 0x004E sub_42_flags_2 ; Flags bits ; 01 : ; 02 : ; 04 : ; 08 : ; 10 : ; 20 : Close loop mode? Check for midpoint crossing if clear ; 40 : ARF_4 (Chan_1_4) ; 80 : AFR_9 (Chan_1_9) & 10 set if AFR < limit 2, reset if ch > limit 2; ; used to set/reset bit 04 (AFR Rich/Lean - "Green Lamp") of PIA A. byte 0x004A AFR_flags_2 ; Flags bits ; 01 : ; 02 : ; 04 : ; 08 : If set, Sub_42 will calculate the next filtered Batt value ; 10 : ; 20 : ; 40 : ; 80 : byte 0x004D sub_52_flags ; Flags bits ; 10 : If cleared, skip Self_test (clearing self_test_flag) ; 40 : If set, clear sub_42_value_1 ; 80 : If cleared, byte 0x004F self_test_flags_1 ; Flags bits ; 04 : If set ; 80 : If cleared, clear sub_42_value_1 byte 0x0050 self_test_flags_2 ; error_flags_1 ; ; 01 : ; 02 : ; 04 : ; 08 : ; 10 : ; 20 : ; 40 : Set if AFM value below AFM_Err_const ; 80 : Set for CAS failure byte 0x0051 error_flags_1 ; error_flags_2: a bit field ; 01 : IAT (Ch 4) out of range ; 02 : Trailing Coil Failure (Sub_72 sets & checks) ; 04 : ATP (Ch 0) out of range ; 08 : Boost (Ch D) out of range (Sub_31 checks) ; 10 : TPS (Ch 8) out of range (ADC_Init sets & clears) ; 20 : AFR (Ch 1) status (AFR sets & clears, Sub_06 sets) ; 40 : AFM Temp (Ch 6) out of range ; 80 : Water Temp (Ch 5) out of range (Sub_39 checks) byte 0x0052 error_flags_2 ; sub_45_flags: a bit field ; 80 : Set when CAS is working ; 08 : Set in Sub_78/Cleared in Sub_11 ; 04 : Set/cleared in Timer_In_Int ; 01 : Set/cleared in Timer_In_Int, set in Sub_45, cleared in Sub_47 byte 0x0053 sub_45_flags byte 0x0054 TPS_update_flags_1 byte 0x0055 PIA_A_data_shadow byte 0x0056 PIA_B_data_shadow byte 0x0057 main_time_sync byte 0x0059 Switches_ADC_inputs byte 0x005A Switches_port_inputs ; The region 0x5C to 0x66 tested some how ;word 0x005C ADC_ch_2_value ;byte 0x005F ADC_ch_1_value word 0x005C ADC_AFM_value byte 0x005F ADC_AFR_value ; These are the destination values referenced by the ADC_ch_n_structs ;byte 0x0060 ADC_ch_7_value ;byte 0x0061 ADC_ch_3_value ;byte 0x0062 ADC_ch_0_value ;byte 0x0063 ADC_ch_D_value ;byte 0x0064 ADC_ch_4_value ;byte 0x0065 ADC_ch_6_value ;byte 0x0066 ADC_ch_5_value byte 0x0060 ADC_Batt_value byte 0x0061 ADC_VRes_value byte 0x0062 ADC_ATP_value byte 0x0063 ADC_Boost_value byte 0x0064 ADC_IntakeTemp_value byte 0x0065 ADC_AFMTemp_value byte 0x0066 ADC_WaterTemp_value byte 0x0067 Scaled_IntakeTemp_value byte 0x0068 Scaled_AFMTemp_value byte 0x0069 Scaled_WaterTemp_value byte 0x006A twoD_interpolator_colum_num byte 0x006B twoD_interpolator_column_fract byte 0x006C twoD_interpolator_row_num byte 0x006D twoD_interpolator_row_fract byte 0x006F timer_OCR1_rollover ; If less than 0x1000, Self_test will exit (clearing self_test_flag) byte 0x0074 timer_chan_1 byte 0x0075 timer_chan_2 byte 0x0076 CAS_timer_1 word 0x0077 sub_48_data_1 byte 0x0079 sub_76_data_1 word 0x007A temp_word_1 byte 0x007B temp_word_1_byte_2 word 0x007C temp_word_2 word 0x007D temp_word_2_byte_2 byte 0x007F timer_OCR2_rollover word 0x0080 BAC_Pulse_Width word 0x0090 sub_42_value_10 word 0x0093 Scaled_WaterTemp_1 word 0x009E Scaled_WaterTemp_2 ;word 0x009E sub_42_value_12 word 0x00A0 interp_filtered_Batt_value word 0x00A2 sub_42_value_8 word 0x00A4 sub_42_value_2 word 0x00A6 sub_42_value_11 word 0x00A8 sub_42_value_7 byte 0x00AA sub_23_value_1 byte 0x00AB sub_23_value_2 byte 0x00AC sub_23_value_3 byte 0x00AD twoD_interpolator_out_2 byte 0x00AE twoD_interpolator_out_1 byte 0x00B5 sub_23_value_4 ; Flags bits ; 04 byte 0x00B6 AFR_flags_3 ; Flags ; 02 : same as bit 80 of AFR_flags_2 and PIA A bit 04 byte 0x00B7 AFR_flags_4 byte 0x00B9 sub_02_data_1 byte 0x00BA sub_02_data_2 byte 0x00E7 sub_02_data_3 byte 0x00EB sub_02_data_4 word 0x00DB sub_02_data_5 byte 0x00E2 sub_02_data_6 byte 0x00E4 sub_02_data_7 byte 0x00BB sub_50_data_1 word 0x00BF Scaled_Batt_val word 0x00DE sub_04_data_1 word 0x00C5 sec_inj_width byte 0x00C9 Scaled_WaterTemp_3 word 0x00CB Scaled_WaterTemp_4 word 0x00D7 Scaled_VRes word 0x00D9 sub_20_data byte 0x00EA Scaled_WaterTemp_5 word 0x00F3 TPS_fuel_or_something byte 0x00F9 timer_word_stuff byte 0x00FA timer_word_stuff_LSB byte 0x00F7 self_test_flag byte 0x00F8 ADC_ch_5_value_1 ;============================================================================= ; ; ECU variables in external RAM ; message "Parsing ECU variables in external RAM" symbol 0x47FF stack_base symbol 0x47FD alt_stack_base ; Check for extended ROM at 0x8000 with signature of 0x5A symbol 0x8000 rom_test_8000 byte 0x4000 init_flag_AA ; Initialized to 0x8080 in Init_stuff byte 0x4001 global_stuff 100 ; Initialized to 0x7F7F in Init_stuff word 0x4065 global_data_table 50 byte 0x40EB sub_02_data_8 symbol 0x40D8 Init_global_start symbol 0x40FF Int3_data_1 ; Indexed as a table of words[8] in Sub_39, Sub_42 & Init_stuff ; The second 4 values are the complement of the first 4, i.e. X[i+4]=~X[i] ; initialized to 0x0555 word 0x40C9 global_word_0 ; initialized to 0x02AA word 0x40CB global_word_1 word 0x40CD global_word_2 word 0x40CF global_word_3 ; initialized to 0xFAAA word 0x40D1 global_word_4 ; initialized to 0xFD55 word 0x40D3 global_word_5 word 0x40D5 global_word_6 word 0x40D7 global_word_7 byte 0x40D9 init_flag_55 byte 0x40DA Scaled_AFMTemp_1 byte 0x40DC Scaled_ATP byte 0x40DE sub_04_data_2 byte 0x40DF sub_04_data_3 byte 0x40EA sub_01_data_1 word 0x40ED sub_01_data_2 word 0x40EF sub_01_data_3 word 0x40E7 AFR_value_1 byte 0x40EC AFR_value_2 byte 0x40FA sub_36_data_1 byte 0x40FB sub_36_data_2 byte 0x4121 Int3_data_2 byte 0x4164 sub_36_data_3 word 0x4167 Scaled_WaterTemp_6 word 0x412A mystery_data_1 byte 0x412B mystery_data_1_LSB word 0x412C mystery_data_2 byte 0x4133 CAS_timer_2 ; Initialized to 0x80, incremented in the Main_Loop, tested & cleared in ; Timer_In_Int byte 0x4136 sub_45_value_1 word 0x4137 mystery_timer_delta byte 0x4138 mystery_timer_delta_LSB word 0x4139 sub_45_value_2 word 0x413B mystery_data_3 byte 0x413D diag_timer word 0x413E diag_work_DCC1 word 0x4140 diag_work_DCC2 word 0x4142 diag_next_DCC1 word 0x4144 diag_next_DCC2 byte 0x4146 diag_count_DCC1 byte 0x4147 diag_count_DCC2 byte 0x4148 diag_last_code byte 0x4149 diag_busy_flag word 0x414D sub_42_value_9 byte 0x4150 sub_42_value_6 word 0x4152 Scaled_IntakeTemp_value_2 word 0x4158 sub_42_value_1 word 0x4160 sub_42_value_4 word 0x4165 sub_42_value_3 word 0x416B sub_42_value_5 byte 0x416E sub_40_flags byte 0x416F sub_23_value_4 byte 0x4170 sub_23_value_5 byte 0x4171 sub_23_value_6 byte 0x417D ADC_Batt_filtered byte 0x417E ADC_AFR_value_old byte 0x4180 Switches_state_1 byte 0x4181 Switches_state_2 word 0x4185 TPS_scaled_value_1 word 0x4187 TPS_scaled_value_2 ;============================================================================= ; ; Constants (in ROM) message "Parsing Constants" string 0xC006 ver_string 6 symbol 0xC05E table_1 symbol 0xC23D table_2 symbol 0xD44D table_3 byte 0xE0D7 sub_36_const_1 word 0xE0DA sub_36_const_2 byte 0xE0DC sub_36_const_3 word 0xE0DF sub_42_value_1_init word 0xE0EF sub_42_value_5_init byte 0xC014 AFR_threshold_value_1 byte 0xC015 AFR_threshold_value_2 word 0xC016 AFR_constant_value_1 word 0xC056 AFR_constant_value_2 symbol 0xC2FA data_X symbol 0xC2FB data_Y symbol 0xC2E8 mystery_table symbol 0xC01E sub_14_table_1 symbol 0xC020 sub_14_table_2 symbol 0xC02A sub_14_table_3 symbol 0xC024 sub_14_table_4 symbol 0xC02C sub_14_table_5 symbol 0xC060 sub_02_table_1 symbol 0xC092 sub_02_table_2 symbol 0xC0F6 sub_02_table_3 symbol 0xC051 sub_02_const_1 symbol 0xC1AA sub_10_const symbol 0xC1E5 sub_12_const word 0xD447 sub_23_const_4 ; Two D arrays [19, 21] ([0x13, 0x15]) byte 0xD44E twoD_interpolator_table_1 byte 0xD5DD twoD_interpolator_table_2 symbol 0xD76C sub_25_const_1 symbol 0xD777 sub_25_const_2 word 0xD782 diag_table_DCC1 0x0A word 0xD796 diag_table_DCC2 0x0A byte 0xD7AA diag_table_DCC3 0x26 symbol 0xD7D4 sub_23_const_1 symbol 0xD7D5 sub_23_table symbol 0xD7E1 sub_23_const_2 symbol 0xD7E7 sub_23_const_3 symbol 0xE0F1 sub_35_const_2 symbol 0xE0FE sub_33_const_2 symbol 0xE0F3 sub_33_const_1 symbol 0xE109 sub_33_const_3 symbol 0xE114 sub_33_const_6 symbol 0xE11F sub_33_const_5 symbol 0xE12A sub_33_const_4 symbol 0xE135 sub_35_const_1 symbol 0xE20D sub_38_const symbol 0xE221 sub_37_const symbol 0xE27D sub_42_const symbol 0xE809 sub_47_const symbol 0xE873 sub_48_const_2 symbol 0xFA9D ADC_Init_const_1 symbol 0xFAA3 ADC_Init_const_2 byte 0xFA97 timer_in_const ; This structure is an interpolated table: ; struct { byte clip_max; ; byte offset; ; byte scale; ; byte data[N]; // N = scale ; } byte 0xC1C4 waterTemp_i_table_1 byte 0xC1D0 sub_13_1_i_table byte 0xC1DC sub_13_2_i_table byte 0xC1E8 sub_12_1_ix_table byte 0xC1F5 waterTemp_i_table_2 symbol 0xC1FE vRes_i_table byte 0xC201 vRes_ix_table byte 0xC206 waterTemp_i_table_3 byte 0xC212 AFMTemp_i_table byte 0xC21B calc_ATP_i_table byte 0xC21E calc_ATP_ix_table byte 0xC227 Batt_i_table byte 0xC23F sub_01_1_i_table byte 0xC242 sub_01_1_ix_table byte 0xC248 sub_01_2_i_table byte 0xC24B sub_01_2_ix_table byte 0xC251 sub_01_3_i_table byte 0xC254 sub_01_3_ix_table byte 0xD76F sub_26_1_ix_table byte 0xD77A sub_26_2_ix_table byte 0xE231 sub_42_1_i_table byte 0xE23D waterTemp_i_table_4 byte 0xE248 sub_41_i_table byte 0xE251 waterTemp_i_table_5 byte 0xE25A waterTemp_i_table_6 byte 0xE263 waterTemp_i_table_7 byte 0xE26D sub_38_1_i_table byte 0xE28F sub_42_2_i_table byte 0xEFFF temp_interp_table byte 0xF051 intake_temp_i_table byte 0xFBFA sub_51_i_table byte 0xFBEE sub_58_i_table byte 0xFC03 TPS_1_ix_table byte 0xFC0A TPS_2_ix_table byte 0xFC11 TPS_3_ix_table byte 0xFC18 TPS_4_ix_table byte 0xFC32 sub_55_i_table ; These are structures with the following byte sequence: ; 0: ADC channel number + 0x80 (init conversion?) ; 1: Minimum value (if non-zero) ; 2: Maximum value (if non-zero) ; 3: If non-zero, default value to store in address in byte 5 for out of range ; 4: Flag to set if out of range, clear if in range in error_flags_2 ; 5: Address to store the final value ;byte 0xFABB ADC_ch_0_struct 6 ;byte 0xFAB5 ADC_ch_3_struct 6 ;byte 0xFAC1 ADC_ch_4_struct 6 ;byte 0xFACD ADC_ch_5_struct 6 ;byte 0xFC45 ADC_ch_5_struct_1 6 ;byte 0xFAC7 ADC_ch_6_struct 6 ;byte 0xFAAF ADC_ch_7_struct 6 ;byte 0xFAD3 ADC_ch_D_struct 6 byte 0xFABB ADC_ATP_struct 6 byte 0xFAB5 ADC_VRes_struct 6 byte 0xFAC1 ADC_IntakeTemp_struct 6 byte 0xFACD ADC_WaterTemp_struct 6 byte 0xFC45 ADC_WaterTemp_struct_1 6 byte 0xFAC7 ADC_AFMTemp_struct 6 byte 0xFAAF ADC_Batt_struct 6 byte 0xFAD3 ADC_TPS_struct 6 ; From Sub_67 byte 0xFAD9 check_thresh_table_1 byte 0xFAEA check_thresh_table_2 byte 0xFAF9 check_thresh_table_3 byte 0xFC26 check_thresh_table_4 byte 0xFC29 check_thresh_table_5 byte 0xFC2C check_thresh_table_6 byte 0xFC2F check_thresh_table_7 byte 0xE801 check_thresh_table_8 ; From Check_Switches byte 0xFB08 check_thresh_table_9 byte 0xFB15 check_thresh_table_10 byte 0xFB22 check_thresh_table_11 ; From Sub_57 byte 0xFB2F check_thresh_table_12 ; From Sub_61 byte 0xFB3C check_thresh_table_IntakeTemp ; From TPS_Update These are rows of an array indexed in TPS_Update byte 0xFB43 boost_thresh_table_1 7 byte 0xFB4A boost_thresh_table_2 7 byte 0xFB51 boost_thresh_table_3 7 byte 0xFB58 boost_thresh_table_4 7 ; This table consists of 3 byte elements, one byte followed by one word. byte 0xFB5F Sub_49_table byte 0xFBE4 Check_Switches_const_1 byte 0xFBE5 Check_Switches_const_2 byte 0xFB71 sub_52_table_1 byte 0xFB95 sub_52_table_2 word 0xFC4D AFM_Min_const word 0xFA98 AFM_Err_const byte 0xFC4B ATP_Base_const byte 0xFC4C ATP_Hyst_const word 0xFC22 TPS_adj_const_1 word 0xFC24 TPS_adj_const_2 ;============================================================================= ; ; ECU code labels ; message "Parsing ECU code labels" symbol 0xB000 Extended_ROM_Reset_Entry symbol 0xB003 Extended_ROM_Loop_Entry symbol 0xE30D Memory_clear1_loop symbol 0xE316 Memory_clear2_loop code 0xE326 Extended_ROM_branch_1 code 0xE57C Extended_ROM_branch_2 symbol 0xE329 Reset_1 ; This appears to be the main loop??? symbol 0xE40E Main_Loop symbol 0xE424 Main_Loop_1 symbol 0xE430 Main_Loop_2 symbol 0xE437 Main_Loop_3 symbol 0xE444 Main_Loop_skip_Sub_45 symbol 0xE453 Main_Loop_5 symbol 0xE483 Main_Loop_6 symbol 0xE4D4 Main_Loop_7 symbol 0xE4E9 Main_Loop_8 symbol 0xE4F4 Main_Loop_9 symbol 0xE500 Main_Loop_10 symbol 0xE50F Main_Loop_11 symbol 0xE51D Main_Loop_12 symbol 0xE541 Main_Loop_13 symbol 0xE54D Main_Loop_14 symbol 0xE559 Main_Loop_15 symbol 0xE565 Main_Loop_16 symbol 0xE56B Main_Loop_17 symbol 0xE571 Main_Loop_18 ; This routine checks init_flag_AA and init_flag_55, if they are not ; 0xAA and 0x55 respectivet, then the hardawre is initialized. symbol 0xE3C3 Check_for_init symbol 0xE3D2 Reinit_stuff symbol 0xE3D8 Init_global_word_loop symbol 0xE3E4 Init_global_word_comp_loop symbol 0xE3F0 Init_global_data_table_loop symbol 0xE3FB Init_global_stuff_loop symbol 0xE61C ADC_Init symbol 0xE631 ADC_Init_1 symbol 0xE643 ADC_Init_2 symbol 0xE64B ADC_Init_3 symbol 0xE655 ADC_Init_4 symbol 0xE65B ADC_Init_5 symbol 0xE65D ADC_Init_6 symbol 0xE66B ADC_Init_7 symbol 0xE68E ADC_Init_8 symbol 0xE691 ADC_Init_9 symbol 0xE699 ADC_Init_10 symbol 0xE69D ADC_Init_11 symbol 0xE69F ADC_Init_exit ; Main_Fuel ; ; X = &Main_Fuel_computed_target ; D = ADC_AFM_value; ; if (D < 0x0040) ; D = 0x0040; // D >= 0x0040 ; while ((D & 0xFE00) == 0) { ; X += 2; // X += { 0, 1, 2, 3 } ; D <<= 1; // D >= 0x0200 ; } ; D <<= 2; // D >= 0x0800 ; PUSH X // Used as return address ; mystery_data_1 = D; ; B = A; // B >= 0x08 ; B <<= 1; // B >= 0x10 ; X = &Main_Fuel_table_base; ; X += B; // X >= Main_Fuel_table_base ; D = *X; ; D -= *(X + 2) ; A = LSB( mystery_data_1 ); ; A:B = A * B; ; B = A; ; A = 0xFF; ; B = -B; // Set carry if (B != 0) ; A -= 0xFF + carry; // Sign extend -B (A = [0x00 or 0xFF]) ; D += *X; ; mystery_data_2 = D; ; A = 0; ; B = LSB( mystery_data_1 ); ; D <<= 3; ; LSB( mystery_data_1 ) = B; // LSB( mystery_data_1 ) *= 8 ; B = A; // B = 3 MSb of LSB( mystery_data_1 ) [0-7] ; X = &data_X + B; ; A = LSB( mystery_data_1 ); ; if (A != 0) { ; if ((B = *(X + 1) - *X) < 0) { ; A = -A; ; B = -B; ; X++; ; } ; A:B = A * B; ; } ; A += *X; ; B = LSB( mystery_data_1 ); ; X = &data_Y + B; ; B = *X; ; A:B = A * B; ; A >>= 5; ; B = A; ; A = 0xFF; ; B = -B; // Set carry if (B != 0) ; A -= 0xFF + carry; // Sign extend -B (A = [0x00 or 0xFF]) ; D += mystery_data_2; ; mystery_data_2 = D; ; D = mystery_data_3; ; if ((D < 0) || (ADC_AFM_value != 0)) { ; D >>= 1; ; POP X ; X++; ; PUSH X ; } ; X = mystery_data_2; ; D = Word_Mult( D, X ); ; RTS to Main_Fuel_computed_target + some N (X on stack) ; ; ; ; symbol 0xC25F Main_Fuel symbol 0xC26C Main_Fuel_above_floor symbol 0xC26F Main_Fuel_loop symbol 0xC278 Main_Fuel_loop_end symbol 0xC2B4 Main_Fuel_skip_negate symbol 0xC2B5 Main_Fuel_zero symbol 0xC2D8 Main_Fuel_table_base symbol 0xC2E1 Main_Fuel_skip_inc ; This is a computed jump with six LSRD instructions code 0xC30B Main_Fuel_computed_target Symbol 0xc325 Main_Fuel_10 Symbol 0xc33c Main_Fuel_11 Symbol 0xC34A Main_Fuel_12 symbol 0xC34F Main_Fuel_13 symbol 0xC358 Main_Fuel_14 symbol 0xC35B Main_Fuel_15 symbol 0xC38C Main_Fuel_16 symbol 0xC3A4 Main_Fuel_17 symbol 0xC3B6 Main_Fuel_18 symbol 0xC3C2 Main_Fuel_19 symbol 0xC3D8 Main_Fuel_20 symbol 0xC3E6 Main_Fuel_21 symbol 0xC3EB Main_Fuel_22 symbol 0xC3ED Main_Fuel_23 symbol 0xC405 Main_Fuel_24 symbol 0xC41E Main_Fuel_25 symbol 0xC423 Main_Fuel_26 symbol 0xC42F Main_Fuel_27 symbol 0xC439 Main_Fuel_28 symbol 0xC441 Main_Fuel_29 symbol 0xC444 Main_Fuel_30 symbol 0xC44A Main_Fuel_31 symbol 0xC465 Main_Fuel_32 symbol 0xC47F Main_Fuel_33 symbol 0xC497 Main_Fuel_34 symbol 0xC49F Main_Fuel_35 symbol 0xC4A7 Main_Fuel_36 symbol 0xC4B4 Main_Fuel_37 symbol 0xC4BC Main_Fuel_38 symbol 0xC4BD Main_Fuel_39 symbol 0xC4C4 Main_Fuel_40 symbol 0xC4DF Main_Fuel_41 symbol 0xC4E1 Main_Fuel_42 symbol 0xC4F4 Main_Fuel_exit ; Sub_01 ; ; D = sub_48_data_1 // Clip to 0x0200 <= D <= 0x0C00 ; if ((D -= 0x0200) < 0) ; D = 0; ; if (D > 0x0A00) ; D = 0x0A00; // 0x0000 <= D <= 0x0A00 ; D >>= 1; // 0x0000 <= D <= 0x0500 ; sub_48_data_1 = D; ; D = Table_Interpolate_no_offset_scale(sub_01_1_i_table, D); ; Sub_01_data_1 = A; // Should always be 0xFF ; D = Table_Interpolate_no_offset_scale(sub_01_2_i_table, sub_48_data_1); ; D >>= 6; ; Sub_01_data_2 = D + 0x0400; ; D = Table_Interpolate_no_offset_scale(sub_01_3_i_table, sub_48_data_1); ; D >>= 6; ; Sub_01_data_3 = 0x0400 - D; symbol 0xC4F5 Sub_01 symbol 0xC4FE Sub_01_above_floor symbol 0xC505 Sub_01_below_ceiling symbol 0xC541 Sub_02 symbol 0xC55A Sub_02_1 symbol 0xC564 Sub_02_2 symbol 0xC575 Sub_02_3 symbol 0xC576 Sub_02_4 symbol 0xC579 Sub_02_5 symbol 0xC581 Sub_02_6 symbol 0xC58D Sub_02_7 symbol 0xC590 Sub_02_8 symbol 0xC5A7 Sub_02_9 symbol 0xC5B5 Sub_02_10 symbol 0xC5BD Sub_02_11 symbol 0xC5D3 Sub_02_12 symbol 0xC5E6 Sub_02_13 symbol 0xC5E9 Sub_02_14 symbol 0xC600 Sub_02_15 symbol 0xC610 Sub_02_16 symbol 0xC61C Sub_02_17 symbol 0xC62A Sub_02_18 symbol 0xC63C Sub_02_19 symbol 0xC64D Sub_02_20 symbol 0xC64E Sub_02_21 symbol 0xC64F Sub_02_22 symbol 0xC66D Sub_02_23 symbol 0xC67B Sub_02_24 symbol 0xC68C Sub_02_exit symbol 0xC68D Sub_03 symbol 0xC699 Sub_03_1 symbol 0xC6A3 Sub_03_2 symbol 0xC6A9 Sub_03_3 symbol 0xC7A8 Sub_04 symbol 0xC7BB Sub_04_1 symbol 0xC7C6 Sub_04_2 symbol 0xC7D1 Sub_04_3 symbol 0xC7D6 Sub_04_4 symbol 0xC7F5 Sub_04_5 symbol 0xC7FA Sub_04_6 symbol 0xC7FF Sub_04_7 symbol 0xC80A Sub_04_8 symbol 0xC815 Sub_04_9 symbol 0xC818 Sub_04_10 symbol 0xC81C Sub_04_11 symbol 0xC826 Sub_04_12 symbol 0xC841 Sub_04_13 symbol 0xC84E Sub_04_14 symbol 0xC858 Sub_04_15 symbol 0xC860 Sub_04_16 symbol 0xC869 Sub_05 symbol 0xC87D Sub_05_1 symbol 0xC88C Sub_05_2 symbol 0xC8AD Sub_05_3 symbol 0xC8BC Sub_05_4 symbol 0xC8C8 Sub_05_5 symbol 0xC8CC Sub_05_6 symbol 0xC8D5 Sub_05_7 symbol 0xC8DB Sub_05_8 symbol 0xC8E5 Sub_05_8 symbol 0xC8ED Sub_05_10 symbol 0xC8FB Sub_06 symbol 0xC907 Sub_06_1 symbol 0xC914 Sub_06_2 symbol 0xC91F Sub_06_3 symbol 0xC924 Sub_06_4 symbol 0xC92E Sub_06_5 symbol 0xC938 Sub_06_6 symbol 0xC93B Sub_06_7 symbol 0xC95C Sub_06_8 symbol 0xC964 Sub_06_9 symbol 0xC96D Sub_06_10 symbol 0xC97C Sub_06_11 symbol 0xC985 Sub_06_12 symbol 0xC98E Sub_06_13 symbol 0xC9A5 Sub_06_14 symbol 0xC9A8 Sub_06_15 symbol 0xC9B4 Sub_06_16 symbol 0xC9B9 Sub_06_17 symbol 0xC9C6 Sub_06_18 symbol 0xC9C9 Sub_06_19 symbol 0xC9D4 Sub_06_20 symbol 0xC9D7 Sub_06_21 symbol 0xC9D8 Sub_06_22 symbol 0xC9EE Sub_06_23 symbol 0xCA00 Sub_06_24 symbol 0xCA05 Sub_06_25 symbol 0xCA0B Sub_06_26 symbol 0xCA16 Sub_06_27 symbol 0xCA27 Sub_06_exit symbol 0xCA28 Sub_07 symbol 0xCA3F Sub_07_1 symbol 0xCA41 Sub_07_2 symbol 0xCA4D Sub_07_3 symbol 0xCA5D Sub_07_4 symbol 0xCA5F Sub_07_5 symbol 0xCA6D Sub_07_6 symbol 0xCA77 Sub_07_7 symbol 0xCA7C Sub_07_8 symbol 0xCAA4 Sub_07_9 symbol 0xCABF Sub_07_10 symbol 0xCADC Sub_07_exit symbol 0xCADE Sub_08 symbol 0xCAE0 Sub_08_1 symbol 0xCAF2 Sub_08_2 symbol 0xCAF6 Sub_08_exit symbol 0xCAF7 Sub_10 symbol 0xCAFF Sub_10_1 symbol 0xCB05 Sub_10_2 symbol 0xCB16 Sub_10_3 symbol 0xCB21 Sub_10_4 symbol 0xCB29 Sub_10_5 symbol 0xCB2F Sub_10_6 symbol 0xCB40 Sub_11 symbol 0xCB4A Sub_11_1 symbol 0xCB6D Sub_11_2 symbol 0xCB7A Sub_11_3 symbol 0xCB83 Sub_11_4 symbol 0xCB87 Sub_11_5 symbol 0xCB97 Sub_11_6 symbol 0xCB9B Sub_11_7 symbol 0xCBAF Sub_11_8 symbol 0xCBB9 Sub_11_9 symbol 0xCBCB Sub_11_10 symbol 0xCBD4 Sub_11_11 symbol 0xCBDC Sub_11_12 symbol 0xCBF7 Sub_11_13 symbol 0xCC07 Sub_11_14 symbol 0xCC15 Sub_11_15 symbol 0xCC21 Sub_11_16 symbol 0xCC25 Sub_11_17 symbol 0xC6AA Sub_11_18 symbol 0xC6C6 Sub_11_19 symbol 0xC6D2 Sub_11_20 symbol 0xC6DD Sub_11_21 symbol 0xC6EF Sub_11_22 symbol 0xC6FA Sub_11_23 symbol 0xC70F Sub_11_24 symbol 0xC718 Sub_11_25 symbol 0xC724 Sub_11_26 symbol 0xC726 Sub_11_27 symbol 0xC733 Sub_11_28 symbol 0xC748 Sub_11_29 symbol 0xC751 Sub_11_30 symbol 0xC75D Sub_11_31 symbol 0xC75F Sub_11_32 symbol 0xC783 Sub_11_33 symbol 0xC787 Sub_11_34 symbol 0xC79B Sub_11_35 symbol 0xC7A7 Sub_11_exit symbol 0xCC2A Sub_12 symbol 0xCC35 Sub_12_1 symbol 0xCC3F Sub_12_2 symbol 0xCC54 Sub_13 symbol 0xCC85 Sub_14 symbol 0xCCA9 Sub_14_1 symbol 0xCCB3 Sub_14_2 symbol 0xCCB5 Sub_14_3 symbol 0xCCBA Sub_14_4 symbol 0xCCC3 Sub_14_5 symbol 0xCCC5 Sub_14_6 symbol 0xCCD9 Sub_14_7 symbol 0xCCEC Sub_14_8 symbol 0xCCFE Sub_14_9 symbol 0xCD08 Sub_14_10 symbol 0xCD0F Sub_14_11 symbol 0xCD12 Sub_14_12 symbol 0xCD1C Sub_14_13 symbol 0xCD29 Sub_14_14 symbol 0xCD31 Sub_14_15 symbol 0xCD33 Sub_14_16 symbol 0xCD47 Sub_14_17 symbol 0xCD53 Sub_14_18 symbol 0xCD67 Sub_14_19 symbol 0xCD80 Sub_14_20 symbol 0xCD84 Sub_14_21 symbol 0xCD8C Sub_14_22 symbol 0xCD8E Sub_14_23 symbol 0xCD94 Sub_14_24 symbol 0xCDA8 Sub_14_25 symbol 0xCDAD Sub_14_26 symbol 0xCDB9 Sub_14_exit ; Performs a piecewise linear fit on Scaled_WaterTemp_value and ; returns the value/64 in Scaled_WaterTemp_5 ; (formerly Sub_15) symbol 0xCDBD Calc_WaterTemp ; Performs a piecewise linear fit on Scaled_AFMTemp_value and ; returns the value in Scaled_WaterTemp_1 ; (formerly Sub_16) symbol 0xCDCD Calc_AFMTemp ; Scales and clips ADC_ATP_value: ; ; First clip: 0x6E <= ADC_ATP_value <= 0xD9 ; Remove offset: 0x00 <= ADC_ATP_value <= 0x6B ; Then scaled by 0x98 to [0x0000 - 0x3F88] ; Then shifted right by 3 to: [0x0000 - 0x07F1] ; Then performs a piecewise linear fit and ; returns the value in Scaled_ATP ; (formerly Sub_17) symbol 0xCDD9 Calc_ATP symbol 0xCDE0 Calc_ATP_no_floor symbol 0xCDE6 Calc_ATP_no_ceil ; Performs a piecewise linear fir on Scaled_WaterTemp_value and ; returns the 10 MSbs in Scaled_WaterTemp_4. ; (formerly Sub_18) symbol 0xCDF6 Calc_WaterTemp ; Scales and clips ADC_VRes_value (variable resistor): ; ; Returns 0x00 if ((sub_02_data_1 & 0x7F) != 0x03) ; ; First clip: 0x19 <= ADC_VRes_value <= 0xE5 ; Remove offset: 0x00 <= ADC_ATP_value <= 0xCC ; Then scaled by 0xA1 to [0x0000 - 0x804C] ; Then shifted right by 5 to: [0x0000 - 0x0402] ; Then performs a piecewise linear fit ; Then extracts the 10 MSb's [0x0000 - 0x03FF] ; Then subtracts an offset of 0x0200 to make bipolar [-0x0200 - 0x01FF] ; Then returns the value in Scaled_VRes ; (formerly Sub_19) symbol 0xCE0E Calc_VRes symbol 0xCE1D Calc_VRes_no_floor symbol 0xCE23 Calc_VRes_no_ceil symbol 0xCE43 Calc_VRes_return_0 symbol 0xCE45 Calc_VRes_exit symbol 0xCE48 Sub_20 symbol 0xCE53 Sub_20_1 symbol 0xCE55 Sub_20_exit ; Performs a piecewise linear fir on ADC_Batt_value and ; returns the 10 MSbs in Scaled_Batt_val. ; (formerly Sub_21) symbol 0xCE58 Calc_Batt_val ; Performs a piecewise linear fir on Scales_WaterTemp_value and ; returns the value in Scaled_WaterTemp_3. ; (formerly Sub_22) symbol 0xCE70 Calc_WaterTemp_1 symbol 0xCE7B Sub_23 symbol 0xCE87 Sub_23_1 symbol 0xCE9D Sub_23_2 symbol 0xCEB3 Sub_23_3 symbol 0xCEBB Sub_23_4 symbol 0xCEDC Sub_23_5 symbol 0xCEF2 Sub_23_6 symbol 0xCF09 Sub_23_7 symbol 0xCF17 Sub_23_8 symbol 0xCF38 Sub_23_9 symbol 0xCF42 Sub_23_10 symbol 0xCF46 Sub_23_11 symbol 0xCF54 Sub_23_12 symbol 0xCF6A Sub_23_13 symbol 0xCF6F Sub_23_14 symbol 0xCF7F Sub_23_15 symbol 0xCF84 Sub_23_16 symbol 0xCF89 Sub_23_17 symbol 0xCF90 Sub_23_18 symbol 0xCF95 Sub_23_19 symbol 0xCFA7 Sub_23_20 symbol 0xCFBB Sub_23_exit ; TwoD_Interpolator ; ; A = twoD_interpolator_row_num; ; if (A >= 0x10) { ; twoD_interpolator_row_fract = 0; ; A = 0x10; ; } ; D = A * 0x15; ; D += 0:twoD_interpolator_colum_num; ; temp_word_2 = D; ; X = D + &twoD_interpolator_table_2; ; temp_LSB = OneD_Interpolator( twoD_interpolator_column_fract, X ); ; temp_MSB = OneD_Interpolator( twoD_interpolator_column_fract, X + 0x15 ); ; X = &temp; ; twoD_interpolator_out_2 = OneD_Interpolator(twoD_interpolator_row_fract, X); ; ; X = temp_word_2 + &twoD_interpolator_table_1; ; temp_LSB = OneD_Interpolator( twoD_interpolator_column_fract, X ); ; temp_MSB = OneD_Interpolator( twoD_interpolator_column_fract, X + 0x15); ; X = &temp; ; twoD_interpolator_out_1 = OneD_Interpolator(twoD_interpolator_row_fract, X); ; Goto Sub_23_18 ; ; (formerly Sub_24) symbol 0xCFBE TwoD_Interpolator symbol 0xCFC9 TwoD_Interpolator_no_clip ; OneD_Interpolator, a linear 1D interpolator ; ; Entry: Fixed point fraction value in B and pointer to Y table in X ; Exit: Interpolated value in A, X unchanged, B consumed ; ; A = B; ; if (A != 0) { ; A = *(X + 1) - *X; ; if (A < 0) { // Negative slope ; A = -A; ; A:B = A * B; ; A -= *X; ; A = -A; ; return ; } ; A:B = A * B; ; } ; A += *X; ; return ; ; A = X[0] + B * (X[1] - X[0]) ; or ; A = B * X[1] + (1 - B) * X[0] ; ; (formerly Sub_24_sub) symbol 0xD019 OneD_Interpolator symbol 0xD028 OneD_Interpolator_positive symbol 0xD029 OneD_Interpolator_left_pt symbol 0xD02C Sub_26 symbol 0xD075 Sub_26_1 symbol 0xD083 Sub_27 symbol 0xD097 Sub_27_1 symbol 0xD0A2 Sub_28 symbol 0xD089 Sub_28_1 symbol 0xD0B9 Sub_28_2 symbol 0xD0BF Sub_29 symbol 0xD0D3 Sub_29_1 symbol 0xD0DE Sub_29_2 symbol 0xD0E0 Sub_29_3 symbol 0xD0E7 Sub_29_4 symbol 0xD117 Sub_29_5 symbol 0xD11E Sub_29_6 symbol 0xD123 Sub_29_7 symbol 0xD138 Sub_29_8 symbol 0xD146 Sub_29_9 symbol 0xD148 Sub_29_10 symbol 0xD160 Sub_29_11 symbol 0xD178 Sub_29_12 symbol 0xD19C Sub_29_13 symbol 0xD1B8 Sub_29_14 symbol 0xD1BF Sub_29_15 symbol 0xD1C4 Sub_29_16 symbol 0xD1CB Sub_30 symbol 0xD1E5 Sub_30_1 symbol 0xD1F1 Sub_30_2 symbol 0xD1F8 Sub_30_3 symbol 0xD1FD Sub_30_4 symbol 0xD216 Sub_30_5 symbol 0xD21B Sub_30_6 symbol 0xD23B Sub_30_7 symbol 0xD242 Sub_30_8 symbol 0xD247 Sub_30_9 symbol 0xD275 Sub_30_10 symbol 0xD27D Sub_30_11 symbol 0xD28D Sub_30_12 symbol 0xD294 Sub_30_13 symbol 0xD299 Sub_30_14 symbol 0xD2BB Sub_30_15 symbol 0xD2C2 Sub_30_16 symbol 0xD2C7 Sub_30_17 ; Sub_31 : Seems to check for Boost sensor out of range and sets/clears ; the "Shift Up" light symbol 0xD2CE Sub_31 symbol 0xD2D5 Sub_31_continue ; Apparently there was some commented/if-deffed out code here symbol 0xD2E1 Sub_31_next symbol 0xD30A Sub_31_set_shift_up symbol 0xD30F Sub_31_wr_port1_exit ; Diag_Out ; ; if (diag_timer < 0x29) { // This must be for init time ; diag_timer++; // since diag_timer is not ref'ed any ; set DCC bits; ; } else { // Diag_Out_Next_Code ; B = 1; ; if (error_flags_1 & 0x80) // CAS failure ; goto Diag_Out_Cont; ; B++; ; if (error_flags_1 & 0x40) // AFM failure ; goto Diag_Out_Cont; ; ; if (error_flags_2 == 0) { ; if (diag_busy_flag == 0) { // Diag_Out_No_Err ; clear DCC bits; ; diag_count_DCC1 = 0; ; diag_last_code = 0; ; diag_busy_flag = 0; ; return; ; } else { ; goto Diag_Out_8; ; } ; } else { // error_flags_2 != 0 Diag_Out_Flags_2 ; B++; ; if (error_flags_2 & 0x80) // Water Temp failure ; goto Diag_Out_Cont; ; B++; ; if (error_flags_2 & 0x40) // AFM Temp failure ; goto Diag_Out_Cont; ; B++; ; if (error_flags_2 & 0x20) // AFR failure ; goto Diag_Out_Cont; ; B++; ; if (error_flags_2 & 0x10) // TPS failure ; goto Diag_Out_Cont; ; B++; ; if (error_flags_2 & 0x08) // Boost failure ; goto Diag_Out_Cont; ; B++; ; if (error_flags_2 & 0x04) // ATP failure ; goto Diag_Out_Cont; ; B++; ; if (error_flags_2 & 0x02) // Trailing Coil failure ; goto Diag_Out_Cont; ; B++; // IAT failure ; ; Diag_Out_Cont: // 1 <= B <= 10 ; if (B != diag_last_code) { ; if (diag_busy_flag == 0){// Diag_Out_Get_Code ; diag_last_code = B; ; B = (B - 1) << 1; // 0 <= B <= 18 (even) ; X = diag_table_DCC2[ B ]; ; diag_work_DCC2 = X; ; diag_next_DCC2 = X; ; X = diag_table_DCC1[ B ]; ; diag_work_DCC1 = X; ; diag_next_DCC1 = X; ; diag_count_DCC1 = *X; ; X = diag_work_DCC2; ; B = PIA_A; ; if ((diag_count_DCC2 = *X) == 0) { // Diag_Out_6 ; B &= 0xF7; // Clear DCC2 ; } else { ; B |= 0x08; // Set DCC2 ; } ; B |= 0x10; // Set DCC1 Diag_Out_7 ; PIA_A = B; ; return; ; } else { // Diag_Out_8 ; Diag_Out_8: ; A = diag_count_DCC1 - 1; ; if (A == 0) { // Diag_Out_9 ; X = diag_work_DCC1; ; A = *(X + 1); ; if (A != 0) { // Diag_Out_10 ; X++; ; diag_work_DCC1 = X; ; Toggle DCC1; ; } else { // Diag_Out_12 ; Diag_Out_12: ; diag_work_DCC1 = diag_next_DCC1; ; diag_busy_flag = 0; ; A = *diag_next_DCC1; ; } ; } ; // Diag_Out_13 ; Diag_Out_13: ; diag_count_DCC1 = A; ; A = diag_count_DCC2; ; if (A == 0) ; return; ; A--; ; if (A == 0) { ; toggle DCC2; ; A = *(diag_work_DCC2 + 1); ; if (A != 0) { ; diag_work_DCC2++; ; } else { // Diag_Out_14 ; diag_work_DCC2 = diag_next_DCC2; ; A = *diag_work_DCC2; ; } ; } ; // Diag_Out_15 ; diag_count_DCC2 = A; ; } ; } else { // Diag_Out_11 ; diag_busy_flag = 1; ; A = diag_count_DCC2; ; A--; ; if (A != 0) ; goto Diag_Out_13; ; toggle DCC1; ; X = diag_work_DCC1; ; A = *(X + 1);; ; if (A == 0) ; goto Diag_Out_12; ; diag_work_DCC1++; ; goto Diag_Out_13; ; } ; } ; } symbol 0xD313 Diag_Out symbol 0xD32A Diag_Out_Next_Code symbol 0xD343 Diag_Out_No_Err symbol 0xD356 Diag_Out_Flags_2 symbol 0xD37A Diag_Out_Cont symbol 0xD387 Diag_Out_Get_Code symbol 0xD3BA Diag_Out_6 symbol 0xD3BC Diag_Out_7 symbol 0xD3C5 Diag_Out_8 symbol 0xD3CE Diag_Out_9 symbol 0xD3D8 Diag_Out_10 symbol 0xD3E9 Diag_Out_11 symbol 0xD40C Diag_Out_12 symbol 0xD417 Diag_Out_13 symbol 0xD43A Diag_Out_14 symbol 0xD442 Diag_Out_15 symbol 0xD445 Diag_Out_exit symbol 0xD7EF Sub_33 symbol 0xD819 Sub_33_1 symbol 0xD833 Sub_33_2 symbol 0xD86E Sub_33_3 symbol 0xD87E Sub_33_4 symbol 0xD883 Sub_33_5 symbol 0xD88F Sub_34 symbol 0xD8A2 Sub_34_1 symbol 0xD8C1 Sub_34_2 symbol 0xD8CC Sub_34_3 symbol 0xD8DD Sub_34_4 symbol 0xD8EB Sub_34_5 symbol 0xD8F2 Sub_34_6 symbol 0xD903 Sub_34_7 symbol 0xD91F Sub_34_8 symbol 0xD931 Sub_34_9 symbol 0xD942 Sub_34_10 symbol 0xD950 Sub_34_11 symbol 0xD956 Sub_34_12 symbol 0xD966 Sub_34_13 symbol 0xD971 Sub_34_14 symbol 0xD983 Sub_34_15 symbol 0xD994 Sub_34_16 symbol 0xD9A1 Sub_34_17 symbol 0xD9A6 Sub_34_18 symbol 0xD9B0 Sub_34_19 symbol 0xD9BC Sub_34_20 symbol 0xD9D1 Sub_34_21 symbol 0xD9E3 Sub_34_22 symbol 0xD9F0 Sub_35 symbol 0xD9FB Sub_35_1 symbol 0xDA0C Sub_35_2 symbol 0xDA1A Sub_35_3 symbol 0xDA24 Sub_35_4 symbol 0xDA27 Sub_35_5 symbol 0xDA38 Sub_35_6 symbol 0xDA49 Sub_35_7 symbol 0xDA57 Sub_35_8 symbol 0xDA62 Sub_35_9 symbol 0xDA6D Sub_35_10 symbol 0xDA7B Sub_35_11 symbol 0xDA8C Sub_35_12 symbol 0xDA9A Sub_35_13 symbol 0xDAB0 Sub_35_14 symbol 0xDAC4 Sub_35_15 symbol 0xDAD4 Sub_35_16 symbol 0xDAE3 Sub_35_17 symbol 0xDAFF Sub_35_18 symbol 0xDB0D Sub_35_19 symbol 0xDB14 Sub_35_20 symbol 0xDB16 Sub_35_21 symbol 0xDB18 Sub_35_22 symbol 0xDB31 Sub_35_23 symbol 0xDB3B Sub_35_24 symbol 0xDB45 Sub_35_25 symbol 0xDB4A Sub_35_26 symbol 0xDB67 Sub_35_27 symbol 0xDB73 Sub_35_28 symbol 0xDB82 Sub_35_29 symbol 0xDB8F Sub_35_30 symbol 0xDB94 Sub_35_31 symbol 0xDBB0 Sub_35_32 symbol 0xDBB1 Sub_35_33 symbol 0xDBC0 Sub_35_34 symbol 0xDBCC Sub_35_35 symbol 0xDBDE Sub_35_36 symbol 0xDBE8 Sub_35_37 symbol 0xDBF3 Sub_35_38 symbol 0xDBF8 Sub_35_39 symbol 0xDBFB Sub_36 symbol 0xDC1D Sub_36_1 symbol 0xDC23 Sub_36_2 symbol 0xDC26 Sub_36_3 symbol 0xDC32 Sub_36_4 symbol 0xDC47 Sub_36_5 symbol 0xDC4B Sub_36_6 symbol 0xDC50 Sub_36_7 symbol 0xDC53 Sub_36_8 symbol 0xDC57 Sub_37 symbol 0xDC65 Sub_37_1 symbol 0xDC74 Sub_37_2 symbol 0xDC7B Sub_37_3 symbol 0xDC90 Sub_37_4 symbol 0xDCAF Sub_37_5 symbol 0xDCBE Sub_37_6 symbol 0xDCC0 Sub_37_7 symbol 0xDCCF Sub_37_8 symbol 0xDCD2 Sub_37_9 symbol 0xDCE4 Sub_37_10 symbol 0xDCE6 Sub_37_11 symbol 0xDCF0 Sub_37_12 symbol 0xDD08 Sub_37_exit symbol 0xDD09 Sub_38 symbol 0xDD28 Sub_38_1 symbol 0xDD37 Sub_38_2 symbol 0xDD55 Sub_38_3 symbol 0xDD59 Sub_38_4 symbol 0xDD62 Sub_38_5 symbol 0xDD67 Sub_38_6 symbol 0xDD7E Sub_38_7 symbol 0xDD80 Sub_38_8 symbol 0xDD8A Sub_38_9 symbol 0xDD93 Sub_38_10 symbol 0xDDA2 Sub_38_11 symbol 0xDDAE Sub_38_12 symbol 0xDDB5 Sub_38_13 symbol 0xDDCC Sub_38_14 symbol 0xDDD7 Sub_38_15 symbol 0xDE0B Sub_38_16 symbol 0xDE10 Sub_38_17 symbol 0xDE19 Sub_38_18 symbol 0xDE2C Sub_38_19 symbol 0xDE39 Sub_38_20 symbol 0xDE4A Sub_38_21 symbol 0xDE55 Sub_38_22 symbol 0xDE58 Sub_38_23 symbol 0xDE61 Sub_39 symbol 0xDE81 Sub_39_1 symbol 0xDE85 Sub_39_2 symbol 0xDE8F Sub_39_3 symbol 0xDE9D Sub_39_4 symbol 0xDEB2 Sub_39_5 symbol 0xDEB4 Sub_39_6 symbol 0xDEB8 Sub_39_7 symbol 0xDEBE Sub_39_8 symbol 0xDECF Sub_39_9 symbol 0xDEE1 Sub_39_10 symbol 0xDEF7 Sub_39_11 symbol 0xDF0B Sub_39_12 symbol 0xDF1C Sub_39_13 symbol 0xDF1E Sub_39_14 symbol 0xDF25 ReScale_WaterTemp symbol 0xDF4F ReScale_WaterTemp_use_table_6 symbol 0xDF52 ReScale_WaterTemp_use_table_5 symbol 0xDF5E ReScale_IntakeTemp symbol 0xDF6F Sub_42 ; Implements a low pass, IIR filter of ADC_Batt_value ; ADC_Batt_filtered = (3/4) * ADC_Batt_filtered + (1/4) * ADC_Batt_value symbol 0xDF75 Sub_42_entry_2 symbol 0xDF92 Sub_42_2 symbol 0xDFA4 Sub_42_clear_value_1 symbol 0xDFAB Sub_42_init_vars symbol 0xDFBC Sub_42_cont symbol 0xDFD4 Sub_42_lt_100 symbol 0xDFD9 Sub_42_lt_200 symbol 0xDFDC Sub_42_cont_1 symbol 0xDFFE Sub_42_9 symbol 0xE001 Sub_42_10 symbol 0xE01C Sub_42_check_global_word_table symbol 0xE027 Sub_42_clip_max symbol 0xE033 Sub_42_use_value symbol 0xE035 Sub_42_14 symbol 0xE04A Sub_42_15 symbol 0xE05A Sub_42_16 symbol 0xE071 Sub_42_17 symbol 0xE074 Sub_42_18 symbol 0xE085 Sub_42_20 symbol 0xE088 Sub_42_21 symbol 0xE096 Sub_42_22 symbol 0xE0B6 Sub_42_23 symbol 0xE0BE Sub_42_24 symbol 0xE0C1 Sub_42_25 symbol 0xE0CC Sub_42_exit symbol 0xE575 HW_ReInit ; This code checks for bits 5-7 of Port 2 to be set to 0x40 but these bits ; do not seem to exist or at least are not documented. The upper 3 bits of ; P2 may be some sort of chip ID, and this code prevents the firmware from ; running on another processor. If the Chip ID is OK, then all the hardware ; control registers are intialized. symbol 0xE57F HW_ReInit_Chip_ID_check symbol 0xE58B HW_ReInit_death_loop symbol 0xE58D HW_ReInit_Chip_ID_OK ; Sub_45 may clear BOTH OCR bits, clears PA7 and togles PA1, based on ; sub_45_value_1 ; symbol 0xE5D9 Sub_45 symbol 0xE5F8 Sub_45_clear_OCR_bits symbol 0xE5FE Sub_45_skip_clear symbol 0xE61B Sub_45_exit ; Possibly checks for AFR transitions in closed loop? ; Keeps AFR from ADC in B ; Keeps AFR_flags_2 in A ; (Previously Sub_46) symbol 0xE6A0 Check_AFR symbol 0xE6A8 Check_AFR_sample_loop symbol 0xE6B3 Check_AFR_continue symbol 0xE6CC Check_AFR_below_threshold symbol 0xE6D8 Check_AFR_4 ; (Chan_1_4) symbol 0xE6E2 Check_AFR_check_threshold_cross symbol 0xE6F6 Check_AFR_check_neg_edge symbol 0xE6FB Check_AFR_no_threshold symbol 0xE702 Check_AFR_crossed_threshold symbol 0xE70A Check_AFR_9 ; (Chan_1_9) symbol 0xE719 Check_AFR_10 symbol 0xE71F Check_AFR_ge_limit_2 symbol 0xE72B Check_AFR_lt_limit_2 symbol 0xE740 Check_AFR_13 symbol 0xE746 Check_AFR_skip_PIA_update symbol 0xE750 Check_AFR_exit symbol 0xE753 Sub_47 symbol 0xE761 Sub_47_1 symbol 0xE77B Sub_47_2 symbol 0xE792 Sub_47_3 symbol 0xE79A Sub_47_4 symbol 0xE7A5 Sub_47_5 symbol 0xE7B2 Sub_47_6 symbol 0xE7CA Sub_47_7 symbol 0xE7D5 Sub_47_8 symbol 0xE7DF Sub_47_9 symbol 0xE7F1 Sub_47_10 ; Possibly computes RPM/2 ; symbol 0xE819 Sub_48 symbol 0xE827 Sub_48_1 symbol 0xE82E Sub_48_2 symbol 0xE836 Sub_48_3 symbol 0xE840 Sub_48_4 code 0xE848 Sub_48_jump_base_min code 0xE84B Sub_48_jump_base code 0xE84D Sub_48_jump_base_max symbol 0xE84F Sub_48_5 symbol 0xE859 Sub_48_6 symbol 0xE866 Sub_48_7 symbol 0xE86D Sub_48_8 symbol 0xE86F Sub_48_9 symbol 0xE885 Sub_48_10 ; Check_Switches : ; ; A = (CPU_Port data) P17:P16:P20:P14:P13:P24:0:0 ; A ^= 0xC4 /P17:/P16:P20:P14:P13:/P24:0:0 ; B = Switches_port_inputs ; Switches_port_inputs = A ; B ^= A ; A = B ; A = ~A & Switches_post_inputs ; B &= self_test_flags_2 ; self_test_flags_2 = A + B ; temp1 = 0; //temp_word_1 = 0x0004 ; temp2 = 4; ; set_ADC_V_comp = 2.50V ; B = 0x0A // Clutch switch channel ; repeat { ; set_ADC_chan = B++ ; temp_word_2 = B ; if (ADC_chan > 2.50V) ; temp1 += temp2; ; B = temp_word_2; ; while ( temp2 <<= 1 ); ; // temp1 = HeatHaz:Starter:Boost:InitialSet:ACSwitch:Clutch:0:0 ; A = temp1 ^ 0xA4 ; // temp1 = /HeatHaz:Starter:/Boost:InitialSet:ACSwitch:/Clutch:0:0 ; B = Switches_ADC_inputs ; Switches_ADC_inputs = A ; B ^= A ; A = ~B ; A &= Switches_ADC_inputs ; B &= self_test_flags_1 ; A += B ; if (sub_02_flags_7 & 0x20) ; A &= 0xF7; // Ignore ACSwitch? ; self_test_flags_1 = A ; ; if ((error_flags_1 & 0x40) == 0) { ; if ((error_flags_1 & 0x08) == 0) { ; Switches_state_1 = Check_Switches_const_1; ; if (Switches_state_2 != 0) ; goto junk ; } else { ; Switches_state_2 = Check_Switches_const_2; ; if (Switches_state_1 == 0) { ; junk: ; if ((sub_02_flags_7 & 0x20) == 0) { ; PIA_B_Data &= 0xFD // AC relay off ; return ; } ; } ; } ; PIA_B_Data != 0x02 // AC relay on ; } ; return; ; symbol 0xE89C Sub_49 symbol 0xE8B1 Sub_49_1 symbol 0xE8EA Check_Switches_main_loop symbol 0xE8F8 Check_Switches_P20_is_clear symbol 0xE917 Check_Switches_ADC_chan_loop symbol 0xE929 Check_Switches_chan_low symbol 0xE949 Check_Switches_dont_mask_AC symbol 0xE962 Check_Switches_7 symbol 0xE96D Check_Switches_test_AC symbol 0xE97A Check_Switches_enable_AC symbol 0xE97F Check_Switches_wr_PIA_B_exit symbol 0xE9D2 Sub_49_11 symbol 0xE9F3 Sub_49_12 symbol 0xEA03 Sub_49_13 symbol 0xEA38 Sub_49_14 symbol 0xEA9F Sub_49_15 symbol 0xEAB2 Sub_49_16 symbol 0xEAB4 Sub_49_17 symbol 0xEAC1 Sub_49_18 symbol 0xEAD4 Sub_49_19 symbol 0xEAE0 Sub_49_20 symbol 0xEAF0 Sub_49_21 symbol 0xEAF6 Sub_49_22 symbol 0xEAF8 Sub_49_23 symbol 0xEB02 Sub_49_24 ; Prep_2D_Interp (formerly Sub_50) ; ; D = MAX( 0x0C00, sub_48_data_1 ); ; D = MIN( 0, D - 0x0200 ); ; D <<= 1; ; twoD_interpolator_colum_num:twoD_interpolator_column_fract = D; ; D = MAX( 0x0A00, sub_50_data_1 ); ; D = MIN( 0, D - 0x0100 ); ; D <<= 1; ; twoD_interpolator_row_num:twoD_interpolator_row_fract = D; symbol 0xE8BD Prep_2D_Interp symbol 0xE8C6 Prep_2D_Interp_no_clip_max_col symbol 0xE8D0 Prep_2D_Interp_no_clip_low_col symbol 0xE8DC Prep_2D_Interp_no_clip_max_row symbol 0xE8E6 Prep_2D_Interp_no_clip_low_row symbol 0xE986 Sub_51 symbol 0xE990 Sub_51_1 symbol 0xE9B6 Sub_51_2 symbol 0xE9B8 Sub_51_3 symbol 0xE9C3 Sub_51_4 symbol 0xE9CB Sub_51_5 symbol 0xE9D1 Sub_51_exit symbol 0xEA3B Sub_52 symbol 0xEA48 Sub_52_1 symbol 0xEA74 Sub_52_2 symbol 0xEA79 Sub_52_3 symbol 0xEA84 Sub_52_4 symbol 0xEA91 Sub_52_5 symbol 0xEA99 Sub_52_6 symbol 0xEB07 Sub_53 symbol 0xEB1D Sub_53_1 symbol 0xEB34 Sub_53_2 symbol 0xEB36 Sub_54 symbol 0xEB45 Sub_54_1 symbol 0xEB53 Sub_54_2 symbol 0xEB5F Sub_54_3 symbol 0xEB6B Sub_54_4 symbol 0xEB71 Sub_54_5 symbol 0xEB9D Sub_54_6 symbol 0xEBA8 Sub_54_7 symbol 0xEBAF Sub_54_8 symbol 0xEBB8 Sub_54_9 symbol 0xEBCA Sub_54_10 symbol 0xEBD1 Sub_54_11 symbol 0xEBD4 Sub_55 symbol 0xEBEC Sub_55_1 symbol 0xEBFC Sub_55_2 symbol 0xEC04 Sub_55_3 symbol 0xEC13 Sub_55_4 symbol 0xEC2F Sub_55_5 symbol 0xEC37 Sub_55_6 symbol 0xEC3E Sub_55_7 symbol 0xEC54 Sub_55_8 symbol 0xEC56 Sub_55_9 symbol 0xEC71 Sub_55_10 symbol 0xEC77 Sub_55_11 symbol 0xEC9B Sub_55_12 symbol 0xECB5 Sub_55_13 symbol 0xECC5 Sub_55_14 symbol 0xECCC Sub_55_15 symbol 0xECD3 Sub_55_16 symbol 0xECDA Sub_55_17 symbol 0xECE1 Sub_55_18 symbol 0xECE8 Sub_55_19 symbol 0xECEF Sub_55_20 symbol 0xECFC Sub_55_21 symbol 0xED0C Sub_55_22 symbol 0xED1A Sub_55_23 symbol 0xED1F Sub_55_24 symbol 0xED2E Sub_55_25 symbol 0xED4E Sub_55_26 symbol 0xED57 Sub_55_27 symbol 0xED5E Sub_55_28 symbol 0xED7B Sub_55_29 symbol 0xED84 Sub_55_30 symbol 0xED8A Sub_55_31 symbol 0xEDB4 Sub_55_32 symbol 0xEDBB Sub_55_33 symbol 0xEDC2 Sub_55_34 symbol 0xEDC9 Sub_55_35 symbol 0xEDED Sub_55_36 symbol 0xEDF4 Sub_55_37 symbol 0xEE00 Sub_55_38 symbol 0xEE18 Sub_55_39 symbol 0xEE2F Sub_55_40 symbol 0xEE38 Sub_55_41 symbol 0xEE3E Sub_55_42 symbol 0xEE62 Sub_55_43 symbol 0xEE69 Sub_55_44 symbol 0xEE70 Sub_55_45 symbol 0xEE84 Sub_55_46 symbol 0xEE8B Sub_55_47 symbol 0xEE92 Sub_55_48 symbol 0xEEA8 Sub_55_49 symbol 0xEEAF Sub_55_50 symbol 0xEEB6 Sub_55_51 symbol 0xEECC Sub_55_52 symbol 0xEED3 Sub_55_53 symbol 0xEEDA Sub_55_54 symbol 0xEEEA Sub_55_55 symbol 0xEEF3 Sub_55_56 symbol 0xEEF9 Sub_55_57 symbol 0xEF00 Sub_55_58 symbol 0xEF19 Sub_55_59 symbol 0xEF1B Sub_55_60 symbol 0xEF3D Sub_55_61 symbol 0xEF44 Sub_55_62 symbol 0xEF4E Sub_55_63 symbol 0xEF52 Sub_55_64 symbol 0xEF5A Sub_55_65 symbol 0xEF80 Sub_55_66 symbol 0xEF87 Sub_55_67 symbol 0xEF92 Sub_55_68 symbol 0xEF98 Sub_55_69 symbol 0xEF9E Sub_55_70 symbol 0xEFA5 Sub_55_71 symbol 0xEFAD Check_CAS symbol 0xEFB7 Check_CAS_continue symbol 0xEFD3 Check_CAS_set_error symbol 0xEFD9 Check_CAS_exit ; The ADC_Read_WaterTemp routine is unusual in that it reads the ADC value ; twice, and calls ADC_check_channel twice, with two different structs. symbol 0xEFDB ADC_Read_WaterTemp symbol 0xF012 Interp_Scaled_WaterTemp symbol 0xF01E ADC_Read_AFMTemp symbol 0xF02F ADC_Read_VarRes symbol 0xF036 Scale_Intake_Temp symbol 0xF063 ADC_Read_ATP symbol 0xF075 ADC_Read_ATP_No_Hyst symbol 0xF07D ADC_Read_ATP_Clr_Hyst symbol 0xF07F ADC_Read_ATP_Store_Exit symbol 0xF082 ADC_Read_Batt ; TPS_Update : Reads the TPS and stuff ; ; D = MAX( 0, ADC_check_channel(TPS) - 0x0400) ; if (sub_48_data_1 >= 0x0A00) ; D = 0x0600; ; temp = D; ; if (TPS_update_flags_1 & 0x10) ; D = Table_Interpolate_no_offset_scale( D, TPS_2_ix_table ); ; else ; D = Table_Interpolate_no_offset_scale( D, TPS_1_ix_table ); ; TPS_scaled_value_1 = D >> 5; ; D = temp; ; if (TPS_update_flags_1 & 0x10) ; D = Table_Interpolate_no_offset_scale( D, TPS_4_ix_table ); ; else ; D = Table_Interpolate_no_offset_scale( D, TPS_3_ix_table ); ; TPS_scaled_value_2 = D >> 5; ; if (TPS_update_flags_1 & 0x80) ; TPS_scaled_value_1 += TPS_adj_const_1; ; if (TPS_update_flags_1 & 0x40) ; TPS_scaled_value_1 += TPS_adj_const_1; ; if (TPS_scaled_value_1 >= TPS_fuel_or_something) ; TPS_update_flags_1 |= 0x80; ; else ; TPS_update_flags_1 &= ~0x80; ; if (TPS_scaled_value_2 >= TPS_fuel_or_something) ; TPS_update_flags_1 |= 0x40; ; else ; TPS_update_flags_1 &= ~0x40; ; ; if (TPS_update_flags_1 & 0x10) ; B = 0x0E; ; else ; B = 0x00; ; if (sub_02_flags_2 & 0x02) ; B += 7; ; sub_02_flags_4 = Check_Thresh(ADC_Boost_value, sub_02_flags_4, &check_thresh_table_14[B]); ; symbol 0xF089 TPS_Update symbol 0xF098 TPS_Update_gt_0 symbol 0xF0A2 TPS_Update_select_table symbol 0xF0B0 TPS_Update_do_lookup_1 symbol 0xF0C9 TPS_Update_do_lookup_2 symbol 0xF0E5 TPS_Update_skip_TPS_adj_1 symbol 0xF0F4 TPS_Update_skip_TPS_adj_2 symbol 0xF101 TPS_Update_set_flag_80 symbol 0xF103 TPS_Update_next_1 symbol 0xF10E TPS_Update_set_flag_40 symbol 0xF110 TPS_Update_next_2 symbol 0xF11B TPS_Update_index_1 symbol 0xF123 TPS_Update_index_2 ; ioPort1Data is complemented for every successful test symbol 0xF131 Self_test symbol 0xF147 Self_test_cont symbol 0xF162 Self_test_exit symbol 0xF165 Self_test_memory symbol 0xF175 Self_test_int_mem_test symbol 0xF178 Self_test_int_mem_write_loop symbol 0xF181 Self_test_int_mem_test_loop symbol 0xF193 Self_test_int_mem_test_fail symbol 0xF19D Self_test_ext_mem_test symbol 0xF1A3 Self_test_ext_mem_write symbol 0xF1A6 Self_test_ext_mem_write_loop symbol 0xF1B5 Self_test_ext_mem_test_loop symbol 0xF1CD Self_test_ext_mem_fail symbol 0xF1D6 Self_test_ext_mem_pass symbol 0xF1DE Self_test_rom_checksum_C000 symbol 0xF1EA Self_test_rom_checksum_C800 symbol 0xF1F6 Self_test_rom_checksum_D000 symbol 0xF202 Self_test_rom_checksum_D800 symbol 0xF20E Self_test_rom_checksum_E000 symbol 0xF21A Self_test_rom_checksum_E800 symbol 0xF226 Self_test_rom_checksum_F000 symbol 0xF232 Self_test_rom_checksum_F800 symbol 0xF244 Self_test_self_test_exit symbol 0xF250 Self_test_self_test_exit_ADC_loop symbol 0xF26A Self_test_self_test_reset symbol 0xF26E Self_test_PART_2 symbol 0xF296 Self_test_26 symbol 0xF2C1 Self_test_27 symbol 0xF2C7 Self_test_28 symbol 0xF2D6 Self_test_29 symbol 0xF2D8 Self_test_30 symbol 0xF2E0 Self_test_31 symbol 0xF2E2 Self_test_32 symbol 0xF2F3 Self_test_33 symbol 0xF2F5 Self_test_34 symbol 0xF301 Self_test_35 symbol 0xF303 Self_test_36 symbol 0xF30B Self_test_37 symbol 0xF30D Self_test_38 symbol 0xF315 Self_test_39 symbol 0xF317 Self_test_40 symbol 0xF31F Self_test_41 symbol 0xF321 Self_test_42 symbol 0xF32B Self_test_43 symbol 0xF32D Self_test_44 ; Takes a pointer to an ADC_ch_n_structs. Will read the ADC channel, ; check for min & max values, returns default value if out of range, ; sets or clears a flag bit in ADC-check_flags, and writes the value ; to a low memory area. symbol 0xF334 ADC_check_channel symbol 0xF340 ADC_check_channel_busy_wait symbol 0xF34B ADC_check_channel_check_min symbol 0xF356 ADC_check_channel_check_max symbol 0xF369 ADC_check_channel_out_of_range symbol 0xF374 ADC_check_channel_in_range symbol 0xF37B ADC_check_channel_6 ; Table_Interpolate ; ; Entry with x value in A, pointer in X to an interpolated table structure ; An index is calculated by f(x) = max(min(max, x) - offset, 0) * scale ; f(x) = two bytes 8.8 (integer.fraction) ; Then i = HIGH_BYTE( f(x) ) indexes p = data[i] and q = data[i+1] ; then the delta = q - p ; if (r >= 0) then y = LOW_BYTE( f(x) ) * delta + p (positive slope) ; else y = -LOW_BYTE( f(x) ) * -delta + q (negative slope) ; The "no_offset_scale" entry point is called with a A.B = f(x) and ; X = data table - 3 (first three bytes are unused) ; ; Returns: 16 bit interpolated table value in D and X = (&data[y]) - 3 ; (Formerly Sub_68) symbol 0xF384 Table_Interpolate symbol 0xF38A Table_Interpolate_do_offset symbol 0xF38F Table_Interpolate_do_scale symbol 0xF392 Table_Interpolate_no_offset_scale symbol 0xF3A3 Table_Interpolate_pos_slope symbol 0xF3A4 Table_Interpolate_no_fraction ; Word_Mult_Scale has two entry points: Word_Mult_Scale_256 and Word_Mult_Scale_1024 ; ; This routine multiplies two 16 bit numbers and returns only the ; middle 16 bits: the 8 MSB and 8 LSB are lost, scaling by 256 (truncation). ; If the 8 MSB are not 0, then the return value saturates to 0xFFFF. The ; second version returns the value scaled down by another 4 (total of 1024). ; ; Entry: D (YH:YL) and X (XH:XL) ; Return: D (X is trashed) ; ; How to do a real 16x16 multiply: ; ; TH:TL = XL * YL ; UH:UL = XL * YH ; VH:VL = XH * YH ; WH:WL = XH + YL ; ; VH:VL ; + UH:UL ; + WH:WL ; + TH:TL ; ------------ ; VH:(VL+UH+WH):(UL+WL+TH):TL ; ; Here, TL is lost immediately, and VH is used to determine overflow. ; ; Word_Mult: ; push A; // ret YH N/A <- SP ; push 0; // ret YH 0 N/A <- SP ; goto Word_Mult_cont ; Word_Mult_alt: ; push A; // ret YH N/A <- SP ; push 2; // ret YH 2 N/A <- SP ; Word_Mult_cont: ; push B; // ret YH N YL N/A <- SP ; push X; // ret YH N YL XL XH N/A <- SP ; push X; // ret YH N YL XL XH XL XH N/A <- SP ; X = SP + 1; ; A = *(X + 1); // XL ; A:B = A * B; // T = XL * YL ; *(X + 3) = A; // ret YH N YL TH XH XL XH <- X ; A = *(X + 6); // YH ; B = *(X + 1); // XL ; A:B = A * B; // U = XL * YH ; B += *(X + 3); // UL += TH ; A += carry; ; *(X + 2) = A ; *(X + 3) = B // ret YH N YL (UL+TH) UH XL XH <- X ; A = XH; ; B = YH; ; A:B = A * B; // V = XH * YH ; B += UH; // VL += UH ; A += carry; ; *(X + 1) = A ; *(X + 2) = B // A = XH; ret YH N YL (UL+TH) (VL+UH) VH XH <- X ; pop A; // A = XH; ret YH N YL (UL+TH) (VL+UH) VH XH <- X, SP ; B = *(X + 4) // B = YL ; A:B = A * B; // W = XH * YL ; W += (UH+VL):(UL+TH); ; if (carry) VH++; ; if (N != 0) { ; VH >>= 1; ; c:WH >>= 1; ; c:WL >>= 1; ; VH >>= 1; ; c:WH >>= 1; ; c:WL >>= 1; ; } ; if (VH != 0) { // Saturate on overflow ; WH:WL = 0xFFFF; ; } ; symbol 0xF3A8 Word_Mult_Scale_256 symbol 0xF3AD Word_Mult_Scale_1024 symbol 0xF3B0 Word_Mult_con symbol 0xF3DA Word_Mult_no_carry symbol 0xF3E6 Word_Mult_no_scale symbol 0xF3ED Word_Mult_no_overflow ; Takes value in D, structure pointer in X ; Returns value in B. ; ; Construct bit field in reflecting setpoints in table ; ; On entry: ; A = new value to lookup (in_val) ; B = previous bit field output (in_flags) ; X = ptr to lookup table ; ; Table offsets description: ; 0 = number of times to loop (Starting bit, shifted left until 0x100) ; 1,2 = 1st lookup entry: value, hysteresis value (if in_flags & bit_mask) ; 3,4 = 2nd lookup entry ; ... ; 13,14 = 7th lookup entry (if necessary) ; 15,16 = 8th lookup entry (if necessary) ; ; in_val = A; ; in_flags = B; ; ; bit_mask = *(X++); ; out_flags = 0; ; repeat { ; A = *(X++); ; if (in_flags & bit_mask) { // Was last value below theshold? ; A += *X; // Add hysteresis ; } ; X++; ; B = A ; A = in_val; ; A = A - B; // Set carry if (in_val < B) ; ROR( out_flags ); // Put the carry bit into MSB ; carry:bit_mask <<= 1; ; until (carry); ; return B = out_flags ); ; symbol 0xF3F1 Check_Thresh symbol 0xF3FA Check_Thresh_loop symbol 0xF405 Check_Thresh_skip symbol 0xF431 Int3_1 symbol 0xF43C Int3_2 symbol 0xF459 Int3_3 symbol 0xF469 Int3_4 symbol 0xF47F Int3_5 symbol 0xF486 Int3_6 symbol 0xF488 Int3_7 symbol 0xF48B Int3_8 symbol 0xF497 Int3_9 symbol 0xF4A0 Int3_10 symbol 0xF4A9 Int3_11 symbol 0xF4B4 Int3_12 symbol 0xF4C5 Int3_13 symbol 0xF4C8 Int3_14 symbol 0xF4D1 Int3_15 symbol 0xF4EC Int3_16 symbol 0xF4F3 Int3_17 symbol 0xF4F5 Int3_18 symbol 0xF4FA Int3_19 symbol 0xF4FB Int3_20 symbol 0xF4FF Int3_21 symbol 0xF508 Int3_22 symbol 0xF511 Int3_23 symbol 0xF51A Int3_24 symbol 0xF523 Int3_25 symbol 0xF52C Int3_26 symbol 0xF535 Int3_27 symbol 0xF53E Int3_28 symbol 0xF547 Int3_29 symbol 0xF550 Int3_30 symbol 0xF554 Int3_31 symbol 0xF564 Int3_32 symbol 0xF569 Int3_33 symbol 0xF571 Int3_34 symbol 0xF57E Int3_35 symbol 0xF587 Int3_exit symbol 0xF58D Timer_In_Int_1 symbol 0xF59C Timer_In_Int_Check_OCR1 symbol 0xF5AB Timer_In_Int_Check_OCR2 symbol 0xF5B6 Timer_In_Int_4 symbol 0xF5D0 Timer_In_Int_flag_CAS_error symbol 0xF5D6 Timer_In_Int_6 symbol 0xF5E4 Timer_In_Int_7 symbol 0xF5E7 Timer_In_Int_reset_CAS_timer symbol 0xF5F7 Timer_In_Int_9 symbol 0xF622 Timer_In_Int_10 symbol 0xF62E Timer_In_Int_11 symbol 0xF63F Timer_In_Int_12 symbol 0xF649 Timer_In_Int_13 symbol 0xF65C Timer_In_Int_14 symbol 0xF665 Timer_In_Int_15 symbol 0xF671 Timer_In_Int_16 symbol 0xF681 Timer_In_Int_17 symbol 0xF696 Timer_In_Int_18 symbol 0xF69B Timer_In_Int_19 symbol 0xF6A4 Timer_In_Int_20 symbol 0xF6AF Timer_In_Int_21 symbol 0xF6B4 Timer_In_Int_22 symbol 0xF6BB Timer_In_Int_exit symbol 0xF6BC Sub_72 symbol 0xF6C5 Sub_72_1 symbol 0xF6CD Sub_72_Check_IgF_1 symbol 0xF6E5 Sub_72_Check_IgF_2 symbol 0xF6E6 Sub_72_Check_IgF_3 symbol 0xF6EB Sub_72_Check_IgF_4 symbol 0xF6FA Sub_72_Check_IgF_5 symbol 0xF6FB Sub_72_Check_IgF_6 symbol 0xF6FE Sub_72_8 symbol 0xF713 Sub_72_9 symbol 0xF717 Sub_72_10 symbol 0xF728 Sub_72_12 symbol 0xF731 Sub_72_13 symbol 0xF743 Sub_72_14 symbol 0xF747 Sub_72_15 symbol 0xF75D Sub_72_16 symbol 0xF767 Sub_72_exit_1 symbol 0xF768 Sub_72_17 symbol 0xF780 Sub_72_18 symbol 0xF78A Sub_72_19 symbol 0xF78B Sub_72_exit_2 symbol 0xF79B Sub_72_20 symbol 0xF7A8 Sub_72_21 symbol 0xF7C6 Sub_72_22 symbol 0xF7CF Sub_72_23 symbol 0xF7D6 Sub_72_24 symbol 0xF7E2 Sub_72_25 symbol 0xF7EF Sub_72_26 symbol 0xF822 Sub_72_exit_3 symbol 0xF823 Sub_72_27 symbol 0xF82A Sub_72_28 symbol 0xF83C Sub_72_29 symbol 0xF844 Sub_72_30 symbol 0xF851 Sub_72_31 symbol 0xF873 Sub_72_exit_4 symbol 0xF874 Sub_72_32 symbol 0xF87D Sub_72_33 symbol 0xF884 Sub_72_34 symbol 0xF88B Sub_72_35 symbol 0xF89D Sub_72_36 symbol 0xF8A5 Sub_72_37 symbol 0xF8D4 Sub_72_exit_5 symbol 0xF8D5 Sub_72_38 symbol 0xF8DE Sub_72_39 symbol 0xF8EE Sub_72_40 symbol 0xF8F6 Sub_72_41 symbol 0xF8FD Sub_72_42 symbol 0xF904 Sub_72_exit_6 ; These clear the OCR output bit regiser then set the OCR to t + 0x0010 symbol 0xF905 Clear_OCR_Out_1 symbol 0xF913 Clear_OCR_Out_2 ; These set OCR output bit register & disables the OCR interrupt, ; set the OCR to t + 0x0010, then set the OCR to current time. symbol 0xF921 Set_OCR_Out_1 ; This also sets/clears PIA Port B bit 7 symbol 0xF938 Set_OCR_Out_2 ; Jumped to from Sub_80_1 symbol 0xF94E Sub_76_entry_1 symbol 0xF95A Sub_76_clear_PB7 symbol 0xF95F Sub_76_set_PB7 symbol 0xF961 Sub_76_write_PB7 ; WORD temp; ; ; temp:C = (WORD) mystery_timer_delta * (BYTE) timer_word_stuff_LSB ; //LSB C thrown away ; ; timer_word_stuff_MSB--; ; if (timer_word_stuff_MSB > 0) { ; temp += mystery_timer_delta;// mystery_timer_delta * (timer_word_stuff_LSB + 1) ; if (temp > 0xFFFF) { ; temp = 0xFFFF; ; goto exit; ; } ; } ; if (timer_word_stuff_MSB >= 0) ; temp += mystery_timer_delta;// mystery_timer_delta * (timer_word_stuff_LSB + 1) ; if (temp > 0xFFFF) ; temp = 0xFFFF; ; } ; exit: ; timer_word_stuff = temp; // mystery_timer_delta * timer_word_stuff_LSB ; symbol 0xF967 Sub_77 symbol 0xF985 Sub_77_skip symbol 0xF98A Sub_77_max_clip symbol 0xF98D Sub_77_store_and_exit symbol 0xF990 Sub_78 symbol 0xF99C Sub_78_1 symbol 0xF9AE Sub_78_2 symbol 0xF9CF Sub_78_3 symbol 0xF9D1 Sub_78_4 symbol 0xF9D9 Sub_78_5 symbol 0xF9FA Sub_78_exit ; This is the CPU Timer Output Compare interrupt service routine ; ; if (PIA_B_data_shadow & PB6) { ; Read all the timer H/W registers, presumably clearing the IRQ ; } else { ; if (CPU_Timer_OCR_1.Output_Compare_Flag) ; Service_OCR1(); ; if (CPU_Timer_OCR_2.Output_Compare_Flag) ? ; Service_OCR2(); ; } ; symbol 0xFA0A Timer_Out_Int_Check_OCR2 symbol 0xFA13 Timer_Out_Int_Exit symbol 0xFA14 Timer_Out_Int_Clear_ISR ; if (CPU_Port2_data.CPU_Timer_Out) { ; if ((timer_OCR1_rollover != 0) && (timer_OCR1_rollover < 4)) { ; timer_OCR1_rollover = 0; ; CPU_Timer_CSR_1 &= ~ Enable Output Capture Interrupt; ; } ; CPU_Timer_OCR_1 = CPU_Timer_Data; ; } else { ; CPU_Timer_CSR_1 = 0x09; // Enable output capture int, next out 1 ; CPU_Timer_OCR_1 += mystery_timer_delta; ; timer_OCR1_rollover--; ; if (CPU_Timer_OCR_1 <= CPU_Timer_Data) { ; CPU_Timer_OCR_1 = CPU_Timer_Data + 10; ; } ; } symbol 0xFA21 Service_OCR1 symbol 0xFA40 Service_OCR1_exit symbol 0xFA41 Service_OCR1_timer_out_1 symbol 0xFA52 Service_OCR1_max_OCR ; This routine seems to implement Service_OCR1 for a second OCR register: ; ; if (CPU_Port1_data.P11) { ; if ((timer_OCR2_rollover != 0) && (timer_OCR2_rollover < 4)) { ; timer_OCR2_rollover = 0; ; CPU_Timer_CSR_2 &= ~ Enable Output Capture Interrupt; ; goto Sub_76_entry_1; ; } else { ; CPU_Timer_OCR_2 = CPU_Timer_Data; ; } ; } else { ; CPU_Timer_CSR_2 = 0x19; // Enable output capture int, next out 1 ; // Enable Input Capture Interrupt ; CPU_Timer_OCR_2 += mystery_timer_delta; ; timer_OCR2_rollover--; ; if (CPU_Timer_OCR_2 < CPU_Timer_Data) ; CPU_Timer_OCR_2 = CPU_Timer_Data + 0x0010; ; } symbol 0xFA57 Service_OCR2 symbol 0xFA76 Service_OCR2_exit symbol 0xFA77 Service_OCR2_timer_out_1 symbol 0xFA8F Service_OCR2_max_shadow_OCR