This commit is contained in:
Brooke Vibber 2022-11-30 04:52:40 -08:00
parent b2994f093f
commit 3826fe8205

View file

@ -129,42 +129,10 @@ wait_loop:
sta scanline
each_scanline:
; it'll fire on unused lines, but harmlessly
.macro fake1
jmp fake
; audio sample; low nybble
ldx #0
lda (sample_ptr,x)
sta temp2
; high nybble
lsr a
lsr a
lsr a
lsr a
; set the volume-only bit
ora #$10
pha
; low nybble
lda temp2
and #$0f
; set the volume-only bit
ora #$10
lda #0
pha
.endmacro
.macro audio_play
ldy #0
lda (sample_ptr),y
sta AUDC1
.endmacro
.macro inner_scanline
ldy scanline
inc scanline
; it'll fire on unused lines, but harmlessly
ldy scanline ; 3 cyc
inc scanline ; 5 cyc
; Leisurely memory fetches
lda palette1,y
@ -183,16 +151,25 @@ each_scanline:
sty COLPF2
.endmacro
.macro audio_play
ldy VCOUNT ; 4 cycles
lda (sample_ptr),y ; 5/6 cyc
sta AUDC1 ; 4 cyc
.endmacro
inner_scanline
audio_play
.macro audio_inc
; Increment sample ptr
inc sample_ptrl
bne audio_cont
inc sample_ptrh
clc
lda sample_ptrl
adc #130
sta sample_ptrl
lda sample_ptrh
adc #0
sta sample_ptrh
cmp #.hibyte(audio_samples_end)
bne audio_cont
@ -210,15 +187,12 @@ each_scanline:
inner_scanline
audio_inc
lda VCOUNT
cmp #130 ;#130
bne each_scanline
;bne foo
audio_inc
jmp wait_start
;foo:
;jmp each_scanline
.endproc