A83: CP with register DE?


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

A83: CP with register DE?




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


Follow-Ups: