Hi. I'm looking at triggering interrupts upon the status of certain pins on the parallel port, something similar to pin interrupts on the Arduino or the Raspberry Pi. Is the TI capable of doing this? The E/A manual is very sketchy on the use of interrupts, but it does mention INT1 as an external interrupt for the 9901. Not sure how to use that info or whether it would even help me in the current situation...
You can't trigger anything direct from a pin on the parallel port because there is no connection from the parallel port to the interrupt circuitry. You can *poll* the parallel port for pin status but that's not what you're asking. /INT1 is an interrupt generated by one of the PEB cards, and I don't think there is any way you can usefully use that for what you're thinking of (unless you design your own PEB card).
You've got access to some of the interrupt pins on the TMS 9901 (/INT3 - /INT7) through the joystick interface, and you could use one of these to trigger an interrupt. You have the problem though of the processor interrupt code being hard-wired and so the processor only calls the interrupt service routine in the console ROM. It might be possible to hook into the user-defined interrupt service routine called from the VDP interrupt routine and use that to interrogate the interrupt pins on the TMS 9901, but then you might as well just directly interrogate the pins on the parallel port. Trying to use these pins on the joystick port in this way will also preclude use of the keyboard while you have anything connected to the joystick port.
If you're interested in experimenting, I've got some more of my TMS 9900 system PCBs on order and that gives you easy access to all the interrupt pins on the TMS 9901 and all the interrupt vectors. You can program the TMS 9901 either from Cortex BASIC or assembler. A little example program below. In this case the interrupt vector for /INT2 (the interrupt vectors are stored in the low area of ROM) is >8004 (which is in RAM in this system). The code places at >8004 a jump to the code at address MESSG. Each time an /INT2 interrupt occurs (just use a bit of wire to short the /INT2 pin on a header connector to ground) the code at address MESSG is run to print a message over the serial port.
*The following block of code has to be run by the user to initialise the interrupt routine.
AORG >80C0 Load code after the interrupt /INT2 entry point and workspace.
LWPI MYWS Load workspace.
*Store a branch instruction at the /INT2 code entry point to branch to the code to print a message.
LI R1,>0460 Op-code for Branch instruction.
*Enable /INT2 interrupts on the TMS 9901 and TMS 9900.
LI R12,>0040 CRU base address for the TMS 9901.
SBZ 0 Set Control bit to 0 to select interrupt mode.
SBO 2 Enable (unmask) /INT2 interrupt.
LIMI 2 Enable processor interrupt levels 0, 1 and 2.
*Return to TIBUG.
B @>0080 Quit back to TIBUG.
*The following block of code is called each time an /INT2 interrupt occurs.
*Code to print message.
MESSG EQU $
MOV R11,@SAVR11 Save R11.
CLR R12 CRU base address for the TMS 9902.
LI R1,MSGTXT Set pointer to text message.
BL @PMESSG Print message.
*** XOP @MSGTXT,14 Print message text. *** CAN'T USE AN XOP IN THE INTERRUPT ROUTINE.
MOV @SAVR11,R11 Restore R11.
LI R0,>8000 Timing loop to debounce the switch contact.
DBLOOP DEC R0
RTWP Return to calling routine.
*Print message subroutine.
PMESSG MOVB *R1+,R2 Copy character from text message and increment pointer.
JEQ EXIT If character is >00 then exit.
SBO 16 Set /RTS on.
WENTRY1 TB 22 Transmit buffer register empty?
JNE WENTRY1 No, loop until it is.
LDCR R2,8 Send character.
WLOOP1 TB 22 Transmit buffer register empty?
JNE WLOOP1 No, loop until it is.
JMP PMESSG Process next character in message.
EXIT B *R11 Return.
*Workspace and data.
MYWS BSS 32 Workspace.
SAVR11 DATA 0
MSGTXT BYTE >0D,>0A
TEXT 'An /INT2 interrupt has occurred.'
Edited by Stuart, Sat Sep 9, 2017 6:27 AM.