A83: Re: Link port


[Prev][Next][Index][Thread]

A83: Re: Link port




>Are there any good link port tutorials available?  I would like to be able
>to send bytes through the link port on the TI-83 and Plus.

Below is a dump of TI-83 link information using ROM routines, these routines
require an error handler to be set up. If you want more "performant"
routines, you can look at the ztetris source code or contact me for my own.

Solignac Julien
x1cygnus@xcalc.org
http://xcalc.org

This brief look at the TI-83 link port shows how to access
        the port and use it for basic sending and receiving of bytes of
        data.

        The TI-83 link port uses 2 data lines, D0 & D1, for communicating.
        These data lines are accessed through the B-port of the Z80.
        The symbol BPORT is equated to the correct port value in
        the include file "TI83ASM.INC".

        Note :  THE DATA LINES ARE READ IN AS HIGH (1) WHEN NO

                ACTIVITY IS PRESENT ON THE DATA LINES.

                THE LOWER 2 BITS OF THE B-PORT, BITS 0 AND 1, ARE FOR
                WRITING TO THE DATA LINES.

                BITS 2 AND 3 OF THE B-PORT ARE FOR READING IN THE STATUS
                OF THE DATA LINES.


        Reading the data lines :


                IN      A,(BPORT)       ; READ THE VALUE OF THE B-PORT
                CP      0Ch             ; ANY DATA LINE GO LOW ?
                JR      Z,NO_ACTIVITY   ; IF READ 0Ch THEN NO LINES LOW

                CP      8               ; IS D0 PULLED LOW ?
                JR      Z,D0_LOW        ; YES, BIT 2 = 0 SO D0 IS LOW NOW
               ;
               ; ELSE BIT 3 WAS LOW (ACC=4), SO D1 IS LOW
               ;


        Writing to the data lines :

                There are symbols equated to the correct values
                to "OUT" to the B-PORT for controlling the
                status of the data lines.

                LD      A,D0LD1L

                OUT     (BPORT),A    ; is used for setting D0 low, D1 low

                LD      A,D0LD1H
                OUT     (BPORT),A    ; is used for setting D0 low, D1 high

                LD      A,D0HD1L
                OUT     (BPORT),A    ; is used for setting D0 high, D1 low

                LD      A,D0HD1H
                OUT     (BPORT),A    ; is used for setting D0 high, D1 high


        A few of the TI-83 system routines concerning the link port

        are availble for ASM use. These routines are accessed by making
        a call to the routine _IO_EXEC, with a value stored in the
        byte at ASM_IND_CALL (808Ch).

        _IO_EXEC = 51EFh

        D0LD1L      EQU              0C3h
        D0LD1H      EQU              0C1h
        D0HD1L      EQU              0C2h
        D0HD1H      EQU              0C0h
        BPORT       EQU              0



        ASM_IND_VALUE
        -------------

            19d         REC1STBYTE : This routine goes into idle

                                     or low power mode and waits for
                                     the data lines to change. Then
                                     reads a byte of data using the TI-83
                                     bit protocol. This only reads the 1st
                                     byte of data. The byte is returned
                                     in the accumlator.

            20d         REC1STBYTENC : The same as REC1STBYTE except

                                       that the cursor does not flash.
                                       The byte is returned in the
                                       accumulator.

            22d         RECABYTE     : This routine looks at the data
                                       lines for activity for about
                                       2 seconds and reads in a single
                                       byte of data. If no data is found

                                       an error will be generated.
                                       The byte is returned in the
                                       accumulator.

            11d         SENDABYTE    : This routine sends a byte of
                                       data across the data lines
                                       using the TI-83 bit protocol. If
                                       there is no response within about 2
                                       seconds an error is generated.

                                       The data to be sent needs to be in
                                       the accumulator.



------------------------------------------------------------------------

(c) Copyright 1997 Texas Instruments Incorporated. All rights reserved.
Trademarks