Assembly is real open source .


bound

Usage: BOUND src,limit Modifies flags: None

Array index in source register is checked against upper and lower bounds in memory source. The first word located at 'limit' is the lower boundary and the word at 'limit+2' is the upper array bound. Interrupt 5 occurs if the source value is less than or higher than the source.

Check Array Index against Bounds

 

 

BOUND reg16,mem ; o16 62 /r [186]

BOUND reg32,mem ; o32 62 /r [386]

 

BOUND expects its second operand to point to an area of memory containing two signed values of the same size as its first operand (i.e. two words for the 16-bit form; two doublewords for the 32-bit form). It performs two signed comparisons: if the value in the register passed as its first operand is less than the first of the in-memory values, or is greater than or equal to the second, it throws a BR exception. Otherwise, it does nothing.

 

Example:

bound eax label

ret