Intel 80286 Computer Accessories User Manual


 
NUMERIC PROGRAMMING EXAMPLES
i
CALCULATE
OFFSET
INTO
JUMP
TABLE
MOV
BH,O
i
CLEAR
UPPER
HALF
OF
BX,
MOV
Bl,AH i
lOAD
CONDITION
CODE
INTO
BL
AND
BL,OOOOOIIIB i
CLE~R
ALL
BITS
EXCEPT
C2-CO
AND
AH,01000000B i
CLEAR
ALL
BITS
EXCEPT
C3
SHR
AH,2
SHIFT
C3
TWO
PLACES
RIGHT
SAL
BX,1
SHIFT
C2-CO
1
PLACE
LEFT
(MULTIPLY
BY
2)
OR
Bl,AH
DROP
C3
BACK
IN
ADJACENT
TO
C2
(OOOXXXXO)
i
JUMP
TO
THE
ROUTINE
'ADDRESSED'
BY
CONDITION
CODE
JMP
FXAM_TBLIBXl
HERE
ARE
THE
JUMP
TARGETS,
ONE
TO
HANDLE
i
EACH
POSSIBLE
RESULT
OF
fXAM
PO
LU
N
NOR
M :
POS_NAN:
N E
LU
N
NOR
M :
N E
LN
AN:
PO
LN
0
RM:
POLINFINITY:
N E
LH
0
RM:
NELINFINITY:
PO
LZ
E:
R 0:
EMPTY:
NELZERO:
PO
LDE H 0
RM:
HELDENORM:
Figure 4-2. Conditional Branching
for
FXAM (Cont'd.)
EXCEPTION
HANDLING
EXAMPLES
There are many approaches to writing exception handlers. One useful technique
is
to consider the
exception handler procedure
as
consisting of "prologue," "body," and "epilogue" sections of code. (For
compatibility with the 80287 emulators, this procedure should be invoked by interrupt pointer (vector)
number 16.)
4-3