demo: more missing files

This commit is contained in:
Vince Weaver 2022-11-12 14:32:56 -05:00
parent f8a3b7cba8
commit 19e5b1735e
9 changed files with 1053 additions and 0 deletions

View File

@ -0,0 +1,60 @@
include ../../Makefile.inc
DOS33 = ../../utils/dos33fs-utils/dos33
TOKENIZE = ../../utils/asoft_basic-utils/tokenize_asoft
EMPTYDISK = ../../empty_disk/empty.dsk
PICTUREDSK = ~/research/picturedsk.git/picturedsk
LINKER_SCRIPTS = ../../linker_scripts/
all: hgr_escape.dsk
###
hgr_escape.dsk: HELLO ESCAPE
cp $(EMPTYDISK) hgr_escape.dsk
$(DOS33) -y hgr_escape.dsk SAVE A HELLO
$(DOS33) -y hgr_escape.dsk BSAVE -a 0xc00 ESCAPE
###
HELLO: hello.bas
$(TOKENIZE) < hello.bas > HELLO
#submit: escape512.zip
#escape512.zip: ESCAPE escape.s file_id.diz escape_512.dsk
# mkdir -p lovebyte2021_escape_512
# cp ESCAPE ./lovebyte2021_escape_512
# cp *.s ./lovebyte2021_escape_512
# cp file_id.diz ./lovebyte2021_escape_512
# cp escape_512.dsk ./lovebyte2021_escape_512
# cp escape_512.woz ./lovebyte2021_escape_512
# cp escape_720p.mp4 ./lovebyte2021_escape_512
# cp desire2.png ./lovebyte2021_escape_512
# zip -r escape512.zip lovebyte2021_escape_512
####
ESCAPE: escape.o
ld65 -o ESCAPE escape.o -C $(LINKER_SCRIPTS)/apple2_c00.inc
escape.o: escape.s \
logo_intro.s \
ay3_write_regs.s escape.s interrupt_handler.s \
mA2E_4.s mockingboard_constants.s mockingboard_init.s tracker_init.s
ca65 -o escape.o escape.s -l escape.lst
####
make_points: make_points.o
$(CC) -o make_points make_points.o
make_points.o: make_points.c
$(CC) $(CFLAGS) -c make_points.c
####
clean:
rm -f *~ *.o *.lst ESCAPE *.zip make_points

View File

@ -0,0 +1,34 @@
;=====================
;=====================
;=====================
; ay3 write regs
;=====================
;=====================
;=====================
; write all 14 registers at AY_REGS
ay3_write_regs:
ldx #13
ay3_write_reg_loop:
lda #MOCK_AY_LATCH_ADDR ; latch_address for PB1 ; 2
ldy #MOCK_AY_INACTIVE ; go inactive ; 2
stx MOCK_6522_ORA1 ; put address on PA1 ; 4
sta MOCK_6522_ORB1 ; latch_address on PB1 ; 4
sty MOCK_6522_ORB1 ; 4
; value
lda AY_REGS,X
sta MOCK_6522_ORA1 ; put value on PA1 ; 4
lda #MOCK_AY_WRITE ; ; 2
sta MOCK_6522_ORB1 ; write on PB1 ; 4
sty MOCK_6522_ORB1 ; 4
dex
bpl ay3_write_reg_loop
; rts

View File

@ -0,0 +1,8 @@
5 HOME
10 PRINT " HGR ESCAPE -- A 1K BYTE APPLE II INTRO"
15 PRINT " BY DEATER / DSR"
20 PRINT CHR$(4)"CATALOG"
25 PRINT:PRINT "PRESS ANY KEY TO 'BRUN ESCAPE'"
30 GET A$
35 PRINT

View File

