source: buchla-68k/orig/RAM/EXECINS.S@ c93e44d

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

Imported original source code.

  • Property mode set to 100755
File size: 5.1 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 .equ 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 .equ D4
26OLDSR .equ D5
27VCE .equ D7
28*
29IP .equ A5
30P1 .equ A4
31P2 .equ A3
32*
33P3 .equ A2
34P4 .equ A1
35*
36* parameter offsets
37* -----------------
38VOICE .equ 8
39INS .equ 10
40TAG .equ 12
41*
42 .page
43*
44_execins: 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 #$202,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 #$2200,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 #$2000,SYNC * ...
144*
145L15: btst #2,75(IP) * sync 3rd osc
146 beq L16 * ...
147*
148 ori.w #$4000,SYNC * ...
149*
150L16: btst #2,76(IP) * sync 4th osc
151 beq L17 * ...
152*
153 ori.w #$8000,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 #$5FE0,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.