Comparison of two number is done by checking value CY and ZF flags.
CY | ZF | |
(A) < (R) | 1 | 0 |
(A) = (R) | 0 | 1 |
(A) > (R) | 0 | 0 |
After compare two value CY and ZF are set or reset according to value and depend on this two flag we can identify value is less than, greater than or equal. One number is stored in C050h and other number is 05h.
If ((A) = (R) ) then
stored in C051h
else if ((A) < (R) ) then
stored in C052h
else if ((A) > (R)) then
stored in C053h
Program:
LXI H C050h
MOV A,M
CPI 05h
JZ NEXT
JC THIRD
STA C053h
HLT
NEXT: JNC SECOND
HLT
SECOND: STA C051h
HLT
THIRD: STA C052h
HLT
Input:
C050: 06h
Output:
C053: 06h
4 Comments
It's going to be ending of mine day, but before ending I am reading this fantastic piece of writing to improve my know-how.|
ReplyDeleteYou can certainly see your enthusiasm within the article you write. The world hopes for more passionate writers like you who are not afraid to say how they believe. All the time follow your heart.|
ReplyDeleteI'd like to find out more? I'd care to find out some additional information.|
ReplyDeleteI every time spent my half an hour to read this website's content every day along with
ReplyDeletea cup of coffee.