tiny_tracker: a few more bytes

This commit is contained in:
Vince Weaver 2022-01-19 00:51:08 -05:00
parent fc1a5afa97
commit 0c62d901d2
7 changed files with 63 additions and 37 deletions

View File

@ -15,7 +15,7 @@ submit: hgr_d2_1k.zip
hgr_d2.dsk: HELLO D2
cp $(EMPTY_DISK)/empty.dsk ./hgr_d2.dsk
$(DOS33) -y hgr_d2.dsk SAVE A HELLO
$(DOS33) -y hgr_d2.dsk -t BIN -a 0x80 BSAVE D2
$(DOS33) -y hgr_d2.dsk -t BIN -a 0x60 BSAVE D2
####
@ -37,7 +37,7 @@ mA2E_2.s: mA2E_2.txt text_to_tiny
####
D2: d2.o
ld65 -o D2 d2.o -C ./apple2_80_zp.inc
ld65 -o D2 d2.o -C ./apple2_60_zp.inc
d2.o: d2.s \
zp.inc hardware.inc \

View File

@ -1,5 +1,5 @@
MEMORY {
ZP: start = $80, size = $120, type = rw;
ZP: start = $60, size = $120, type = rw;
RAM: start = $100, size = $8E00, file = %O;
}

View File

@ -5,11 +5,11 @@
;=====================
;=====================
;=====================
; write all 14 registers at AY_REGS
; write all 13 registers at AY_REGS
ay3_write_regs:
ldx #13
ldx #12
ay3_write_reg_loop:
lda #MOCK_AY_LATCH_ADDR ; latch_address for PB1 ; 2
@ -29,6 +29,3 @@ ay3_write_reg_loop:
dex
bpl ay3_write_reg_loop
; rts

View File

@ -32,9 +32,12 @@
; 241 bytes -- forgot we didn't need to init volume in play_frame anymore
; 238 bytes -- can use Y to save note value in play_frame now
; 237 bytes -- make song terminator #$FF so we don't have to load it
; 235 bytes -- note X is $FF on entry to mockingboard entry
.zeropage
;.globalzp rot_smc
.globalzp frequencies_low
.globalzp frequencies_high
d2:
; this is also the start of AY_REGS
@ -51,6 +54,8 @@ d2:
.byte $38,$e,$e,$e ; mixer, A, B, C volume
.include "notes.inc"
skip_const:
txs ; write 0 to stack pointer
@ -101,7 +106,7 @@ inner_wait:
.byte $00,$00,$00,$00
.byte $00,$00,$00,$00,$00
.byte $00,$00,$00
.byte $00
.byte $00,$00,$00
; music
.include "mA2E_2.s"

View File

@ -65,13 +65,29 @@ mockingboard_init:
; Initialize the 6522s
; Reset Left AY-3-8910
;===========================
; 15 bytes
ldx #$FF
stx MOCK_6522_DDRB1
stx MOCK_6522_DDRA1
; X is FF on entry?
inx ; #MOCK_AY_RESET $0
stx MOCK_6522_ORB1
ldx #MOCK_AY_INACTIVE ; $4
stx MOCK_6522_ORB1
; ldx #$FF ; 2
stx MOCK_6522_DDRB1 ; 3 $C402
stx MOCK_6522_DDRA1 ; 3 $C403
inx ; 1 #MOCK_AY_RESET $0
stx MOCK_6522_ORB1 ; 3 $C400
ldx #MOCK_AY_INACTIVE ; 2 $4
stx MOCK_6522_ORB1 ; 3 $C400
; lda #$FF ; 2
; ldy #$2 ; 2
; sta ($44),Y ; 2
; iny ; 1
; sta ($44),Y ; 2
; lda #0 ; 2
; ldy #$0 ; 2
; blah:
; sta $C400,Y ; 3
; lda #$4 ; 2
; sta (blah+1),Y ; 2

View File

@ -461,46 +461,55 @@ printf("\n");
printf("\t.byte $FF ; end\n");
total_len++;
FILE *fff;
int o,n;
fff=fopen("notes.inc","w");
if (fff==NULL) {
fprintf(stderr,"Oh no!\n");
exit(1);
}
for(o=0;o<4;o++) {
printf("; Octave %d : ",o);
fprintf(fff,"; Octave %d : ",o);
for(n=0;n<12;n++) {
printf("%d ",notes_used[(o*12)+n]);
fprintf(fff,"%d ",notes_used[(o*12)+n]);
}
printf("\n");
fprintf(fff,"\n");
}
printf("; %d notes allocated\n",notes_allocated);
fprintf(fff,"; %d notes allocated\n",notes_allocated);
printf(";.byte ");
fprintf(fff,";.byte ");
for(n=0;n<notes_allocated;n++) {
printf("%d,",allocated_notes[n]);
fprintf(fff,"%d,",allocated_notes[n]);
}
printf("\n");
fprintf(fff,"\n");
/* put these first as we use the high bit to end things? */
printf("frequencies_low:\n");
printf(".byte ");
fprintf(fff,"frequencies_low:\n");
fprintf(fff,".byte ");
for(n=0;n<notes_allocated;n++) {
printf("$%02X",(frequencies[allocated_notes[n]])&0xff);
if (n!=(notes_allocated-1)) printf(",");
fprintf(fff,"$%02X",(frequencies[allocated_notes[n]])&0xff);
if (n!=(notes_allocated-1)) fprintf(fff,",");
total_len++;
}
printf("\n");
fprintf(fff,"\n");
printf("frequencies_high:\n");
printf(".byte ");
fprintf(fff,"frequencies_high:\n");
fprintf(fff,".byte ");
for(n=0;n<notes_allocated;n++) {
printf("$%02X",(frequencies[allocated_notes[n]]>>8));
if (n!=(notes_allocated-1)) printf(",");
fprintf(fff,"$%02X",(frequencies[allocated_notes[n]]>>8));
if (n!=(notes_allocated-1)) fprintf(fff,",");
total_len++;
}
printf("\n");
fprintf(fff,"\n");
printf("; total len=%d\n",total_len);
fprintf(fff,"; total len=%d\n",total_len);
(void) irq;
(void) loop;

View File

@ -9,8 +9,7 @@ GBASH = $27
BASL = $28
BASH = $29
AY_REGS = $80
SAVE = $60
AY_REGS = $60
HGR_Y = $E2
HGR_COLOR = $E4