Classic Computer Magazine Archive PROGRAM LISTING: 85-09/REVB2C.M65


0250 ; REV.B TO REV.C CONVERTER
0260 ; BY MATTHEW RATCLIFF
0270 ; (c) 1985, ANTIC PUBLISHING
0280     *=  $0600
0290     .OPT OBJ
0300 ;
0310 ; PUT CODE INTO PAGE 6
0320 ;
0330 CASINI = $02    ;VECTOR WE WILL STEAL
0340 BOOT =  $09     ;CASS/DISK BOOT FLAG
0350 ; SET BIT 1 AND SYSTEM LOOKS FOR
0360 ; POST RESET HANDLER CODE POINTED
0370 ; TO BY CASINI VECTOR. THIS IS
0380 ; HOW RESET ALWAYS GIVES YOU REV.C
0390 ; RAM-BASIC.
0400 GINTLK = $03FA  ;EXTERNAL CART?  DO NOTHING
0410 RMPNT = $D8     ;ROM/RAM POINTER
0420 COUNT = $DA     ;BUG FIX COUNT LOC
0430 PORTB = $D301   ;CONTROL ROM/RAM THRU HERE
0440 BEGBAS = $A000  ;BASIC ROM STARTS HERE
0450 ;
0460 ; STEAL CASSETTE RESET VECTOR
0470 ; AND POINT HERE FOR NEXT RESET.
0480 ;
0490 STEAL LDA # <STEAL
0500     STA CASINI  ;MUST RESTORE VECTOR
0510     LDA # >STEAL ;EVERY TIME RESET IS PRESSED
0520     STA CASINI+1
0530     LDA GINTLK  ;EXTERNAL CART?
0540     BEQ CNTNU   ;IF YES, CONTINUE
0550     RTS         ; IF NO, ABORT
0560 CNTNU LDA # <BEGBAS ;POINT TO START OF
0570     STA RMPNT   ;BAD BASIC ROM
0580     LDA # >BEGBAS
0590     STA RMPNT+1
0600 BCOPY LDY #0    ;COPY IT TO RAM
0610     LDA PORTB   ;BASIC ROM ON PLEASE
0620     AND #$FD    ;RESET CONTROL BIT=ON
0630     STA PORTB   ;GOT IT
0640     LDA (RMPNT),Y ;GET ROM BYTE
0650     PHA         ;SAVE IT
0660     LDA PORTB   ;NOW ENABLE THE RAM INSTEAD
0670     ORA #$02    ;SET CONTROL BIT=OFF
0680     STA PORTB   ;ROM OFF, RAM ON
0690     PLA         ;GET ROM BYTE
0700     STA (RMPNT),Y ;RAM VERSION UPDATED
0710     INC RMPNT
0720     BNE BCOPY
0730     INC RMPNT+1
0740     LDA RMPNT+1 ;DONE COPYING?
0750     CMP #$C0    ;END OF BASIC?
0760     BNE BCOPY   ;NOT YET!
0770 ; NOW GO FIX THE BUGS!
0780 FIXBUGS LDX #0  ;BUG TABLE INDEX
0790     LDA #12     ;12 BUGS TO FIX
0800     STA COUNT
0810 FXLOOP LDY #0   ;SETUP RAM POINTERS
0820     LDA FXTBL,X ;GET ADDR LO BYTE
0830     STA RMPNT   ;SETUP RAM POINTER
0840     INX 
0850     LDA FXTBL,X ;GET ADDR HI BYTE
0860     STA RMPNT+1
0870     INX 
0880     LDA FXTBL,X ;GET CORRECT BYTE
0890     STA (RMPNT),Y ;TO FIX THE BUG
0900     INX         ;POINT TO NEXT FIX
0910     DEC COUNT
0920     BNE FXLOOP
0930     LDA BOOT    ;ALL DONE WITH FIXED RAM-BASIC
0940     ORA #$02    ;RE-HOOK INTO BOOT
0950     STA BOOT    ;FOR NEXT RESET KEY-PRESS
0960     RTS 
0970 ;
0980 ; ADDRESS,BYTE FIXUP TABLE FOR
0990 ; REV.B TO REV.C CONVERSION!
1000 ;
1010 FXTBL .WORD $A8DF ;ADDRESS
1020     .BYTE 234   ;WAS 202, NOW 234 IN REV.C
1030     .WORD $A8E0
1040     .BYTE 240   ;WAS 208
1050     .WORD $A8E1
1060     .BYTE 17    ;WAS 10
1070     .WORD $A8E2
1080     .BYTE 234   ;WAS 96
1090 ;
1100 ; PEEK (43234)=96 FOR REV.B
1110 ; THAT IS ADDR $A8E2
1120 ;
1130     .WORD $BB29
1140     .BYTE 0     ;WAS 16
1150     .WORD $BFF3
1160     .BYTE 0     ;WAS 44
1170     .WORD $BFF4
1180     .BYTE 0     ;WAS 55
1190     .WORD $BFF5
1200     .BYTE 0     ;WAS 105
1210     .WORD $BFF6
1220     .BYTE 0     ;WAS 110
1230     .WORD $BFF7
1240     .BYTE 0     ;WAS 110
1250     .WORD $BFF8
1260     .BYTE 0     ;WAS 101
1270     .WORD $BFF9
1280     .BYTE 0     ;WAS 114
1290 ;
1300 ; ONLY 12 BYTES DIFFERENCE BETWEEN
1310 ; REV.B & REV.C!
1320 ;
1330     .END 

Back to previous page