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