I suggest familiarising yourself with the 'hc11 instruction set

it will make a lot more sense then.
The code on the PCM is structured to ensure that it has enough time (in theory!) to do the necessary calculations, refresh the ram, and service the interupts etc.
the code I pasted earlier is the first of 16 minor subroutines, one of which is called every 6.25ms, sequentially by the main code loop.
Each one of these subroutines then calls a number of other routines to perform each the various calculations required to run the engine and transmission.
ok so this portion of code is the bank switching.
Code: Select all
tpa ;transfer the value of the cpu status flags register to accumulator a
psha ;push accumulator a onto the stack
sei ;set the interrupt mask bit (inhibits interrupts from being executed)
ldab PORTG ;load accumulator b with the value from Port G's Data register
orab #0x40 ;logical OR accumulator b with 0x40, with the result in accumulator b (sets bit 6)
stab PORTG ;store the contents of accumulator b to Port G's Data register
pula ;pull the last value that was placed on the stack back off and store in accumulator a
tap ;transfer the value from accumulator a to the cpu status flags register (this will also clear the interrupt mask bit, allowing interrupts to be serviced again)
.......
tpa ;transfer the value of the cpu status flags register to accumulator a
psha ;push accumulator a onto the stack
sei ;set the interrupt mask bit (inhibits interrupts from being executed)
ldab PORTG ;load accumulator b with the value from Port G's Data register
andb #0xBF ;logical AND accumulator b with 0xBF, with the result in accumulator b (clears bit 6)
stab PORTG ;store the contents of accumulator b to Port G's Data register
pula ;pull the last value that was placed on the stack back off and store in accumulator a
tap ;transfer the value from accumulator a to the cpu status flags register (this will also clear the interrupt mask bit, allowing interrupts to be serviced again)
........
Code: Select all
<<<SWITCH TO HIGH BANK 2>>>
.............
brclr *RAM_OPTIONS1,#1,loc_7D0A ; BRANCH to "loc_7D0A" IF MANUAL TRANSMISSION OPTION FLAG IS CLEAR (branch if auto essentially)
brset *RAM_OPTIONS2,#0x80,loc_7D07 ; BRANCH to "loc_7D07" IF MANUAL TRANSMISSION VSS OPTION FLAG IS SET
jsr loc_1DD51 ;jump to subroutine at address 0xDD51 (I have renamed it to read 1DD51 since that is where it is physically located)
;If we got here we must be a manual transmission with an auto style VSS, a Getrag box?
loc_7D07: jsr loc_1DDE2 ;jump to subroutine at address 0xDDE2 (I have renamed it to read 1DDE2 since that is where it is physically located)
loc_7D0A: jsr loc_1A000 ;jump to subroutine at address 0xA000 (I have renamed it to read 1A000 since that is where it is physically located)
............
<<<SWITCH TO HIGH BANK 1>>>
............
jsr sub_BB4A ;jump to subroutine at address 0xBB4A