Re: A83: CP with register DE?


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

Re: A83: CP with register DE?




On 29-Jan-99, AtmaZ@aol.com (AtmaZ@aol.com) wrote:

>Hi all,

>What the sources on Z80 ASM have taught me is that CP only works with
register
>A.  However, the below usage of CP is contradictory to that rule...take a
look
>at this.

>Here's the code:

>call _getk         ; get keycode
>call _op2toop1  ; swap OPs
>call _convop1     ; put OP1 in -->DE<-- and not A
>cp  22      ; compare with [MODE] keycode
>ret   z              ; exit if pressed

>And this works, for some strange reason!  I hit MODE and the program exits.
>Can anybody tell me _why_ this works?

>Chances are that the answer is painfully obvious and I'm just slow,
but...hey,
>what the hell.

>--David

You are completely right, cp compares with a. So _convop1 must be putting the
result in a, not de. I've never used _convop1 so I don't know, really..

Linus

.--> ____
|    \OO/     -  -- --- ------ Linus Akesson -- http://fly.to/linus.world -.
`-OoO-\/-OoO---------------------------------------------------------------'
             God is real, unless specifically declared integer.
             ----> MrCookie v1.1 (text/misc/MrCookie.lha) <----



References: