annotate level2/modules/snddrv_cc3.asm @ 1904:fd159d660df5

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