A82: a division problem


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

A82: a division problem



if I wanted to divide a number by 16 for the sprite routine that I am making
I would go
SLA b
SLA b
SLA b
SLA b
(I think)
To find the remainder would I check the carry flag after each SLA and then
combine that into a binary byte or something or would it just be easier to
subtract the answer from the original or something. To help you understand
what I am trying to say, I am making a sprite routine that will write a
sprite directly into the display port. Since I like to understand the
programs I use I generally write my own. This allows me to learn more about
programing too. So to find what column the sprite is in I have to divide the
x-pos (stored at b) by 16, then I have to move the sprite the remainder of
the way to the left. To do this I need to find the remainder. Or would it be
easier/faster to do 
push bc
SRA b
SRA b
SRA b
SRA b
ld a, b
pop bc
sub b