annotate level2/modules/snddrv_cc3.asm @ 1254:5bced1e03639

Changed to new naming convention
author boisy
date Sun, 17 Aug 2003 16:25:29 +0000
parents
children 67e11bfc9cd4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1254
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
1 ********************************************************************
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
2 * SndDrv - Sound Driver for CoCo 3
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
3 *
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
4 * $Id$
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
5 *
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
6 * Should be fully compatible with old SS.Tone.
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
7 * (needs cleaning up for space)
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
8 *
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
9 * Ed. Comments Who YY/MM/DD
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
10 * ------------------------------------------------------------------
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
11 * First working version KKD 88/08/24
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
12 * Bell version for critics <grin> KKD 88/11/14
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
13 * 6 Upgrade to edition 3 from Monk-o-Ware BGP 98/09/26
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
14
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
15 nam SndDrv
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
16 ttl Sound Driver for CoCo 3
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
17
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
18 ifp1
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
19 use defsfile
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
20 endc
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
21
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
22 * SYSTEM MAP GLOBALS:
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
23
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
24 rev set 1
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
25 edition set 3
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
26
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
27 mod sndlen,sndnam,systm+objct,reent+rev,entry,0
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
28
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
29 sndnam fcs "SndDrv"
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
30 fcb edition
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
31
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
32 *******************************************************
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
33 entry lbra init init codriver
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
34 lbra getstt
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
35 lbra setstt ss.tone
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
36 lbra term terminate
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
37
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
38 *******************************************************
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
39 * INIT: set bell vector for F$Alarm
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
40
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
41 init leax Bell,pcr
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
42 stx >WGlobal+G.BelVec save bell vector
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
43 getstt
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
44 term
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
45 okend clrb
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
46 rts
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
47
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
48 *******************************************************
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
49 * SETSTT: do SS.Tone ($98) calls
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
50 * SS.Tone 98
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
51 * regs: X=vol,duration, Y=tone
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
52 * Y=path desc
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
53
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
54 setstt ldx PD.RGS,y get user regs
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
55 ldd #$1000 check for 1-4095 range
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
56 subd R$Y,x on passed Y
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
57 lble BadArgs ..okay if less
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
58 cmpd #$1000 ..else err on $1000
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
59 lbge BadArgs ..
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
60 tfr d,y set tone to D
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
61
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
62 ldd R$X,x get vol, duration
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
63 stb >WGlobal+G.TnCnt save duration
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
64 ldb #1 fake cycles
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
65 anda #$3F make volume ok
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
66 bra BellTone ..do it
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
67
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
68 BadArgs comb
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
69 ldb #E$IllArg
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
70 rts
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
71
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
72 *******************************************************
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
73 * Bell ($07):
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
74 * can destroy D,Y
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
75
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
76 Bell inc >WGlobal+G.BelTnF set bell flag
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
77 * lda #230/4 start value
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
78 * ldb #230/2-18 cycle repeats
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
79 * ldd #60*256+96
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
80 ldd #$3E60
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
81 ldy #$0060 bell freq
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
82
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
83 * COMMON SS.TONE and BELL ROUTINE:
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
84 * A=volume byte (0-63)
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
85 * B=cycle repeats (1 means use G.TnCnt as countdown)
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
86 * Y=freq
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
87
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
88 BellTone lsla set A for PIA D/A bits
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
89 lsla
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
90 lbeq okend okay end if just setting it
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
91 ora #2 add printer port bit
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
92 pshs a,b,x
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
93 ldx #PIA0Base save current PIA setting
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
94 lda 1,x
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
95 ldb 3,x
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
96 pshs a,b
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
97
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
98 anda #$F7 set for sound
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
99 andb #$F7
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
100 sta 1,x
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
101 stb 3,x
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
102 leax $20,x save PIA2 setting
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
103 lda 3,x
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
104 pshs A
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
105 ora #8 and set it too
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
106 sta 3,x
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
107 bra ToneLoop ..enter main play loop
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
108
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
109 BellLoop lda 3,s only bell does this countdown
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
110 deca
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
111 deca
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
112 sta 3,s
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
113 anda #$F7
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
114 ora #$02
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
115 bra Loop2
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
116 ToneLoop ldd 3,s get D/A byte, repeat cnt
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
117 Loop2 bsr SendByte send it (Y=tone delay)
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
118 lda #2 go back to zero
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
119 bsr SendByte send it
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
120 decb count-1 (SS.Tone always=0!)
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
121 bne BellLoop ..loop if bell cycles only <<
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
122
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
123 ldb >WGlobal+G.BelTnF is it bell?
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
124 bne ToneExit ..yes, end
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
125 ldb >WGlobal+G.TnCnt else get ticks left
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
126 bne ToneLoop and do again if any, else...
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
127
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
128 * Note: G.TnCnt is counted down by cc3io at 60hz.
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
129
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
130 ToneExit clr >WGlobal+G.BelTnF clear bell flag
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
131 puls A reset PIA's as before:
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
132 sta 3,x
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
133 leax -$20,x
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
134 puls a,b
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
135 sta 1,x
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
136 stb 3,x
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
137 clrb okay
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
138 puls a,b,x,pc end tone/bell.
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
139
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
140 SendByte pshs y save delay
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
141 sta ,x store D/A byte
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
142 SendDely leay -1,y delay
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
143 bne SendDely for tone
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
144 puls y,pc retn.
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
145
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
146 emod
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
147 sndlen equ *
5bced1e03639 Changed to new naming convention
boisy
parents:
diff changeset
148 end