Instruction Set
4-90
JE
JE
Examples
This example reads a character from the serial port, and then uses that character to select
a menu item. CMP, JE, and JMP implement a construct equivalent to the C-language
switch
statement.
Tips
If you need to jump to an instruction at
farlabel that is more than 128 bytes away, use the
following sequence of statements:
JNE nearlabel
; This does the equivalent of a long jump
JMP farlabel
; based on the JE condition.
nearlabel:
Related Instructions
If you want to
See
Compare two components using subtraction and set the flags accordingly
CMP
Jump unconditionally
JMP
Jump if the result of a previous integer or unsigned comparison was
not equal
JNE
Set the flags according to whether particular bits of a component are set to 1
TEST
; display menu and read character from serial port into AX
MENU:
mREAD_SPORT_CHAR
; read character into AX (macro)
CMP
AX,’1’
; did user select item 1?
JE
ITEM1
; if so, then jump
CMP
AX,’2’
; did user select item 2?
JE
ITEM2
; if so, then jump
; if user didn’t select valid item, jump back to menu
JMP
MENU
ITEM1:
...
ITEM2:
...
Содержание Am186 Series
Страница 1: ...Am186 and Am188 Family Instruction Set Manual February 1997...
Страница 10: ...Table of Contents x...
Страница 18: ...Programming 1 8...
Страница 40: ...Instruction Set Listing 3 14...