Re: A86: input command


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

Re: A86: input command



Butler Family wrote:

> Is there an asm version of the input command?  Also could someone
> explain to me the cp command and how to use it to find if  a is
> greater
> than b (those r just example variables)
>
> Thanx in advance,
>                     Patrick Butler

  the cp commend basically "returns" the value of a-[whatever you put
after cp]

ex:  cp a,21  ; this is = to a-21 , but a remains a not a-21..

   to find if a>b is EASY:

   ld a,##      ; some number
   ld b,##      ; some number
   cp a,b       ;  a-b
   jr m,BGA ;m is if the [M]inus flag was set  (b>a....  therefore a-b =
-#)
   jr z,AEB   ;z is if the [Z]ero flag was set (a=b... therefore a-b=0)
   jr AGB     ;if neither of those MUST be a>b
BGA:           ; if B is Greater then A
   ; do somthing here
   jr DONE
AEB:           ; if A Equals B
   ; do somthing here
   jr DONE
AGB:          ; if A is greater than B
  ; so somthing here
DONE:


hope that helps




References: