Re: A85: Oh boy!!! Another question!!!


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

Re: A85: Oh boy!!! Another question!!!






On Tue, 12 May 1998 16:56:05 -0400, you wrote:

>
>Could you guys (and gals I suppose) help me with what's wrong with my ASM
>at the bottom of this message?:

What specifically is wrong (i.e. what type of problems are you
having)?

>Also, how do you know when you use CALL_, jr, etc.?
>Does this put Str1 to the screen or Str2?:
>
>ld	hl, (PROGRAM_ADDR)
>ld	de, Str1
>ld	a, 3
>cp	3
>ld	de, Str2
>add	hl, de
>ROM_CALL(D_ZT_STR)

a cp instruction only changes the value of the flag register.  to do
anything based on these flags, you must use a jr, call, or jp
instruction.  the cp instruction actually performs a subtraction on
the accumulator and the specified register or value.  so if you have:

ld a,3
cp 3		;3-3=0 so set (TRUE; make 1) the z flag
cp 2		;3-2=1 so reset (FALSE; make 0) the z flag

note: if you use a subtract instead of a cp, flags are still set, but
the value of the accumulator is changed.

-mike pearce


References: