diff --git a/chiptune_debug/Makefile b/chiptune_debug/Makefile index f4a51d18..44193a42 100644 --- a/chiptune_debug/Makefile +++ b/chiptune_debug/Makefile @@ -5,10 +5,11 @@ PNG2GR = ../gr-utils/png2gr all: chiptune_debug.dsk -chiptune_debug.dsk: CHIPTUNE_IRQ CHIPTUNE_NOIRQ ./sdemo.raw +chiptune_debug.dsk: CHIPTUNE_IRQ CHIPTUNE_NOIRQ CHIPTUNE_25HZ ./sdemo.raw cp chiptune_empty.dsk chiptune_debug.dsk $(DOS33) -y chiptune_debug.dsk BSAVE -a 0x0C00 CHIPTUNE_IRQ $(DOS33) -y chiptune_debug.dsk BSAVE -a 0x0C00 CHIPTUNE_NOIRQ + $(DOS33) -y chiptune_debug.dsk BSAVE -a 0x0C00 CHIPTUNE_25HZ CHIPTUNE_IRQ: chiptune_irq.o @@ -29,8 +30,17 @@ chiptune_noirq.o: chiptune_player.s \ zp.inc ca65 -D NOIRQ=1 -o chiptune_noirq.o chiptune_player.s -l chiptune_noirq.lst +CHIPTUNE_25HZ: chiptune_25Hz.o + ld65 -o CHIPTUNE_25HZ chiptune_25Hz.o -C ../linker_scripts/apple2_c00.inc + +chiptune_25Hz.o: chiptune_player.s \ + mockingboard_a.s \ + interrupt_handler.s \ + zp.inc + ca65 -D F25HZ=1 -o chiptune_25Hz.o chiptune_player.s -l chiptune_25Hz.lst + clean: rm -f *~ TITLE.GR *.o *.lst \ - CHIPTUNE_PLAYER CHIPTUNE_IRQ CHIPTUNE_NOIRQ + CHIPTUNE_PLAYER CHIPTUNE_IRQ CHIPTUNE_NOIRQ CHIPTUNE_25HZ diff --git a/chiptune_debug/chiptune_debug.dsk b/chiptune_debug/chiptune_debug.dsk new file mode 100644 index 00000000..b66e81c1 Binary files /dev/null and b/chiptune_debug/chiptune_debug.dsk differ diff --git a/chiptune_debug/chiptune_player.s b/chiptune_debug/chiptune_player.s index 61d6f90d..c826a773 100644 --- a/chiptune_debug/chiptune_player.s +++ b/chiptune_debug/chiptune_player.s @@ -52,14 +52,27 @@ sta $C40D ; IFR: 1100, enable interrupt on timer one oflow sta $C40E ; IER: 1100, enable timer one interrupt +.ifdef F25HZ + lda #$40 + sta $C404 ; write into low-order latch + lda #$9c + sta $C405 ; write into high-order latch, + ; load both values into counter + ; clear interrupt and start counting + + ; 9c40 / 1e6 = .040s, 25Hz + + +.else lda #$E7 sta $C404 ; write into low-order latch lda #$4f sta $C405 ; write into high-order latch, ; load both values into counter ; clear interrupt and start counting - ; 4fe7 / 1e6 = .020s, 50Hz +.endif + .endif ;================== diff --git a/linker_scripts/apple2_c00.inc b/linker_scripts/apple2_c00.inc index 72588b0d..9704d857 100644 --- a/linker_scripts/apple2_c00.inc +++ b/linker_scripts/apple2_c00.inc @@ -4,7 +4,7 @@ MEMORY { } SEGMENTS { -CODE: load = RAM, type = ro; +CODE: load = RAM, type = ro, align = $100; RODATA: load = RAM, type = ro; DATA: load = RAM, type = rw; BSS: load = RAM, type = bss, define = yes;