source: buchla-68k/ram/execins.s@ d235320

Last change on this file since d235320 was 8325447, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Removed _ prefix.

  • Property mode set to 100644
File size: 4.8 KB
Line 
1| ------------------------------------------------------------------------------
2| execins.s -- execute an instrument selection
3| Version 9 -- 1988-09-09 -- D.N. Lynx Crowe
4
5| Hand optimized C object code from: execins.c -- ver 2 -- 1988-06-29
6| ------------------------------------------------------------------------------
7
8 .text
9
10DOUBLED = 1 | double output to WS table
11
12 .xdef execins
13
14 .xref clrvce
15 .xref execkey
16
17 .xref io_fpu
18 .xref instmod
19 .xref s_inst
20 .xref idefs
21 .xref vbufs
22
23| register equates
24| ----------------
25SYNC = D4
26OLDSR = D5
27VCE = D7
28
29IP = A5
30P1 = A4
31P2 = A3
32
33P3 = A2
34P4 = A1
35
36| parameter offsets
37| -----------------
38VOICE = 8
39INS = 10
40TAG = 12
41
42 .page
43
44execins: link A6,#0 | link stack frames
45 movem.l D3-VCE/P2-IP,-(sp) | preserve registers
46 move.w VOICE(A6),VCE | get voice number
47 move.w VCE,D0 | calculate IP
48 add.w D0,D0 | ...
49 add.w D0,D0 | ...
50 lea vibtabl,A0 | ...
51 movea.l 0(A0,D0.W),IP | ...
52 add.l #vbufs,IP | ...
53 move.w VCE,(sp) | clrvce(vce)
54 jsr clrvce | ...
55 tst.w TAG(A6) | if (tag) {
56 beq L2 | ...
57
58 move.l IP,P1 | p1 = ip;
59 move.w INS(A6),D0 | p2 = &idefs[ins]
60 add.w D0,D0 | ...
61 add.w D0,D0 | ...
62 lea vibtabl,A0 | ...
63 movea.l 0(A0,D0.W),P2 | ...
64 add.l #idefs,P2 | ...
65 move.w #1968,D0 | set move count
66
67L6: move.w (P2)+,(P1)+ | load voice buffer
68 dbra D0,L6 | ...
69
70 .page
71
72 move.w VCE,D0 | calculate FPU offset for voice
73 move.w #9,D1 | ...
74 asl.w D1,D0 | ...
75 asl.w #1,D0 | ...
76 ext.l D0 | ...
77 move.l D0,P1 | ...
78 move.l D0,P3 | ...
79 add.l #io_fpu,P1 | point P1 at FPU WS A
80 add.l #0x202,P1 | ...
81 lea 1778(IP),P2 | point P2 at instdef WS A
82 add.l #io_fpu,P3 | point P3 at FPU WS B
83 add.l #2,P3 | ...
84 lea 2858(IP),P4 | point P4 at instdef WS B
85 move.w #253,D0 | setup move count
86
87 .ifne DOUBLED
88 move.l P1,-(a7) | save P1 on stack
89 move.l P2,-(a7) | save P2 on stack
90 move.l P3,-(a7) | save P3 on stack
91 move.l P4,-(a7) | save P4 on stack
92 move.w D0,-(a7) | save D0 on stack
93 .endc
94
95 move.w SR,OLDSR | turn off FPU interrupts
96 move.w #0x2200,SR | ...
97
98L10: move.w (P2)+,(P1)+ | set FPU WS A from instdef
99 nop | delay for FPU timing
100 nop | ...
101 nop | ...
102 move.w (P4)+,(P3)+ | set FPU WS B from instdef
103 nop | delay for FPU timing
104 nop | ...
105 dbra D0,L10 | loop until done
106
107 .ifne DOUBLED
108 move.w (a7)+,D0 | restore D0 from stack
109 movea.l (a7)+,P4 | restore P4 from stack
110 movea.l (a7)+,P3 | restore P3 from stack
111 movea.l (a7)+,P2 | restore P2 from stack
112 movea.l (a7)+,P1 | restore P1 from stack
113
114L10A: move.w (P2)+,(P1)+ | set FPU WS A from instdef
115 nop | delay for FPU timing
116 nop | ...
117 nop | ...
118 move.w (P4)+,(P3)+ | set FPU WS B from instdef
119 nop | delay for FPU timing
120 nop | ...
121 dbra D0,L10A | loop until done
122
123 .endc
124
125 move.w OLDSR,SR | enable FPU interrupts
126
127 .page
128
129 move.w VCE,A0 | instmod[vce] = FALSE
130 add.l A0,A0 | ...
131 add.l #instmod,A0 | ...
132 clr.w (A0) | ...
133 move.w VCE,A0 | s_inst[vce] = ins
134 add.l A0,A0 | ...
135 add.l #s_inst,A0 | ...
136 move.w INS(A6),(A0) | ...
137 move.b 70(IP),SYNC | get config bits
138 ext.w SYNC | ...
139 asl.w #8,SYNC | ...
140 btst #2,74(IP) | sync 2nd osc
141 beq L15 | ...
142
143 ori.w #0x2000,SYNC | ...
144
145L15: btst #2,75(IP) | sync 3rd osc
146 beq L16 | ...
147
148 ori.w #0x4000,SYNC | ...
149
150L16: btst #2,76(IP) | sync 4th osc
151 beq L17 | ...
152
153 ori.w #0x8000,SYNC | ...
154
155L17: move.w VCE,A0 | send sync to FPU
156 add.l A0,A0 | ...
157 add.l #io_fpu,A0 | ...
158 add.l #0x5FE0,A0 | ...
159 move.w SYNC,(A0) | ...
160
161L2: move.w #1,(sp) | execkey(-1, 0, vce, 1)
162 move.w VCE,-(sp) | ...
163 clr.w -(sp) | ...
164 move.w #-1,-(sp) | ...
165 jsr execkey | ...
166 addq.l #6,sp | ...
167 tst.l (sp)+ | clean up stack
168 movem.l (sp)+,SYNC-VCE/P2-IP | restore registers
169 unlk A6 | unlink stack frames
170 rts | return
171
172 .page
173
174 .data
175
176| vibtabl -- voice and instrument buffer offset table
177| ------- ----------------------------------------
178vibtabl: .dc.l 0 | 0
179 .dc.l 3938 | 1
180 .dc.l 7876 | 2
181 .dc.l 11814 | 3
182 .dc.l 15752 | 4
183 .dc.l 19690 | 5
184 .dc.l 23628 | 6
185 .dc.l 27566 | 7
186 .dc.l 31504 | 8
187 .dc.l 35442 | 9
188 .dc.l 39380 | 10
189 .dc.l 43318 | 11
190 .dc.l 47256 | 12
191 .dc.l 51194 | 13
192 .dc.l 55132 | 14
193 .dc.l 59070 | 15
194 .dc.l 63008 | 16
195 .dc.l 66946 | 17
196 .dc.l 70884 | 18
197 .dc.l 74822 | 19
198 .dc.l 78760 | 20
199 .dc.l 82698 | 21
200 .dc.l 86636 | 22
201 .dc.l 90574 | 23
202 .dc.l 94512 | 24
203 .dc.l 98450 | 25
204 .dc.l 102388 | 26
205 .dc.l 106326 | 27
206 .dc.l 110264 | 28
207 .dc.l 114202 | 29
208 .dc.l 118140 | 30
209 .dc.l 122078 | 31
210 .dc.l 126016 | 32
211 .dc.l 129954 | 33
212 .dc.l 133892 | 34
213 .dc.l 137830 | 35
214 .dc.l 141768 | 36
215 .dc.l 145706 | 37
216 .dc.l 149644 | 38
217 .dc.l 153582 | 39
218 .dc.l 157520 | 40
219
220 .end
Note: See TracBrowser for help on using the repository browser.