Pre-start listener routine, rev4. To insert: Change the LCALL to 68A1 (-607) or 6827 (-608) in the prestart loop at 0x3C69 (-607) or 0x3BEF (-608) to LCALL 0x8800. Place the following bytes at 0x8800, which are the original bytes from the 68A1/6827 routine. Same bytes in both 607 and 608: D2 2A 75 DC 04 75 DA 00 20 DC FD E5 D9 85 DA F0 30 2A ED F5 7C 85 F0 7D 00 Then follow with the bytes of this routine. ------------------ 90 FD CB E0 F5 F0 30 F3 01 22 90 FD C4 E0 F9 90 FD C5 E0 FA 74 01 C3 29 B4 41 14 E4 F9 90 FD C4 F0 74 01 2A B4 05 01 E4 90 FD C5 F0 FA 80 05 F9 90 FD C4 F0 E9 B4 01 37 E5 F0 53 E0 C0 B4 00 02 C2 34 B4 40 02 D2 34 B4 80 0D EA B4 00 02 D2 34 B4 02 02 C2 34 80 18 B4 C0 15 EA B4 00 02 C2 34 B4 01 02 D2 34 B4 02 02 C2 34 B4 03 02 D2 34 30 F5 54 90 FD AF E0 FE 90 FD B0 E0 FD 74 01 2E FE 50 1B 74 01 2D FD 50 15 C2 F5 E5 F0 90 FD CB F0 E4 90 FD AF F0 90 FD B0 F0 75 98 50 22 E4 90 87 C4 93 F5 AA 75 BA 03 43 98 40 53 98 6F C2 AC 90 FD AF EE F0 90 FD B0 ED F0 8E 82 8D 83 E0 FF 75 98 40 12 86 28 22 30 F1 0F C2 F1 20 F4 03 53 F0 F2 E5 F0 90 FD CB F0 22 E4 90 87 C4 93 F5 AA 75 BA 03 43 98 50 53 98 7F 43 87 80 43 D8 80 C2 AC D2 2A 75 DC 00 75 DA 00 20 DC FD E5 D9 30 2A F0 B4 80 00 40 1C 90 FD B0 E0 B4 08 00 50 0A 04 F0 7D 64 C2 9C 12 86 0D 22 90 FD C6 E0 D2 E2 F0 80 33 90 FD C6 E0 30 E2 2C 90 FD B1 E0 B4 08 00 50 0A 04 F0 7D 75 C2 9C 12 86 0D 22 90 FD B0 E4 F0 A3 F0 90 FD C6 F0 E5 F0 24 40 F5 F0 90 FD CB F0 12 87 17 22 E5 98 20 E0 04 75 98 50 22 E5 99 FB 53 98 EE 7D 52 12 86 0D BB 30 06 E4 90 FD CB F0 22 BB 31 0F D2 F6 C2 F7 E5 F0 90 FD CB F0 7D 21 12 86 0D BB 32 0F C2 F6 D2 F7 E5 F0 90 FD CB F0 7D 40 12 86 0D BB 33 0E 43 F0 C0 E5 F0 90 FD CB F0 7D 23 12 86 0D BB 6C 10 D2 F0 53 F0 EB E5 F0 90 FD CB F0 7D 6C 12 86 0D BB 4C 10 C2 F2 43 F0 11 E5 F0 90 FD CB F0 7D 4C 12 86 0D BB 64 0E 53 F0 EA E5 F0 90 FD CB F0 7D 64 12 86 0D BB 78 1E 75 F0 20 E5 F0 90 FD CB F0 90 FD AF 74 FF F0 90 FD B0 74 F7 F0 7D 78 12 86 0D 75 98 40 22 BB 73 15 D2 F2 53 F0 EE E5 F0 90 FD CB F0 90 FD B0 E4 F0 7D 73 12 86 0D BB 53 15 43 F0 14 C2 F0 E5 F0 90 FD CB F0 90 FD B0 E4 F0 7D 53 12 86 0D BB 70 17 AD 80 AE 90 AF A0 12 86 28 AD B0 AE E8 AF F8 12 86 28 AD FA 12 86 0D BB 6F 1B 75 F0 08 E5 F0 90 FD CB F0 7D 6F 12 86 0D 75 98 90 75 BA 03 75 AA CC 53 87 7F 22 BB 4F 1B 75 F0 18 E5 F0 90 FD CB F0 7D 4F 12 86 0D 75 98 90 75 BA 03 75 AA CC 53 87 7F 22 12 87 17 75 98 50 22 ------------------ Values: B Per-loop holding for flagbyte - B register because it's bit addressable, unlike R(x). R1 Counter low byte storage R2 Counter high byte storage R3 Per-loop holding for S0BUF receive byte R5 1st byte of serial send for CODE_860D [1 Byte], CODE_8617 [2 Bytes], CODE_8628 [3 Bytes] R6 2nd byte of serial send for CODE_8617 [2 Bytes], CODE_8628 [3 Bytes] R7 3rd byte of serial send for CODE_8628 [3 Bytes] 0xFDCB Flagbyte 0xFDC4 Cycle counter, low byte (counter for timing MIL flashing) 0xFDC5 Cycle counter, high byte (counter for timing MIL flashing) 0xFDC6 Additional flagbyte, used for TPS mapswitch stuff XRAM 0xFDCB logflag bits: 0: Request Logging 1: Request ACK from drive cycle logging routine 2: XRAM streaming mode 3: Request for pre-start OBD-II -- Abandon listener routine until next drivecycle (drivecycle routine clears bit) 4: Persistent logging enabled 5: XRAM dump in progress 6: Map Switch bit 1 7: Map Switch bit 2 Prestart inputs: d: disable logging, also clears persistence l: enable logging, non-persistent (disables persistence if set) L: enable logging, persistent s: enable XRAM streaming logging, non-persistent (disables persistence if set) S: enable XRAM streaming logging, persistent o: enable pre-start OBD-II O: enable pre-start OBD-II, persistent (disables pre-start listener, must remove all power to ECU to log again -- use this when getting car smogged) x: XRAM dump (spits out F800-FFFF immediately) p: dump port SFRs (spits out port SFRs P0-P7 immediately) 0: clear all flagbits 1: activate alternate map set 1 2: activate alternate map set 2 3: activate alternate map set 3 TPS: Cycles between stock maps, alt map 1, alt map 2, and alt map 3. MIL on for stock maps, off for set 1, even blink for set 2, uneven blink for set 3. ----- CODE START ; Get Flagbyte to B register 90 FD CB MOV DPTR, #0xFDCB ; Logging Flagbyte E0 MOVX A, @DPTR ; Get byte to ACC F5 F0 MOV B, A ; Move to B ; Handle pre-start OBD-II request - Abandon ship if this is set. 30 F3 01 JNB B.3 +1 ; Pre-start OBD-II not requested, skip over return 22 RET ; Get Counter Low/High from XRAM to R1/R2 90 FD C4 MOV DPTR, #0xFDC4 ; CounterLow E0 MOV A, @DPTR F9 MOV R1, A ; in R1 90 FD C5 MOV DPTR, #0xFDC5 ; CounterHigh E0 MOV A, @DPTR FA MOV R2, A ; in R2 ; Increment R1 and R2, checking for carry to spin high at 64 74 01 MOV A, #1 ; For addition C3 CLR C ; Ensure carry is clear 29 ADD A, R1 ; Add CLOW to A -- CLOW +1 ; If we're at 64, reset to zero, INC the high byte B4 41 14 CJNE A, #0x41 +20 ; Loop at 64 E4 CLR A ; Reset to 0 F9 MOV R1, A ; Update CLOW in R1 90 FD C4 MOV DPTR, #0xFDC4 ; CounterLow XRAM F0 MOV @DPTR, A ; Update CounterLow XRAM ; Do high byte 74 01 MOV A, #1 ; For addition 2A ADD A, R2 ; Add CHIGH to A -- CHIGH +1 B4 05 01 CJNE A, #0x05 ; Loop high byte at 5 E4 CLR A ; If we incremented to 5, clear (0) it. 90 FD C5 MOV DPTR, #0xFDC5 ; CounterHigh F0 MOV @DPTR, A ; Update CounterHigh XRAM FA MOV R2, A ; Update CHIGH in R2 80 05 SJMP +5 ; If we hit 64 and did this stuff, counter low was already updated, skip that ; Update counter low F9 MOV R1, A ; Update CLOW in R1 90 FD C4 MOV DPTR, #0xFDC4 ; CounterLow XRAM F0 MOV @DPTR, A ; Update CounterLow XRAM ; Do MIL flashy stuff.. But only when low byte is 01 E9 MOV A, R1 ; Loop counter low byte to A B4 01 37 CJNE A, #0x01 +55 ; Jump over if counter is not 0x01 E5 F0 MOV A, B ; Get flagbyte from B, to A 53 E0 C0 ANL A, 0xC0 ; Zero lower 6 bits of B -- 0x40 = Map 1 // 0x80 = Map 2 // 0xC0 = Map 3 ; Case when using stock maps B4 00 02 CJNE A, #0x00 +2 ; Skip next if mapbits != 0x00 C2 34 CLR RAM_26.4 ; Make sure MIL is on for stock mapset, as it usually is before the car is started ; Case when using alt map set 1 B4 40 02 CJNE A, #0x40 +2 ; Skip next if mapbits != 0x40 D2 34 SETB RAM_26.4 ; Make sure MIL is off to indicate first alt map set ; Case when using alt map set 2, turn MIL on and off at 128 increments of counter high byte B4 80 0D CJNE A, #0x80 +13 ; Skip next if mapbits != 0x80 EA MOV A, R2 ; Loop counter high byte to A B4 00 02 CJNE A, #0x00 +2 ; Jump over if counter is not 0x00 D2 34 SETB RAM_26.4 ; Make sure MIL is off B4 02 02 CJNE A, #0x02 +2 ; Jump over if counter is not 0x02 C2 34 CLR RAM_26.4 ; Make sure MIL is on 80 18 SJMP +24 ; ACC was replaced with counter, we're done with the MIL anyways, jump over the last conditional ; 31 ; Case when using alt map set 3, flash MIL 3 times B4 C0 15 CJNE A, #0xC0 +21 ; Skip next if mapbits != 0xC0 EA MOV A, R2 ; Loop counter high byte to A B4 00 02 CJNE A, #0x01 +2 ; Jump over if counter is not 0x00 C2 34 CLR RAM_26.4 ; Make sure MIL is on B4 01 02 CJNE A, #0x20 +2 ; Jump over if counter is not 0x01 D2 34 SETB RAM_26.4 ; Make sure MIL is off B4 02 02 CJNE A, #0x40 +2 ; Jump over if counter is not 0x02 C2 34 CLR RAM_26.4 ; Make sure MIL is on B4 03 02 CJNE A, #0x60 +2 ; Jump over if counter is not 0x03 D2 34 SETB RAM_26.4 ; Make sure MIL is off ;55 ; B.5 indicates we're doing an SRAM dump -- Get the byte, dump it, and bail.. keep looping until all is dumped, then clear B.5 30 F5 54 JNB B.5 +84 ; Get DPL/DPH from XRAM to R6/R5 90 FD AF MOV DPTR, #0xFDAF ; DPL holding address E0 MOV A, @DPTR ; GET DPL from XRAM FE MOV R6, A ; DPL in R6 90 FD B0 MOV DPTR, #0xFDB0 ; DPH holding address E0 MOV A, @DPTR ; GET DPH from XRAM FD MOV R5, A ; DPH in R5 ; Increment R5 and R6, checking for carry 74 01 MOV A, #1 ; For addition 2E ADD A, R6 ; Add DPL to A -- DPL +1 FE MOV R6, A ; Update DPL 50 1B JNC +27 ; If DPL didn't roll, we can just jump to sending the byte 74 01 MOV A, #1 ; For addition 2D ADD A, R5 ; Add DPH to A -- DPH +1 FD MOV R5, A ; Update DPH 50 15 JNC +21 ; If DPH didn't roll either, we can just send the byte ; DPL/DPH rolled, we hit FFFF, bail C2 F5 CLR B.5 ; DPH rolled, we are done, clear the XRAM dumping bit E5 F0 MOV A, B 90 FD CB MOV DPTR, #0xFDCB ; Logging Flagbyte F0 MOVX @DPTR, A ; Update XRAM flagbyte ; Clear bytes used for DPTR 31 E4 CLR A ; A = 0 90 FD AF MOV DPTR, #0xFDAF ; DPL XRAM F0 MOVX @DPTR, A ; Clear FDAF 90 FD B0 MOV DPTR, #0xFDB0 ; DPH XRAM F0 MOVX @DPTR, A ; Clear FDB0 ; Set serial port REN0 and exit 40 75 98 50 MOV S0CON, #0x50 ; Serial Mode1, REN0 Enabled 22 RET ; Just bail ; Init Serial Port E4 CLR A 90 87 C4 MOV DPTR, #0x87C4 ; S0RELL value for setting serial line speed 93 MOVC A, @A+DPTR ; Get code byte F5 AA MOV S0RELL, A ; Move code byte to S0RELL for serial line speed selection 75 BA 03 MOV S0RELH, 0x3 ; Speed = 500,000 / (256-S0RELL) 43 98 40 ORL S0CON, 0x40 ; Set bit SM1 53 98 6F ANL S0CON, 0x6F ; Clear bit SM0 - Ensure Mode 1 8Bit UART, Disable REN C2 AC CLR IEN0.4 ; Turn off serial interrupt ; Update memory with the new DPTR first 90 FD AF MOV DPTR, #0xFDAF ; DPL XRAM EE MOV A, R6 F0 MOVX @DPTR, A ; Update XRAM 90 FD B0 MOV DPTR, #0xFDB0 ; DPH XRAM ED MOV A, R5 F0 MOVX @DPTR, A ; Update XRAM 8E 82 MOV DPL, R6 ; Update DPTR 8D 83 MOV DPH, R5 ; Update DPTR ; 76 ; Dump byte, DPTR value first. DPH and DPL are already in R5 and R6, which will be sent by CODE_8628 as well as R7, which we grab now. E0 MOV A, @DPTR ; Get XRAM byte to dump FF MOV R7, A ; Dumped byte in R7 75 98 40 MOV S0CON, #0x40 ; Serial Mode1, REN0 Disabled (we'll turn it back on when we're done dumping) 12 86 28 LCALL CODE_8628 ; Send 3 Bytes 22 RET ; Just bail ; END of XRAM dumper ; The running routine sets B.1 when it logs so we can distinguish drive cycles. ; If this is the first loop of pre-start after a drive cycle, disable logging, unless persistent logging was enabled. 30 F1 0F JNB B.1, +15 ; B.1 is not set, jump over this routine C2 F1 CLR B.1 ; Clear B.1 Request Ack 20 F4 03 JB B.4 +3 ; B.4 Persist bit: Don't clear the following if persist enabled 53 F0 F2 ANL B, #0xF2 ; Clear bits 0, 2, 3 E5 F0 MOV A, B ; Flagbyte from B to A 90 FD CB MOV DPTR, #0xFDCB ; Logging Flagbyte XRAM F0 MOVX @DPTR, A ; Update flagbyte 22 RET ; Return. Resume processing on next loop. ; Init Serial Port E4 CLR A 90 87 C4 MOV DPTR, #0x87C4 ; S0RELL value for setting serial line speed 93 MOVC A, @A+DPTR ; Get code byte F5 AA MOV S0RELL, A ; Move code byte to S0RELL for serial line speed selection 75 BA 03 MOV S0RELH, 0x3 ; Speed = 500,000 / (256-S0RELL) 43 98 50 ORL S0CON, 0x50 ; Set bits SM1 and REN0 53 98 7F ANL S0CON, 0x7F ; Clear bit SM0 - Ensure Mode 1 8Bit UART 43 87 80 ORL PCON, #0x80 ; set PCON0.7 (SMOD), bitrate doubler 43 D8 80 ORL ADCON0, #0x80 ; Set ADCON0.7 (BD), enable baud rate generator C2 AC CLR IEN0.4 ; Turn off serial interrupt ; ADC THE TPS, jump over throttle depressed block if it's not depressed. D2 2A SETB RAM_25.2 75 DC 00 MOV ADCON1, #0 ; ADC channel 0: TPS 75 DA 00 MOV DAPR, #0 ; Initiate conversion 20 DC FD JB ADCON0.4, $ ; Wait for conversion E5 D9 MOV A, ADDAT ; Move result to ACC 30 2A F0 JNB RAM_25.2 -13 B4 80 00 CJNE A, 0x80, NEXT ; Compare to 0x80 (2.50v) 40 1C JC +28 ; Jump if throttle is not depressed (ADDAT returned < 0x80) ; throttle depressed. Check for 8 ADCs > 0x80 using FBD0 counter. If throttle is depressed, but <8 ADCs, spin counter and loop 90 FD B0 MOV DPTR, #0xFDB0 ; TPS ADC counter E0 MOVX A, @DPTR ; Fetch to ACC B4 08 00 CJNE A, 8 ; Compare ACC (FDB0) to 8, set carry if <8 50 0A JNC +10 ; Carry not set, counter >8, don't INC counter and return 04 INC A ; Increment counter F0 MOVX @DPTR, A ; Update FDB0 Counter 7D 64 MOV R5, 44 ; "d" C2 9C CLR S0CON.4 ; Clear REN0 for send 12 86 0D LCALL CODE_860D ; Send d to indcate throttle is down, but not 8 counts 22 RET ; Loop ; throttle is down, and we have >8 catches. Update TPS flagbyte to indicate. 90 FD C6 MOV DPTR, #0xFDC6 ; TPS flagbyte E0 MOV A, @DPTR D2 E2 SETB ACC.2 ; Set bit 2 of flagbyte to indicate we have >8 cycles of throttle down F0 MOV @DPTR, A ; Update flagbyte 80 33 SJMP +51 ; Jump past the rest of TPS routine to serial listener ; Jump to here when the throttle is up. Check if it's been up for 8 cycles... But only is throttle depression set FDC6.2, meaning we've changed state. 90 FD C6 MOV DPTR, #0xFDC6 ; TPS flagbyte E0 MOV A, @DPTR 30 E2 2C JNB ACC.2 +44 ; Jump over this if throttle wasn't previously depressed for >8 cycles. 90 FD B1 MOV DPTR, #0xFDB1 ; TPS ADC counter (up state) E0 MOVX A, @DPTR ; Fetch to ACC B4 08 00 CJNE A, 8 ; Compare ACC (FDB0) to 8, set carry if <8 50 0A JNC +10 ; Carry not set, counter >8, don't INC counter and return 04 INC A ; Increment counter F0 MOVX @DPTR, A ; Update FDB0 Counter 7D 75 MOV R5, 75 ; "u" C2 9C CLR S0CON.4 ; Clear REN0 for send 12 86 0D LCALL CODE_860D ; Send u to indcate throttle is down, but not 8 counts 22 RET ; Loop, increment counter again next cycle if throttle still up ;26 ; throttle is up, and we have >8 catches, after we caught 8 downs. Clear stuff out and select the next map set. 90 FD B0 MOV DPTR, #0xFDB0 ; FDB0 TPS ADC Counter (depressed) E4 CLR A ; Clear A F0 MOVX @DPTR, A ; Clear FDB0 A3 INC DPTR ; INC DPTR - FDB1 TPS ADC Counter (up) F0 MOVX @DPTR, A ; Clear FDB1 90 FD C6 MOV DPTR, #0xFDC6 ; TPS Byte F0 MOVX @DPTR, A ; TPS Byte ; Then increment the map bits 47 E5 F0 MOV A, B ; Get flagbyte from B 24 40 ADD A, #0x40 ; Add 0x40 to A which increments bytes 6/7 F5 F0 MOV B, A ; Move back to B 90 FD CB MOV DPTR, #0xFDCB ; XRAM for flagbyte F0 MOVX @DPTR, A ; update XRAM 12 87 17 LCALL CODE_8717 ; Send flagbyte in ASCII 22 RET ;51 ; Check for pending serial input E5 98 MOV A, S0CON 20 E0 04 JB ACC.0, +4 ; Got input, step over return ; No input, set Mode1 + REN0 and return 75 98 50 MOV S0CON, #0x50 ; Bits SM1 and REN0 22 RET ; Get S0BUF and send "R" to ack input E5 99 MOV A, S0BUF ; MOV received byte to ACC FB MOV R3, A ; Store received byte in R3 53 98 EE ANL S0CON, #0xEE ; Clear RI0 and REN0 7D 52 MOV R5, 0x52 ; "R" 12 86 0D LCALL CODE_860D ; Send "R" ; check for incoming "0" to clear and update flagbyte BB 30 06 CJNE R3, #0x30, +06 ; Compare to "0" E4 CLR A ; 0 -> A 90 FD CB MOV DPTR, #0xFDCB ; Logging Flagbyte F0 MOVX @DPTR, A ; Clear XRAM flagbyte 22 RET ; Loop ; Check for incoming "1": Map switch, set 1 BB 31 0F CJNE R3, #0x31, +15 ; Compare to "1" D2 F6 SETB B.6 ; Set mapbit 1 C2 F7 CLR B.7 ; Clear mapbit 2 E5 F0 MOV A, B 90 FD CB MOV DPTR, #0xFDCB ; Logging Flagbyte F0 MOVX @DPTR, A ; Update XRAM flagbyte ; Send ! to ack 7D 21 MOV R5, 0x21 ; "!" 12 86 0D LCALL CODE_860D ; Send "!" ; Check for incoming "2": Map switch, set 2 BB 32 0F CJNE R3, #0x32, +15 ; Compare to "2" C2 F6 CLR B.6 ; Clear mapbit 1 D2 F7 SETB B.7 ; Set mapbit 2 E5 F0 MOV A, B 90 FD CB MOV DPTR, #0xFDCB ; Logging Flagbyte F0 MOVX @DPTR, A ; Update XRAM flagbyte ; Send @ to ack 7D 40 MOV R5, 0x40 ; "@" 12 86 0D LCALL CODE_860D ; Send "@" ; Check for incoming "3": Map switch, set 3 BB 33 0E CJNE R3, #0x33, +14 ; Compare to "3" 43 F0 C0 ORL B, #0xC0 ; Set bits 6 and 7 E5 F0 MOV A, B 90 FD CB MOV DPTR, #0xFDCB ; Logging Flagbyte F0 MOVX @DPTR, A ; Update XRAM flagbyte ; Send # to ack 7D 23 MOV R5, 0x23 ; "#" 12 86 0D LCALL CODE_860D ; Send "#" ; Check for incoming "l" to enable logging BB 6C 10 CJNE R3, #0x6C, +16 ; Compare to "l" D2 F0 SETB B.0 ; Set bit 0, log enable 53 F0 EB ANL B, #0xEB ; Clear bits 2 and 4 E5 F0 MOV A, B 90 FD CB MOV DPTR, #0xFDCB ; Logging Flagbyte F0 MOVX @DPTR, A ; Update XRAM flagbyte ; Send l to ack 7D 6C MOV R5, 0x6C ; "l" 12 86 0D LCALL CODE_860D ; Send "l" ; Check for incoming "L" to persistent logging BB 4C 10 CJNE R3, #0x4C, +16 ; Compare to "L" C2 F2 CLR B.2 ; Disable streaming logging, in case that was previously set 43 F0 11 ORL B, #0x11 ; Set bits 0 and 4 E5 F0 MOV A, B 90 FD CB MOV DPTR, #0xFDCB ; Logging Flagbyte F0 MOVX @DPTR, A ; Update XRAM flagbyte ; Send L to ack 7D 4C MOV R5, 0x4C ; "L" 12 86 0D LCALL CODE_860D ; Send "L" ; Check for incoming "d" to disable logging BB 64 0E CJNE R3, #0x64, +14 ; Compare to "d" 53 F0 EA ANL B, #0xEA ; Clear bits 0, 2 and 4 E5 F0 MOV A, B 90 FD CB MOV DPTR, #0xFDCB ; Logging Flagbyte F0 MOVX @DPTR, A ; Update XRAM flagbyte ; Send d to ack 7D 64 MOV R5, 0x64 ; "d" 12 86 0D LCALL CODE_860D ; Send "d" ; Check for "x", do XRAM dump BB 78 1E CJNE R3, #0x78, +30 ; Compare to "x" 75 F0 20 MOV B, #20 ; Set bit 5 only E5 F0 MOV A, B 90 FD CB MOV DPTR, #0xFDCB ; Logging Flagbyte F0 MOVX @DPTR, A ; Update XRAM flagbyte 90 FD AF MOV DPTR, #0xFDAF ; Update DPL in XRAM 74 FF MOV A, #FF F0 MOVX @DPTR, A 90 FD B0 MOV DPTR, #0xFDB0 ; Update DPH in XRAM 74 F7 MOV A, #F7 F0 MOVX @DPTR, A ; Send X to ack and bail with REN0 off - Next time into this loop, we'll start dumping 7D 78 MOV R5, 0x78 ; "x" 12 86 0D LCALL CODE_860D ; Send "x" 75 98 40 MOV S0CON, #0x40 ; Serial Mode1, REN0 Disabled (we'll turn it back on when we're done dumping) 22 RET ; Just bail, XRAM dump will start next loop ; Check for incoming "s", XRAM streaming mode BB 73 15 CJNE R3, #0x73, +21 ; Compare to "s" D2 F2 SETB B.2 ; Set bit 1, log enable 53 F0 EE ANL B, #0xEE ; Clear bits 0 and 4 E5 F0 MOV A, B 90 FD CB MOV DPTR, #0xFDCB ; Logging Flagbyte F0 MOVX @DPTR, A ; Update XRAM flagbyte 90 FD B0 MOV DPTR, #0xFDB0 ; DPTR to FDB0, cycle counter for XRAM dumper E4 CLR A ; ACC = 0 F0 MOVX @DPTR, A ; Set counter byte to 0 ; Send s to ack 7D 73 MOV R5, 0x73 ; "s" 12 86 0D LCALL CODE_860D ; Send "s" ; Check for incoming "S", XRAM streaming mode, persistent BB 53 15 CJNE R3, #0x53, +21 ; Compare to "s" 43 F0 14 ORL B, #0x14 ; Set bits 2 and 4 C2 F0 CLR B.0 ; Disable normal logging, in case that was previously set E5 F0 MOV A, B 90 FD CB MOV DPTR, #0xFDCB ; Logging Flagbyte F0 MOVX @DPTR, A ; Update XRAM flagbyte 90 FD B0 MOV DPTR, #0xFDB0 ; DPTR to FDB0, cycle counter for XRAM dumper E4 CLR A ; ACC = 0 F0 MOVX @DPTR, A ; Set counter byte to 0 ; Send S to ack 7D 53 MOV R5, 0x53 ; "S" 12 86 0D LCALL CODE_860D ; Send "S" ; Check for incoming "p" to dump port SFRs BB 70 17 CJNE R3, #0x70, +23 ; Compare to "p" AD 80 MOV R5, P0 ; Port 0 -> R5 AE 90 MOV R6, P1 ; Port 1 -> R6 AF A0 MOV R7, P2 ; Port 2 -> R7 12 86 28 LCALL CODE_8628 ; Send R5/R6/R7 AD B0 MOV R5, P3 ; Port 3 -> R5 AE E8 MOV R6, P4 ; Port 4 -> R6 AF F8 MOV R7, P5 ; Port 5 -> R7 12 86 28 LCALL CODE_8628 ; Send R5/R6/R7 AD FA MOV R5, P6 ; Port 6 -> R5 12 86 0D LCALL CODE_860D ; Send R5 ; Check for incoming "o" to enable pre-start OBD-II BB 6F 1B CJNE R3, #0x6F, +27 ; Compare to "o" 75 F0 08 MOV B, #8 ; bit 3, prestart OBDII - everything else cleared. E5 F0 MOV A, B 90 FD CB MOV DPTR, #0xFDCB ; Logging Flagbyte F0 MOVX @DPTR, A ; Update XRAM flagbyte ; Send "o" 7D 6F MOV R5, 0x6F ; "o" 12 86 0D LCALL CODE_860D ; Send "o" ; Reapply the settings found in the RESET routine used to initally configure the serial port 75 98 90 MOV S0CON, #0x90 75 BA 03 MOV S0RELH, #3 75 AA CC MOV S0RELL, #0xCC 53 87 7F ANL PCON, #7F 22 RET ; Check for incoming "O" to enable persistent pre-start OBD-II BB 4F 1B CJNE R3, #0x4F, +27 ; Compare to "O" 75 F0 18 MOV B, #0x18 ; bit 3: prestart OBD-II, bit 4: persistence E5 F0 MOV A, B 90 FD CB MOV DPTR, #0xFDCB ; Logging Flagbyte F0 MOVX @DPTR, A ; Update XRAM flagbyte ; Send "O" 7D 4F MOV R5, 0x4F ; "O" 12 86 0D LCALL CODE_860D ; Send "O" ; Reapply the settings found in the RESET routine used to initally configure the serial port 75 98 90 MOV S0CON, #0x90 75 BA 03 MOV S0RELH, #3 75 AA CC MOV S0RELL, #0xCC 53 87 7F ANL PCON, #7F 22 RET ; Send current logbyte, bit by bit in ASCII for readablity. 12 87 17 LCALL CODE_8717 ; Now in external function ; End of subroutine 75 98 50 MOV S0CON, #0x50 ; Serial Mode1, REN0 Enabled 22 RET