@ -0,0 +1,68 @@
;================================
;================================
; mockingboard interrupt handler
;================================
;================================
; On Apple II/6502 the interrupt handler jumps to address in 0xfffe
; This is in the ROM, which saves the registers
; on older IIe it saved A to $45 (which could mess with DISK II)
; newer IIe doesn't do that.
; It then calculates if it is a BRK or not (which trashes A)
; Then it sets up the stack like an interrupt and calls 0x3fe
; Note: the IIc is much more complicated
; its firmware tries to decode the proper source
; based on various things, including screen hole values
; we bypass that by switching out ROM and replacing the
; $fffe vector with this, but that does mean we have
; to be sure status flag and accumulator set properly
interrupt_handler:
php ; save status flags
cld ; clear decimal mode
pha ; save A ; 3
; A is saved in $45 by firmware
txa
pha ; save X
tya
pha ; save Y
inc $0404 ; debug (flashes char onscreen)
ay3_irq_handler:
bit MOCK_6522_T1CL ; clear 6522 interrupt by reading T1C-L ; 4
.include "play_frame.s"
.include "ay3_write_regs.s"
;=================================
; Finally done with this interrupt
;=================================
done_ay3_irq_handler:
pla
tay ; restore Y
pla
tax ; restore X
pla ; restore a ; 4
; on II+/IIe (but not IIc) we need to do this?
interrupt_smc:
lda $45 ; restore A
plp ; restore flags
rti ; return from interrupt ; 6
;============
; typical
; ???? cycles

View File

