how to do less than or equal to in 8085 Assembly language

1.2k views Asked by At

I'm not sure if all assembly is the same, I have looked this question up already and the language I saw looked different. I am learning to code for the 8085 microprocessor and need to know how take a byte stored in location 4050h and test if its less than or equal to 7Fh, if it is, I need to store 00h in location 5000h. If its greater than 7F, I need to store 01h in location 5000h. I don't need someone to do the whole thing for me, just point me in the right direction. Any help would be great :)

1

There are 1 answers

4
Alex Skalozub On

Unlike 8051 (which I'm used to), 8085 actually has CMP instruction to compare A with operand, but it is not needed in your case. Condition "less than or equal to 7Fh" actually means "has no bit 7 set", so you just need to rotate value left (so bit 7 becomes bit 0) and bit-and it with 01h.

So it would be something like:

LDA 4050h
RLC 
ANI 01h
STA 5000h