Load_4_Parameters IDNT ; title Rev 1-JUN-1994 SECTION Load_4_Parameters,4,C ; Declare a noncommon code ; section. Align to Longwords. INCLUDE 135Bug_Equates.Include ; Get the 135Bug "Sytem Calls". ************************************************************************* * This section defines program-specific macros: * * * * SOFTWAIT: Software delay timer for short waits * * * ************************************************************************* SoftWait MACRO ; Software timer loop. LOCAL WaitMore ; Define a local symbol. MOVE.L \1,D4 ; Load delay time \1 into D4. WaitMore SUBI.L #1,D4 ; Decrement loop counter. BNE WaitMore ; Test for end of delay. ENDM ; Called with an argument ; of $1000 and with cashe off causes a delay of about 4 ; mill seconds, with cashe on the delay is 2.4 mill sec. Start MOVE.L #1,D0 ; Get the Cashe running MOVEC D0,CACR MOVE.L #$F92C,D0 ; Enable the VSB Interface MOVE.L #$FFFA0000,A1 ; (as the Controller) MOVE.W D0,(A1) Loop MOVE.L #All_Init_OK,D5 ; Store the "all DSPs OK" ; flag in D5 PEA.L Hello_0_Loc ; push message address on stack. JSR ChrStrgOut ; and send it out. PEA.L Hello_1_Loc ; push message address on stack. JSR ChrStrgOut ; and send it out. PEA.L Hello_2_Loc ; push message address on stack. JSR ChrStrgOut ; and send it out. PEA.L Hello_Q_Loc ; push message address on stack. JSR ChrStrgOut ; and send it out. SOFTWAIT #$1000 ; Wait about 3 mill seconds. PEA.L CharSpace ; Push space and carage return message JSR ChrStrgOut ; on the stack and send it out. SUBQ.L #2,SP ; Allocate stack space for result SYSCALL .inchr ; Get a character MOVE.B (SP)+,D0 ; Put the character in D0 PEA.L Char_is_Loc ; push message address on stack JSR ChrStrgOut ; and send it out MOVE.L D0,-(A7) ; Put keypress on stack JSR SendCharP1 ; and send it out PEA.L CharSpace ; Push space and carage return message JSR ChrStrgOut ; on the stack and send it out. CMPI.B #'1',D0 ; is the character a "1"? Beq Param_Interrupts ; if yes, go to NMI Generator CMPI.B #'2',D0 ; is the character a "2"? Beq Error_Interrupts ; if yes, go to IIOF2 Generator CMPI.B #'Q',D0 ; is the character a "Q"? Beq Quit ; if yes, go to Quit routine CMPI.B #'q',D0 ; is the character a "q"? Beq Quit ; if yes, go to Quit routine PEA.L BadCharLoc ; push message address on stack. JSR ChrStrgOut ; and send it out. PEA.L CharSpace ; Push space and carage return message JSR ChrStrgOut ; on the stack and send it out. JMP Loop ; Go back! Param_Interrupts MOVEA.L #DSP_B1_ICR,A1 ; Put DSP #B1 Interrupt Control Reg ; Address in A1 MOVEA.L #LDSP_B1_to_TCC_Stat_Base_Address,A2 ; Put DSP #B1-to-TCC Status Address ; in A2 MOVE.L #$B1,D2 ; Put ID of DSP B1 in D2 JSR Load_Params ; Make NMI on B1 MOVEA.L #DSP_B2_ICR,A1 ; Put DSP #B2 Interrupt Control Reg ; Address in A1 MOVEA.L #GDSP_B2_to_TCC_Stat_Base_Address,A2 ; Put DSP #B2-to-TCC Status Address ; in A2 MOVE.L #$B2,D2 ; Put ID of DSP B2 in D2 JSR Load_Params ; Make NMI on B2 MOVEA.L #DSP_B3_ICR,A1 ; Put DSP #B3 Interrupt Control Reg ; Address in A1 MOVEA.L #LDSP_B3_to_TCC_Stat_Base_Address,A2 ; Put DSP #B3-to-TCC Status Address ; in A2 MOVE.L #$B3,D2 ; Put ID of DSP B3 in D2 JSR Load_Params ; Make NMI on B3 MOVEA.L #DSP_B4_ICR,A1 ; Put DSP #B4 Interrupt Control Reg ; Address in A1 MOVEA.L #LDSP_B4_to_TCC_Stat_Base_Address,A2 ; Put DSP #B4-to-TCC Status Address ; in A2 MOVE.L #$B4,D2 ; Put ID of DSP B4 in D2 JSR Load_Params ; Make NMI on B4 PEA.L CharSpace ; Push space and carage return message JSR ChrStrgOut ; on the stack and send it out. IF.L D5 #All_Init_OK THEN.S ; Send a "global" success or PEA.L All_OK_Loc ; failure message to the JSR ChrStrgOut ; console ELSE.S PEA.L Failure_Loc JSR ChrStrgOut ENDI JMP LOOP ; Go Back Error_Interrupts MOVEA.L #DSP_B1_ICR,A1 ; Put DSP #B1 Interrupt Control Reg ; Address in A1 JSR Generate_IIOF2 ; Make IIOF2 on B1 MOVEA.L #DSP_B2_ICR,A1 ; Put DSP #B2 Interrupt Control Reg ; Address in A1 JSR Generate_IIOF2 ; Make IIOF2 on B2 MOVEA.L #DSP_B3_ICR,A1 ; Put DSP #B3 Interrupt Control Reg ; Address in A1 JSR Generate_IIOF2 ; Make IIOF2 on B3 MOVEA.L #DSP_B4_ICR,A1 ; Put DSP #B4 Interrupt Control Reg ; Address in A1 JSR Generate_IIOF2 ; Make IIOF2 on B4 JMP LOOP ; Go Back Load_Params CLR.L D4 ; Clear the loop counter MOVE.L #Status_Invalid,(A2) ; Set the DSP-to-TCC Status ; Word invalid MOVE.B #Gen_NMI,D1 ; Set D1 to generate NMI MOVE.L D1,(A1) ; and program the DSP's ICR Check_Loop ; This is where we wait for ; the DSP to respond with ; either Status_OK or a ; Comm Port Warning. IF.L D4 #1000 THEN.S ; If we try too many times then JMP Param_Fail ; assume that the DSP is screwed ENDI ; up and jump to the parameter ; failure point ; if we get to this point we ; should continue looking at ; the status word MOVE.L (A2),D3 ; Get DSP-to-TCC Status Word IF.B D3 #255 THEN.S ; if the Status is still invalid ADDQ.L #1,D4 ; increment the loop counter and JMP Check_Loop ; go back to the top of the loop ENDI ; if we get to this point then ; the status word has been set ; by the DSP and we should ; examine it IF.B D3 #0 OR.B D3 #241 THEN.S ; If the message JMP Param_Success ; is either OK or ELSE.S ; a safe warning JMP Param_Fail ; then jump to the ENDI ; Success exit point ; otherwise jump ; to the Fail exit ; point Param_Success ; If we get to this point then ; the DSP initialized OK and we ; should send a message to the ; console PEA.L ParamOKIntro ; Send out "Params OK" message JSR ChrWrtOut ; Push Param OK message address ; on the stack and send message out. ROL.L #8,D2 ; Now send out the DSP ID. ROL.L #8,D2 ; Move DSP ID to MSByte of D2 ROL.L #8,D2 FOR.L D4 = #1 TO #2 DO.S ; Loop through both characters of ROL.L #4,D2 ; the DSP ID. Rotate left Move.L D2,-(A7) ; into position and push onto stack. JSR BinASCII ; Convert to ASCII and send it out. ENDF PEA.L StatWordIntro ; Send the Status Word message JSR ChrWrtOut ; Push Status word message address ; on the stack and send message out. FOR.L D4 = #1 TO #8 DO.S ; Now send out the Status word ROL.L #4,D3 ; Loop through all 8 chars of Move.L D3,-(A7) ; the Status Word Rotate left JSR BinASCII ; into position and push onto stack. ENDF ; Convert to ASCII and send it out. PEA.L MsgEndLine ; End the Version Number JSR ChrStrgOut ; message line. MOVE.B #Default_ICR1,D1 ; Set D1 to default ICR value MOVE.L D1,(A1) ; and program the DSP's ICR RTS Param_Fail ; If we get to this point then ; the DSP initialized OK and we ; should send a message to the ; console MOVE.L #Init_Failure,D5 ; Set the global "initialize failure" ; flag PEA.L ParamFAILIntro ; Send out "Params FAIL" msg. JSR ChrWrtOut ; Push Param FAIL msg address ; on the stack and send message out. ROL.L #8,D2 ; Now send out the DSP ID. ROL.L #8,D2 ; Move DSP ID to MSByte of D2 ROL.L #8,D2 FOR.L D4 = #1 TO #2 DO.S ; Loop through both characters of ROL.L #4,D2 ; the DSP ID. Rotate left Move.L D2,-(A7) ; into position and push onto stack. JSR BinASCII ; Convert to ASCII and send it out. ENDF PEA.L StatWordIntro ; Send the Status Word message JSR ChrWrtOut ; Push Status word message address ; on the stack and send message out. FOR.L D4 = #1 TO #8 DO.S ; Now send out the Status word ROL.L #4,D3 ; Loop through all 8 chars of Move.L D3,-(A7) ; the Status Word Rotate left JSR BinASCII ; into position and push onto stack. ENDF ; Convert to ASCII and send it out. PEA.L MsgEndLine ; End the Version Number JSR ChrStrgOut ; message line. MOVE.B #Default_ICR1,D1 ; Set D1 to default ICR value MOVE.L D1,(A1) ; and program the DSP's ICR RTS Generate_IIOF2 MOVE.B #Gen_IIOF2,D1 ; Set D1 to generate IIOF2 MOVE.L D1,(A1) ; and program the DSP's ICR PEA.L IIOF2_Service ; push message address on stack. JSR ChrStrgOut ; and send it out. PEA.L CharSpace ; Push space and carage return message JSR ChrStrgOut ; on the stack and send it out. MOVE.B #Default_ICR,D1 ; Set D1 to default ICR value MOVE.L D1,(A1) ; and program the DSP's ICR RTS Quit PEA.L Goodbye_Loc ; push message address on stack. JSR ChrStrgOut ; and send it out. PEA.L CharSpace ; Push space and carage return message JSR ChrStrgOut ; on the stack and send it out. SYSCALL .return Hello_0_Loc DC.B 50,' Hello from the Make-an-Interrupt Program ' Hello_1_Loc DC.B 50,' 1: Load Parameters on ALL 12 DSPS ' Hello_2_Loc DC.B 50,' 2: generate an IIOF2 on ALL 12 DSPS ' Hello_Q_Loc DC.B 50,' Q: exit this program (return to 135BUG) ' Char_is_Loc DC.B 50,' You have pressed the following key: ' BadCharLoc DC.B 50,' The key you pressed is illegal. ' NMI_Service DC.B 50,' NMI Service subroutine executed ' IIOF2_Service DC.B 50,' IIOF2 Service subroutine executed ' Goodbye_Loc DC.B 50,' Goodbye from the Make-an-Interrupt Program ' All_OK_Loc DC.B 50,' All DSPs have accepted their Parameters ' Failure_Loc DC.B 50,'**One or more DSPs have had a Parameter FAILURE***' ParamOKIntro DC.B 29,' Params OK for DSP ID ' ParamFAILIntro DC.B 29,' Params **FAIL** for DSP ID ' StatWordIntro DC.B 18,' Status Word is $' MsgEndLine DC.B 1,' ' CharSpace DC.B 4,' ' Low4Long DC.L $0000000F ; Low order 4 bits set, Mask for Sync. DSP_A1_ICR EQU $00A10810 DSP_A2_ICR EQU $00A10814 DSP_A3_ICR EQU $00A10818 DSP_A4_ICR EQU $00A1081C DSP_B1_ICR EQU $00B10810 DSP_B2_ICR EQU $00B10814 DSP_B3_ICR EQU $00B10818 DSP_B4_ICR EQU $00B1081C DSP_C1_ICR EQU $00C10810 DSP_C2_ICR EQU $00C10814 DSP_C3_ICR EQU $00C10818 DSP_C4_ICR EQU $00C1081C All_Init_OK EQU $00000000 Status_Invalid EQU $FFFFFFFF Init_Failure EQU $FFFFFFFF LDSP_A2_to_TCC_Stat_Base_Address EQU $00A07e40 ; Base Address of ; the "Status to LDSP_A3_to_TCC_Stat_Base_Address EQU $00A07e60 ; 68K Services" block ; for each of the LDSP_A4_to_TCC_Stat_Base_Address EQU $00A07e80 ; Local DSP and ; the Global DSP LDSP_A1_to_TCC_Stat_Base_Address EQU $00A07ea0 LDSP_B3_to_TCC_Stat_Base_Address EQU $00B07ec0 LDSP_B4_to_TCC_Stat_Base_Address EQU $00B07ee0 LDSP_B1_to_TCC_Stat_Base_Address EQU $00B07f00 LDSP_C3_to_TCC_Stat_Base_Address EQU $00C07f20 LDSP_C4_to_TCC_Stat_Base_Address EQU $00C07f40 LDSP_C1_to_TCC_Stat_Base_Address EQU $00C07f60 LDSP_C2_to_TCC_Stat_Base_Address EQU $00C07f80 GDSP_B2_to_TCC_Stat_Base_Address EQU $00B07fa0 Gen_IIOF2 EQU $14 Gen_NMI EQU $22 Default_ICR EQU $04 Default_ICR1 EQU $20 XREF ChrStrgOut,ChrWrtOut,BinASCII,SendCharP1 XDEF Low4Long END