wip 2frame

This commit is contained in:
Brooke Vibber 2022-12-07 18:20:24 -08:00
parent 9200e82a15
commit 76ebed5871
2 changed files with 37 additions and 53 deletions

View file

@ -667,7 +667,7 @@ function genAssembly(width, height, nbits, lines, reps) {
palette3: new Uint8Array(linesEach), palette3: new Uint8Array(linesEach),
bitmap: new Uint8Array(stride * linesEach), bitmap: new Uint8Array(stride * linesEach),
}; };
for (let y = 0; y < lines.length; y++) { for (let y = 0; y < linesEach; y++) {
let base = linesEach * i; let base = linesEach * i;
console.log(i, y, base); console.log(i, y, base);
frame.palette1[y] = lines[y + base].palette[1]; frame.palette1[y] = lines[y + base].palette[1];
@ -694,49 +694,49 @@ function genAssembly(width, height, nbits, lines, reps) {
.export frame2_palette2 .export frame2_palette2
.export frame2_palette3 .export frame2_palette3
.segment buffers .segment "BUFFERS"
.align 4096 .align 4096
frame1_top frame1_top:
${byte2byte(frame[0].bitmap.slice(0, half))} ${byte2byte(frames[0].bitmap.slice(0, half))}
.align 256 .align 256
frame1_palette1: frame1_palette1:
${byte2byte(frame[0].palette1)} ${byte2byte(frames[0].palette1)}
.align 256 .align 256
frame1_palette2: frame1_palette2:
${byte2byte(frame[0].palette2)} ${byte2byte(frames[0].palette2)}
.align 256 .align 256
frame1_palette3: frame1_palette3:
${byte2byte(frame[0].palette3)} ${byte2byte(frames[0].palette3)}
.align 4096 .align 4096
frame1_bottom: frame1_bottom:
${byte2byte(frame[0].bitmap.slice(half))} ${byte2byte(frames[0].bitmap.slice(half))}
.align 4096 .align 4096
frame2_top frame2_top:
${byte2byte(frame[1].bitmap.slice(0, half))} ${byte2byte(frames[1].bitmap.slice(0, half))}
.align 256 .align 256
frame2_palette1: frame2_palette1:
${byte2byte(frame[1].palette1)} ${byte2byte(frames[1].palette1)}
.align 256 .align 256
frame2_palette2: frame2_palette2:
${byte2byte(frame[1].palette2)} ${byte2byte(frames[1].palette2)}
.align 256 .align 256
frame2_palette3: frame2_palette3:
${byte2byte(frame[1].palette3)} ${byte2byte(frames[1].palette3)}
.align 4096 .align 4096
frame2_bottom: frame2_bottom:
${byte2byte(frame[1].bitmap.slice(half))} ${byte2byte(frames[1].bitmap.slice(half))}
`; `;
} }

View file

@ -13,11 +13,6 @@ WSYNC = $D40A
VCOUNT = $D40B VCOUNT = $D40B
NMIEN = $D40E NMIEN = $D40E
framebuffer = $a000
framebuffer2 = $b000
framebuffer3 = $8000
framebuffer4 = $9000
temp1l = $80 temp1l = $80
temp1h = $81 temp1h = $81
temp1 = temp1l temp1 = temp1l
@ -40,13 +35,20 @@ scanline_max = (lines_per_frame - scanline_offset) / 2
.data .data
.import palette1
.import palette2
.import palette3
.import bitmap
.import audio_samples .import audio_samples
.import audio_samples_end .import audio_samples_end
.import frame1_top
.import frame1_bottom
.import frame1_palette1
.import frame1_palette2
.import frame1_palette3
.import frame2_top
.import frame2_bottom
.import frame2_palette1
.import frame2_palette2
.import frame2_palette3
displaylist: displaylist:
; 40 lines overscan ; 40 lines overscan
.repeat 5 .repeat 5
@ -56,12 +58,12 @@ displaylist:
; 160 lines graphics ; 160 lines graphics
; ANTIC mode e (160px 2bpp, 1 scan line per line) ; ANTIC mode e (160px 2bpp, 1 scan line per line)
.byte $4e .byte $4e
.addr framebuffer .addr frame1_top
.repeat height / 2 - 1 .repeat height / 2 - 1
.byte $0e .byte $0e
.endrep .endrep
.byte $4e .byte $4e
.addr framebuffer2 .addr frame1_bottom
.repeat height / 2 - 1 .repeat height / 2 - 1
.byte $0e .byte $0e
.endrep .endrep
@ -78,12 +80,12 @@ displaylist_part2:
; 160 lines graphics ; 160 lines graphics
; ANTIC mode e (160px 2bpp, 1 scan line per line) ; ANTIC mode e (160px 2bpp, 1 scan line per line)
.byte $4e .byte $4e
.addr framebuffer3 .addr frame2_top
.repeat height / 2 - 1 .repeat height / 2 - 1
.byte $0e .byte $0e
.endrep .endrep
.byte $4e .byte $4e
.addr framebuffer4 .addr frame2_bottom
.repeat height / 2 - 1 .repeat height / 2 - 1
.byte $0e .byte $0e
.endrep .endrep
@ -121,24 +123,6 @@ audio_high_byte:
.export start .export start
.proc start .proc start
; Copy the bitmap into our framebuffer
lda #.lobyte(bitmap)
sta temp1l
lda #.hibyte(bitmap)
sta temp1h
lda #.lobyte(framebuffer)
sta temp2l
lda #.hibyte(framebuffer)
sta temp2h
jsr copy_half_frame
; Second half of bitmap has to be separately aligned
lda #.lobyte(framebuffer2)
sta temp2l
lda #.hibyte(framebuffer2)
sta temp2h
jsr copy_half_frame
; Set up the audio sample buffer ; Set up the audio sample buffer
lda #.lobyte(audio_samples) lda #.lobyte(audio_samples)
sta sample_ptrl sta sample_ptrl
@ -150,7 +134,7 @@ audio_high_byte:
sta DMACTL sta DMACTL
; Disable VBI and DLI but allow Reset ; Disable VBI and DLI but allow Reset
lda #32 lda #$20
sta NMIEN sta NMIEN
; Set up the display list ; Set up the display list
@ -186,16 +170,16 @@ each_scanline:
sta audiotemp ; 3 cyc sta audiotemp ; 3 cyc
.endmacro .endmacro
.macro inner_scanline .macro inner_scanline frame_base
; it'll fire on unused lines, but harmlessly ; it'll fire on unused lines, but harmlessly
ldy scanline ; 3 cyc ldy scanline ; 3 cyc
inc scanline ; 5 cyc inc scanline ; 5 cyc
; Leisurely memory fetches ; Leisurely memory fetches
lda palette1,y ; 5 lda frame1_palette1,y ; 5 @FIXME alternate
pha ; ...3? pha ; ...3?
ldx palette2,y ; 5 ldx frame1_palette2,y ; 5
lda palette3,y ; 5 lda frame1_palette3,y ; 5
tay tay
pla pla
@ -210,8 +194,8 @@ each_scanline:
.macro audio_play_lo ; 11 cycles .macro audio_play_lo ; 11 cycles
lda audiotemp ; 3 cyc lda audiotemp ; 3 cyc
;and #$0f ; 2 cyc and #$0f ; 2 cyc
;ora #$10 ; 2 cyc ora #$10 ; 2 cyc
sta AUDC1 ; 4 cyc sta AUDC1 ; 4 cyc
.endmacro .endmacro