megamusic: need to get music working

This commit is contained in:
Vince Weaver 2018-10-26 23:40:54 -04:00
parent d528ee0b56
commit c208d0f5a7
14 changed files with 1745 additions and 0 deletions

34
megamusic/Makefile Normal file
View File

@ -0,0 +1,34 @@
include ../Makefile.inc
DOS33 = ../dos33fs-utils/dos33
B2D = ../bmp2dhr/b2d
PNG_TO_40x96 = ../gr-utils/png_to_40x96
PNG_TO_RLE = ../gr-utils/png2rle
all: megamusic.dsk
megamusic.dsk: MEGAMUSIC MEGALOAD
$(DOS33) -y megamusic.dsk BSAVE -a 0x4000 MEGAMUSIC
$(DOS33) -y megamusic.dsk BSAVE -a 0x800 MEGALOAD
####
MEGAMUSIC: megamusic.o
ld65 -o MEGAMUSIC megamusic.o -C ../linker_scripts/apple2_4000.inc
megamusic.o: megamusic.s
ca65 -o megamusic.o megamusic.s -l megamusic.lst
####
MEGALOAD: megaload.o
ld65 -o MEGALOAD megaload.o -C ../linker_scripts/apple2_800.inc
megaload.o: megaload.s
ca65 -o megaload.o megaload.s -l megaload.lst
####
clean:
rm -f *~ *.o *.lst MEGAMUSIC MEGALOAD

177
megamusic/apple_40_96.inc Normal file
View File

@ -0,0 +1,177 @@
apple_low: .byte $28 ; ysize=48
.byte $A8,$FF, $5F, $5A, $55, $98, $55, $D8
.byte $55, $58, $55,$55, $58, $95, $85, $58
.byte $55, $95, $A3,$55, $85, $5A, $A0,$12,$FF, $BF
.byte $5F, $DD, $5B, $5F, $5D, $DF, $5D
.byte $5F,$5F, $8F, $5D, $5F, $5D, $5B, $5D
.byte $FF, $D5, $59, $95, $58, $55, $A0,$13,$FF
.byte $55, $08, $55, $05, $50, $A3,$55, $58
.byte $0A, $5D, $05, $0A,$0A, $58, $DF, $BD
.byte $DA, $5A, $59, $85, $5A, $A0,$12,$FF, $55
.byte $08, $50, $05, $55, $A4,$5A, $55,$55, $00
.byte $50, $05, $D5, $FA, $FF, $DA, $B5
.byte $88, $5A, $5D, $A0,$12,$FF, $55,$55, $50, $55
.byte $05, $65, $5A,$5A, $55,$55, $45, $55,$55, $05
.byte $D5, $FA, $DD, $BF, $D5, $98, $55,$55
.byte $DF, $A0,$11,$FF, $A3,$55, $50, $54, $55,$55, $05
.byte $65, $55, $45, $55, $50, $05, $D5
.byte $BD, $DF, $FD, $95, $58, $8B, $58
.byte $5F, $A0,$11,$FF, $55, $05, $54, $00, $56
.byte $A3,$55, $45, $05, $50, $55,$55, $00, $55
.byte $DD, $FF, $5D, $55, $89, $95, $58
.byte $5A, $A0,$11,$FF, $5D, $00, $55, $00, $A3,$55
.byte $00, $56, $00, $55, $54, $00, $55
.byte $85, $5D, $FA, $DD, $55, $88, $55
.byte $90, $5F, $A0,$11,$FF, $DD, $50, $05, $50
.byte $05, $40, $55, $05, $60, $05, $40
.byte $05, $50, $05, $55, $DD, $BA, $DF
.byte $55, $88, $55, $90, $5D, $5A,$5A, $5F
.byte $DA, $5F,$5F, $DF, $5F, $A9,$FF, $5D, $50
.byte $05, $50, $55, $00, $54, $05, $50
.byte $05, $45, $00, $55, $50, $55, $DD
.byte $5F, $FF, $55, $89, $55,$55, $F5, $5A
.byte $FA, $DD, $B5, $D9, $5A, $5D, $5A
.byte $A9,$FF, $5A, $55, $05, $55, $00, $05
.byte $40, $05, $50, $05, $50, $04, $50
.byte $05, $D5, $5D, $DF, $FD, $5B, $5D
.byte $5B, $5D, $5B, $5A, $DD, $BB, $5D
.byte $5A,$5A, $55,$55, $FA, $A8,$FF, $FA, $5A, $DA
.byte $5D, $85, $A4,$55, $D8, $55,$55, $58, $55
.byte $D5, $59, $DF, $FD, $55, $00, $55
.byte $00, $50, $05, $50, $00, $55, $5A,$5A
.byte $5B, $55, $DD, $A8,$FF, $5A, $DF, $BD
.byte $8F, $5D,$5D, $5B, $5D, $5B, $5D, $FB
.byte $D5, $F5, $D8, $F5,$F5, $FD, $5B, $55
.byte $50, $00, $05, $00, $55, $00,$00, $55,$55
.byte $5A, $DD, $55, $FA, $A7,$FF, $5A, $DD
.byte $BB, $DD, $BA, $DD, $5F, $9D, $5A,$5A
.byte $DD, $55, $D5, $55, $D8, $BB, $D5
.byte $5B, $5D, $55, $00, $52, $00, $55
.byte $00, $55, $52, $05, $55, $5A, $DD
.byte $55, $FA, $A5,$FF, $5F,$5F, $DF, $FA, $FF
.byte $FA, $FB, $FD, $DB, $F5, $50, $D5
.byte $59, $D5, $FD, $D9, $BF, $FA, $DB
.byte $BD, $DF, $A3,$55, $50, $06, $50, $55
.byte $59, $05, $55, $DA, $5D, $DA, $5F
.byte $A3,$FF, $5F, $FF, $DF, $5D, $05, $5A,$5A
.byte $8F, $5D, $5A, $5D, $5B, $5D, $DF
.byte $BF, $5D, $FF, $DF, $5D, $FB, $DF
.byte $FD, $55,$55, $00, $50, $05, $75, $05
.byte $55, $05, $55,$55, $DD, $BA, $DD, $5A
.byte $FF,$FF, $DF, $BF, $DA, $5D, $80, $55,$55
.byte $85, $58, $05, $10, $05, $55, $51
.byte $55, $00, $55, $05, $FD, $DF, $FD
.byte $DD, $5B, $58, $55, $00,$00, $50, $02
.byte $20, $05, $00, $55, $5A,$5A, $DF, $5A
.byte $5D, $FF,$FF, $FA, $5F, $FD, $D5, $F5
.byte $58, $5B, $55,$55, $15, $80, $58, $51
.byte $55, $58, $85, $B0, $5A, $FF, $FD
.byte $DF, $5D, $55, $58, $55, $50, $05
.byte $50, $05, $00, $50, $05, $50, $5F
.byte $DD, $5A, $F5, $FF,$FF, $5F,$5F, $A4,$FF, $FA
.byte $FD, $FA,$FA, $F5, $FD, $FB, $55, $D5
.byte $F5, $F8, $FB, $DD, $FF, $DD, $5A
.byte $59, $A3,$55, $00, $55, $00, $55, $00
.byte $55, $15, $00, $FD, $5A, $FA, $A4,$FF
.byte $F5,$F5, $A4,$5A, $5F, $BF, $A3,$5F, $A5,$FF, $FD
.byte $FF, $DF, $5D, $55, $DA, $55, $B8
.byte $FA,$FA, $F5,$F5, $F7, $55,$55, $50, $55,$55, $AC,$FF
.byte $FA,$FA, $A3,$F5, $B5, $A4,$5A, $A3,$5F, $FA, $DD
.byte $5A, $F5, $A0,$12,$FF, $CF, $AF,$FF, $FA, $F5
.byte $F0, $F5, $AF,$FF, $CF, $FF, $9F, $A3,$9C
.byte $FC, $FF,$FF, $C9, $CF, $C9, $FF, $C9
.byte $CF, $C9, $FF, $C9, $CF, $C9, $FF
.byte $C9, $A3,$FF, $C9, $CF, $A4,$FF, $C9, $FF
.byte $C9, $A3,$FF, $9F, $A3,$9C, $FC, $A5,$F2, $FF,$FF
.byte $F6, $FF, $F6, $FF, $F6, $A3,$FF, $F6
.byte $A3,$FF, $F6, $A3,$FF, $F6, $A5,$FF, $F6, $FF
.byte $F6, $A3,$FF, $A5,$F2
.byte $A1
apple_high: .byte $28 ; ysize=48
.byte $A8,$FF, $5F, $8F, $5F, $A5,$5A, $8F, $BA
.byte $8F, $5A, $A3,$5F, $8F, $5F, $8F, $5F
.byte $DF, $5F, $A0,$12,$FF, $DD, $5F, $5D, $5F
.byte $9D, $5A, $5D, $5B, $9D, $FA, $5D
.byte $FA,$FA, $D5, $FD, $D5, $55, $DD, $5A
.byte $55,$55, $85, $A0,$12,$FF, $5D, $55, $95, $0D
.byte $0A,$0A, $5A, $5D, $5A,$5A, $5B, $55, $05
.byte $5A, $59, $B5, $DF, $FF, $DF, $58
.byte $85, $58, $A0,$12,$FF, $5D, $55,$55, $50, $00
.byte $55, $7A, $A3,$5A, $A4,$55, $00, $55, $DF
.byte $DD, $5F, $D9, $55, $5A,$5A, $A0,$11,$FF, $DF
.byte $5D, $00, $45, $05, $55, $A3,$5A, $55,$55
.byte $05, $55, $05, $50, $55, $5D, $FF
.byte $DA, $59, $55, $88, $5A, $A0,$11,$FF, $5F
.byte $DD, $00, $50, $05, $55, $05, $65
.byte $55,$55, $05, $50, $55, $05, $50, $55
.byte $5F, $FD, $5A, $55, $85, $58, $55
.byte $A0,$11,$FF, $DF, $5D, $50, $00, $55, $00
.byte $45, $55, $05, $50, $55,$55, $00, $85
.byte $55,$55, $5F, $FD, $DA, $55,$55, $58, $55
.byte $A0,$12,$FF, $5A, $54, $40, $05, $40, $05
.byte $50, $A3,$55, $05, $50, $55, $05, $B5
.byte $DA, $FF, $FD, $15, $55, $88, $55
.byte $5F, $A0,$11,$FF, $FA, $05, $50, $06, $60
.byte $04, $55, $50, $05, $54, $55, $50
.byte $85, $05, $BA, $DA, $FF, $DD, $55
.byte $B5, $88, $55, $5F,$5F, $DF, $5F, $DF
.byte $5F, $DF, $5F,$5F, $A8,$FF, $FA, $F5, $05
.byte $40, $05, $50, $55, $05, $50, $45
.byte $00, $55, $00, $55, $05, $55, $BA
.byte $DD, $FF, $85, $58, $80, $B5, $DD
.byte $9A, $5D, $5B, $DA, $5F, $5A, $DA
.byte $5A, $A9,$FF, $5D, $85, $50, $00, $55
.byte $56, $50, $05, $40, $05, $50, $05
.byte $50, $00, $55, $BA, $DF, $5D, $D5
.byte $5A,$5A, $DD, $5A, $FD, $5A,$5A, $DD, $5B
.byte $9A, $DD, $55, $A9,$FF, $DD, $5A, $5D
.byte $A3,$55, $D5, $50, $55, $50, $55, $50,$50
.byte $85, $5A,$5A, $FF, $FD, $55, $50, $00
.byte $55, $00, $05, $55, $05, $5D, $5A
.byte $DA, $58, $55, $A8,$FF, $DF, $5D, $5B
.byte $5D, $5B, $5D, $5B, $FD, $D5, $F8
.byte $D5,$D5, $B8, $D5, $BB, $D8, $5B, $DD
.byte $DF, $55, $00,$00, $55, $20, $00, $55
.byte $00, $85, $5A, $59, $5A, $55, $A7,$FF
.byte $BF, $DD, $FB, $5D, $FA, $DF, $59
.byte $F5, $55, $D9, $55, $B5, $D5, $B5
.byte $5D, $5B, $8D, $5F, $5D, $5A, $A3,$55
.byte $05, $50, $00, $55, $00, $55, $D9
.byte $5A, $55,$55, $A6,$FF, $DF, $FD, $FB, $FD
.byte $DA, $FF, $DD, $5A, $B5, $D8, $A4,$55
.byte $FF, $5A, $DF, $DD, $5F, $DD, $5A
.byte $55,$55, $07, $50, $25, $50, $05, $BD
.byte $55, $5D, $5A,$5A, $55, $A5,$FF, $DF, $BD
.byte $FA, $5F, $8A, $1D, $5A, $5F,$5F, $FF
.byte $DF, $FF, $5F, $FF, $DA, $FB, $FD
.byte $FA, $FF, $FD, $FA, $55,$55, $A6,$05, $55,$55
.byte $5A, $5B, $5A,$5A, $A4,$FF, $FD, $FB, $5D
.byte $5B, $08, $15, $00, $55, $50, $89
.byte $50, $85, $08, $55, $85, $5D, $5B
.byte $DD, $BA, $FF, $5A,$5A, $55,$55, $50, $02
.byte $00, $55, $00, $55, $00, $55, $BA
.byte $DD, $5A,$5A, $5F, $FF, $BF, $DD, $FF
.byte $DA, $BB, $55, $8A, $50, $0B, $88
.byte $A4,$55, $00, $55,$55, $59, $D5, $BB, $DD
.byte $BB, $A4,$55, $A3,$00, $25, $50, $05, $50
.byte $00, $FA, $5F, $5A, $5F, $FA, $FF,$FF
.byte $FD, $FF,$FF, $FA, $FF, $F9, $F5, $D5
.byte $F5, $55,$55, $80, $58, $51, $F5, $55
.byte $DA, $BF, $FD, $FB, $5A, $55, $85
.byte $55,$55, $57, $70, $00, $27, $00, $55
.byte $90, $55, $FB, $5A, $55, $A4,$FF, $55,$55
.byte $5A,$5A, $A5,$5F, $FD, $A3,$FF, $FB, $FD, $FF,$FF
.byte $FB, $FD, $5B, $9A, $5D, $55,$55, $A3,$F5
.byte $55, $50,$50, $55, $5A, $55, $5A, $FA
.byte $A9,$FF, $FA, $A3,$F5, $FA, $5A, $55,$55, $A3,$5A
.byte $A3,$5F, $DF, $BA, $5A,$5A, $55, $A9,$FF, $FA
.byte $A0,$15,$FF, $FA,$FA, $F0, $F5,$F5, $A3,$FA, $A0,$10,$FF, $DF,$DF
.byte $DC, $DF, $A3,$FF, $DF, $F1, $DF, $FF
.byte $D1, $F1, $D1, $FF, $D1, $F1, $D1
.byte $FF, $D1, $A3,$FF, $D1, $F1,$F1, $FF,$FF, $F1
.byte $D1, $FF, $D1, $F1, $FF,$FF, $DF,$DF, $DC
.byte $DF, $FF, $F1, $A3,$61, $F1, $FF,$FF, $24
.byte $FF, $24, $FF, $24, $A3,$FF, $24, $A3,$FF
.byte $24, $2F,$2F, $FF, $24, $2F,$2F, $FF,$FF, $2F
.byte $24, $FF, $24, $2F, $FF,$FF, $F1, $A3,$61, $F1
.byte $A1

