Compare commits

...

2 commits

Author SHA1 Message Date
335c4d2c96 and use display list copy in aligned memory 2023-01-22 07:36:08 -08:00
6fc07b9e65 hmm 2023-01-22 07:23:46 -08:00

View file

@ -24,10 +24,11 @@ FR1 = $e0
FR2 = $e6 FR2 = $e6
; High data ; High data
framebuffer_top = $8000 framebuffer_top = $8000
textbuffer = $8f00
framebuffer_bottom = $9000 framebuffer_bottom = $9000
textbuffer = $9f00 display_list = $9f00
framebuffer_end = $a000 framebuffer_end = $a000
height = 184 height = 184
half_height = height >> 1 half_height = height >> 1
@ -54,7 +55,7 @@ str_speed:
.byte "ms/px" .byte "ms/px"
str_speed_end: str_speed_end:
str_run: str_run:
.byte "RUN " .byte " RUN"
str_run_end: str_run_end:
str_done: str_done:
.byte "DONE" .byte "DONE"
@ -104,7 +105,7 @@ bit_masks:
.byte 3 << 4 .byte 3 << 4
.byte 3 << 6 .byte 3 << 6
display_list: display_list_start:
; 48 lines overscan ; 48 lines overscan
.repeat 5 .repeat 5
.byte $70 ; 8 blank lines .byte $70 ; 8 blank lines
@ -129,6 +130,8 @@ display_list:
.byte $41 ; jump and blank .byte $41 ; jump and blank
.addr display_list .addr display_list
display_list_end:
display_list_len = display_list_end - display_list_start
.code .code
@ -528,14 +531,6 @@ done:
; Disable display DMA ; Disable display DMA
sta DMACTL sta DMACTL
; Set up the display list
lda #.lobyte(display_list)
sta DLISTL ; actual register
sta SDLSTL ; shadow register the OS will copy in
lda #.hibyte(display_list)
sta DLISTH ; actual register
sta SDLSTH ; shadow register the OS will copy in
; zero the range from framebuffer_top to framebuffer_end ; zero the range from framebuffer_top to framebuffer_end
lda #.lobyte(framebuffer_top) lda #.lobyte(framebuffer_top)
sta temp sta temp
@ -555,6 +550,25 @@ zero_byte_loop:
cmp #.hibyte(framebuffer_end) cmp #.hibyte(framebuffer_end)
bne zero_page_loop bne zero_page_loop
; Copy the display list into properly aligned memory
; Can't cross 1024-byte boundaries :D
ldx #0
copy_byte_loop:
lda display_list_start,x
sta display_list,x
inx
cpx #display_list_len
bne copy_byte_loop
; Set up the display list
lda #.lobyte(display_list)
sta DLISTL ; actual register
sta SDLSTL ; shadow register the OS will copy in
lda #.hibyte(display_list)
sta DLISTH ; actual register
sta SDLSTH ; shadow register the OS will copy in
; Status bar
draw_text 0, str_self_len, str_self draw_text 0, str_self_len, str_self
draw_text 40 - str_run_len, str_run_len, str_run draw_text 40 - str_run_len, str_run_len, str_run