Jump to content

Photo

TI 99/4A interfacing


180 replies to this topic

#176 Vorticon OFFLINE  

Vorticon

    River Patroller

  • Topic Starter
  • 2,726 posts
  • Location:Eagan, MN, USA

Posted Sat Sep 9, 2017 12:22 AM

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...



#177 Stuart OFFLINE  

Stuart

    Dragonstomper

  • 692 posts
  • Location:Southampton, UK

Posted Sat Sep 9, 2017 6:23 AM

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.
        MOV  R1,@>8004
        LI   R1,MESSG
        MOV  R1,@>8006

*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
        JNE  DBLOOP

        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.'
        BYTE >0D,>0A
        BYTE >00

        END

Edited by Stuart, Sat Sep 9, 2017 6:27 AM.


#178 Vorticon OFFLINE  

Vorticon

    River Patroller

  • Topic Starter
  • 2,726 posts
  • Location:Eagan, MN, USA

Posted Sat Sep 9, 2017 8:13 AM

Great example, even though I really want to keep things on the actual TI. I did find on Thierry Nouspikel's site a mouse interface design that uses the LOAD interrupt line on the side expansion port to trigger a user interrupt when the mouse is moved, and then reading the joystick port which is connected to the mouse as well to read movement direction and button presses. Unfortunately, that requires having an interface board attached to the expansion port in order to gain access to the LOAD line... It's an option I suppose...

I'll have to think about this a bit more and see if I can get creative without having to use interrupts. I do have one of Jim Fetzner's PEB proto boards on hand which I could also use.



#179 Stuart OFFLINE  

Stuart

    Dragonstomper

  • 692 posts
  • Location:Southampton, UK

Posted Sat Sep 9, 2017 9:31 AM

Have you got a Horizon Ramdisk? That apparently has a hook for a user interrupt service routine, so you could possibly trigger interrupts through the joystick port and TMS 9901, and that will trigger the console ISR to run each PEB card ISR in turn to find the source. A hook into the Ramdisk ISR could check the TMS 9901 interrupt pins to see if one of your interrupts occurred. I don't fully understand how the Ramdisk card ISR works (the Ramdisk code is on Thiery's site) but it would be simple to modify the Ramdisk code to point directly to your ISR (at a known location in memory) and reload the Ramdisk code.



#180 apersson850 OFFLINE  

apersson850

    Moonsweeper

  • 418 posts

Posted Sat Sep 9, 2017 9:59 AM

On an original TI, this is difficult.

I can do it on mine, since I have either the capability to run it from one of my own PEB cards, either the /O card or the clock card, but they are my own designs. I also have more freedom in doing what I want with an interrupt, since I've modified my console to allow modification of the operating system ROM chips, which otherwise have full control over all interrupts except the LOAD one.



#181 Vorticon OFFLINE  

Vorticon

    River Patroller

  • Topic Starter
  • 2,726 posts
  • Location:Eagan, MN, USA

Posted Sat Sep 9, 2017 12:10 PM

Have you got a Horizon Ramdisk? That apparently has a hook for a user interrupt service routine, so you could possibly trigger interrupts through the joystick port and TMS 9901, and that will trigger the console ISR to run each PEB card ISR in turn to find the source. A hook into the Ramdisk ISR could check the TMS 9901 interrupt pins to see if one of your interrupts occurred. I don't fully understand how the Ramdisk card ISR works (the Ramdisk code is on Thiery's site) but it would be simple to modify the Ramdisk code to point directly to your ISR (at a known location in memory) and reload the Ramdisk code.

 

Yes, I saw that on Thierry's site. It's another option to look into...






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users