25
megamusic/delay_a.s Normal file
View File

@ -0,0 +1,25 @@
; From http://6502org.wikidot.com/software-delay
; 25+A cycles (including JSR), 19 bytes (excluding JSR)
;
; The branches must not cross page boundaries!
;
; Cycles Accumulator Carry flag
; 0 1 2 3 4 5 6 (hex) 0 1 2 3 4 5 6
; jsr delay_a ; 6 6 6 6 6 6 6 00 01 02 03 04 05 06
dly0: sbc #7
delay_a:cmp #7 ; 2 2 2 2 2 2 2 00 01 02 03 04 05 06 0 0 0 0 0 0 0
bcs dly0 ; 2 2 2 2 2 2 2 00 01 02 03 04 05 06 0 0 0 0 0 0 0
lsr ; 2 2 2 2 2 2 2 00 00 01 01 02 02 03 0 1 0 1 0 1 0
bcs dly1 ; 2 3 2 3 2 3 2 00 00 01 01 02 02 03 0 1 0 1 0 1 0
dly1: beq dly2 ; 3 3 2 2 2 2 2 00 00 01 01 02 02 03 0 1 0 1 0 1 0
lsr ; 2 2 2 2 2 00 00 01 01 01 1 1 0 0 1
beq dly3 ; 3 3 2 2 2 00 00 01 01 01 1 1 0 0 1
bcc dly3 ; 3 3 2 01 01 01 0 0 1
dly2: bne dly3 ; 2 2 3 00 00 01 0 1 0
dly3: rts ; 6 6 6 6 6 6 6 00 00 00 00 01 01 01 0 1 1 1 0 0 1
;
; Total cycles: 25 26 27 28 29 30 31

222
megamusic/falling_apple.s Normal file
View File

@ -0,0 +1,222 @@
; Display Falling Apple II and message
falling_apple:
;===================
; init screen
jsr TEXT
jsr HOME
bit KEYRESET
;===================
; init vars
lda #0
sta DRAW_PAGE
sta FRAME
sta FRAMEH
;=============================
; Load graphic page0
lda #$0c
sta BASH
lda #$00
sta BASL ; load image to $c00
lda #<apple_low
sta GBASL
lda #>apple_low
sta GBASH
jsr load_rle_gr
lda #4
sta DRAW_PAGE
jsr gr_copy_to_current ; copy to page1
; GR part
bit PAGE1
bit LORES ; 4
bit SET_GR ; 4
bit FULLGR ; 4
;=============================
; Load graphic page1
lda #$0c
sta BASH
lda #$00
sta BASL ; load image to $c00
lda #<apple_high
sta GBASL
lda #>apple_high
sta GBASH
jsr load_rle_gr
lda #0
sta DRAW_PAGE
jsr gr_copy_to_current
; GR part
bit PAGE0
;==============================
; setup graphics for vapor lock
;==============================
jsr vapor_lock ; 6
; vapor lock returns with us at beginning of hsync in line
; 114 (7410 cycles), so with 5070 lines to go
jsr gr_copy_to_current ; 6+ 9292
; now we have 322 left
; GR part
bit LORES ; 4
bit SET_GR ; 4
bit FULLGR ; 4
; 322 - 12 = 310
; - 3 for jmp
; 307
; Try X=9 Y=6 cycles=307
ldy #6 ; 2
faloopA:ldx #9 ; 2
faloopB:dex ; 2
bne faloopB ; 2nt/3
dey ; 2
bne faloopA ; 2nt/3
jmp fa_display_loop ; 3
.align $100
;================================================
; Display Loop
;================================================
; each scan line 65 cycles
; 1 cycle each byte (40cycles) + 25 for horizontal
; Total of 12480 cycles to draw screen
; Vertical blank = 4550 cycles (70 scan lines)
; Total of 17030 cycles to get back to where was
; in the end, scrolling in was deemed to complex
; what we do is load both to PAGE1/PAGE2 and then
; slowly shift from all PAGE1 to PAGE1/PAGE every two scanlines
fa_display_loop:
ldy #48 ; 2
outer_loop:
bit PAGE0 ; 4
ldx #25 ; 130 cycles with PAGE0 ; 2
page0_loop: ; delay 126+bit
dex ; 2
bne page0_loop ; 2/3
bit PAGE1 ; 4
ldx #23 ; 130 cycles with PAGE1 ; 2
page1_loop: ; delay 115+(7 loop)+4 (bit)+4(extra)
dex ; 2
bne page1_loop ; 2/3
nop ; 2
lda DRAW_PAGE ; 3
dey ; 2
bne outer_loop ; 2/3
;======================================================
; We have 4550 cycles in the vblank, use them wisely
;======================================================
; 4550 cycles
; -1 (+1-2) from above
; -25 inc framecount
; -7 see if timeout
; -10 keypress
;================
; 4507
; Try X=149 Y=6 cycles=4507
ldy #6 ; 2
faloop1:ldx #149 ; 2
faloop2:dex ; 2
bne faloop2 ; 2nt/3
dey ; 2
bne faloop1 ; 2nt/3
;========================
; Increment Frame at 20Hz
;========================
; noinc: 13+12=25
; inc: 13+12=25
inc FRAME ; 5
lda FRAME ; 3
cmp #4 ; 2
bne fa_noinc ; 3
; -1
lda #0 ; 2
sta FRAME ; 3
inc FRAMEH ; 5
jmp fa_doneinc ; 3
fa_noinc:
lda $0 ; 3
lda $0 ; 3
lda $0 ; 3
lda $0 ; 3
fa_doneinc:
;====================
; exit after 5s or so
;====================
; 7 cycles
lda FRAMEH ; 3
cmp #100 ; 2
beq fa_done ; 3
; -1
;=====================
; check for keypress
; 10 cycles
lda KEYPRESS ; 4
bpl fa_no_keypress ; 3
jmp fa_done
fa_no_keypress:
jmp fa_display_loop ; 3
fa_done:
bit KEYRESET ; clear keypress ; 4
rts ; 6
;.include "../asm_routines/gr_unrle.s"
;.include "gr_copy.s"
;.include "apple_40_96.inc"

58
megamusic/gr_copy.s Normal file
View File

@ -0,0 +1,58 @@
;=========================================================
; gr_copy_to_current, 40x48 version
;=========================================================
; copy 0xc00 to DRAW_PAGE
;
; 45 + 2 + 120*(8*9 + 5) -1 + 6 = 9292
.align $100
gr_copy_to_current:
lda DRAW_PAGE ; 3
clc ; 2
adc #$4 ; 2
sta gr_copy_line+5 ; 4
sta gr_copy_line+11 ; 4
adc #$1 ; 2
sta gr_copy_line+17 ; 4
sta gr_copy_line+23 ; 4
adc #$1 ; 2
sta gr_copy_line+29 ; 4
sta gr_copy_line+35 ; 4
adc #$1 ; 2
sta gr_copy_line+41 ; 4
sta gr_copy_line+47 ; 4
;===========
; 45
ldy #119 ; for early ones, copy 120 bytes ; 2
gr_copy_line:
lda $C00,Y ; load a byte (self modified) ; 4
sta $400,Y ; store a byte (self modified) ; 5
lda $C80,Y ; load a byte (self modified) ; 4
sta $480,Y ; store a byte (self modified) ; 5
lda $D00,Y ; load a byte (self modified) ; 4
sta $500,Y ; store a byte (self modified) ; 5
lda $D80,Y ; load a byte (self modified) ; 4
sta $580,Y ; store a byte (self modified) ; 5
lda $E00,Y ; load a byte (self modified) ; 4
sta $600,Y ; store a byte (self modified) ; 5
lda $E80,Y ; load a byte (self modified) ; 4
sta $680,Y ; store a byte (self modified) ; 5
lda $F00,Y ; load a byte (self modified) ; 4
sta $700,Y ; store a byte (self modified) ; 5
lda $F80,Y ; load a byte (self modified) ; 4
sta $780,Y ; store a byte (self modified) ; 5
dey ; decrement pointer ; 2
bpl gr_copy_line ; ; 2nt/3
rts ; 6

44
megamusic/gr_hline.s Normal file
View File

@ -0,0 +1,44 @@
;==================================
; HLINE
;==================================
; Color in A
; Y has which line
; takes 435 cycles
hline:
pha ; 3
ldx gr_offsets,y ; 4+
stx hline_loop+1 ; self-modify code ; 4
lda gr_offsets+1,y ; 4+
clc ; 2
adc DRAW_PAGE ; 3
sta hline_loop+2 ; self-modify code ; 4
pla ; 4
ldx #39 ; 2
;===========
; 30
hline_loop:
sta $5d0,X ; 38 ; 5
dex ; 2
bpl hline_loop ; 2nt/3
;===========
; 40*(10)=400
; -1
rts ; 6
;==========================
; Clear gr screen
;==========================
; Color in A, Clears 0 to and including Y
; clear_gr: takes 2+(48/2)*(6+435+7)+5 = 10759
; cpl: takes (Y/2)*(6+435+7)+5 = ?
clear_gr:
ldy #46 ; 2
clear_page_loop:
jsr hline ; 6+435
dey ; 2
dey ; 2
bpl clear_page_loop ; 2/3
rts ; 6

4
megamusic/gr_offsets.s Normal file
View File

@ -0,0 +1,4 @@
gr_offsets:
.word $400,$480,$500,$580,$600,$680,$700,$780
.word $428,$4a8,$528,$5a8,$628,$6a8,$728,$7a8
.word $450,$4d0,$550,$5d0,$650,$6d0,$750,$7d0

115
megamusic/gr_unrle.s Normal file
View File

@ -0,0 +1,115 @@
;=================
; load RLE image
;=================
; Output is BASH/BASL
; Input is in GBASH/GBASL
load_rle_gr:
lda #$0
tay ; init Y to 0
sta TEMP ; stores the xcoord
sta CV ; ycoord=0
jsr load_and_increment ; load xsize
sta CH
rle_loop:
jsr load_and_increment
cmp #$A1 ; if 0xa1
beq rle_done ; we are done
pha
and #$f0 ; mask
cmp #$a0 ; see if special AX
beq decompress_special
pla ; note, PLA sets flags!
ldx #$1 ; only want to print 1
bne decompress_run
decompress_special:
pla
and #$0f ; check if was A0
bne decompress_color ; if A0 need to read run, color
decompress_large:
jsr load_and_increment ; get run length
decompress_color:
tax ; put runlen into X
jsr load_and_increment ; get color
decompress_run:
rle_run_loop:
sta (BASL),y ; write out the value
inc BASL ; increment the pointer
bne rle_skip3 ; if wrapped
inc BASH ; then increment the high value
rle_skip3:
pha ; store colore for later
inc TEMP ; increment the X value
lda TEMP
cmp CH ; compare against the image width
bcc rle_not_eol ; if less then keep going
lda BASL ; cheat to avoid a 16-bit add
cmp #$a7 ; we are adding 0x58 to get
bcc rle_add_skip ; to the next line
inc BASH
rle_add_skip:
clc
adc #$58 ; actually do the 0x58 add
sta BASL ; and store it back
inc CV ; add 2 to ypos
inc CV ; each "line" is two high
lda CV ; load value
cmp #15 ; if it's greater than 14 it wraps
bcc rle_no_wrap ; Thanks Woz
lda #$0 ; we wrapped, so set to zero
sta CV
; when wrapping have to sub 0x3d8
sec ; this is a 16-bit subtract routine
lda BASL
sbc #$d8 ; LSB
sta BASL
lda BASH ; MSB
sbc #$3 ;
sta BASH
rle_no_wrap:
lda #$0 ; set X value back to zero
sta TEMP
rle_not_eol:
pla ; restore color
dex
bne rle_run_loop ; if not zero, keep looping
beq rle_loop ; and branch always
rle_done:
lda #$15 ; move the cursor somewhere sane
sta CV
rts
load_and_increment:
lda (GBASL),y ; load value ; 5?
inc GBASL ; 5?
bne lskip2 ; 2nt/3
inc GBASH ; 5?
lskip2:
rts ; 6

84
megamusic/hardware.inc Normal file
View File

@ -0,0 +1,84 @@
;; HARDWARE LOCATIONS
KEYPRESS = $C000
KEYRESET = $C010
;; SOFT SWITCHES
CLR80COL = $C000 ; PAGE0/PAGE1 normal
SET80COL = $C001 ; PAGE0/PAGE1 switches PAGE0 in Aux instead
EIGHTYCOLOFF = $C00C
EIGHTYCOLON = $C00D
SPEAKER = $C030
SET_GR = $C050
SET_TEXT = $C051
FULLGR = $C052
TEXTGR = $C053
PAGE0 = $C054
PAGE1 = $C055
LORES = $C056 ; Enable LORES graphics
HIRES = $C057 ; Enable HIRES graphics
AN3 = $C05E ; Annunciator 3
PADDLE_BUTTON0 = $C061
PADDL0 = $C064
PTRIG = $C070
;; BASIC ROUTINES
NORMAL = $F273
;; MONITOR ROUTINES
HLINE = $F819 ;; HLINE Y,$2C at A
VLINE = $F828 ;; VLINE A,$2D at Y
CLRSCR = $F832 ;; Clear low-res screen
CLRTOP = $F836 ;; clear only top of low-res screen
SETCOL = $F864 ;; COLOR=A
TEXT = $FB36
TABV = $FB5B ;; VTAB to A
BASCALC = $FBC1 ;;
VTAB = $FC22 ;; VTAB to CV
HOME = $FC58 ;; Clear the text screen
WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us
SETINV = $FE80 ;; INVERSE
SETNORM = $FE84 ;; NORMAL
COUT = $FDED ;; output A to screen
COUT1 = $FDF0 ;; output A to screen
COLOR_BLACK = 0
COLOR_RED = 1
COLOR_DARKBLUE = 2
COLOR_PURPLE = 3
COLOR_DARKGREEN = 4
COLOR_GREY = 5
COLOR_MEDIUMBLUE = 6
COLOR_LIGHTBLUE = 7
COLOR_BROWN = 8
COLOR_ORANGE = 9
COLOR_GREY2 = 10
COLOR_PINK = 11
COLOR_LIGHTGREEN = 12
COLOR_YELLOW = 13
COLOR_AQUA = 14
COLOR_WHITE = 15
COLOR_BOTH_BLACK = $00
COLOR_BOTH_RED = $11
COLOR_BOTH_DARKBLUE = $22
COLOR_BOTH_DARKGREEN = $44
COLOR_BOTH_GREY = $55
COLOR_BOTH_MEDIUMBLUE = $66
COLOR_BOTH_LIGHTBLUE = $77
COLOR_BOTH_BROWN = $88
COLOR_BOTH_ORANGE = $99
COLOR_BOTH_PINK = $BB
COLOR_BOTH_LIGHTGREEN = $CC
COLOR_BOTH_YELLOW = $DD
COLOR_BOTH_AQUA = $EE
COLOR_BOTH_WHITE = $FF

515
megamusic/megaload.s Normal file
View File

