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

View file

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