Posted Sun Feb 19, 2012 5:41 AM
One part of the rom code has always got me stumped.
According to the specs I have. the only way the 8040 (mcs-48) can jump rom banks (2K boundary) is to use SEL MBx they use either jump or call. Also, if the program reaches the end of a 2k boundary, it loops back to the beginning of said bank. So code JMP FEE (used 3 times) in the 2nd bank jumps to nowhere where the rom is blank (FF or MOV A,R7), then loops round to 800.
I believe it was ment to go to 7EE But it cannot as no SEL MB0 command is used prior. The PSW bits that are changed are only the stack pointer.
The following code from 7EE to 7FF according to the specs is never used. If this code is run, it will loop back to 000!!!!
So is this a rather bad error in the code?? And what that little bit do anywhy???
The xf single rom from CSS has the same code that is listed at 7ee moved to 800 so perhaps he saw the error and fixed it?
;==========================================================================
; Track/sector division routine
;
A7EE MOV A,R0 ;save R0-R5 to 075-070H
MOV R0,#75H ;...
MOV @R0,A ;...
DEC R0 ;...
MOV A,R1 ;...
MOV @R0,A ;...
DEC R0 ;...
MOV A,R2 ;...
MOV @R0,A ;...
DEC R0 ;...
MOV A,R3 ;...
MOV @R0,A ;...
DEC R0 ;...
MOV A,R4 ;...
MOV @R0,A ;...
DEC R0 ;...
MOV A,R5 ;...
; 2k Boundry 800 hex
MOV @R0,A ;...
MOV R0,#77H
MOV A,@R0
ADD A,#0FFH
MOV R2,A
DEC R0
MOV A,@R0
etc
Please note that code at 070, 251, 252,2a5 and 2a6 are also not used. This is the serial timing changes required to get xf to work properly with PAL. When caculated out, 1 cycle is added to the timing.
James