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"
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
133142setr:
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
150160no_4k:
@@ -186,7 +196,8 @@ setp:
186196palette: .byte $28 ,$CA ,$94 ,$46 ,$00
187197
188198dl_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
191202mem_adr_l: .lobytes $3E20 , $3F10 , $3C40 , $3E20 , $3100 , $21F0 , $21F0 , $21F0
192203mem_adr_h: .hibytes $3E20 , $3F10 , $3C40 , $3E20 , $3100 , $21F0 , $21F0 , $21F0
0 commit comments