Skip to content

Commit

Permalink
Make X16 work with both R38 and R39 type bank switching
Browse files Browse the repository at this point in the history
  • Loading branch information
pzembrod committed Apr 10, 2021
1 parent 663b1e1 commit fb100de
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions 6502/C64/src/vf-sys-x16.fth
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ include vf-lbls-cbm.fth
0381 >label CurFlg \ aka qtsw
0385 >label InsCnt \ aka insrt

09f60 >label RomBank
09f61 >label RamBank
\ TODO(issues/33): Remove the R?mBank38 labels.
09f60 >label RomBank38
09f61 >label RamBank38
1 >label RomBank
0 >label RamBank

0a000 >label KeyD \ keyboard buffer
0a00a >label Ndx \ #keys in keyboard buffer
Expand All @@ -44,21 +47,29 @@ include vf-lbls-cbm.fth

Code c64key? ( -- flag)
RamBank ldx
\ TODO(issues/33): Remove the lines accessing RamBank38.
RamBank38 ldy
0 # lda RamBank sta
RamBank38 sta
Ndx lda
0<> ?[ 0FF # lda ]? pha
RamBank stx
RamBank38 sty
Push jmp end-code

Code getkey ( -- 8b)
RamBank lda N sta
\ TODO(issues/33): Remove the lines accessing RamBank38.
RamBank38 lda N 1+ sta
0 # lda RamBank sta
RamBank38 sta
Ndx lda 0<>
?[ sei KeyD ldy
[[ KeyD 1+ ,X lda KeyD ,X sta inx
Ndx cpx 0= ?]
Ndx dec
N lda RamBank sta
N 1+ lda RamBank38 sta
tya cli 0A0 # cmp
0= ?[ bl # lda ]?
]?
Expand Down Expand Up @@ -113,6 +124,8 @@ Label restore pha txa pha tya pha cld
Label first-init
sei cld
RomBank lda $f8 # and RomBank sta \ map in KERNAL ROM
\ TODO(issues/33): Remove this line accessing RomBank38.
RomBank38 lda $f8 # and RomBank38 sta \ map in KERNAL ROM for R38
IOINIT jsr CINT jsr RESTOR jsr \ init. and set I/O-Vectors
ink-pot lda BrdCol sta \ border
ink-pot 1+ lda BkgCol sta \ backgrnd
Expand Down

0 comments on commit fb100de

Please sign in to comment.