Skip to content

Commit 2b61399

Browse files
committed
A5200: Fixes graphics modes with more than 4K RAM, implement GTIA modes.
1 parent 2912035 commit 2b61399

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

src/interp/a5200/graphics.asm

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
.export set_grmode
3131
.importzp tmp1, tmp2, next_instruction
3232
.importzp DINDEX, COLCRS, ROWCRS, SAVMSC, COLOR
33-
.import mem_set_0, MEMTOP
33+
.import mem_set_0, MEMTOP, GPRIOR
3434

3535
.segment "RUNTIME"
3636
.include "atari5200.inc"
@@ -79,11 +79,20 @@
7979
sty DMACTL
8080

8181
tay
82-
lda dl_mode, y
83-
pha
82+
8483
ldx dl_type, y
8584
stx DINDEX
8685

86+
lda GPRIOR ; Mask bits 6-7 of GPRIOR, and set from table
87+
eor dl_mode, y
88+
and #$C0
89+
eor GPRIOR
90+
sta GPRIOR
91+
92+
lda dl_mode, y
93+
and #$0F
94+
pha
95+
8796
lda mem_adr_l, x
8897
sta SAVMSC
8998
sta tmp2
@@ -132,7 +141,7 @@ lp1: sta (SDLSTL), y
132141
pla
133142
setr:
134143
iny
135-
cpy #100
144+
cpy #95
136145
bne no_4k
137146
; Patch crossing of 4K segment
138147
pha
@@ -145,6 +154,7 @@ setr:
145154
lda #>$3000
146155
sta (SDLSTL), y
147156
iny
157+
dec ROWCRS
148158
pla
149159

150160
no_4k:
@@ -186,7 +196,8 @@ setp:
186196
palette: .byte $28,$CA,$94,$46,$00
187197

188198
dl_type: .byte 2, 0, 1, 2, 2, 2, 2, 4, 5, 6, 6, 6, 2, 3, 2, 7
189-
dl_mode: .byte 2, 6, 7, 2, 2, 2, 2,13,15,15,15,15, 4, 5, 2,14
199+
; Encode ANTIC mode and GPRIOR values
200+
dl_mode: .byte $02,$06,$07,$02,$02,$02,$02,$0D,$0F,$4F,$8F,$CF,$04,$05,$02,$0E
190201

191202
mem_adr_l: .lobytes $3E20, $3F10, $3C40, $3E20, $3100, $21F0, $21F0, $21F0
192203
mem_adr_h: .hibytes $3E20, $3F10, $3C40, $3E20, $3100, $21F0, $21F0, $21F0

0 commit comments

Comments
 (0)