| ??? 04/24/99 20:54 Read: times |
#390 - RE: Greater then less then |
To compare two 16-bit values, use SUBB instruction. This method can be expanded to as many bytes as you wish (32-bits, 64 bits etc.).
Here is an example. We'll check if DPTR is greater than 083ch. SETB C MOV A,DPL SUBB A,#03CH MOV A,DPH SUBB A,#08H JC NOT_GREATER ;jump if not greater If Carry bit is set, DPTR is not greater than 083ch. Here is an example how to check, if DPTR equals 12f5h: MOV A,DPL CJNE A,#03CH,NOT_EQUAL ;jump if not equal MOV A,DPH CJNE A,#08H,NOT_EQUAL ;jump if not equal Now we will check if DPTR is less than 16-bit value ramptr (HI-byte first) CLR C MOV A,DPL SUBB A,ramptr+01H MOV A,DPH SUBB A,ramptr JNC NOT_LESS ;jump if not less |
| Topic | Author | Date |
| Greater then less then | 01/01/70 00:00 | |
| RE: Greater then less then | 01/01/70 00:00 | |
| RE: Greater then less then | 01/01/70 00:00 | |
| RE: Greater then less then | 01/01/70 00:00 | |
| RE: Greater then less then | 01/01/70 00:00 | |
RE: Greater then less then | 01/01/70 00:00 |



