Re: A83: Just Curious...


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

Re: A83: Just Curious...




I thought of that, but a negative number in our respect is simply
denoted by bit 7's value. So, how would you "add" the 0-6 as if they
were negative then??? It is the same as if they were positive.

Olle Hedman wrote:
> 
> A subtraction is normally done by adding a negative number.
> 
> //Olle
> 
> Scott Dial wrote:
> >
> > I was playing around the other day and I was thinking about how a byte
> > is added to another byte, and I wrote some z80 code that used bit-level
> > commands to add a byte to another (Basically, doesn't use add). I got to
> > trying to figure out subtracting and I got stumped... This really as no
> > point, but I was just wondering how a subtraction is performed. And,
> > don't bother telling me how "unoptimized" it is and I don't need some
> > smart-ass to say, "Why don't you just say 'add a,b'?"!
> >
> >  ld a,1
> >  ld b,1
> > AddAtoB:
> >  push bc
> >  push af
> >  xor b          ;XOR A and B
> >  pop de
> >  pop bc
> >  push af
> >  push de
> >  pop af
> >  and b          ;AND A and B
> >  rs             ;RS (AND A and B)
> >  pop bc         ;    |
> >  or b           ;OR -/ and B
> >  ret            ;A = A + B
> >
> > --
> > Scott "_Wrath_" Dial
> > homosapian@geocities.com
> > ICQ#3608935
> > http://www.geocities.com/~homosapian/

-- 
Scott "_Wrath_" Dial
homosapian@geocities.com
ICQ#3608935
http://www.geocities.com/~homosapian/
________________________________________________________
NetZero - We believe in a FREE Internet.  Shouldn't you?
Get your FREE Internet Access and Email at
http://www.netzero.net/download.html


Follow-Ups: References: