Problems setting link port in TI-83 Assembly


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

Problems setting link port in TI-83 Assembly



I have a parallel link and I have built software for the computer that can
communicate with the calculater.  The question I have is that I am also trying
to build a program for the calculator (in assembly) that allows a computer and
calculator program to contact back and forth.  I know how to read in and write
to the calc port (from the computer and the calculator), but the problem is
that if I set the port on the computer, the port will stay at the value
(high,high; low, high; etc.) until it is changed.  However, when the calculator
sets the port:

ld a, whatever value
out (BPORT), a        ; BPORT is 0


The port changes for a millisecond or so but then changes.  I have had success
in calling the _io_exec function with a "send byte instruction", but I am
trying to build my own communications protocol.  Does anyone know why the link
port would act  that way after being changed on the calculator.  Here is a
"snippet" of my source code.  Any help would be appreciated.
-GregoRaya@aol.com


The C++ code (key would be a bit to send, I have defined it for 0 and 1 but I
only show 0 here:

    switch( key )
    {

      case '0':
      {

        outportb(DataAddress,LowHighOut);  //These are constants I have defined

        while( ( inportb(StatusAddress) & OnlyCalcBits ) != LowLowIn );

        outportb(DataAddress,HighLowOut);

        while( ( inportb(StatusAddress) & OnlyCalcBits ) != HighHighIn );

      break;
      }


and here is the code that would handle this on the calculator (the WaitForBit
function is defined later:

BitIsLowHigh:

        ld      a, LowLow
        out     (BPORT), a

        ld      a, InHighLow
        call    WaitForBit
        jp      z, End

        ld      a, HighHigh
        out     (BPORT), a

        ld      l, 0
        ld      h, 0
        call    _disphl                 ;print bit received
        call    _newline

        jp      MainLoop


WaitForBit:                     ;bit is in a

        ld      h, 5            ;outer counter
        ld      bc, 0FFFFh
        ld      l, a

WaitingLoop:
        dec     bc
        ld      a, b
        or      c
        jp      nz, ContinueLoop

        ;else change outer loop
        ld      a, h
        sub     1
        or      a
        ret     z               ;leave in inner counter is 0
        ld      h, a            ;else restore updated counter into h
        ld      bc, 0FFFFh


ContinueLoop:

        in      a, (BPORT)
        and     InAndBits
        cp      l
        ld      a, 10           ;set a to a non 0 number to ensure that
        ret     z               ;caller can check if function worked or failed
        jp      WaitingLoop




Another question now that I think about it is that whenever I make a ROM call
(_disphl, etc.) the link port is set to high, high.  I have no idea why.

-GregoRaya@aol.com