@ -0,0 +1,515 @@
; read any file slot 6 version
; based on FASTLD6 and RTS copyright (c) Peter Ferrie 2011-2013,2018
; TODO:
; non-slot6? self modfiy code?
adrlo = $26 ; constant from boot prom
adrhi = $27 ; constant from boot prom
tmpsec = $3c ; constant from boot prom
reqsec = $3d ; constant from boot prom
curtrk = $40
sizelo = $44
sizehi = $45
secsize = $46
TEMPY = $fa
namlo = $fb
namhi = $fc
step = $fd ; state for stepper motor
tmptrk = $fe ; temporary copy of current track
phase = $ff ; current phase for /seek
dirbuf = $1e00 ; note, don't put this immediately below
; the value being read as destaddr-4
; is temporarily overwritten during read
; process
; note also, can't load file bigger than $8000 (32k) in size?
; seems to break things?
start:
jsr init ; unhook DOS, init nibble table
; open and read a file
lda #<megademo_filename
sta namlo
lda #>megademo_filename
sta namhi
jsr opendir ; open and read entire file into memory
; open and read a file
; lda #<c64_filename
; sta namlo
; lda #>c64_filename
; sta namhi
; jsr opendir ; open and read entire file into memory
jmp $4000 ; jump to entry point
; filename to open is 30-character Apple text:
megademo_filename: ;.byte "MEGAMUSIC "
.byte 'M'|$80,'E'|$80,'G'|$80,'A'|$80,'M'|$80,'U'|$80,'S'|$80,'I'|$80
.byte 'C'|$80,$A0,$A0,$A0,$A0,$A0,$A0,$A0
.byte $A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0
.byte $A0,$A0,$A0,$A0,$A0,$A0
c64_filename: ;.byte "C64.IMG "
.byte 'C'|$80,'6'|$80,'4'|$80,'.'|$80,'I'|$80,'M'|$80,'G'|$80,$A0
.byte $A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0
.byte $A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0
.byte $A0,$A0,$A0,$A0,$A0,$A0
;unhook DOS and build nibble table
init:
jsr $fe93 ; clear COUT
jsr $fe89 ; clear KEYIN
;========================
; Create nibble table
; Note: the table starts 16 bytes in, and is sparse
; so it doesn't entirely look like the DOS33 table at
ldy #0
ldx #3
L1: stx $3c ; store tempx (3?)
txa ; a=x (a=3)
asl ; a*=2 (a=6)
bit $3c ; a&tempx, set N/V (a=6)
beq L3 ; if 0, skip to L3
ora $3c ; a|=tempx (a=7)
eor #$ff ; a=~a (a=f8)
and #$7e ; a&=0x7e 0111 1110 (a=78)
L2: bcs L3 ; this set way back at asl??
lsr ; a>>1 a=3c c=0
; a=1e c=0
; a=0f c=0
; a=07 c=1
bne L2 ; if a!=0 goto l2
tya ; if a==0, a=y
sta nibtbl, x ; write out to table
iny ; increment y
L3: inx ; increment x x=4, a=0f
bpl L1 ; loop while high bit not set
rts
;===========================
; opendir
;===========================
; turn on drive and read volume table of contents
opendir:
lda $c0e9 ; turn slot#6 drive on
ldx #0
stx adrlo ; zero out adrlo
stx secsize ; zero out secsize
lda #$11 ; a=$11 (VTOC)
jsr readdirsec
firstent:
lda dirbuf+1
; lock if entry not found
entry_not_found:
beq entry_not_found
; read directory sector
ldx dirbuf+2
jsr seekread1
ldy #7 ;number of directory entries in a sector
ldx #$2b ;offset of filename in directory entry
nextent:
tya
pha ; was **phy**
txa
pha ; was **phx**
ldy #$1d
; match name backwards (slower but smaller)
L4:
lda (namlo), y
cmp dirbuf, x
beq foundname
pla
; move to next directory in this block, if possible
clc
adc #$23
tax
pla
tay ; was **ply**
dey
bne nextent
beq firstent ; was **bra**
foundname:
dex
dey
bpl L4
pla
tay ; was **ply**
pla
; read track/sector list
lda dirbuf-32, y
ldx dirbuf-31, y
jsr seekread1
; read load offset and length info only, initially
lda #<filbuf
sta adrlo
lda #4
sta secsize
lda dirbuf+12
ldx dirbuf+13
ldy #>filbuf
jsr seekread
; reduce load offset by 4, to account for offset and length
sec
lda filbuf
sbc #4
sta adrlo
lda filbuf+1
sbc #0
sta adrhi
; save on stack bytes that will be overwritten by extra read
ldy #3
L5:
lda (adrlo), y
pha
dey
bpl L5
lda adrhi
pha
lda adrlo
pha
; increase load size by 4, to account for offst and length
lda filbuf+2
adc #3
sta sizelo
sta secsize
lda filbuf+3
adc #0
sta sizehi
beq readfirst
ldy #0 ; was **stz secsize**
sty secsize
readfirst:
ldy #$0c
; read a file sector
readnext:
lda dirbuf, y ; A = track
ldx dirbuf+1, y ; x = sector
sty TEMPY ; save t/s ptr ** was phy **
jsr seekread1
ldy TEMPY ; restore t/s ptr ** was ply **
; if low count is non-zero then we are done
; (can happen only for partial last block)
lda secsize
bne readdone
; continue if more than $100 bytes left
dec sizehi
bne L6
; set read size to min(length, $100)
lda sizelo
beq readdone
sta secsize
L6:
inc adrhi
iny
iny
bne readnext
; save current address for after t/s read
lda adrhi
pha
lda adrlo
pha
lda #0
sta adrlo ; was **stz adrlo**
; read next track/sector sector
lda dirbuf+1
ldx dirbuf+2
jsr readdirsec
clc
; restore current address
readdone:
pla
; sta adrhi
; pla
sta adrlo ; code originally had this backwards
pla
sta adrhi
bcc readfirst
lda $c0e8
; restore from stack bytes that were overwritten by extra read
ldx #3
ldy #0
L7:
pla
sta (adrlo), y
iny
dex
bpl L7
rts
;======================
; readdirsec
;======================
; a = track?
; x = sector?
readdirsec:
ldy #>dirbuf
seekread:
sty adrhi
seekread1:
sta phase
lda sectbl, x
sta reqsec
jsr readadr
; if track does not match, then seek
; lda curtrk ; BUG fixed recently
; cmp phase
cpx phase
beq repeat_until_right_sector
jsr seek
; [re-]read sector
re_read_addr:
jsr readadr
repeat_until_right_sector:
cmp reqsec
bne re_read_addr
;==========================
; read sector data
;==========================
;
readdata:
ldy $c0ec ; read data until valid
bpl readdata
find_D5:
cpy #$d5 ; if not D5, repeat
bne readdata
find_AA:
ldy $c0ec ; read data until valid, should be AA
bpl find_AA
cpy #$aa ; we need Y=#$AA later
bne find_D5
find_AD:
lda $c0ec ; read data until high bit set (valid)
bpl find_AD
eor #$ad ; should match $ad
bne * ; lock if didn't find $ad (failure)
L12:
ldx $c0ec ; read data until high bit set (valid)
bpl L12
eor nibtbl-$80, x
sta bit2tbl-$aa, y
iny
bne L12
L13:
ldx $c0ec ; read data until high bit set (valid)
bpl L13
eor nibtbl-$80, x
sta (adrlo), y ; the real address
iny
cpy secsize
bne L13
ldy #0
L14:
ldx #$a9
L15:
inx
beq L14
lda (adrlo), y
lsr bit2tbl-$aa, x
rol
lsr bit2tbl-$aa, x
rol
sta (adrlo), y
iny
cpy secsize
bne L15
rts
; no tricks here, just the regular stuff
;=================
; readadr -- read address field
;=================
; Find address field, put track in cutrk, sector in tmpsec
readadr:
lda $c0ec ; read data until we find a $D5
bpl readadr
adr_d5:
cmp #$d5
bne readadr
adr_aa:
lda $c0ec ; read data until we find a $AA
bpl adr_aa
cmp #$aa
bne adr_d5
adr_96:
lda $c0ec ; read data until we find a $96
bpl adr_96
cmp #$96
bne adr_d5
ldy #3 ; three?
; first read volume/volume
; then track/track
; then sector/sector?
adr_read_two_bytes:
sta curtrk ; store out current track
tax
L20:
lda $c0ec ; read until full value
bpl L20
rol
sta tmpsec
L21:
lda $c0ec ; read until full value
bpl L21 ; sector value is (v1<<1)&v2????
and tmpsec
dey ; loop 3 times
bne adr_read_two_bytes
seekret:
rts ; return
;================
; SEEK
;================
; current track in curtrk
; desired track in phase
seek:
asl curtrk ; multiply by 2
asl phase ; multiply by 2
lda #0
sta step
copy_cur:
lda curtrk ; load current track
sta tmptrk ; store as temptrk
sec ; calc current-desired
sbc phase
beq seekret ; if they match, we are done!
bcs seek_neg ; if negative, skip ahead
eor #$ff ; ones-complement the distance
inc curtrk ; increment current (make it 2s comp?)
bcc L114 ; skip ahead
seek_neg:
adc #$fe
dec curtrk
L114:
cmp step
bcc L115
lda step
L115:
cmp #8
bcs L116
tay
sec
L116:
lda curtrk
ldx step1, y
bne L118
L117:
clc
lda tmptrk
ldx step2, y
L118:
stx tmpsec
and #3
rol
tax
sta $c0e0, x
L119:
ldx #$13
L120:
dex
bne L120
dec tmpsec
bne L119
lsr
bcs L117
inc step
bne copy_cur
step1: .byte $01, $30, $28, $24, $20, $1e, $1d, $1c
step2: .byte $70, $2c, $26, $22, $1f, $1e, $1d, $1c
sectbl: .byte $00,$0d,$0b,$09,$07,$05,$03,$01,$0e,$0c,$0a,$08,$06,$04,$02,$0f
; From $BA96 of DOS33
nibtbl: .res 128 ; = *
; .byte $00,$01,$98,$99,$02,$03,$9C,$04 ; $BA96 ; 00
; .byte $05,$06,$A0,$A1,$A2,$A4,$A4,$A5 ; $BA9E ; 08
; .byte $07,$08,$A8,$A9,$AA,$09,$0A,$0B ; $BAA6 ; 10
; .byte $0C,$0D,$B0,$B1,$0E,$0F,$10,$11 ; $BAAE ; 18
; .byte $12,$13,$B8,$14,$15,$16,$17,$18 ; $BAB6 ; 20
; .byte $19,$1A,$C0,$C1,$C2,$C3,$C4,$C5 ; $BABE ; 28
; .byte $C6,$C7,$C8,$C9,$CA,$1B,$CC,$1C ; $BAC6 ; 30
; .byte $1D,$1E,$D0,$D1,$D2,$1E,$D4,$D5 ; $BACE ; 38
; .byte $20,$21,$D8,$22,$23,$24,$25,$26 ; $BAD6 ; 40
; .byte $27,$28,$E0,$E1,$E2,$E3,$E4,$29 ; $BADE ; 48
; .byte $2A,$2B,$E8,$2C,$2D,$2E,$2F,$30 ; $BAE6 ; 50
; .byte $31,$32,$F0,$F1,$33,$34,$35,$36 ; $BAEE ; 58
; .byte $37,$38,$F8,$39,$3A,$3B,$3C,$3D ; $BAF6 ; 60
; .byte $3E,$3F,$13,$00,$01,$02,$01,$00 ; $BAFE ; 68
; .byte $00,$00,$00,$00,$00,$00,$00,$00
; .byte $00,$00,$00,$00,$00,$00,$00,$00
bit2tbl: .res 86 ; = nibtbl+128
filbuf: .res 4 ; = bit2tbl+86
;dataend = filbuf+4

BIN
megamusic/megamusic.dsk Normal file

Binary file not shown.

85
megamusic/megamusic.s Normal file
View File

@ -0,0 +1,85 @@
; Apple II Megademo
; by deater (Vince Weaver) <vince@deater.net>
.include "zp.inc"
.include "hardware.inc"
megamusic_start: ; this should end up at $4000
;===================
; set graphics mode
;===================
jsr HOME
; apple
jsr falling_apple
;==================
; Game over
;==================
; we never get here
game_over_man:
jmp game_over_man
; .include "lz4_decode.s"
; .include "c64_opener.s"
.include "falling_apple.s"
.include "gr_unrle.s"
.include "gr_copy.s"
; .include "starring.s"
; .include "starring_people.s"
; .include "check_email.s"
.align $100
.include "gr_offsets.s"
.include "gr_hline.s"
.include "vapor_lock.s"
.include "delay_a.s"
; .include "wait_keypress.s"
; .include "random16.s"
.align $100
; .include "fireworks.s"
; .include "hgr.s"
; .include "bird_mountain.s"
; .include "move_letters.s"
.align $100
; .include "gr_putsprite.s"
; .include "mode7.s"
; .include "space_bars.s"
; .include "takeoff.s"
; .include "leaving.s"
; .include "arrival.s"
; .include "waterfall.s"
; .include "text_print.s"
.align $100
; .include "screen_split.s"
;============================
; Include Sprites
;============================
.align $100
; .include "tfv_sprites.inc"
; .include "mode7_sprites.inc"
;=================================
; Include Text for Sliding Letters
; *DONT CROSS PAGES*
;=================================
;.include "letters.s"
;============================
; Include Lores Graphics
; No Alignment Needed
;============================
; falling_apple
.include "apple_40_96.inc"

216
megamusic/vapor_lock.s Normal file
View File

@ -0,0 +1,216 @@
; This took a while to track down
; On Apple II/II+ the horiz blanking addr are $1000 higher than on IIe
; So on II+ were outside video area, so unlikely to be our set value
; (unless I foolishly use $ff which some uninitialized mem is set to)
; Lots of this color fiddling is to make sure you don't accidentally
; get runs of colors on IIe due to the horiz blank
; 0-5 aqua 6-12 = grey, 13 - 20 = yellow, 21-23 = aqua rainbow 14
;
;
;16 0 YA
;17 1 YA
;18 2 YA
;19 3 YA
;20 4 YA
;21 5 AA
;22 6 AG
;23 7 AG
;0 8 AG
;1 9 AG
;2 10 AG
;3 11 AG
;4 12 AG
;5 13 AY ****
;6 14 GY RAINBOW
;7 15 GY
;8 16 GY
;9 17 GY
;10 18 GY
;11 19 GY
;12 20 GY
;13 21 YA
;14 22 YA
;15 23 YA
;==============================
; setup graphics for vapor lock
;==============================
vapor_lock:
; Clear Page0
lda #$0
sta DRAW_PAGE
lda #$ee ; full screen white $ff
jsr clear_gr
lda #$dd
ldy #40
jsr clear_page_loop ; make top half grey2 $aa
lda #$aa
ldy #24
jsr clear_page_loop ; make top half grey2 $aa
lda #$ee
ldy #10
jsr clear_page_loop ; make top half grey2 $aa
; set up a rainbow to aid in exact lock
ldy #00
rainbow_loop:
tya
sta $728+20,Y
iny
cpy #20
bne rainbow_loop
;btt:
; jmp btt
;=====================================================
; attempt vapor lock
; by reading the "floating bus" we can see most recently
; written value of the display
;=====================================================
; See:
; Have an Apple Split by Bob Bishop
; Softalk, October 1982
; Challenges: each scan line scans 40 bytes.
; The blanking happens at the *beginning*
; So 65 bytes are scanned, starting at adress of the line - 25
; the scan takes 8 cycles, look for 4 repeats of the value
; to avoid false positive found if the horiz blanking is mirroring
; the line (max 3 repeats in that case)
vapor_lock_loop:
; first make sure we have a full line of $aa
lda #$aa ; 2
zxloop:
ldx #$04 ; 2
wiloop:
cmp $C051 ; read the floating bus ; 4
bne zxloop ; if not, start from scratch ; 2/3
dex ; we were, dec ; 2
bne wiloop ; if not 4 of them, restart ; 3/2
; if we get here we read 4 proper pixels, 11 apart (2+4+2+2+3)
; 0 11 22 33, clock at 34
; 1 12 23 34, clock at 35
; 2 13 24 35, clock at 36
; 3 14 25 36, clock at 37
; 4 15 26 37, clock at 38
; 5 16 27 38, clock at 39
; 6 17 28 39, clock at 40
; X X X X
; X X X X
; X X X X
; X X X X
; X X X X
; X X X X
; X X X X
; 0123456789012345678901234 0123456789012345678901234567890123456789
; 1 2 1 2 3
; hsync pixels
; XXXXXXXXXXXXXXXXXXXXXXXXX 4444444444444444444444444444440123456789
; now look for the color change that
; happens at line 13*8 = 104
lda #$dd ; 2
zloop:
ldx #$04 ; 2
qloop:
cmp $C051 ; read floating bus ; 4
bne zloop ; 2/3
dex ; 2
bne qloop ; 3/2
;============
; 11
; Found it!
; if we get here we read 4 proper pixels, 11 apart (2+4+2+2+3)
; 0 11 22 33, clock at 34
; 1 12 23 34, clock at 35
; 2 13 24 35, clock at 36
; 3 14 25 36, clock at 37
; 4 15 26 37, clock at 38
; 5 16 27 38, clock at 39
; 6 17 28 39, clock at 40
; In theory near end of line 104
; now skip ahead 8 lines and read from the rainbow pattern we set
; up to find our exact location
; delay 65 * 8 = 520
; we back off a few to make sure we're not in the horiz blank
; try to delay 510
lda #230 ; 2
jsr delay_a ; delay 25+230 = 255
lda #226 ; 2
jsr delay_a ; delay 25+226 = 251
; now near end of line 112
lda $C051 ; 4
;kbb:
; jmp kbb
; we are in theory on line $728 = 14*8 = 112
; so 112*65 = 7280 cycles from start
; we are actualy 25+20+A pixels in
; 7325+A
; Our goal is line 114 at 7410 cycles
; 7410 - 7325 = 85
; so kill 85-A cycles
; -6 to do subtraction
; -6 for rts
; -25 for delay_a overhead
eor #$ff ; 2
sec ; 2
adc #48 ; 2
jsr delay_a ; should total 48 cycles
done_vapor_lock:
rts ; 6
; Some random related work
; Docs:
; Lancaster
; Bishop
; Sather
; Vaguely relevant but no help with the Apple II+ issue
;
; Eamon: Screen display and timing synchronization
; on the Apple IIe and Apple IIgs
;
; Adams: Visually presented verbal stimuli by assembly
; language on the Apple II computer.
; Cavanagh and Anstis: Visual psychophysics on the
; Apple II: Getting started

166
megamusic/zp.inc Normal file
View File

@ -0,0 +1,166 @@
;; Zero Page
FRAMEBUFFER = $00 ; $00 - $0F
;; LZ4 addresses
LZ4_SRC = $00
LZ4_DST = $02
LZ4_END = $04
COUNT = $06
DELTA = $08
;; Zero page monitor routines addresses
WNDLFT = $20
WNDWDTH = $21
WNDTOP = $22
WNDBTM = $23
CH = $24
CV = $25
GBASL = $26
GBASH = $27
BASL = $28
BASH = $29
H2 = $2C
V2 = $2D
MASK = $2E
COLOR = $30
;INVFLG = $32
; dos33 zero page = 26-2f, 35-38, 3e 3f 40-4d
; overlap applesoft 67-6a,6f,70,af,b0,ca-cd,d8
; DOS33: Confirmed kills $68
RWTSL = $60
RWTSH = $61
DOSBUFL = $62
DOSBUFH = $63
FILEML = $64
FILEMH = $65
FRAME = $60
FRAMEH = $61
WAITING = $62
LETTERL = $63
LETTERH = $64
LETTERX = $65
LETTERY = $66
LETTERD = $67
LETTER = $68
BLARGH = $69
;FACTOR_I = $66
;FACTOR_F = $67
;DX_I = $68
;DX_F = $69
;SPACEX_I = $6A
;SPACEX_F = $6B
;CX_I = $6C
;CX_F = $6D
;DY_I = $6E
;DY_F = $6F
ZPOS = $78
REGISTER_DUMP = $70
A_FINE_TONE = $70
A_COARSE_TONE = $71
B_FINE_TONE = $72
B_COARSE_TONE = $73
C_FINE_TONE = $74
C_COARSE_TONE = $75
NOISE = $76
ENABLE = $77
A_VOLUME = $78
B_VOLUME = $79
C_VOLUME = $7A
ENVELOPE_FINE = $7B
ENVELOPE_COARSE = $7C
ENVELOPE_SHAPE = $7D
COPY_OFFSET = $7E
DECODER_STATE = $7F
REGISTER_DUMP2 = $80
A_FINE_TONE2 = $80
A_COARSE_TONE2 = $81
B_FINE_TONE2 = $82
B_COARSE_TONE2 = $83
C_FINE_TONE2 = $84
C_COARSE_TONE2 = $85
NOISE2 = $86
ENABLE2 = $87
A_VOLUME2 = $88
B_VOLUME2 = $89
C_VOLUME2 = $8A
ENVELOPE_FINE2 = $8B
ENVELOPE_COARS2 = $8C
ENVELOPE_SHAPE2 = $8D
LYRICSL = $8E
LYRICSH = $8F
FRAME_COUNT = $90
MB_VALUE = $91
MB_ADDRL = $91
MB_ADDRH = $92
DONE_PLAYING = $93
MB_CHUNK_OFFSET = $94
CHUNKSIZE = $95
LZ4_DONE = $96
DECODE_ERROR = $97
COPY_TIME = $98
DECOMPRESS_TIME = $99
TIME_TAKEN = $9A
LYRICS_ACTIVE = $9B
;FORTYCOL = $9C
CURSOR = $9D
; More zero-page addresses
; we try not to conflict with anything DOS, MONITOR or BASIC related
;COLOR1 = $E0
;COLOR2 = $E1
;MATCH = $E2
XX = $E3
YY = $E4
HGR_COLOR = $E4
;SHIPY = $E4
;YADD = $E5
;LOOP = $E6
;MEMPTRL = $E7
;MEMPTRH = $E8
;NAMEL = $E9
;NAMEH = $EA
;NAMEX = $EB
;CHAR = $EC
STATE = $ED
DISP_PAGE = $ED
DRAW_PAGE = $EE
OFFSET = $EF
;FIRST = $F0
LASTKEY = $F1
PADDLE_STATUS = $F2
SPRITETEMP = $F2
XPOS = $F3
YPOS = $F4
TEMP = $FA
TEMPY = $FB
INL = $FC
INH = $FD
OUTL = $FE
OUTH = $FF