@ -0,0 +1,588 @@
peasant_song:
; register init
track0:
; A: 12
; B: 55
; none: a=-1 b=-1 len=0
; A: 12
; none: a=0 b=1 len=2
.byte $00 ; A=0 L=0
.byte $0D ; B=1 L=2
; A: 24
; B: 64
; none: a=0 b=-1 len=2
.byte $04 ; A=0 L=2
; A: 12
; none: a=2 b=3 len=2
.byte $10 ; A=2 L=0
.byte $1D ; B=3 L=2
; A: 10
; B: 62
; none: a=0 b=-1 len=2
.byte $04 ; A=0 L=2
; A: 12
; B: 60
; none: a=4 b=5 len=2
.byte $20 ; A=4 L=0
.byte $2D ; B=5 L=2
; A: 15
; none: a=0 b=6 len=2
.byte $00 ; A=0 L=0
.byte $35 ; B=6 L=2
; A: 17
; B: 58
; none: a=7 b=-1 len=2
.byte $3C ; A=7 L=2
; A: 10
; none: a=8 b=9 len=2
.byte $40 ; A=8 L=0
.byte $4D ; B=9 L=2
; A: 10
; none: a=4 b=-1 len=2
.byte $24 ; A=4 L=2
; A: 22
; none: a=4 b=-1 len=2
.byte $24 ; A=4 L=2
; A: 10
; B: 57
; none: a=10 b=-1 len=2
.byte $54 ; A=10 L=2
; A: 8
; B: 58
; none: a=4 b=11 len=2
.byte $20 ; A=4 L=0
.byte $5D ; B=11 L=2
; A: 7
; B: 57
; none: a=12 b=9 len=2
.byte $60 ; A=12 L=0
.byte $4D ; B=9 L=2
; A: 5
; B: 55
; none: a=13 b=11 len=2
.byte $68 ; A=13 L=0
.byte $5D ; B=11 L=2
; A: 3
; B: 53
; none: a=14 b=1 len=2
.byte $70 ; A=14 L=0
.byte $0D ; B=1 L=2
; A: 12
; B: 52
; none: a=15 b=16 len=2
.byte $78 ; A=15 L=0
.byte $85 ; B=16 L=2
; A: 12
; none: a=0 b=17 len=2
.byte $00 ; A=0 L=0
.byte $8D ; B=17 L=2
; A: 24
; none: a=0 b=-1 len=2
.byte $04 ; A=0 L=2
; A: 12
; B: 55
; none: a=2 b=-1 len=2
.byte $14 ; A=2 L=2
; A: 10
; none: a=0 b=1 len=2
.byte $00 ; A=0 L=0
.byte $0D ; B=1 L=2
; A: 12
; none: a=4 b=-1 len=2
.byte $24 ; A=4 L=2
; A: 15
; none: a=0 b=-1 len=2
.byte $04 ; A=0 L=2
; A: 17
; none: a=7 b=-1 len=2
.byte $3C ; A=7 L=2
; A: 17
; none: a=8 b=-1 len=2
.byte $44 ; A=8 L=2
; A: 17
; none: a=8 b=-1 len=2
.byte $44 ; A=8 L=2
; A: 29
; none: a=8 b=-1 len=2
.byte $44 ; A=8 L=2
; A: 29
; none: a=18 b=-1 len=2
.byte $94 ; A=18 L=2
; A: 27
; none: a=18 b=-1 len=2
.byte $94 ; A=18 L=2
; A: 26
; none: a=19 b=-1 len=2
.byte $9C ; A=19 L=2
; A: 24
; none: a=20 b=-1 len=2
.byte $A4 ; A=20 L=2
; A: 22
; none: a=2 b=-1 len=2
.byte $14 ; A=2 L=2
.byte $ff
track1:
; A: 12
; B: 55
; none: a=10 b=-1 len=2
.byte $54 ; A=10 L=2
; A: 12
; none: a=0 b=1 len=2
.byte $00 ; A=0 L=0
.byte $0D ; B=1 L=2
; A: 24
; B: 64
; none: a=0 b=-1 len=2
.byte $04 ; A=0 L=2
; A: 12
; none: a=2 b=3 len=2
.byte $10 ; A=2 L=0
.byte $1D ; B=3 L=2
; A: 10
; B: 62
; none: a=0 b=-1 len=2
.byte $04 ; A=0 L=2
; A: 12
; B: 64
; none: a=4 b=5 len=2
.byte $20 ; A=4 L=0
.byte $2D ; B=5 L=2
; A: 15
; none: a=0 b=3 len=2
.byte $00 ; A=0 L=0
.byte $1D ; B=3 L=2
; A: 17
; B: 65
; none: a=7 b=-1 len=2
.byte $3C ; A=7 L=2
; A: 10
; none: a=8 b=21 len=2
.byte $40 ; A=8 L=0
.byte $AD ; B=21 L=2
; A: 10
; none: a=4 b=-1 len=2
.byte $24 ; A=4 L=2
; A: 22
; none: a=4 b=-1 len=2
.byte $24 ; A=4 L=2
; A: 10
; B: 64
; none: a=10 b=-1 len=2
.byte $54 ; A=10 L=2
; A: 8
; B: 65
; none: a=4 b=3 len=2
.byte $20 ; A=4 L=0
.byte $1D ; B=3 L=2
; A: 7
; B: 64
; none: a=12 b=21 len=2
.byte $60 ; A=12 L=0
.byte $AD ; B=21 L=2
; A: 5
; B: 62
; none: a=13 b=3 len=2
.byte $68 ; A=13 L=0
.byte $1D ; B=3 L=2
; A: 3
; B: 60
; none: a=14 b=5 len=2
.byte $70 ; A=14 L=0
.byte $2D ; B=5 L=2
; A: 12
; B: 52
; none: a=15 b=6 len=2
.byte $78 ; A=15 L=0
.byte $35 ; B=6 L=2
; A: 12
; none: a=0 b=17 len=2
.byte $00 ; A=0 L=0
.byte $8D ; B=17 L=2
; A: 24
; none: a=0 b=-1 len=2
.byte $04 ; A=0 L=2
; A: 12
; none: a=2 b=-1 len=2
.byte $14 ; A=2 L=2
; A: 10
; none: a=0 b=-1 len=2
.byte $04 ; A=0 L=2
; A: 12
; none: a=4 b=-1 len=2
.byte $24 ; A=4 L=2
; A: 15
; none: a=0 b=-1 len=2
.byte $04 ; A=0 L=2
; A: 17
; none: a=7 b=-1 len=2
.byte $3C ; A=7 L=2
; A: 17
; none: a=8 b=-1 len=2
.byte $44 ; A=8 L=2
; A: 17
; none: a=8 b=-1 len=2
.byte $44 ; A=8 L=2
; A: 29
; none: a=8 b=-1 len=2
.byte $44 ; A=8 L=2
; A: 29
; none: a=18 b=-1 len=2
.byte $94 ; A=18 L=2
; A: 27
; none: a=18 b=-1 len=2
.byte $94 ; A=18 L=2
; A: 26
; none: a=19 b=-1 len=2
.byte $9C ; A=19 L=2
; A: 24
; none: a=20 b=-1 len=2
.byte $A4 ; A=20 L=2
; A: 22
; none: a=2 b=-1 len=2
.byte $14 ; A=2 L=2
.byte $ff
track2:
; A: 15
; B: 63
; none: a=10 b=-1 len=2
.byte $54 ; A=10 L=2
; A: 15
; none: a=7 b=22 len=2
.byte $38 ; A=7 L=0
.byte $B5 ; B=22 L=2
; A: 27
; none: a=7 b=-1 len=2
.byte $3C ; A=7 L=2
; A: 15
; none: a=19 b=-1 len=2
.byte $9C ; A=19 L=2
; A: 17
; B: 62
; none: a=7 b=-1 len=2
.byte $3C ; A=7 L=2
; A: 17
; B: 60
; none: a=8 b=5 len=2
.byte $40 ; A=8 L=0
.byte $2D ; B=5 L=2
; A: 29
; B: 58
; none: a=8 b=6 len=2
.byte $40 ; A=8 L=0
.byte $35 ; B=6 L=2
; A: 17
; B: 53
; none: a=18 b=9 len=2
.byte $90 ; A=18 L=0
.byte $4D ; B=9 L=2
; A: 12
; B: 55
; none: a=8 b=16 len=2
.byte $40 ; A=8 L=0
.byte $85 ; B=16 L=2
; A: 12
; none: a=0 b=1 len=2
.byte $00 ; A=0 L=0
.byte $0D ; B=1 L=2
; A: 24
; none: a=0 b=-1 len=2
.byte $04 ; A=0 L=2
; A: 12
; none: a=2 b=-1 len=2
.byte $14 ; A=2 L=2
; A: 12
; none: a=0 b=-1 len=2
.byte $04 ; A=0 L=2
; A: 12
; none: a=0 b=-1 len=2
.byte $04 ; A=0 L=2
; A: 24
; none: a=0 b=-1 len=2
.byte $04 ; A=0 L=2
; A: 12
; none: a=2 b=-1 len=2
.byte $14 ; A=2 L=2
; A: 15
; B: 51
; none: a=0 b=-1 len=2
.byte $04 ; A=0 L=2
; A: 15
; none: a=7 b=23 len=2
.byte $38 ; A=7 L=0
.byte $BD ; B=23 L=2
; A: 27
; none: a=7 b=-1 len=2
.byte $3C ; A=7 L=2
; A: 15
; none: a=19 b=-1 len=2
.byte $9C ; A=19 L=2
; A: 17
; B: 55
; none: a=7 b=-1 len=2
.byte $3C ; A=7 L=2
; A: 17
; B: 53
; none: a=8 b=1 len=2
.byte $40 ; A=8 L=0
.byte $0D ; B=1 L=2
; A: 29
; B: 51
; none: a=8 b=16 len=2
.byte $40 ; A=8 L=0
.byte $85 ; B=16 L=2
; B: 50
; none: a=18 b=23 len=1
.byte $90 ; A=18 L=0
.byte $BB ; B=23 L=1
; A: 17
; B: 48
; none: a=-1 b=24 len=1
.byte $C3 ; B=24 L=1
; B: 46
; none: a=8 b=25 len=1
.byte $40 ; A=8 L=0
.byte $CB ; B=25 L=1
; A: 12
; B: 48
; none: a=-1 b=26 len=1
.byte $D3 ; B=26 L=1
; A: 10
; none: a=0 b=25 len=4
.byte $00 ; A=0 L=0
.byte $CF ; B=25 L=3
; A: 12
; none: a=4 b=-1 len=4
.byte $26 ; A=4 L=3
.byte $ff
track3:
; A: 15
; B: 39
; none: a=0 b=-1 len=8
.byte $10 ; A=0 L=8
; A: 15
; none: a=7 b=27 len=2
.byte $38 ; A=7 L=0
.byte $DD ; B=27 L=2
; A: 27
; none: a=7 b=-1 len=2
.byte $3C ; A=7 L=2
; A: 15
; none: a=19 b=-1 len=2
.byte $9C ; A=19 L=2
; A: 17
; B: 41
; none: a=7 b=-1 len=2
.byte $3C ; A=7 L=2
; A: 17
; B: 43
; none: a=8 b=28 len=2
.byte $40 ; A=8 L=0
.byte $E5 ; B=28 L=2
; A: 29
; B: 46
; none: a=8 b=29 len=2
.byte $40 ; A=8 L=0
.byte $ED ; B=29 L=2
; A: 17
; B: 48
; none: a=18 b=26 len=2
.byte $90 ; A=18 L=0
.byte $D5 ; B=26 L=2
; A: 12
; B: 43
; none: a=8 b=25 len=2
.byte $40 ; A=8 L=0
.byte $CD ; B=25 L=2
; A: 12
; none: a=0 b=29 len=2
.byte $00 ; A=0 L=0
.byte $ED ; B=29 L=2
; A: 24
; none: a=0 b=-1 len=2
.byte $04 ; A=0 L=2
; A: 12
; none: a=2 b=-1 len=2
.byte $14 ; A=2 L=2
; A: 12
; none: a=0 b=-1 len=2
.byte $04 ; A=0 L=2
; A: 12
; none: a=0 b=-1 len=2
.byte $04 ; A=0 L=2
; A: 24
; none: a=0 b=-1 len=2
.byte $04 ; A=0 L=2
; A: 12
; none: a=2 b=-1 len=2
.byte $14 ; A=2 L=2
; A: 15
; B: 51
; none: a=0 b=-1 len=2
.byte $04 ; A=0 L=2
; A: 15
; none: a=7 b=23 len=2
.byte $38 ; A=7 L=0
.byte $BD ; B=23 L=2
; A: 27
; none: a=7 b=-1 len=2
.byte $3C ; A=7 L=2
; A: 15
; none: a=19 b=-1 len=2
.byte $9C ; A=19 L=2
; A: 17
; B: 48
; none: a=7 b=-1 len=2
.byte $3C ; A=7 L=2
; A: 17
; B: 51
; none: a=8 b=25 len=2
.byte $40 ; A=8 L=0
.byte $CD ; B=25 L=2
; A: 29
; B: 53
; none: a=8 b=23 len=2
.byte $40 ; A=8 L=0
.byte $BD ; B=23 L=2
; A: 17
; B: 58
; none: a=18 b=16 len=2
.byte $90 ; A=18 L=0
.byte $85 ; B=16 L=2
; A: 12
; B: 55
; none: a=8 b=9 len=2
.byte $40 ; A=8 L=0
.byte $4D ; B=9 L=2
; A: 12
; none: a=0 b=1 len=2
.byte $00 ; A=0 L=0
.byte $0D ; B=1 L=2
; A: 24
; none: a=0 b=-1 len=2
.byte $04 ; A=0 L=2
; A: 12
; none: a=2 b=-1 len=2
.byte $14 ; A=2 L=2
; A: 12
; none: a=0 b=-1 len=2
.byte $04 ; A=0 L=2
; A: 12
; none: a=0 b=-1 len=2
.byte $04 ; A=0 L=2
; A: 24
; none: a=0 b=-1 len=2
.byte $04 ; A=0 L=2
; A: 12
; none: a=2 b=-1 len=2
.byte $14 ; A=2 L=2
.byte $ff
track4:
; A: 12
; none: a=0 b=-1 len=2
.byte $04 ; A=0 L=2
; A: 12
; none: a=0 b=-1 len=2
.byte $04 ; A=0 L=2
; A: 24
; none: a=0 b=-1 len=2
.byte $04 ; A=0 L=2
; A: 12
; none: a=2 b=-1 len=2
.byte $14 ; A=2 L=2
; A: 10
; none: a=0 b=-1 len=2
.byte $04 ; A=0 L=2
; A: 12
; none: a=4 b=-1 len=2
.byte $24 ; A=4 L=2
; A: 15
; none: a=0 b=-1 len=2
.byte $04 ; A=0 L=2
; A: 17
; none: a=7 b=-1 len=2
.byte $3C ; A=7 L=2
; A: 10
; none: a=8 b=-1 len=2
.byte $44 ; A=8 L=2
; A: 10
; none: a=4 b=-1 len=2
.byte $24 ; A=4 L=2
; A: 22
; none: a=4 b=-1 len=2
.byte $24 ; A=4 L=2
; A: 10
; none: a=10 b=-1 len=2
.byte $54 ; A=10 L=2
; A: 8
; none: a=4 b=-1 len=2
.byte $24 ; A=4 L=2
; A: 7
; none: a=12 b=-1 len=2
.byte $64 ; A=12 L=2
; A: 5
; none: a=13 b=-1 len=2
.byte $6C ; A=13 L=2
; A: 3
; none: a=14 b=-1 len=2
.byte $74 ; A=14 L=2
; A: 12
; none: a=15 b=-1 len=2
.byte $7C ; A=15 L=2
; A: 12
; none: a=0 b=-1 len=2
.byte $04 ; A=0 L=2
; A: 24
; none: a=0 b=-1 len=2
.byte $04 ; A=0 L=2
; A: 12
; none: a=2 b=-1 len=2
.byte $14 ; A=2 L=2
; A: 10
; none: a=0 b=-1 len=2
.byte $04 ; A=0 L=2
; A: 12
; none: a=4 b=-1 len=2
.byte $24 ; A=4 L=2
; A: 15
; none: a=0 b=-1 len=2
.byte $04 ; A=0 L=2
; A: 17
; none: a=7 b=-1 len=2
.byte $3C ; A=7 L=2
; A: 17
; none: a=8 b=-1 len=2
.byte $44 ; A=8 L=2
; A: 15
; none: a=8 b=-1 len=4
.byte $46 ; A=8 L=3
; A: 12
; none: a=7 b=-1 len=4
.byte $3E ; A=7 L=3
; B: 51
; none: a=0 b=-1 len=4
.byte $06 ; A=0 L=3
; B: 53
; none: a=-1 b=23 len=2
.byte $BD ; B=23 L=2
; last: a=-1 c=-1 len=2
.byte $85 ; B=16 L=2
.byte $FF ; end
; Octave 0 : 0 0 0 3 0 3 0 3 3 0 16 0
; Octave 1 : 45 0 0 19 0 23 0 0 0 0 5 0
; Octave 2 : 14 0 2 6 0 8 0 0 0 0 0 0
; Octave 3 : 0 0 0 1 0 1 0 2 0 0 2 0
; Octave 4 : 4 0 1 5 2 5 0 7 0 2 4 0
; Octave 5 : 3 0 4 1 5 2 0 0 0 0 0 0
; 30 notes allocated
;.byte 12,55,24,64,10,62,60,15,17,58,22,57,8,7,5,3,53,52,29,27,26,65,63,51,50,48,46,39,41,43,
frequencies_low:
.byte $D1,$51,$E8,$30,$49,$36,$3D,$36,$DC,$44,$24,$48,$CF,$18,$B8,$6C,$5B,$60,$6E,$9B,$B3,$2D,$33,$66,$6C,$7A,$89,$CD,$B7,$A3
frequencies_high:
.byte $03,$00,$01,$00,$04,$00,$00,$03,$02,$00,$02,$00,$04,$05,$05,$06,$00,$00,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00
; total len=61

View File

@ -0,0 +1,21 @@
init_addresses:
.byte <MOCK_6522_DDRB1,<MOCK_6522_DDRA1 ; set the data direction for all pins of PortA/PortB to be output
.byte <MOCK_6522_ACR,<MOCK_6522_IER ; Continuous interrupts, clear all interrupts
.byte <MOCK_6522_IFR,<MOCK_6522_IER ; enable interrupt on timer overflow
.byte <MOCK_6522_T1CL,<MOCK_6522_T1CH ; set oflow value, start counting
.byte <MOCK_6522_ORB1,<MOCK_6522_ORB1 ; reset ay-3-8910
; note, terminated by the $ff below
init_values:
.byte $ff,$ff ; set the data direction for all pins of PortA/PortB to be output
.byte $40,$7f
.byte $C0,$C0
.byte $e7,$4f ; c7ce / 1.023e6 = .050s, 20Hz
.byte MOCK_AY_RESET,MOCK_AY_INACTIVE
; c7ce / 1.023e6 = .050s, 20Hz
; 9c40 / 1.023e6 = .040s, 25Hz
; 4fe7 / 1.023e6 = .020s, 50Hz
; 411a / 1.023e6 = .016s, 60Hz

View File

@ -0,0 +1,119 @@
; Mockingboad programming:
; + Has two 6522 I/O chips connected to two AY-3-8910 chips
; + Optionally has some speech chips controlled via the outport on the AY
; + Often in slot 4
; TODO: how to auto-detect?
; References used:
; http://macgui.com/usenet/?group=2&id=8366
; 6522 Data Sheet
; AY-3-8910 Data Sheet
;========================
; Mockingboard card
; Essentially two 6522s hooked to the Apple II bus
; Connected to AY-3-8910 chips
; PA0-PA7 on 6522 connected to DA0-DA7 on AY
; PB0 on 6522 connected to BC1
; PB1 on 6522 connected to BDIR
; PB2 on 6522 connected to RESET
; left speaker
MOCK_6522_ORB1 = $C400 ; 6522 #1 port b data
MOCK_6522_ORA1 = $C401 ; 6522 #1 port a data
MOCK_6522_DDRB1 = $C402 ; 6522 #1 data direction port B
MOCK_6522_DDRA1 = $C403 ; 6522 #1 data direction port A
MOCK_6522_T1CL = $C404 ; 6522 #1 t1 low order latches
MOCK_6522_T1CH = $C405 ; 6522 #1 t1 high order counter
MOCK_6522_T1LL = $C406 ; 6522 #1 t1 low order latches
MOCK_6522_T1LH = $C407 ; 6522 #1 t1 high order latches
MOCK_6522_T2CL = $C408 ; 6522 #1 t2 low order latches
MOCK_6522_T2CH = $C409 ; 6522 #1 t2 high order counters
MOCK_6522_SR = $C40A ; 6522 #1 shift register
MOCK_6522_ACR = $C40B ; 6522 #1 auxilliary control register
MOCK_6522_PCR = $C40C ; 6522 #1 peripheral control register
MOCK_6522_IFR = $C40D ; 6522 #1 interrupt flag register
MOCK_6522_IER = $C40E ; 6522 #1 interrupt enable register
MOCK_6522_ORANH = $C40F ; 6522 #1 port a data no handshake
; right speaker
MOCK_6522_ORB2 = $C480 ; 6522 #2 port b data
MOCK_6522_ORA2 = $C481 ; 6522 #2 port a data
MOCK_6522_DDRB2 = $C482 ; 6522 #2 data direction port B
MOCK_6522_DDRA2 = $C483 ; 6522 #2 data direction port A
; AY-3-8910 commands on port B
; RESET BDIR BC1
MOCK_AY_RESET = $0 ; 0 0 0
MOCK_AY_INACTIVE = $4 ; 1 0 0
MOCK_AY_READ = $5 ; 1 0 1
MOCK_AY_WRITE = $6 ; 1 1 0
MOCK_AY_LATCH_ADDR = $7 ; 1 1 1
;========================
;========================
; Mockingboard Init
;========================
;========================
; Left channel only
mockingboard_init:
;=========================
; Initialize the 6522s
; Reset Left AY-3-8910
;===========================
; ldx #$FF
; stx MOCK_6522_DDRB1
; stx MOCK_6522_DDRA1
; inx ; #MOCK_AY_RESET $0
; stx MOCK_6522_ORB1
; ldx #MOCK_AY_INACTIVE ; $4
; stx MOCK_6522_ORB1
; sei ; disable interrupts, is this necessary?
;=========================
; Setup Interrupt Handler
;=========================
; NOTE: we don't support IIc as it's a hack
; traditionally Mockingboard on IIc was rare
;========================
; set up interrupt
; Vector address goes to 0x3fe/0x3ff
; can save 10 bytes if we load in memory so this
; is in the right place automatically
lda #<interrupt_handler ; 2
sta $03fe ; 3
lda #>interrupt_handler ; 2
sta $03ff ; 3
;=========
; 10
;=========================
; Initialize the 6522s
; Reset Left AY-3-8910
;===========================
; entries=10
; 14 + 2*entries = 34 bytes
; assume Y=0 on entry?
ldy #0 ; 2
init_it_loop:
lda init_values,Y ; 3
ldx init_addresses,Y ; 3
bmi doneit ; 2
iny ; 1
sta $c400,X ; 3
bne init_it_loop ; 2
doneit:

