A82: Re: Couple Z80 command questions
[Prev][Next][Index][Thread]
A82: Re: Couple Z80 command questions
-----Original Message-----
From: Evil Sam <evil_sam@hotmail.com>
To: assembly-82@lists.ticalc.org <assembly-82@lists.ticalc.org>
Date: Tuesday, January 12, 1999 10:13 PM
Subject: A82: Couple Z80 command questions
>
>Ok, time for a few elementary questions. What do these do:
>neg
>scf
>
neg does the two's complement of a number.
scf sets the carry flag. this is useful for greater than 16 bit math
operations and i have used it to indicate a true or false when returning
from a function. do "scf" to set (TRUE) and "or a" to reset the carry flag
(FALSE).
>Another question:
>
>Harper used this:
> ld hl,timer
> inc (hl)
>
>to equal this:
> ld a,(timer)
> inc a
> ld (timer),a
>
> Does the first way work? It doesn't seem like it should because hl
>isn't loaded back into the variable. Also can HL be used set a z-flag?
> Sam
>
>
These two are equivalent (but the first is faster and uses less memory). A
pretty good general rule as to what sets the carry and zero flags is that if
the operation is on an 8-bit value and not a load type operation, it will
affect them. Therefore, both set the flags (the "inc (hl)" would because it
is incrementing the 8-bit value stored at the "timer" address).
-mike pearce