A85: What's wrong with this code


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

A85: What's wrong with this code




The ASM I previously sent out appears to do absolutely nothing.  I press
Enter to run it on my calc (ZShell) and it sits there and locks the calc
up.  Occasionally it will print something like it's supposed to like
this:

L-a character
R-some other character
U-another character
D-and another character

but it always locks up and I have to remove the batteries.  Sometimes it
will clear the screen and I can see the busy indicator for awhile or it
will print ERROR: Undefined
but it always freezes up.

Here's the code in case you didn't see it the first time around:

#include "ti-85.h"

   .org  0
   .db   "Bit-pair test",  0

ClipLeft    = $80DF
ClipRight   = $80E0
ClipUp      = $80E1
ClipDown    = $80E2

InitClipping:
   ld    a, (SomeByte)
   ld    hl, ClipLeft
   ld    b, 4
   CALL_(SplitByte)

ShowClipping:
   ROM_CALL(CLEARLCD)

   sub   a
   ld    (CURSOR_ROW), a
   ld    (CURSOR_COL), a
   ld    a, 'L'
   ROM_CALL(TX_CHARPUT)
   ld    a, (ClipLeft)
   ROM_CALL(TX_CHARPUT)

   sub   a
   ld    (CURSOR_COL), a
   inc   a
   ld    (CURSOR_ROW), a
   ld    a, 'R'
   ROM_CALL(TX_CHARPUT)
   ld    a, (ClipRight)
   ROM_CALL(TX_CHARPUT)

   sub   a
   ld    (CURSOR_COL), a
   ld    a, 2
   ld    (CURSOR_ROW), a
   ld    a, 'U'
   ROM_CALL(TX_CHARPUT)
   ld    a, (ClipUp)
   ROM_CALL(TX_CHARPUT)

   sub   a
   ld    (CURSOR_COL), a
   ld    a, 3
   ld    (CURSOR_ROW), a
   ld    a, 'D'
   ROM_CALL(TX_CHARPUT)
   ld    a, (ClipDown)
   ROM_CALL(TX_CHARPUT)

WaitForExit:
   call  GET_KEY
   or    a
   jr    z, WaitForExit
   ret   z

SplitByte:
   rlca
   rlca
   push  af
   and   3
   ld    (hl), a
   inc   hl
   pop   af
   djnz  SplitByte

SomeByte:
   .db   %00011011

.end


egillespie@juno.com
erik_gillespie_1096@gwgate.kvcc.edu

"In a prototypical world, nothing ever goes wrong." -Scott Meyers

_____________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com
Or call Juno at (800) 654-JUNO [654-5866]


Follow-Ups: