From 64af286053e19092e1cb1b72fe6b4bf873486ffa Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Sat, 3 Feb 2018 23:54:56 -0500 Subject: [PATCH] mockingboard: rename some things --- asm_routines/mockingboard.s | 153 ++++++++++++++++++ mockingboard/Makefile | 14 +- .../{mock_test.s => ksp_theme_uncompressed.s} | 0 mockingboard/mock_test.dsk | Bin 143360 -> 143360 bytes 4 files changed, 160 insertions(+), 7 deletions(-) create mode 100644 asm_routines/mockingboard.s rename mockingboard/{mock_test.s => ksp_theme_uncompressed.s} (100%) diff --git a/asm_routines/mockingboard.s b/asm_routines/mockingboard.s new file mode 100644 index 00000000..7fbd83b0 --- /dev/null +++ b/asm_routines/mockingboard.s @@ -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 + + diff --git a/mockingboard/Makefile b/mockingboard/Makefile index eedc3ec5..004de8a8 100644 --- a/mockingboard/Makefile +++ b/mockingboard/Makefile @@ -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 diff --git a/mockingboard/mock_test.s b/mockingboard/ksp_theme_uncompressed.s similarity index 100% rename from mockingboard/mock_test.s rename to mockingboard/ksp_theme_uncompressed.s diff --git a/mockingboard/mock_test.dsk b/mockingboard/mock_test.dsk index b2c0cebde464f6ae81648cc6f701bb1fd9b01f0a..bd8cb2e63236d8c4c9b6e7c172cbce590b6a61cc 100644 GIT binary patch delta 505 zcmaKpJ!=$E7)I}V=X>V99|%GejeD<^jS?F{0#0YErQKKs#KvE+6DuucglRXX7s9{{ zSjd15@oRO-u7%Yu2!e$mh=mr$2o_eJ;^9U6m1-kqR^wf&>qDs=FI@v$1)(Wa1Jy*jXd@}S% zjrQf9{46HaecJn;HSYJO4qYb;IOys|w&z6f9!*p1_fBWp+bapVz=fm^K zU$)et@)s``Z-&SF2i5k8~P(Z(~r2~7B(4(q=G DYpH&6 delta 655 zcmYL_Pe>F|9LL{p-g`5%GjC?zzBkc|kWX77L3FbS>XO}g^D6Sx(;x*WA1+i!lMagcpSblH6FZ@2gAD?pFEZ5CS(MAUe z->r5|>8|ckM1g7)Q$i`#sXAD=2@smVf(R;fVF*)Xge7dj#0f_t2~v|-5=o^l4Qa}Z zw4^PWbfhaiANk;GKK6-Eecd;FD+H@Af)N;?dvP{srYA>WU0)pfMv@G9BgV5V2A@Z9S-@PZgHjbTO@WjZrL zwz~B9q2v_wWIGBwf02garJUc9OoE2$Pp>V)Gbh?CK;xg3q2&1R zKwHX|8+I3_!)9cr)jHhtlJ4QTww;S^1RMsTJN(jfAu4mohf_y$TC1Ecak%b6XEfLa zU92*JTAo&0TV7syAALLmhh3?m79!hg+v_WHt6Smyjzj6wE|}a|oY0Ku%_x-9*D2h~ F{RSOtz25);