mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-02-09 03:31:05 +00:00
tiny_tracker: more optimization
This commit is contained in:
parent
920934fde4
commit
d2f2d97ff1
@ -17,6 +17,8 @@
|
|||||||
; 250 bytes -- song only has 16 notes so can never be negative
|
; 250 bytes -- song only has 16 notes so can never be negative
|
||||||
; 249 bytes -- make terminating value $80 instead of $FF
|
; 249 bytes -- make terminating value $80 instead of $FF
|
||||||
; 247 bytes -- combine note loop. makes song a bit faster
|
; 247 bytes -- combine note loop. makes song a bit faster
|
||||||
|
; 245 bytes -- try to optimize writing out volume
|
||||||
|
; 255 bytes -- add in some visualization
|
||||||
|
|
||||||
d2:
|
d2:
|
||||||
|
|
||||||
@ -33,7 +35,15 @@ tracker_song = peasant_song
|
|||||||
|
|
||||||
.include "tracker_init.s"
|
.include "tracker_init.s"
|
||||||
|
|
||||||
|
jsr SETGR
|
||||||
|
|
||||||
game_loop:
|
game_loop:
|
||||||
|
; typically A=0, X=FF, Y=0
|
||||||
|
|
||||||
|
; lda $70
|
||||||
|
;blah_smc:
|
||||||
|
; sta $400
|
||||||
|
; inc blah_smc+1
|
||||||
|
|
||||||
; start the music playing
|
; start the music playing
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ set_notes_loop:
|
|||||||
|
|
||||||
; this song only 16 notes so valid notes always positive
|
; this song only 16 notes so valid notes always positive
|
||||||
; cmp #$80
|
; cmp #$80
|
||||||
bpl all_ok
|
bpl not_end
|
||||||
|
|
||||||
;====================================
|
;====================================
|
||||||
; if at end, loop back to beginning
|
; if at end, loop back to beginning
|
||||||
@ -27,20 +27,24 @@ set_notes_loop:
|
|||||||
asl ; reset song offset to 0
|
asl ; reset song offset to 0
|
||||||
sta SONG_OFFSET
|
sta SONG_OFFSET
|
||||||
beq set_notes_loop
|
beq set_notes_loop
|
||||||
all_ok:
|
|
||||||
|
|
||||||
|
not_end:
|
||||||
note_only:
|
|
||||||
|
|
||||||
; NNNNNECC -- c=channel, e=end, n=note
|
; NNNNNECC -- c=channel, e=end, n=note
|
||||||
|
|
||||||
tay ; save note in Y
|
pha ; save note
|
||||||
|
|
||||||
and #3
|
and #3
|
||||||
|
tax
|
||||||
|
ldy #$0E
|
||||||
|
sty AY_REGS+8,X ; $08 set volume A,B,C
|
||||||
|
|
||||||
asl
|
asl
|
||||||
tax ; put channel offset in X
|
tax ; put channel offset in X
|
||||||
|
|
||||||
tya
|
|
||||||
|
pla ; restore note
|
||||||
|
tay
|
||||||
and #$4
|
and #$4
|
||||||
sta SONG_COUNTDOWN ; always 4 long?
|
sta SONG_COUNTDOWN ; always 4 long?
|
||||||
|
|
||||||
@ -50,12 +54,19 @@ note_only:
|
|||||||
lsr ; get note in A
|
lsr ; get note in A
|
||||||
|
|
||||||
tay ; lookup in table
|
tay ; lookup in table
|
||||||
lda frequencies_low,Y
|
|
||||||
|
|
||||||
sta AY_REGS,X ; set proper register value
|
|
||||||
|
|
||||||
lda frequencies_high,Y
|
lda frequencies_high,Y
|
||||||
sta AY_REGS+1,X
|
sta AY_REGS+1,X
|
||||||
|
; sta $500,X
|
||||||
|
|
||||||
|
lda frequencies_low,Y
|
||||||
|
sta AY_REGS,X ; set proper register value
|
||||||
|
|
||||||
|
; visualization
|
||||||
|
blah_urgh:
|
||||||
|
sta $400,Y
|
||||||
|
inc blah_urgh+1
|
||||||
|
|
||||||
|
|
||||||
;============================
|
;============================
|
||||||
; point to next
|
; point to next
|
||||||
|
@ -479,6 +479,16 @@ printf("\n");
|
|||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
|
/* put these first as we use the high bit to end things? */
|
||||||
|
printf("frequencies_low:\n");
|
||||||
|
printf(".byte ");
|
||||||
|
for(n=0;n<notes_allocated;n++) {
|
||||||
|
printf("$%02X",(frequencies[allocated_notes[n]])&0xff);
|
||||||
|
if (n!=(notes_allocated-1)) printf(",");
|
||||||
|
total_len++;
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
printf("frequencies_high:\n");
|
printf("frequencies_high:\n");
|
||||||
printf(".byte ");
|
printf(".byte ");
|
||||||
for(n=0;n<notes_allocated;n++) {
|
for(n=0;n<notes_allocated;n++) {
|
||||||
@ -489,14 +499,6 @@ printf("\n");
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
|
|
||||||
printf("frequencies_low:\n");
|
|
||||||
printf(".byte ");
|
|
||||||
for(n=0;n<notes_allocated;n++) {
|
|
||||||
printf("$%02X",(frequencies[allocated_notes[n]])&0xff);
|
|
||||||
if (n!=(notes_allocated-1)) printf(",");
|
|
||||||
total_len++;
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
|
|
||||||
printf("; total len=%d\n",total_len);
|
printf("; total len=%d\n",total_len);
|
||||||
|
|
||||||
|
@ -14,9 +14,9 @@ init_loop:
|
|||||||
|
|
||||||
lda #$38
|
lda #$38
|
||||||
sta AY_REGS+7 ; $07 mixer (ABC on)
|
sta AY_REGS+7 ; $07 mixer (ABC on)
|
||||||
lda #$0E
|
; lda #$0E
|
||||||
sta AY_REGS+8 ; $08 volume A
|
; sta AY_REGS+8 ; $08 volume A
|
||||||
lda #$0C
|
; lda #$0C
|
||||||
sta AY_REGS+9 ; $09 volume B
|
; sta AY_REGS+9 ; $09 volume B
|
||||||
sta AY_REGS+10 ; $0A volume C
|
; sta AY_REGS+10 ; $0A volume C
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user