View File

@ -0,0 +1,132 @@
play_frame:
;===============================
;===============================
; things that happen every frame
;===============================
;===============================
;=================================
; inc frame counter
inc FRAME
;=================================
; rotate through channel A volume
lda FRAME
and #$7
tay
lda channel_a_volume,Y
sta AY_REGS+8
;============================
; see if still counting down
lda SONG_COUNTDOWN
bpl done_update_song
set_notes_loop:
;==================
; load next byte
ldy SONG_OFFSET
track_smc:
lda track4,Y
;==================
; see if hit end
cmp #$ff
bne not_end
;====================================
; if at end, loop back to beginning
inc WHICH_TRACK
ldy WHICH_TRACK
cpy #5
bne no_wrap
ldy #1
sty WHICH_TRACK
no_wrap:
lda tracks_l,Y
sta track_smc+1
lda tracks_h,Y
sta track_smc+2
lda #0
sta SONG_OFFSET
beq set_notes_loop ; bra
not_end:
; NNNNNEEC -- c=channel, e=end, n=note
pha ; save note
and #1
tax
ldy #$0E
sty AY_REGS+8,X ; $08 set volume A,B
asl
tax ; put channel offset in X
pla ; restore note
pha
and #$6
lsr
tay
lda lengths,Y
sta SONG_COUNTDOWN ;
pla
lsr
lsr
lsr ; get note in A
tay ; lookup in table
lda frequencies_high,Y
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
; assume less than 256 bytes
inc SONG_OFFSET
done_update_song:
dec SONG_COUNTDOWN
bmi set_notes_loop
bpl skip_data
channel_a_volume:
.byte 14,14,14,14,11,11,10,10
lengths:
.byte 0*8,1*8,2*8,4*8
tracks_l:
.byte <track4,<track0,<track1,<track2,<track3
tracks_h:
.byte >track4,>track0,>track1,>track2,>track3
skip_data:

View File

@ -0,0 +1,23 @@
tracker_init:
; setup initial ay-3-8910 values (this depends on song)
init_registers_to_zero:
ldx #$13 ; init past end to zero others too
lda #0
; sta SONG_OFFSET ; also init song stuff
; sta SONG_COUNTDOWN
init_loop:
sta AY_REGS,X
dex
bpl init_loop
; jsr ay3_write_regs
lda #$38
sta AY_REGS+7 ; $07 mixer (ABC on)
; lda #$0E
; sta AY_REGS+8 ; $08 volume A
; lda #$0C
; sta AY_REGS+9 ; $09 volume B
; sta AY_REGS+10 ; $0A volume C