d4: more accuracy

This commit is contained in:
Vince Weaver 2022-11-09 23:35:01 -05:00
parent 243abc4f10
commit 8ebbb46376
2 changed files with 22 additions and 8 deletions

View File

@ -78,14 +78,15 @@ not_end:
pla ; restore note
tay
pha
and #$6
; asl
asl
asl
lsr
tay
lda lengths,Y
sta SONG_COUNTDOWN ;
tya
pla
lsr
lsr
lsr ; get note in A
@ -119,6 +120,9 @@ done_update_song:
channel_a_volume:
.byte 14,14,14,14,11,11,10,10
lengths:
.byte 0*8,1*8,2*8,4*8
tracks_l:
.byte <track4,<track0,<track1,<track2,<track3
tracks_h:

View File

@ -219,7 +219,12 @@ static int write_note(int *a_last,int *b_last,int *c_last,int *total_len) {
temp_value=(*a_last<<3)|0;
/* if no note b, use the passed in length */
if ((*b_last<0) && (*c_last<0)) {
length=(*total_len<<1);
if (*total_len==4) {
length=3<<1;
}
else {
length=(*total_len<<1);
}
temp_value|=length;
}
printf("\t.byte $%02X ; A=%d L=%d\n",
@ -232,9 +237,14 @@ static int write_note(int *a_last,int *b_last,int *c_last,int *total_len) {
if (*b_last>=0) {
/* note is shifted left by 3, channel 1 */
temp_value=(*b_last<<3)|1;
length=(*total_len<<1);
if (*total_len==4) {
length=3<<1;
}
else {
length=(*total_len<<1);
}
temp_value|=length;
if (*c_last<0) {
if (*c_last>=0) {
// temp_value|=2;
fprintf(stderr,"Error, shouldn't have C\n");
}