Re: A82: Re: Check for a positive number


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

Re: A82: Re: Check for a positive number





-----Original Message-----
From: ilya winham <ilyamojo@geocities.com>
To: assembly-82@lists.ticalc.org <assembly-82@lists.ticalc.org>
Date: 11. oktober 1997 19:18
Subject: Re: A82: Re: Check for a positive number



>Dines Justesen wrote:
>>
>>  Check if the sign bit is set or not to find the sign of OP1. To see if
it
>> is 0 check wether the first two digits is 0.
>>
>> Dines
>
>Thanks, but how do I do that?
>
>
>
The following rutine checks wether the number in OP1 is <,> or = 0. I can
not remember wether the sign bit always is cleared when the number is 0, if
it is some things could be done easier.

LD A,(OP1) ; Get sign byte into A
AND $80 ; Isolate sign
JR NZ,Negative ; If sign bit is set number is negative
LD A,(OP1+2) ; Get first digits
OR A  ; Check if they are zero
JR Z,Zero
Positive:
..
Negative:
...
Zero:

Dines