Re: A83: Ti83 variables


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

Re: A83: Ti83 variables




In a message dated 99-05-27 18:15:05 EDT, Mike3465@AOL.COM writes:

> yes but what i'm tring to do would be sort of a pain to do that
>  i'm tring to create a map of an area so it wouldn't be so easy

>In a message dated 99-05-27 17:17:18 EDT, you write:
>
> you see, the .db is not doing anything more (or less) than defineing a byte 
> in
>  your program to a certain value. and when you put a label like "var" you 
are
>  giveing that byte's address a name.
>  It is the same thing when you make labels you jump to. They are just names 
> for
>  memoryaddresses.
>  so it is perfectly legal to do like this:
>  
>  var1	.db 0
>  var2  	.db 0
>  var3    .db 42
>  var3    .dw 47
>  
>  And I think you can understand how you use thoose :)
>  the last one ".dw" is defineing a word instead of a byte. (for loading 
into 
> hl
>  for example)
>  
>  //Olle
>  
>  
>  Mike3465@aol.com wrote:
>  > 
>  > in asm i know you can save a variable like for right back as this
>  >         ld a,20
>  >         ld (var),a
>  > var:
>  >         .db 0
>  > i also know you can have many variables in a thing like
>  > 
>  > var:
>  >         .db 0,0,0
>  > but what i was wondering is how you would load it into a variable and 
>  > how you can load a varibale to it.  If any one know please help
>  

What you may be wanting to know about, is using like an offset pointer to 
your array of data, like if this was your data...

var:  .db 2,1,6,0,3,4,

Then (var+0) is a '2' and (var+4) is a '3', for example.

To find the value you want, knowing which spot its at in that array, you put 
the offset value into A. say you wanted to get the value at the 3rd spot in 
there, do...

   ld a, 2  \  ld d, 0  \  ld e, a
   ld hl, var  \  add hl, de
   ld a, (hl)

and then you have the value in the 3rd byte of the array, into A. keep in 
mind that the 1st spot is at an offset of '0' not a '1' because that is where 
the label is assigned to directly... I hope that could be of help so you can 
progress in your program...

Jason_K

P.S. - If anybody wants to see something really funny momentarily, goto 
"http://www.tricity.wsu.edu/~jangeles/funny/funny1.htm". it was so hilarious, 
I was LMAO for like 5 minutes... ;)  Disclaimer:  If you find stuff offensive 
easily, then dont goto that site cuz its sort of a dirty joke... =P
   


Follow-Ups: