A85: Oh boy!!! Another question!!!


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

A85: Oh boy!!! Another question!!!




Could you guys (and gals I suppose) help me with what's wrong with my ASM
at the bottom of this message?:

Also, how do you know when you use CALL_, jr, etc.?
Does this put Str1 to the screen or Str2?:

ld	hl, (PROGRAM_ADDR)
ld	de, Str1
ld	a, 3
cp	3
ld	de, Str2
add	hl, de
ROM_CALL(D_ZT_STR)

I ask this because I had previously thought that if a CP X statement was
true it ran the next line of code otherwise it skipped it, but now I am
thinking otherwise because I have only seen a CP X with a JR Z, X
following it.  Am I right when I think that CP X sets a flag to zero if
it is true?

/////////////////////////////////////////////////////////////////////////////////////////////////////

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