This commit is contained in:
Brooke Vibber 2022-11-30 03:36:25 -08:00
parent d44924aeb4
commit 7dfa1dfb26

View file

@ -131,54 +131,33 @@ wait_loop:
each_scanline: each_scanline:
; it'll fire on unused lines, but harmlessly ; it'll fire on unused lines, but harmlessly
.macro audio_prep jmp fake
; audio sample; low nybble ; audio sample; low nybble
;ldx #0 ldx #0
;lda (sample_ptr,x) lda (sample_ptr,x)
;sta temp2 sta temp2
; high nybble ; high nybble
;lsr a lsr a
;lsr a lsr a
;lsr a lsr a
;lsr a lsr a
; set the volume-only bit ; set the volume-only bit
;ora #$10 ora #$10
;pha pha
; low nybble ; low nybble
;lda temp2 lda temp2
;and #$0f and #$0f
; set the volume-only bit ; set the volume-only bit
;ora #$10 ora #$10
lda #0 lda #0
pha pha
fake:
lda #18
pha
pha pha
.endmacro
.macro audio_inc
; Increment sample ptr
clc
lda sample_ptrl
adc #1
sta sample_ptrl
lda sample_ptrh
adc #0
sta sample_ptrh
lda sample_ptrh
cmp #.hibyte(audio_samples_end)
bne audio_cont
lda sample_ptrl
cmp #.lobyte(audio_samples_end)
bne audio_cont
lda #.lobyte(audio_samples)
sta sample_ptrl
lda #.hibyte(audio_samples)
sta sample_ptrh
audio_cont:
.endmacro
.macro inner_scanline .macro inner_scanline
ldy scanline ldy scanline
@ -200,22 +179,44 @@ each_scanline:
sty COLPF2 sty COLPF2
; Audio sample ; Audio sample
;pla pla
;sta AUDC1 sta AUDC1
inc scanline
.endmacro .endmacro
;audio_prep
inner_scanline inner_scanline
inc scanline
;audio_inc ; too slow? ; Increment sample ptr
jmp audio_cont
inc sample_ptrl
bne audio_cont
inc sample_ptrh
lda sample_ptrh
cmp #.hibyte(audio_samples_end)
bne audio_cont
lda sample_ptrl
cmp #.lobyte(audio_samples_end)
bne audio_cont
lda #.lobyte(audio_samples)
sta sample_ptrl
lda #.hibyte(audio_samples)
sta sample_ptrh
audio_cont:
inner_scanline inner_scanline
inc scanline
lda VCOUNT lda VCOUNT
cmp #130 cmp #130 ;#130
bne each_scanline ;bne each_scanline
bne foo
jmp wait_start jmp wait_start
foo:
jmp each_scanline
.endproc .endproc