assembly to compare two numbers

Alex Gordon picture Alex Gordon · Jul 14, 2009 · Viewed 141.9k times · Source

What is the assembler syntax to determine which of two numbers is greater?

What is the lower level (machine code) for it? Can we go even lower? Once we get to the bit level, what happens? How is it represented in 0's and 1's?

Answer

Spencer Ruport picture Spencer Ruport · Jul 14, 2009

First a CMP (comparison) instruction is called then one of the following:

jle - jump to line if less than or equal to
jge - jump to line if greater than or equal to

The lowest assembler works with is bytes, not bits (directly anyway). If you want to know about bit logic you'll need to take a look at circuit design.