[A83] Re: 'pushing and popping' and grey_lib.zip
[Prev][Next][Index][Thread]
[A83] Re: 'pushing and popping' and grey_lib.zip
When you push a register and then pop it, the values are returned to their
'push'ed state:
ld b,8
ld c,-5
push bc
...(some other stuff)
pop bc
After that code, b = 8, c = -5
If you call a routine that destroys registers, you push the register, call
the routine, pop the register. Here is an example that will put a sprite
every 8 pixels at the top of the screen:
ld b,12
xor a
loop:
push af
push bc
ld l,0
ld b,8
ld ix,sprite
call ionputsprite
pop bc
pop af
add a,8
djnz loop
[that is not tested code, but it should work]
Hope this helps. if not, reply and I will see what I can do.
-joel