mockingboard: rename some things

This commit is contained in:
Vince Weaver 2018-02-03 23:54:56 -05:00
parent 4d54f1f1a7
commit 64af286053
4 changed files with 160 additions and 7 deletions

153
asm_routines/mockingboard.s Normal file
View File

@ -0,0 +1,153 @@
; 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 EQU $C400 ; 6522 #1 port b data
MOCK_6522_ORA1 EQU $C401 ; 6522 #1 port a data
MOCK_6522_DDRB1 EQU $C402 ; 6522 #1 data direction port B
MOCK_6522_DDRA1 EQU $C403 ; 6522 #1 data direction port A
; right speaker
MOCK_6522_ORB2 EQU $C480 ; 6522 #2 port b data
MOCK_6522_ORA2 EQU $C481 ; 6522 #2 port a data
MOCK_6522_DDRB2 EQU $C482 ; 6522 #2 data direction port B
MOCK_6522_DDRA2 EQU $C483 ; 6522 #2 data direction port A
; AY-3-8910 commands on port B
; RESET BDIR BC1
MOCK_AY_RESET EQU $0 ; 0 0 0
MOCK_AY_INACTIVE EQU $4 ; 1 0 0
MOCK_AY_READ EQU $5 ; 1 0 1
MOCK_AY_WRITE EQU $6 ; 1 1 0
MOCK_AY_LATCH_ADDR EQU $7 ; 1 1 1
;========================
; Mockingboard Init
;========================
; Initialize the 6522s
; set the data direction for all pins of PortA/PortB to be output
mockingboard_init:
lda #$ff ; all output (1)
sta MOCK_6522_DDRB1
sta MOCK_6522_DDRA1
sta MOCK_6522_DDRB2
sta MOCK_6522_DDRA2
rts
;======================
; Reset Left AY-3-8910
;======================
reset_ay_left:
lda #MOCK_AY_RESET
sta MOCK_6522_ORB1
lda #MOCK_AY_INACTIVE
sta MOCK_6522_ORB1
rts
;======================
; Reset Right AY-3-8910
;======================
reset_ay_right:
lda #MOCK_AY_RESET
sta MOCK_6522_ORB2
lda #MOCK_AY_INACTIVE
sta MOCK_6522_ORB2
rts
; Write sequence
; Inactive -> Latch Address -> Inactive -> Write Data -> Inactive
;=======================
; Write Right AY-3-8910
;=======================
; register in Y
; value in X
write_ay_right:
; address
sty MOCK_6522_ORA1 ; put address on PA
lda #MOCK_AY_LATCH_ADDR ; latch_address on PB
sta MOCK_6522_ORB1
lda #MOCK_AY_INACTIVE ; go inactive
sta MOCK_6522_ORB1
; value
stx MOCK_6522_ORA1 ; put value on PA
lda #MOCK_AY_WRITE ; write on PB
sta MOCK_6522_ORB1
lda #MOCK_AY_INACTIVE ; go inactive
sta MOCK_6522_ORB1
rts
;=======================
; Write Left AY-3-8910
;=======================
; register in X
; value in Y
write_ay_left:
; address
sty MOCK_6522_ORA2 ; put address on PA
lda #MOCK_AY_LATCH_ADDR ; latch_address on PB
sta MOCK_6522_ORB2
lda #MOCK_AY_INACTIVE ; go inactive
sta MOCK_6522_ORB2
; value
stx MOCK_6522_ORA2 ; put value on PA
lda #MOCK_AY_WRITE ; write on PB
sta MOCK_6522_ORB2
lda #MOCK_AY_INACTIVE ; go inactive
sta MOCK_6522_ORB2
rts
;=======================================
; clear ay -- clear all 14 AY registers
; should silence the card
;=======================================
clear_ay_left:
ldy #14
ldx #0
clear_ay_left_loop:
jsr write_ay_left
dey
bpl clear_ay_left_loop
rts
;=======================================
; clear ay -- clear all 14 AY registers
; should silence the card
;=======================================
clear_ay_right:
ldy #14
ldx #0
clear_ay_right_loop:
jsr write_ay_right
dey
bpl clear_ay_right_loop
rts

View File

@ -5,14 +5,14 @@ PNG2GR = ../gr-utils/png2gr
all: dump_ed mock.dsk
mock.dsk: MOCK_TEST
$(DOS33) -y mock_test.dsk BSAVE -a 0x1000 MOCK_TEST
mock.dsk: KSP_THEME_UNCOMPRESSED
$(DOS33) -y mock_test.dsk BSAVE -a 0x1000 KSP_THEME_UNCOMPRESSED
MOCK_TEST: mock_test.o
ld65 -o MOCK_TEST mock_test.o -C ./apple2_1000.inc
KSP_THEME_UNCOMPRESSED: ksp_theme_uncompressed.o
ld65 -o KSP_THEME_UNCOMPRESSED ksp_theme_uncompressed.o -C ./apple2_1000.inc
mock_test.o: mock_test.s
ca65 -o mock_test.o mock_test.s -l mock_test.lst
ksp_theme_uncompressed.o: ksp_theme_uncompressed.s
ca65 -o ksp_theme_uncompressed.o ksp_theme_uncompressed.s -l ksp_theme_uncompressed.lst
ED: duet.o
ld65 -o ED duet.o -C ./apple2_900.inc
@ -31,5 +31,5 @@ dump_ed: dump_ed.o notes.o
clean:
rm -f *~ TITLE.GR *.o *.lst ED MOCK_TEST dump_ed
rm -f *~ TITLE.GR *.o *.lst ED KSP_THEME_UNCOMPRESSED dump_ed

Binary file not shown.