7.0 Appendix: Generated Code
;User: pino ;Date: Wed Mar 17 17:19:46 1993 ;Target: S-56X ;Universe: DPCM org p: ori #03,mr ;disable interrupts include `/home/ohm1/users/messer/ptolemy/lib/cg56/intequlc.asm' include `/home/ohm1/users/messer/ptolemy/lib/cg56/ioequlc.asm' include `/home/ohm1/users/messer/ptolemy/lib/cg56/s56x.asm' ;initialization code from star DPCM.monoADDA1.Fork.output=21 (class AnyAsmFork) ;initialization code from star DPCM.monoADDA1.SSI1 (class CG56SSI) ;initialization for state DPCM.monoADDA1.SSI1.missCnt org y:15 dc 0 org p: ssi_0_savereg equ 68 ssi_0_buflen equ 8 ssi_0_buffer equ 0 ssi_0_recv_sptr equ 74 ssi_0_recv_iptr equ 76 ssi_0_xmit_sptr equ 75 ssi_0_xmit_iptr equ 77 ssi_0_dualbuf equ 0 ; Initialize all the pointers to the right place. ; Note that recv&xmit bufs are at the same add but recv in x: and xmit in y: org x:74 dc ssi_0_buffer org x:76 dc ssi_0_buffer org x:75 dc ssi_0_buffer org x:77 dc ssi_0_buffer org p: move #ssi_0_buffer,r0 .LOOP #ssi_0_buflen bset #0,x:(r0) ; empty recv buf by setting bit 0 bclr #0,y:(r0)+ ; fill xmit buf by clearing bit 0 .ENDL SAVEPC_3 equ * ; SSI receive data interrupt vector org p:i_ssird jsr ssi_0_intr org p:SAVEPC_3 SAVEPC_4 equ * ; SSI receive data w/ exception interrupt vector ; XXX: this is wrong!!! org p:i_ssirde jsr ssi_0_intr org p:SAVEPC_4 movep #16640,x:m_cra movep #14848,x:m_crb ; Configure Port C pins 8-5 as SSI pins bset #8,x:m_pcc ; STD bset #7,x:m_pcc ; SRD bset #6,x:m_pcc ; SCK (bit clock) bset #5,x:m_pcc ; SC2 (frame clock) ; Configure Port C pins 2-0 as raw data pins (normally SCI) bclr #2,x:m_pcc bclr #1,x:m_pcc bclr #0,x:m_pcc bset #2,x:m_pcddr ; as outputs bset #1,x:m_pcddr bset #0,x:m_pcddr bset #m_ssl0,x:m_ipr ; set SSI IPL 2 bset #m_ssl1,x:m_ipr bset #m_srie,x:m_crb ; enable SSI rx interupts ;initialization code from star DPCM.monoADDA1.BlackHole1 (class AnyAsmBlackHole) ;initialization code from star DPCM.DPCMTX1.DPCMQuant1.Fork.output=41 (class AnyAsmFork) ;initialization code from star DPCM.DPCMTX1.DPCMQuant1.QuantRange1 (class CG56QuantRange) ;initialization for state DPCM.DPCMTX1.DPCMQuant1.QuantRange1.thresholds org x:81 dc 0.0 ;initialization for state DPCM.DPCMTX1.DPCMQuant1.QuantRange1.levels org y:73 dc -0.5 dc 0.5 org p: ;initialization code from star DPCM.DPCMTX1.DPCMQuant1.QuantRange2 (class CG56QuantRange) ;initialization for state DPCM.DPCMTX1.DPCMQuant1.QuantRange2.thresholds org x:71 dc -0.5 dc 0.5 ;initialization for state DPCM.DPCMTX1.DPCMQuant1.QuantRange2.levels org y:70 dc -1.0 dc 0.0 dc 0.99999988079071 org p: ;initialization code from star DPCM.DPCMTX1.DPCMQuant1.QuantRange3 (class CG56QuantRange) ;initialization for state DPCM.DPCMTX1.DPCMQuant1.QuantRange3.thresholds org x:62 dc -0.7 dc -0.42 dc -0.14 dc 0.14 dc 0.42 dc 0.7 ;initialization for state DPCM.DPCMTX1.DPCMQuant1.QuantRange3.levels org y:63 dc -0.84 dc -0.56 dc -0.28 dc 0.0 dc 0.28 dc 0.56 dc 0.84 org p: ;initialization code from star DPCM.DPCMTX1.DPCMQuant1.HostSlider1 (class CG56HostSlider) ;initialization for state DPCM.DPCMTX1.DPCMQuant1.HostSlider1.value org x:82 dc 0.0 org p: ;initialization code from star DPCM.DPCMTX1.DPCMQuant1.switch51.HostMButton1 (class CG56HostMButton) ;initialization for state DPCM.DPCMTX1.DPCMQuant1.switch51.HostMButton1.value org x:83 dc 0.0 org p: ;initialization code from star DPCM.DPCMTX1.DPCMQuant1.switch51.Mux.input=51 (class CG56Mux) org x:8 dc 80 dc 85 dc 86 dc 87 dc 88 org y:8 dc 1-1 dc 1-1 dc 1-1 dc 1-1 dc 1-1 org p: ;initialization code from star DPCM.DPCMTX1.DPCMQuant1.QuantRange4 (class CG56QuantRange) ;initialization for state DPCM.DPCMTX1.DPCMQuant1.QuantRange4.thresholds org x:48 dc -0.845 dc -0.715 dc -0.585 dc -0.455 dc -0.325 dc -0.195 dc -0.065 dc 0.065 dc 0.195 dc 0.325 dc 0.455 dc 0.585 dc 0.715 dc 0.845 ;initialization for state DPCM.DPCMTX1.DPCMQuant1.QuantRange4.levels org y:48 dc -0.91 dc -0.78 dc -0.65 dc -0.52 dc -0.39 dc -0.26 dc -0.13 dc 0.0 dc 0.13 dc 0.26 dc 0.39 dc 0.52 dc 0.65 dc 0.78 dc 0.91 org p: ;initialization code from star DPCM.DPCMTX1.DPCMQuant1.Fork.output=42 (class AnyAsmFork) ;initialization code from star DPCM.DPCMTX1.DPCMQuant1.auto-fork-60 (class AnyAsmFork) ;initialization code from star DPCM.DPCMTX1.Sub1 (class CG56Sub) ;initialization code from star DPCM.DPCMTX1.Add.input=21 (class CG56Add) ;initialization code from star DPCM.DPCMTX1.Fork.output=21 (class AnyAsmFork) ;initialization code from star DPCM.DPCMTX1.Fork.output=31 (class AnyAsmFork) ;initialization code from star DPCM.DPCMTX1.LMS1 (class CG56LMS) ;initialization for state DPCM.DPCMTX1.LMS1.coef org x:16 dc 0.99999988079071 dc 0.0 dc 0.0 dc 0.0 dc 0.0 dc 0.0 dc 0.0 dc 0.0 dc 0.0 dc 0.0 dc 0.0 dc 0.0 dc 0.0 dc 0.0 dc 0.0 dc 0.0 org p: ; delayLine memory org y:16 bsc 16,0 org p: ; pointer to delay line into memory org y:75 dc 16 org p: ;initialization code from star DPCM.APCRx1.Add.input=22 (class CG56Add) ;initialization code from star DPCM.APCRx1.Fork.output=23 (class AnyAsmFork) ;initialization code from star DPCM.APCRx1.Fork.output=24 (class AnyAsmFork) ;initialization code from star DPCM.APCRx1.LMS2 (class CG56LMS) ;initialization for state DPCM.APCRx1.LMS2.coef org x:32 dc 0.99999988079071 dc 0.0 dc 0.0 dc 0.0 dc 0.0 dc 0.0 dc 0.0 dc 0.0 dc 0.0 dc 0.0 dc 0.0 dc 0.0 dc 0.0 dc 0.0 dc 0.0 dc 0.0 org p: ; delayLine memory org y:32 bsc 16,0 org p: ; pointer to delay line into memory org y:76 dc 32 org p: ;initialization code from star DPCM.SwitchDelay1.switch1.HostButton.buttonType=checkbutton1 (class CG56HostButton) org x:96 dc 0 org p: ;initialization code from star DPCM.SwitchDelay1.switch1.Mux.input=21 (class CG56Mux) org x:13 dc 95 dc 98 org y:13 dc 1-1 dc 1-1 org p: ;initialization code from star DPCM.SwitchDelay1.Delay1 (class CG56Delay) ; initialize delay star ; pointer to internal buffer org y:77 dc 8192 org p: ;initialization code from star DPCM.SwitchDelay1.Fork.output=25 (class AnyAsmFork) andi #$fc,mr ;enable interrupts LOOP_5 ;code from star DPCM.DPCMTX1.LMS1 (class CG56LMS) ; initialize address registers for coef and delayLine move #16+16-1,r3 ; insert here move y:75,r5 ; delayLine move #15,m5 ; first adapt coefficients. ; multiply the error by the stepSize --> x0 move #0.0001,x1 move x:92,x0 mpyr x0,x1,a move a,x0 move x:(r3),b y:(r5)+,y0 do #15,endloop_6 macr x0,y0,b move b,x:(r3)- move x:(r3),b y:(r5)+,y0 endloop_6 macr x0,y0,b move b,x:(r3) ; move current inputs into delayLine. move #93,r0 move y:75,r5 move x:(r0)+,y1 move y1,y:(r5)+ ; update delayLine pointer. move r5,y:75 ;oldest sample pointer ; now compute output. lua (r5)-,r5 nop clr a x:(r3)+,x0 y:(r5)-,y0 do #15,loop1_7 mac x0,y0,a x:(r3)+,x0 y:(r5)-,y0 loop1_7 macr x0,y0,a move a,x:91 move m7,m5 ;code from star DPCM.SwitchDelay1.switch1.HostButton.buttonType=checkbutton1 (class CG56HostButton) move x:96,x0 ; move value to output move x0,x:97 ;code from star DPCM.APCRx1.LMS2 (class CG56LMS) ; initialize address registers for coef and delayLine move #32+16-1,r3 ; insert here move y:76,r5 ; delayLine move #15,m5 ; first adapt coefficients. ; multiply the error by the stepSize --> x0 move #0.0001,x1 move x:92,x0 mpyr x0,x1,a move a,x0 move x:(r3),b y:(r5)+,y0 do #15,endloop_8 macr x0,y0,b move b,x:(r3)- move x:(r3),b y:(r5)+,y0 endloop_8 macr x0,y0,b move b,x:(r3) ; move current inputs into delayLine. move #95,r0 move y:76,r5 move x:(r0)+,y1 move y1,y:(r5)+ ; update delayLine pointer. move r5,y:76 ;oldest sample pointer ; now compute output. lua (r5)-,r5 nop clr a x:(r3)+,x0 y:(r5)-,y0 do #15,loop1_9 mac x0,y0,a x:(r3)+,x0 y:(r5)-,y0 loop1_9 macr x0,y0,a move a,x:94 move m7,m5 ;code from star DPCM.DPCMTX1.DPCMQuant1.switch51.HostMButton1 (class CG56HostMButton) move x:83,x0 ; move value to output move x0,x:84 ;code from star DPCM.DPCMTX1.DPCMQuant1.HostSlider1 (class CG56HostSlider) move x:82,x0 ; move value to output move x0,x:89 ;code from star DPCM.DPCMTX1.DPCMQuant1.Fork.output=42 (class AnyAsmFork) ;code from star DPCM.DPCMTX1.Fork.output=21 (class AnyAsmFork) ;code from star DPCM.DPCMTX1.Sub1 (class CG56Sub) move x:90,a move x:91,x0 sub x0,a move a,x:80 ;code from star DPCM.DPCMTX1.DPCMQuant1.Fork.output=41 (class AnyAsmFork) ;code from star DPCM.DPCMTX1.DPCMQuant1.auto-fork-60 (class AnyAsmFork) ;code from star DPCM.DPCMTX1.DPCMQuant1.QuantRange1 (class CG56QuantRange) move #<81,r0 move #>73,r4 move x:80,x0 move x:89,x1 move x:(r0),y0 move y:(r4)+,y1 mpy x1,y0,a mpy x1,y1,b cmp x0,a jge term_10 move y:(r4),y1 mpy x1,y1,b term_10 move b,x:85 ;code from star DPCM.DPCMTX1.DPCMQuant1.QuantRange2 (class CG56QuantRange) move #<71,r0 move #>70,r4 move x:80,x0 move x:89,x1 move x:(r0)+,y0 move y:(r4)+,y1 do #2-1,lab_11 mpy x1,y0,a mpy x1,y1,b cmp x0,a jlt again_12 enddo jmp term_13 again_12 move x:(r0)+,y0 move y:(r4)+,y1 lab_11 cmp x0,a jge term_13 move y:(r4),y1 mpy x1,y1,b term_13 move b,x:86 ;code from star DPCM.DPCMTX1.DPCMQuant1.QuantRange3 (class CG56QuantRange) move #<62,r0 move #>63,r4 move x:80,x0 move x:89,x1 move x:(r0)+,y0 move y:(r4)+,y1 do #6-1,lab_14 mpy x1,y0,a mpy x1,y1,b cmp x0,a jlt again_15 enddo jmp term_16 again_15 move x:(r0)+,y0 move y:(r4)+,y1 lab_14 cmp x0,a jge term_16 move y:(r4),y1 mpy x1,y1,b term_16 move b,x:87 ;code from star DPCM.DPCMTX1.DPCMQuant1.QuantRange4 (class CG56QuantRange) move #<48,r0 move #>48,r4 move x:80,x0 move x:89,x1 move x:(r0)+,y0 move y:(r4)+,y1 do #14-1,lab_17 mpy x1,y0,a mpy x1,y1,b cmp x0,a jlt again_18 enddo jmp term_19 again_18 move x:(r0)+,y0 move y:(r4)+,y1 lab_17 cmp x0,a jge term_19 move y:(r4),y1 mpy x1,y1,b term_19 move b,x:88 ;code from star DPCM.DPCMTX1.DPCMQuant1.switch51.Mux.input=51 (class CG56Mux) move #8,r0 move x:84,n0 nop move x:(r0+n0),r2 nop move x:(r2),x0 move x0,x:92 ;code from star DPCM.DPCMTX1.Fork.output=31 (class AnyAsmFork) ;code from star DPCM.APCRx1.Fork.output=24 (class AnyAsmFork) ;code from star DPCM.DPCMTX1.Add.input=21 (class CG56Add) move x:92,x0 ; 1st input -> x0 move x:91,a ; 2nd input -> a add x0,a move a,x:93 ; this move saturates ;code from star DPCM.APCRx1.Add.input=22 (class CG56Add) move x:92,x0 ; 1st input -> x0 move x:94,a ; 2nd input -> a add x0,a move a,x:95 ; this move saturates ;code from star DPCM.APCRx1.Fork.output=23 (class AnyAsmFork) ;code from star DPCM.SwitchDelay1.Fork.output=25 (class AnyAsmFork) ;code from star DPCM.SwitchDelay1.Delay1 (class CG56Delay) move x:95,x1 move y:77,r0 move #8000-1,m0 move y:(r0),y0 move x1,y:(r0)+ move r0,y:77 move y0,x:98 move #-1,m0 ;code from star DPCM.SwitchDelay1.switch1.Mux.input=21 (class CG56Mux) move #13,r0 move x:97,n0 nop move x:(r0+n0),r2 nop move x:(r2),x0 move x0,x:73 ;code from star DPCM.monoADDA1.Fork.output=21 (class AnyAsmFork) ;code from star DPCM.monoADDA1.SSI1 (class CG56SSI) move #ssi_0_buflen-1,m0 move x:ssi_0_recv_sptr,r0 nop jset #0,x:(r0),* ; Wait for slot to have data move x:(r0),y0 ; Get sample from buffer IF 0 bset #0,x:(r0)+ ; Mark slot as empty ENDIF move y0,x:90 IF 0 move y0,x:78 ENDIF move x:73,y0 IF 0 jclr #0,y:(r0),* ; Wait for slot to be empty ENDIF move y0,y:(r0) ; Put data there IF 0 bclr #0,y:(r0)+ ; Mark slot as full ELSE bset #0,x:(r0)+ ; Mark slot as empty ENDIF jset #0,x:(r0),* ; Wait for slot to have data move x:(r0),y0 ; Get sample from buffer IF 0 bset #0,x:(r0)+ ; Mark slot as empty ENDIF move y0,x:15 IF 0 move y0,x:79 ENDIF move x:73,y0 IF 0 jclr #0,y:(r0),* ; Wait for slot to be empty ENDIF move y0,y:(r0) ; Put data there IF 0 bclr #0,y:(r0)+ ; Mark slot as full ELSE bset #0,x:(r0)+ ; Mark slot as empty ENDIF move r0,x:ssi_0_recv_sptr move m7,m0 ;code from star DPCM.monoADDA1.BlackHole1 (class AnyAsmBlackHole) jmp LOOP_5 jmp ERROR ;Procedures Begin ; Interrupt handler for DPCM.monoADDA1.SSI1 ssi_0_intr move y0,x:ssi_0_savereg+0 ; Save y0, r0, m0 move r0,x:ssi_0_savereg+1 move m0,x:ssi_0_savereg+2 move #ssi_0_buflen-1,m0 move x:ssi_0_recv_iptr,r0 ; recv pointer move x:m_rx,y0 jset #0,x:(r0),doRecv_1 ; make sure recv slot empty IF 1 move #$123064,y0 ; its full...abort jmp ERROR ELSE ; just drop recv sample in y0 move y:-(r0),y0 ; go back two (stereo): prev tx sample move y:-(r0),y0 move y:15,r0 move y0,x:m_tx move (r0)+ move r0,y:15 jmp done_2 ENDIF doRecv_1 move y0,x:(r0) move y:(r0),y0 bclr #0,x:(r0)+ ; mark slot as used move y0,x:m_tx move r0,x:ssi_0_recv_iptr ; save updated pointer done_2 move x:ssi_0_savereg+0,y0 ; Restore y0, r0, m0 move x:ssi_0_savereg+1,r0 move x:ssi_0_savereg+2,m0 rti ;Procedures End ; --------------------- Symmetric memory map: ; Loc 0, length 8, state DPCM.monoADDA1.SSI1(buffer), type FIXARRAY (circular) ; Loc 8, length 5, state DPCM.DPCMTX1.DPCMQuant1.switch51.Mux.input=51(ptrvec), type INTARRAY ; Loc 13, length 2, state DPCM.SwitchDelay1.switch1.Mux.input=21(ptrvec), type INTARRAY ; --------------------- x memory map: ; Loc 15, length 1, port DPCM.monoADDA1.BlackHole1(input), type ANYTYPE (circular) ; Loc 16, length 16, state DPCM.DPCMTX1.LMS1(coef), type FIXARRAY ; Loc 32, length 16, state DPCM.APCRx1.LMS2(coef), type FIXARRAY ; Loc 48, length 14, state DPCM.DPCMTX1.DPCMQuant1.QuantRange4(thresholds), type FIXARRAY ; Loc 62, length 6, state DPCM.DPCMTX1.DPCMQuant1.QuantRange3(thresholds), type FIXARRAY ; Loc 68, length 3, state DPCM.monoADDA1.SSI1(saveReg), type FIXARRAY ; Loc 71, length 2, state DPCM.DPCMTX1.DPCMQuant1.QuantRange2(thresholds), type FIXARRAY ; Loc 73, length 1, port DPCM.monoADDA1.Fork.output=21(input), type ANYTYPE ; Loc 74, length 1, state DPCM.monoADDA1.SSI1(recvStarPtr), type INT ; Loc 75, length 1, state DPCM.monoADDA1.SSI1(xmitStarPtr), type INT ; Loc 76, length 1, state DPCM.monoADDA1.SSI1(recvIntrPtr), type INT ; Loc 77, length 1, state DPCM.monoADDA1.SSI1(xmitIntrPtr), type INT ; Loc 78, length 1, state DPCM.monoADDA1.SSI1(prevOut1), type FIX ; Loc 79, length 1, state DPCM.monoADDA1.SSI1(prevOut2), type FIX ; Loc 80, length 1, port DPCM.DPCMTX1.DPCMQuant1.Fork.output=41(input), type ANYTYPE ; Loc 81, length 1, state DPCM.DPCMTX1.DPCMQuant1.QuantRange1(thresholds), type FIXARRAY ; Loc 82, length 1, state DPCM.DPCMTX1.DPCMQuant1.HostSlider1(value), type FIX ; Loc 83, length 1, state DPCM.DPCMTX1.DPCMQuant1.switch51.HostMButton1(value), type FIX ; Loc 84, length 1, port DPCM.DPCMTX1.DPCMQuant1.switch51.Mux.input=51(control), type INT ; Loc 85, length 1, port DPCM.DPCMTX1.DPCMQuant1.switch51.Mux.input=51(input#2), type ANYTYPE ; Loc 86, length 1, port DPCM.DPCMTX1.DPCMQuant1.switch51.Mux.input=51(input#3), type ANYTYPE ; Loc 87, length 1, port DPCM.DPCMTX1.DPCMQuant1.switch51.Mux.input=51(input#4), type ANYTYPE ; Loc 88, length 1, port DPCM.DPCMTX1.DPCMQuant1.switch51.Mux.input=51(input#5), type ANYTYPE ; Loc 89, length 1, port DPCM.DPCMTX1.DPCMQuant1.Fork.output=42(input), type ANYTYPE ; Loc 90, length 1, port DPCM.DPCMTX1.Sub1(pos), type FIX ; Loc 91, length 1, port DPCM.DPCMTX1.Fork.output=21(input), type ANYTYPE ; Loc 92, length 1, port DPCM.DPCMTX1.Fork.output=31(input), type ANYTYPE ; Loc 93, length 1, port DPCM.DPCMTX1.LMS1(input), type FIX ; Loc 94, length 1, port DPCM.APCRx1.Add.input=22(input#2), type FIX ; Loc 95, length 1, port DPCM.APCRx1.Fork.output=23(input), type ANYTYPE ; Loc 96, length 1, state DPCM.SwitchDelay1.switch1.HostButton.buttonType=checkbutton1(value), type FIX ; Loc 97, length 1, port DPCM.SwitchDelay1.switch1.Mux.input=21(control), type INT ; Loc 98, length 1, port DPCM.SwitchDelay1.switch1.Mux.input=21(input#2), type ANYTYPE ; --------------------- y memory map: ; Loc 15, length 1, state DPCM.monoADDA1.SSI1(missCnt), type INT ; Loc 16, length 16, state DPCM.DPCMTX1.LMS1(delayLine), type INTARRAY (circular) ; Loc 32, length 16, state DPCM.APCRx1.LMS2(delayLine), type INTARRAY (circular) ; Loc 48, length 15, state DPCM.DPCMTX1.DPCMQuant1.QuantRange4(levels), type FIXARRAY ; Loc 63, length 7, state DPCM.DPCMTX1.DPCMQuant1.QuantRange3(levels), type FIXARRAY ; Loc 70, length 3, state DPCM.DPCMTX1.DPCMQuant1.QuantRange2(levels), type FIXARRAY ; Loc 73, length 2, state DPCM.DPCMTX1.DPCMQuant1.QuantRange1(levels), type FIXARRAY ; Loc 75, length 1, state DPCM.DPCMTX1.LMS1(delayLineStart), type INT ; Loc 76, length 1, state DPCM.APCRx1.LMS2(delayLineStart), type INT ; Loc 77, length 1, state DPCM.SwitchDelay1.Delay1(delayBufStart), type INT ; Loc 8192, length 8000, state DPCM.SwitchDelay1.Delay1(delayBuf), type FIXARRAY (circular)