Re: A82: Couple Z80 command questions
[Prev][Next][Index][Thread]
Re: A82: Couple Z80 command questions
> neg
This basically performs: a=-a , where a is a 2's compliment number. Valid
8 bit 2's comp numbers are all integers in the range [-128,127].
> scf
Sets the carry flag... that's it.
> Another question:
>
> Harper used this:
> ld hl,timer
> inc (hl)
>
> to equal this:
> ld a,(timer)
> inc a
> ld (timer),a
>
These basically do the same thing; namely, the value at the memory
location represented by "timer" is increased by 1. The only real
difference is the registers which are "destroyed". Of course, if the
contents of h and l don't matter, you should use the first bit of code,
it's 3 bytes shorter and runs fater. On the other hand, you're better off,
in general, using the second example if you're gonna just store hl on the
stack and then pop it again.
Oh and the reasonthe first one works is because hl is just a pointer to
that mem location, hence the parenthesis with the hl.
Jeremy Wazny
References: