it really looks too tight :(

This commit is contained in:
Brooke Vibber 2022-11-30 04:01:55 -08:00
parent 019422e6e5
commit 5406434c9d
2 changed files with 23 additions and 12 deletions

View file

@ -156,13 +156,15 @@ each_scanline:
pha
.endmacro
fake:
lda #18
pha
pha
.macro audio_play
ldy #0
lda (sample_ptr),y
sta AUDC1
.endmacro
.macro inner_scanline
ldy scanline
inc scanline
; Leisurely memory fetches
lda palette1,y
@ -181,21 +183,21 @@ each_scanline:
sty COLPF2
; Audio sample
pla
sta AUDC1
inc scanline
;pla
;lda temp1
;sta AUDC1
.endmacro
audio_play
inner_scanline
.macro audio_inc
;; toooo slllooowwww
; Increment sample ptr
jmp audio_cont
inc sample_ptrl
bne audio_cont
inc sample_ptrh
inc sample_ptrh
lda sample_ptrh
cmp #.hibyte(audio_samples_end)
bne audio_cont
@ -208,10 +210,12 @@ each_scanline:
sta sample_ptrl
lda #.hibyte(audio_samples)
sta sample_ptrh
.endmacro
audio_cont:
.endmacro
;audio_inc
inner_scanline
lda VCOUNT

View file

@ -15,7 +15,7 @@ function byte2byte(arr) {
}
function to4bit(val8) {
let val = val8 + 7 >> 4;
let val = (val8 + 7) >> 4;
if (val > 15) {
return 15;
}
@ -24,12 +24,19 @@ function to4bit(val8) {
function pack(audio) {
let packed = [];
/*
for (let i = 0; i < audio.length; i += 2) {
let low = to4bit(audio[i]);
let high = to4bit(audio[i + 1]);
let byte = low | (high << 4);
packed.push(byte);
}
*/
for (let i = 0; i < audio.length; i += 2) {
let val = to4bit(audio[i]);
let byte = val | 0x10;
packed.push(byte);
}
return packed;
}