[4f508e6] | 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 |
|
---|
[f40a309] | 8 | .text
|
---|
[4f508e6] | 9 |
|
---|
| 10 | DOUBLED = 1 | double output to WS table
|
---|
| 11 |
|
---|
[8325447] | 12 | .xdef execins
|
---|
[4f508e6] | 13 |
|
---|
[8325447] | 14 | .xref clrvce
|
---|
| 15 | .xref execkey
|
---|
[4f508e6] | 16 |
|
---|
[8325447] | 17 | .xref io_fpu
|
---|
| 18 | .xref instmod
|
---|
| 19 | .xref s_inst
|
---|
| 20 | .xref idefs
|
---|
| 21 | .xref vbufs
|
---|
[4f508e6] | 22 |
|
---|
| 23 | | register equates
|
---|
| 24 | | ----------------
|
---|
| 25 | SYNC = D4
|
---|
| 26 | OLDSR = D5
|
---|
| 27 | VCE = D7
|
---|
| 28 |
|
---|
| 29 | IP = A5
|
---|
| 30 | P1 = A4
|
---|
| 31 | P2 = A3
|
---|
| 32 |
|
---|
| 33 | P3 = A2
|
---|
| 34 | P4 = A1
|
---|
| 35 |
|
---|
| 36 | | parameter offsets
|
---|
| 37 | | -----------------
|
---|
| 38 | VOICE = 8
|
---|
| 39 | INS = 10
|
---|
| 40 | TAG = 12
|
---|
| 41 |
|
---|
[f40a309] | 42 | .page
|
---|
[4f508e6] | 43 |
|
---|
[8325447] | 44 | execins: link A6,#0 | link stack frames
|
---|
[4f508e6] | 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 | ...
|
---|
[8325447] | 52 | add.l #vbufs,IP | ...
|
---|
[4f508e6] | 53 | move.w VCE,(sp) | clrvce(vce)
|
---|
[8325447] | 54 | jsr clrvce | ...
|
---|
[4f508e6] | 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 | ...
|
---|
[8325447] | 64 | add.l #idefs,P2 | ...
|
---|
[4f508e6] | 65 | move.w #1968,D0 | set move count
|
---|
| 66 |
|
---|
| 67 | L6: move.w (P2)+,(P1)+ | load voice buffer
|
---|
| 68 | dbra D0,L6 | ...
|
---|
| 69 |
|
---|
[f40a309] | 70 | .page
|
---|
[4f508e6] | 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 | ...
|
---|
[8325447] | 79 | add.l #io_fpu,P1 | point P1 at FPU WS A
|
---|
[4f508e6] | 80 | add.l #0x202,P1 | ...
|
---|
| 81 | lea 1778(IP),P2 | point P2 at instdef WS A
|
---|
[8325447] | 82 | add.l #io_fpu,P3 | point P3 at FPU WS B
|
---|
[4f508e6] | 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 |
|
---|
[f40a309] | 87 | .ifne DOUBLED
|
---|
[4f508e6] | 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
|
---|
[f40a309] | 93 | .endc
|
---|
[4f508e6] | 94 |
|
---|
| 95 | move.w SR,OLDSR | turn off FPU interrupts
|
---|
| 96 | move.w #0x2200,SR | ...
|
---|
| 97 |
|
---|
| 98 | L10: 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 |
|
---|
[f40a309] | 107 | .ifne DOUBLED
|
---|
[4f508e6] | 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 |
|
---|
| 114 | L10A: 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 |
|
---|
[f40a309] | 123 | .endc
|
---|
[4f508e6] | 124 |
|
---|
| 125 | move.w OLDSR,SR | enable FPU interrupts
|
---|
| 126 |
|
---|
[f40a309] | 127 | .page
|
---|
[4f508e6] | 128 |
|
---|
| 129 | move.w VCE,A0 | instmod[vce] = FALSE
|
---|
| 130 | add.l A0,A0 | ...
|
---|
[8325447] | 131 | add.l #instmod,A0 | ...
|
---|
[4f508e6] | 132 | clr.w (A0) | ...
|
---|
| 133 | move.w VCE,A0 | s_inst[vce] = ins
|
---|
| 134 | add.l A0,A0 | ...
|
---|
[8325447] | 135 | add.l #s_inst,A0 | ...
|
---|
[4f508e6] | 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 |
|
---|
| 145 | L15: btst #2,75(IP) | sync 3rd osc
|
---|
| 146 | beq L16 | ...
|
---|
| 147 |
|
---|
| 148 | ori.w #0x4000,SYNC | ...
|
---|
| 149 |
|
---|
| 150 | L16: btst #2,76(IP) | sync 4th osc
|
---|
| 151 | beq L17 | ...
|
---|
| 152 |
|
---|
| 153 | ori.w #0x8000,SYNC | ...
|
---|
| 154 |
|
---|
| 155 | L17: move.w VCE,A0 | send sync to FPU
|
---|
| 156 | add.l A0,A0 | ...
|
---|
[8325447] | 157 | add.l #io_fpu,A0 | ...
|
---|
[4f508e6] | 158 | add.l #0x5FE0,A0 | ...
|
---|
| 159 | move.w SYNC,(A0) | ...
|
---|
| 160 |
|
---|
| 161 | L2: move.w #1,(sp) | execkey(-1, 0, vce, 1)
|
---|
| 162 | move.w VCE,-(sp) | ...
|
---|
| 163 | clr.w -(sp) | ...
|
---|
| 164 | move.w #-1,-(sp) | ...
|
---|
[8325447] | 165 | jsr execkey | ...
|
---|
[4f508e6] | 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 |
|
---|
[f40a309] | 172 | .page
|
---|
[4f508e6] | 173 |
|
---|
[f40a309] | 174 | .data
|
---|
[4f508e6] | 175 |
|
---|
| 176 | | vibtabl -- voice and instrument buffer offset table
|
---|
| 177 | | ------- ----------------------------------------
|
---|
| 178 | vibtabl: .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 |
|
---|
[f40a309] | 220 | .end
|
---|