mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-05-31 21:41:32 +00:00
d4: fix playback
This commit is contained in:
parent
27516de7f9
commit
716650fa38
|
@ -8,6 +8,11 @@
|
|||
|
||||
|
||||
d4:
|
||||
;=================
|
||||
; init vars
|
||||
|
||||
lda #0
|
||||
sta FRAME
|
||||
|
||||
;===================
|
||||
; music Player Setup
|
||||
|
|
|
@ -1,17 +1,28 @@
|
|||
play_frame:
|
||||
|
||||
;============================
|
||||
; see if still counting down
|
||||
;===============================
|
||||
;===============================
|
||||
; things that happen every frame
|
||||
;===============================
|
||||
;===============================
|
||||
|
||||
lda SONG_COUNTDOWN
|
||||
;=================================
|
||||
; inc frame counter
|
||||
|
||||
inc FRAME
|
||||
|
||||
;=================================
|
||||
; rotate through channel A volume
|
||||
|
||||
tya
|
||||
lda FRAME
|
||||
and #$7
|
||||
tay
|
||||
lda channel_a_volume,Y
|
||||
sta AY_REGS+8
|
||||
|
||||
;============================
|
||||
; see if still counting down
|
||||
|
||||
lda SONG_COUNTDOWN
|
||||
bpl done_update_song
|
||||
|
||||
|
@ -39,14 +50,14 @@ set_notes_loop:
|
|||
not_end:
|
||||
|
||||
|
||||
; NNNNNNEC -- c=channel, e=end, n=note
|
||||
; NNNNNEEC -- c=channel, e=end, n=note
|
||||
|
||||
pha ; save note
|
||||
|
||||
and #1
|
||||
; tax
|
||||
; ldy #$0E
|
||||
; sty AY_REGS+8,X ; $08 set volume A,B
|
||||
tax
|
||||
ldy #$0E
|
||||
sty AY_REGS+8,X ; $08 set volume A,B
|
||||
|
||||
asl
|
||||
tax ; put channel offset in X
|
||||
|
@ -54,14 +65,15 @@ not_end:
|
|||
|
||||
pla ; restore note
|
||||
tay
|
||||
and #$2
|
||||
and #$6
|
||||
; asl
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
sta SONG_COUNTDOWN ; always 2 long?
|
||||
sta SONG_COUNTDOWN ;
|
||||
|
||||
tya
|
||||
lsr
|
||||
lsr
|
||||
lsr ; get note in A
|
||||
|
||||
tay ; lookup in table
|
||||
|
|
|
@ -210,30 +210,40 @@ static void print_help(int just_version, char *exec_name) {
|
|||
|
||||
static int write_note(int *a_last,int *b_last,int *c_last,int *total_len) {
|
||||
|
||||
// NNNNNNEC
|
||||
// NNNNNEEC
|
||||
|
||||
unsigned char temp_value;
|
||||
unsigned char length=0;
|
||||
|
||||
if (*a_last>=0) {
|
||||
temp_value=(*a_last<<2)|0;
|
||||
/* note is shifted left by 3, channel 0 */
|
||||
temp_value=(*a_last<<3)|0;
|
||||
/* if no note b, use the passed in length */
|
||||
if ((*b_last<0) && (*c_last<0)) {
|
||||
temp_value|=2;
|
||||
length=(*total_len<<1);
|
||||
temp_value|=length;
|
||||
}
|
||||
printf("\t.byte $%02X ; A=%d L=%d\n",
|
||||
temp_value,
|
||||
*a_last,(*b_last<0)||(*c_last<0));
|
||||
(*total_len)++;
|
||||
*a_last,length>>1);//(*b_last<0)||(*c_last<0));
|
||||
// (*total_len)++;
|
||||
*a_last=-1;
|
||||
}
|
||||
|
||||
if (*b_last>=0) {
|
||||
temp_value=(*b_last<<2)|1;
|
||||
if (*c_last<0) temp_value|=2;
|
||||
/* note is shifted left by 3, channel 1 */
|
||||
temp_value=(*b_last<<3)|1;
|
||||
length=(*total_len<<1);
|
||||
temp_value|=length;
|
||||
if (*c_last<0) {
|
||||
// temp_value|=2;
|
||||
fprintf(stderr,"Error, shouldn't have C\n");
|
||||
}
|
||||
|
||||
printf("\t.byte $%02X ; B=%d L=%d\n",
|
||||
temp_value,
|
||||
*b_last,(*c_last<0));
|
||||
(*total_len)++;
|
||||
*b_last,length>>1);
|
||||
// (*total_len)++;
|
||||
*b_last=-1;
|
||||
}
|
||||
|
||||
|
@ -416,12 +426,12 @@ printf("\n");
|
|||
}
|
||||
|
||||
if ((a.ed_freq>=0)||(b.ed_freq>=0)||(c.ed_freq>=0)) {
|
||||
printf("; none: a=%d c=%d len=%d\n",a_last,c_last,current_length);
|
||||
printf("; none: a=%d b=%d len=%d\n",a_last,b_last,current_length);
|
||||
|
||||
// now NNNNNNEC
|
||||
|
||||
if (!first) {
|
||||
write_note(&a_last,&b_last,&c_last,&total_len);
|
||||
write_note(&a_last,&b_last,&c_last,¤t_length);
|
||||
}
|
||||
current_length=0;
|
||||
|
||||
|
@ -455,12 +465,12 @@ printf("\n");
|
|||
|
||||
|
||||
printf("; last: a=%d c=%d len=%d\n",a_last,c_last,current_length);
|
||||
write_note(&a_last,&b_last,&c_last,&total_len);
|
||||
write_note(&a_last,&b_last,&c_last,¤t_length);
|
||||
|
||||
// printf("\t.byte $FF ; end\n");
|
||||
|
||||
/* assume 32 notes or fewer */
|
||||
printf("\t.byte $80 ; end\n");
|
||||
printf("\t.byte $FF ; end\n");
|
||||
total_len++;
|
||||
|
||||
int o,n;
|
||||
|
|
Loading…
Reference in New Issue
Block a user