This commit is contained in:
Brooke Vibber 2022-11-25 19:17:34 -08:00
parent f261aa6908
commit 53293e8243

View file

@ -20,12 +20,21 @@ NMIEN = $D40E
.import framebuffer
displaylist:
; @fixme resolve the line counts
.repeat 3
.byte $70 ; 8 blank lines
.endrep
.byte $4e ; ANTIC mode e (160px 2bpp, 1 scan line per line)
; Note the framebuffer cannot cross a 4KiB boundary
; so this is split in half
; ANTIC mode e (160px 2bpp, 1 scan line per line)
.byte $4e
.addr framebuffer
.repeat 191
.repeat 95
.byte $0e
.endrep
.byte $4e
.addr framebuffer + 96*40
.repeat 95
.byte $0e
.endrep
.byte $41 ; jump and blank
@ -36,8 +45,39 @@ displaylist:
.export start
; Loop through scan lines updating the palette
.proc update_palette
.proc start
; Disable display DMA
lda #$00
sta SDMCTL
; Set up the display list
lda #.lobyte(displaylist)
sta SDLSTL
lda #.hibyte(displaylist)
sta SDLSTH
; Turn off interrupts except reset button
;lda #$20
;sta NMIEN
; Manually wait for first scan line
wait_vblank:
lda VCOUNT
bne wait_vblank
; Re-enable display DMA
lda #$22
sta SDMCTL
wait_start:
lda VCOUNT
cmp #12
bne wait_start
ldy #0
each_scanline:
tya
pha
lda palette1,y
pha
ldx palette2,y
@ -52,40 +92,18 @@ displaylist:
sta COLPF0
stx COLPF1
sty COLPF2
pla
tay
iny
cpy #192
bne each_scanline
jmp wait_start
.endproc
; Loop through scan lines updating the palette
.proc update_palette
rts
.endproc
.proc start
; Disable display DMA
lda #$00
sta SDMCTL
; Set up the display list
lda #.lobyte(displaylist)
sta SDLSTL
lda #.hibyte(displaylist)
sta SDLSTH
; Turn off interrupts except reset button
lda #$20
sta NMIEN
; Manually wait for first scan line
wait_vblank:
lda VCOUNT
bne wait_vblank
; Re-enable display DMA
lda #$22
sta SDMCTL
even_scanline:
ldy VCOUNT
jsr update_palette
odd_scanline:
ldy VCOUNT
iny
jsr update_palette
jmp even_scanline
.endproc