Re: A82: i gots a kwestun 4 yous people


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

Re: A82: i gots a kwestun 4 yous people






On Mon, 2 Mar 1998, Barubary wrote:

> 
> >is there any way to detect a register overflow (like "jr o, label") with
> >the z80?  it could really help if there was an instruction... else, is
> >there a simple routine i can use?
> 
> If you are adding, the flag you are looking for is Carry.  All adds on a
> Z80 are 17 bits long (or 9 if you're doing an 8 bit add).  Carry is the
> highest bit.
> 
> Let's consider adding FFFF + FFFF, a combination bound to overflow.
> 
>    1111 1111 1111 1111
>  + 1111 1111 1111 1111
> -----------------------
>  1 1111 1111 1111 1110
>  ^ ^-----------------^
>  |   destination reg
>  carry flag
> 
> The one is "carried" past the destination, so it represents overflow.
> For an add, the instruction you want is "jr c, label".
> 
> -- Barubary
> 
thanx... i just needed it for a favor to a friend...

i know it's a little bit late to ask, but is it ok if i add in a high
score table of sorts to Fast Tunnel for personal usage?  My friends like
to compete in it, trying to get a high score, and that's the only way to
verify the score (good thing they don't know how to use a hexeditor!)...
they (and me) sometimes overflow the score, and we end up getting a really
crappy one instead.  I wanted to see if i could detect that overflow, and
display how many times it did so.  (no, i don't need a routine, thank
you.)

anyway, thanx again.

-Greg



References: