[A83] Re: tilemap: the theory?


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

[A83] Re: tilemap: the theory?



The opcode "cp" only takes one operand -- the value to compare to a.  
Consider:
  cp b   ; check if a = b
  cp 5   ; check if a = 5
  cp a   ; set zero flag, clear carry, etc

And i think you mean to be doing jp c or jr c, which uses the carry flag.  
Carry is set if a is less than the value you just compared it to, whereas m 
literally means the result has a minus sign (and the distinction _is_ 
important in some cases).

A revision of the code you have below:

;a = current tile
 cp 2                       ; 2 is the first non-passable tile value
 jr c,passable

not_passable:
  ;... code

passable:
  ;... other code


In a message dated 4/16/2001 3:42:37 PM Eastern Daylight Time, 
Mike3465@aol.com writes:


> 
> well, you could do this:
>     (a has the tile)
>     cp a,2
>     jp m,passable           ;if it's less then 2(the 'm'(minus)) go to 
> passable
>     cp a,(what ever the max number for nonpassable)
>     jp m,not_passable
>     ;continue on if you have "special" tiles
> 
> I hope that helps ^_^
> 
> the jp m, bassically checks to see if it's less then the number.



----
Jonah Cohen
<ComAsYuAre@aol.com>
http://jonah.ticalc.org