Re: A86: Subtracting 2 16 bit vars


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

Re: A86: Subtracting 2 16 bit vars






Ahmed El-Helw wrote:

> hello,
> Thanks again for everyone's help and answering my questions, as I struggle
> through my project.. can someone tell me how to subtract two 16 bit vars?  I
> tried:
>
> ld hl,(var)
> ld de,-(cash)
> add hl,de               ;but SCabBy said it wouldn't work

Your compiler can't do this kind of arithmetic for you.

>
>
> he said do
>
> ld hl,(var)
> ld de,(cash)
> or a
> sbc hl,de
> ld (var),hl

This is right.  There's no reason why it shouldn't work.

>
>
> i tried that, didn't seem to work.. is this right, or did i do something
> wrong, or maybe I didn't interpret right?  Please help.  Thanks.
>                                                 -Ahmed
>
> --
> Ahmed El-Helw
> ahmedre@bellsouth.net
> http://asm8x.home.ml.org
> ICQ: 3350394




References: