Changeset 8325447 in buchla-68k for ram/fpuint.s
- Timestamp:
- 08/07/2017 02:04:35 PM (7 years ago)
- Branches:
- master
- Children:
- 27c8d40
- Parents:
- 84c0125
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ram/fpuint.s
r84c0125 r8325447 5 5 .text 6 6 7 .xdef _fpuint | process an FPU interrupt8 .xdef _fpuclr | reset the FPU9 .xdef _clrvce | quiet a voice10 11 .xdef _fputrap| a very good debug trap point12 13 .xdef _fp_resv| 'spare' function reset value table14 .xdef _fpuifnc| FPU interrupt code (voice / function)15 16 .xref _irand | ranged random number function17 .xref _scope | diagnostic scope function18 .xref _xgetran| random number function19 20 .xref _expbit21 .xref _funcndx22 .xref _initcfg23 .xref _ndisp24 .xref _pflist25 .xref _pfqhdr26 .xref _prstab27 .xref _ptoftab28 .xref _scopef29 .xref _timemlt30 .xref _trgtab31 .xref _valents32 .xref _vce2grp33 .xref _vce2trg34 .xref _veltab7 .xdef fpuint | process an FPU interrupt 8 .xdef fpuclr | reset the FPU 9 .xdef clrvce | quiet a voice 10 11 .xdef fputrap | a very good debug trap point 12 13 .xdef fp_resv | 'spare' function reset value table 14 .xdef fpuifnc | FPU interrupt code (voice / function) 15 16 .xref irand | ranged random number function 17 .xref scope | diagnostic scope function 18 .xref xgetran | random number function 19 20 .xref expbit 21 .xref funcndx 22 .xref initcfg 23 .xref ndisp 24 .xref pflist 25 .xref pfqhdr 26 .xref prstab 27 .xref ptoftab 28 .xref scopef 29 .xref timemlt 30 .xref trgtab 31 .xref valents 32 .xref vce2grp 33 .xref vce2trg 34 .xref veltab 35 35 36 36 .page … … 194 194 .page 195 195 | ------------------------------------------------------------------------------ 196 | _fpuint() -- process FPU interrupts196 | fpuint() -- process FPU interrupts 197 197 198 198 | void … … 204 204 | ------------------------------------------------------------------------------ 205 205 206 _fpuint:movem.l d0-d5/a0-a3,-(a7) | preserve registers we use206 fpuint: movem.l d0-d5/a0-a3,-(a7) | preserve registers we use 207 207 move.w FPUINT1,d0 | read FPU interrupt status 208 208 andi.w #0x00FF,d0 | mask out garbage in MS bits 209 move.w d0, _fpuifnc | save for later use210 move.w _ndisp,d1 | get display number209 move.w d0,fpuifnc | save for later use 210 move.w ndisp,d1 | get display number 211 211 cmpi.w #11,d1 | see if we display 212 212 bne nodisp | jump if not 213 213 214 tst.w _scopef | ...214 tst.w scopef | ... 215 215 beq nodisp | ... 216 216 217 217 move.w d0,-(a7) | display value 218 jsr _scope | ...218 jsr scope | ... 219 219 tst.w (a7)+ | ... 220 220 221 move.w _fpuifnc,d0 | get FPU status221 move.w fpuifnc,d0 | get FPU status 222 222 223 223 nodisp: move.w d0,d1 | save in d1 (becomes function offset) … … 227 227 228 228 lsl.w #3,d0 | develop funcndx[] index 229 lea _funcndx,a0 | setup funcndx[] base address229 lea funcndx,a0 | setup funcndx[] base address 230 230 231 231 tst.l 0(a0,d0.W) | see if function is defined … … 299 299 | ------------------------------------------------------------------------------ 300 300 301 _fputrap: jmp (a0) | dispatch to action handler301 fputrap: jmp (a0) | dispatch to action handler 302 302 303 303 .page … … 320 320 move.w d3,d0 | extract mantissa 321 321 andi.w #MSK_MNT,d0 | ... 322 mulu _timemlt,d0 | multiply by panel time pot value322 mulu timemlt,d0 | multiply by panel time pot value 323 323 lsr.l #8,d0 | ... and scale it 324 324 lsr.l #7,d0 | ... … … 326 326 andi.w #MSK_EXP,d3 | extract exponent code 327 327 add.w d3,d3 | look up decoded exponent 328 lea _expbit,a0 | ... in expbit328 lea expbit,a0 | ... in expbit 329 329 move.w 0(a0,d3.W),F_EXP(a3,d1.W) | send exponent to FPU 330 330 move.w PT_VAL(a2,d2.W),d3 | get the function value … … 348 348 movem.l d1-d2/a0-a2,-(a7) | preserve registers around call 349 349 move.w PT_VMLT(a2,d2.W),-(a7) | pass multiplier to xgetran() 350 jsr _xgetran| call for a random number350 jsr xgetran | call for a random number 351 351 tst.w (a7)+ | clean up stack 352 352 movem.l (a7)+,d1-d2/a0-a2 | restore registers … … 364 364 lsr.w #6,d0 | shift to a word index 365 365 andi.w #0x01FE,d0 | mask out extraneous bits 366 lea _ptoftab,a0 | get entry from ptoftab[]366 lea ptoftab,a0 | get entry from ptoftab[] 367 367 move.w 0(a0,d0.W),d5 | ... 368 368 bra applym | go apply the multiplier … … 385 385 move.w FH_TRG(a1),d0 | get the trigger number 386 386 add.w d0,d0 | ... as a word index 387 lea _veltab,a0 | ... into veltab[]387 lea veltab,a0 | ... into veltab[] 388 388 move.w 0(a0,d0.W),d5 | get the velocity from veltab[trg] 389 389 bra applym | go apply the multiplier … … 397 397 move.w FH_TRG(a1),d0 | get the trigger number 398 398 add.w d0,d0 | ... as a word index 399 lea _prstab,a0 | ... into prstab[]399 lea prstab,a0 | ... into prstab[] 400 400 move.w 0(a0,d0.W),d5 | get the pressure from prstab[trg] 401 401 bra applym | go apply the multiplier … … 405 405 | all other sources come out of the valents[] array 406 406 | ------------------------------------------------------------------------------ 407 srctyp4: lea _vce2grp,a0 | point at vce2grp[]408 move.w _fpuifnc,d5 | get voice number in d5407 srctyp4: lea vce2grp,a0 | point at vce2grp[] 408 move.w fpuifnc,d5 | get voice number in d5 409 409 lsr.w #3,d5 | ... 410 410 andi.w #0x001E,d5 | ... as a word index … … 417 417 lsl.w #2,d0 | ... via shift and add) 418 418 add.w d5,d0 | ... 419 lea _valents,a0 | get base of valents[]419 lea valents,a0 | get base of valents[] 420 420 move.w VT_VAL(a0,d0.W),d5 | get value 421 421 … … 556 556 | act1 -- AC_SUST -- pause if key is down (sustain) 557 557 | ---- ------------------------------------------ 558 act1: move.w _fpuifnc,d0 | get voice as a word index558 act1: move.w fpuifnc,d0 | get voice as a word index 559 559 lsr.w #3,d0 | ... 560 560 andi.w #0x001E,d0 | ... 561 lea _vce2trg,a0 | point at voice to trigger table561 lea vce2trg,a0 | point at voice to trigger table 562 562 move.w 0(a0,d0.W),d0 | get trigger table entry into d0 563 563 cmpi.w #-1,d0 | see if voice is free … … 570 570 bne act1a | sustain if so 571 571 572 lea _trgtab,a0 | point at trigger table572 lea trgtab,a0 | point at trigger table 573 573 tst.b 0(a0,d0.W) | check trigger status 574 574 beq act0 | continue function if not active 575 575 576 act1a: move.l _pfqhdr,d3 | see if any pflist entries remain576 act1a: move.l pfqhdr,d3 | see if any pflist entries remain 577 577 beq act0 | continue if not (shouldn't happen!) 578 578 … … 586 586 addi.w #PT_LEN,d2 | advance the point index 587 587 movea.l d3,a0 | acquire a new pflist entry 588 move.l (a0), _pfqhdr | ...589 move.l _pflist,(a0) | chain it to pflist590 move.l a0, _pflist | ...588 move.l (a0),pfqhdr | ... 589 move.l pflist,(a0) | chain it to pflist 590 move.l a0,pflist | ... 591 591 move.w FH_TRG(a1),PF_TRIG(a0) | set trigger number in entry 592 move.w _fpuifnc,PF_FUNC(a0) | set v/p word in entry592 move.w fpuifnc,PF_FUNC(a0) | set v/p word in entry 593 593 movem.l d1-d2/d4/a1-a3,PF_D1(a0) | set registers in entry 594 594 move.b FH_TMD(a1),d0 | stop the function … … 606 606 | act2 -- AC_ENBL -- stop if key is up 607 607 | ---- ---------------------------- 608 act2: move.w _fpuifnc,d0 | get voice as a word index608 act2: move.w fpuifnc,d0 | get voice as a word index 609 609 lsr.w #3,d0 | ... 610 610 andi.w #0x001E,d0 | ... 611 lea _vce2trg,a0 | check to see if voice is free611 lea vce2trg,a0 | check to see if voice is free 612 612 move.w 0(a0,d0.W),d0 | ... 613 613 cmpi.w #-1,d0 | ... … … 620 620 bne act0 | ... 621 621 622 lea _trgtab,a0 | check trigger table entry622 lea trgtab,a0 | check trigger table entry 623 623 tst.b 0(a0,d0.W) | ... 624 624 bne act0 | if trigger is active, continue … … 656 656 movem.l d1-d2/a0-a2,-(a7) | get ranged random number 657 657 move.w d0,-(a7) | ... 658 jsr _irand | ...658 jsr irand | ... 659 659 tst.w (a7)+ | ... 660 660 movem.l (a7)+,d1-d2/a0-a2 | ... … … 677 677 | act5 -- AC_KYUP -- jump if key is up 678 678 | ---- ---------------------------- 679 act5: move.w _fpuifnc,d0 | get voice as a word index679 act5: move.w fpuifnc,d0 | get voice as a word index 680 680 lsr.w #3,d0 | ... 681 681 andi.w #0x001E,d0 | ... 682 lea _vce2trg,a0 | check to see if voice is free682 lea vce2trg,a0 | check to see if voice is free 683 683 move.w 0(a0,d0.W),d0 | ... 684 684 cmpi.w #-1,d0 | ... … … 691 691 bne act0 | ... 692 692 693 lea _trgtab,a0 | check trigger table entry693 lea trgtab,a0 | check trigger table entry 694 694 tst.b 0(a0,d0.W) | see if the trigger is active 695 695 beq act3 | if not, do the jump … … 702 702 | act6 -- AC_KYDN -- jump if key is down 703 703 | ---- ------------------------------ 704 act6: move.w _fpuifnc,d0 | get voice as a word index704 act6: move.w fpuifnc,d0 | get voice as a word index 705 705 lsr.w #3,d0 | ... 706 706 andi.w #0x001E,d0 | ... 707 lea _vce2trg,a0 | check to see if voice is free707 lea vce2trg,a0 | check to see if voice is free 708 708 move.w 0(a0,d0.W),d0 | ... 709 709 cmpi.w #-1,d0 | ... … … 716 716 bne act3 | ... 717 717 718 lea _trgtab,a0 | check trigger table entry718 lea trgtab,a0 | check trigger table entry 719 719 tst.b 0(a0,d0.W) | see if the trigger is active 720 720 bne act3 | if so, do the jump … … 730 730 | ------------------------------------------------------------------------------ 731 731 732 | _fpuclr -- clear the FPU733 | ------ --------------732 | fpuclr -- clear the FPU 733 | ------ ------------- 734 734 735 735 | void … … 740 740 | ------------------------------------------------------------------------------ 741 741 742 _fpuclr:link a6,#0 | link stack frames742 fpuclr: link a6,#0 | link stack frames 743 743 move.w sr,-(a7) | save the interrupt level 744 744 ori.w #0x0700,sr | turn off interrupts 745 745 746 746 lea FPUFUNC,a0 | point at the first function 747 lea _fp_resv,a2 | point at reset value table747 lea fp_resv,a2 | point at reset value table 748 748 move.w #11,d1 | set the outer loop count 749 749 … … 854 854 .page 855 855 856 | _clrvce -- quiet a voice857 | ------ --------------856 | clrvce -- quiet a voice 857 | ------ ------------- 858 858 859 859 | void … … 863 863 | Quiet the voice by resetting the FPU functions it uses. 864 864 865 _clrvce:link a6,#0 | link stack frames865 clrvce: link a6,#0 | link stack frames 866 866 move.w sr,-(a7) | save the interrupt level 867 867 ori.w #0x0700,sr | turn off interrupts … … 964 964 | ------------------------------------------------------------------------------ 965 965 966 _fp_resv: .ds.w 12 | fpu spare function reset values967 _fpuifnc: .ds.w 1 | interrupting function number from FPU966 fp_resv: .ds.w 12 | fpu spare function reset values 967 fpuifnc: .ds.w 1 | interrupting function number from FPU 968 968 969 969 .end
Note:
See TracChangeset
for help on using the changeset viewer.