A85: Ugh... So, you guys sick of me yet? =)


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

A85: Ugh... So, you guys sick of me yet? =)




Now that I figured out what was wrong with my last problem, I found
another problem;  the same values are always being placed into ClipLeft,
ClipRight, ClipUp, and ClipDown.  It should print this:

L2
R2
U2
D2

But instead it prints this when the loop count is set to 3 (ld   b, 3):

L3
R2
U1
D0

Or it will print this when the loop count is set to 4 (ld   b, 4):

L3
R2
U1
D1

NOTE:  I also changed SomeByte to %10101010 but I've tried with other
values and they give the same results.

Anyway, here's the source:

#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)
   add   a, $30
   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)
   add   a, $30
   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)
   add   a, $30
   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)
   add   a, $30
   ROM_CALL(TX_CHARPUT)

WaitForExit:
   call  GET_KEY
   or    a
   jr    z, WaitForExit
   ret

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

SomeByte:
   .db   %10101010

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