User's Manual

BASIC INSTRUCTION SET
15 14 13 12
11
10 9 8 7 6 5 4 3 2
STACK
WORD
PUSHF
decrements
SP
by 2 bytes
(1
word) and copies the contents
of
Ihe flag reglsler
10
Ihe
lop
of slack.
POPF
loads Ihe flag reg Isler
wllh
Ihe
conlenls
of
Ihe
lasl
word pushed
onlo
Ihe stack. The
bit
position
of
each flag Is the same
In
the stack word
as
It
Is
In
Ihe flag
register. Only programs executing
allhe
hlghesl privilege level (level 0) may alter the 2-blt
10PL
flag. Only programs executing
al
a
level at leasl as privileged
as
Ihallndlcated
by
10PL
may alter IF.
G30108
Figure 3-14.
PUSHF
and
POPF
Procedures may use this instruction
to
restore the flag status from a previous value.
Example: POPF
3.10
BINARY-CODED DECIMAL ARITHMETIC INSTRUCTIONS
These instructions adjust the results of a previous arithmetic operation to produce a valid packed or
unpacked decimal result. These instructions operate only
on
AL or AH registers.
3.10.1
Packed BCD Adjustment Instructions
DAA
(Decimal Adjust) corrects the result of adding two valid packed decimal operands
in
AL. DAA
must always follow the addition of two pairs of packed decimal numbers (one digit in each nibble) to
obtain a pair of valid packed decimal digits
as
results. The carry flag will be set if carry
was
needed.
Example: DAA
DAS
(Decimal
Adjust
for
Subtraction) corrects the result of subtracting
two
valid packed decimal
operands in AL.
DAS must always follow the subtraction of one pair of packed decimal numbers (one
digit in each nibble) from another
to
obtain a pair of valid packed decimal digits
as
results. The carry
flag
will
be set
if
a borrow was needed.
Example:
DAS
3.10.2
Unpacked BCD Adjustment Instructions
AAA
(ASCII
Adjust
for
Addition) changes the contents of register AL
to
a valid unpacked decimal
number, and zeros the top 4 bits. AAA must always follow the addition of two unpacked decimal
operands in AL. The carry flag
will
be set and AH will be incremented if a carry was necessary.
Example: AAA
3-27