Generate_Interrupt IDNT ; title Rev 19-JUL-1994 SECTION Generate_Interrupt,4,C ; Declare a noncommon code ; section. Align to Longwords. * FOR 133 VERSION UNCOMMENT THE FOLLOWING LINE INCLUDE 133Bug_Equates.Include ; Get the 133Bug "Sytem Calls". * FOR 135 VERSION UNCOMMENT THE FOLLOWING LINE * 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 * FOR 135 VERSION UNCOMMENT THE FOLLOWING 3 LINES * MOVE.L #$F92C,D0 ; Enable the VSB Interface * MOVE.L #$FFFA0000,A1 ; (as the Controller) * MOVE.W D0,(A1) Loop 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_3_Loc ; push message address on stack. JSR ChrStrgOut ; and send it out. PEA.L Hello_4_Loc ; push message address on stack. JSR ChrStrgOut ; and send it out. PEA.L Hello_5_Loc ; push message address on stack. JSR ChrStrgOut ; and send it out. PEA.L Hello_6_Loc ; push message address on stack. JSR ChrStrgOut ; and send it out. PEA.L Hello_7_Loc ; push message address on stack. JSR ChrStrgOut ; and send it out. PEA.L Hello_8_Loc ; push message address on stack. JSR ChrStrgOut ; and send it out. PEA.L Hello_9_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 Generate_B1_NMI ; if yes, go to DSP B1 NMI Generator CMPI.B #'2',D0 ; is the character a "2"? Beq Generate_B1_IIOF2 ; if yes, go to DSP B1 IIOF2 Generator CMPI.B #'3',D0 ; is the character a "3"? Beq Generate_B2_NMI ; if yes, go to DSP B2 NMI Generator CMPI.B #'4',D0 ; is the character a "4"? Beq Generate_B2_IIOF2 ; if yes, go to DSP B2 IIOF Generator CMPI.B #'5',D0 ; is the character a "5"? Beq Generate_B3_NMI ; if yes, go to DSP B3 NMI Generator CMPI.B #'6',D0 ; is the character a "6"? Beq Generate_B3_IIOF2 ; if yes, go to DSP B3 IIOF2 Generator CMPI.B #'7',D0 ; is the character a "7"? Beq Generate_B4_NMI ; if yes, go to DSP B4 NMI Generator CMPI.B #'8',D0 ; is the character a "8"? Beq Generate_B4_IIOF2 ; if yes, go to DSP B4 IIOF Generator CMPI.B #'9',D0 ; is the character a "9"? Beq VSB_Write ; if yes, go to VSB Write 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! VSB_Write MOVE.L #$FFFFFFFF,$1000004 ; Make a VSB Write Access JMP Loop Generate_B1_NMI MOVEA.L #DSP_1_ICR,A1 ; Put DSP #1 Interrupt Control Reg ; Address in A1 JMP Generate_NMI Generate_B2_NMI MOVEA.L #DSP_2_ICR,A1 ; Put DSP #2 Interrupt Control Reg ; Address in A1 JMP Generate_NMI Generate_B3_NMI MOVEA.L #DSP_3_ICR,A1 ; Put DSP #3 Interrupt Control Reg ; Address in A1 JMP Generate_NMI Generate_B4_NMI MOVEA.L #DSP_4_ICR,A1 ; Put DSP #4 Interrupt Control Reg ; Address in A1 JMP Generate_NMI Generate_B1_IIOF2 MOVEA.L #DSP_1_ICR,A1 ; Put DSP #1 Interrupt Control Reg ; Address in A1 JMP Generate_IIOF2 Generate_B2_IIOF2 MOVEA.L #DSP_2_ICR,A1 ; Put DSP #2 Interrupt Control Reg ; Address in A1 JMP Generate_IIOF2 Generate_B3_IIOF2 MOVEA.L #DSP_3_ICR,A1 ; Put DSP #3 Interrupt Control Reg ; Address in A1 JMP Generate_IIOF2 Generate_B4_IIOF2 MOVEA.L #DSP_4_ICR,A1 ; Put DSP #4 Interrupt Control Reg ; Address in A1 JMP Generate_IIOF2 Generate_NMI MOVE.B #Gen_NMI,D1 ; Set D1 to generate NMI MOVE.L D1,(A1) ; and program the DSP's ICR PEA.L NMI_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_ICR1,D1 ; Set D1 to default ICR value MOVE.L D1,(A1) ; and program the DSP's ICR JMP Loop 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 JMP Loop 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 ALIGN 4 Hello_0_Loc DC.B 50,' Hello from the Make-an-Interrupt Program ' Hello_1_Loc DC.B 50,' 1: generate a NMI on DSP B1 ' Hello_2_Loc DC.B 50,' 2: generate an IIOF2 on DSP B1 ' Hello_3_Loc DC.B 50,' 3: generate a NMI on DSP B2 ' Hello_4_Loc DC.B 50,' 4: generate an IIOF2 on DSP B2 ' Hello_5_Loc DC.B 50,' 5: generate a NMI on DSP B3 ' Hello_6_Loc DC.B 50,' 6: generate an IIOF2 on DSP B3 ' Hello_7_Loc DC.B 50,' 7: generate a NMI on DSP B4 ' Hello_8_Loc DC.B 50,' 8: generate an IIOF2 on DSP B4 ' Hello_9_Loc DC.B 50,' 9: generate a VSB Write to 1000004 ' 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 ' CharSpace DC.B 4,' ' Low4Long DC.L $0000000F ; Low order 4 bits set, Mask for Sync. DSP_1_ICR EQU $00B10810 DSP_2_ICR EQU $00B10814 DSP_3_ICR EQU $00B10818 DSP_4_ICR EQU $00B1081C Gen_IIOF2 EQU $14 Gen_NMI EQU $22 Default_ICR EQU $04 Default_ICR1 EQU $20 XREF ChrStrgOut,ChrWrtOut,BinASCII,SendCharP1 XDEF Low4Long END