[A83] Re: Map question


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

[A83] Re: Map question



Your code won't work!  ld (de),a is totally not what you're intending to do.  
That's loading it into the byte pointed to by de, not into the actual 
register pair de.   Plus you're discarding the top 3 bits of a, so if it's > 
31 you'll get an inaccurate value anyway.  What you want is this:

 ld l,a
 ld h,0        ;hl = a
 add hl,hl    ;hl = hl * 2
 add hl,hl    ;hl = hl * 2
 add hl,hl    ;hl = hl * 2
 ex de,hl
 ld ix,Tilestouse
 add ix,de

;and I'll just assume these are right since I've never used ionPutSprite
 ld b,8
 ld a,(tilex)
 ld l,(tiley)
 call ionPutSprite


And you can only set f with the stack because f is a flag byte, not a normal 
data register.  The flags are set by comparisons, mathematical operations, 
shifts/rotations, logical operators, etc.  This is the only mechanism the 
calculator has for conditional operation, so it would compromise the validity 
of the flags if you could haphazardly modify the flag register by using it 
for data.  Plus the data would get modified anyway if you did any of those 
operations listed above.


In a message dated 3/17/2001 7:39:58 PM Eastern Standard Time, 
Mike3465@aol.com writes:


> 
> No, i'm wanting to make my own(yes i'm that sort of person)
> I still see no reason why you said i can only set f with the stack, sence 
> i'm 
> not using it and all... and i ask you, if my code takes up 6 more bytes, 
> but 
> runs faster, is that a good trade off? this routine will be called quite a 
> bit
> 



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