Re: A85: Pixel mover
[Prev][Next][Index][Thread]
Re: A85: Pixel mover
At 03:25 PM 11/11/97 -0500, Erik L Gillespie wrote:
>why would
>
>add a, $F9
>
>subtract 7 from a?
Simply:
$100-$F9 = 7
Because a is an 8-bit register, it will overflow
Complexly:
When the Z80 (or any other processor) subtracts, it performs the two's
complement on the number to be subtracted (in this case 7). This is done
by complementing the number and adding 1. Ex:
07h = 00000111
complement = 11111000
complement + 1 = 11111001 = $F9
It then adds this to the number or register to be subtracted from (in this
case a). So sub a,7 becomes add a,$F9
--
Brian Leech
butvis@mindspring.com
ICQ UIN: 1355611
Follow-Ups:
References: