awesome-cpus/386Intel/386INTEL.APB
2016-06-12 22:59:37 -04:00

248 lines
8.4 KiB
Plaintext

Appendix B Complete Flag Cross-Reference
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
Key to Codes
T = instruction tests flag
M = instruction modifies flag
(either sets or resets depending on operands)
0 = instruction resets flag
1 = instruction sets flag
ÄÄ = instruction's effect on flag is undefined
R = instruction restores prior value of flag
blank = instruction does not affect flag
Instruction OF SF ZF AF PF CF TF IF DF NT RF
AAA ÄÄ ÄÄ ÄÄ TM ÄÄ M
AAD ÄÄ M M ÄÄ M ÄÄ
AAM ÄÄ M M ÄÄ M ÄÄ
AAS ÄÄ ÄÄ ÄÄ TM ÄÄ M
ADC M M M M M TM
ADD M M M M M M
AND 0 M M ÄÄ M 0
ARPL M
BOUND
BSF/BSR ÄÄ ÄÄ M ÄÄ ÄÄ ÄÄ
BT/BTS/BTR/BTC ÄÄ ÄÄ ÄÄ ÄÄ ÄÄ M
CALL
CBW
CLC 0
CLD 0
CLI 0
CLTS
CMC M
CMP M M M M M M
CMPS M M M M M M T
CWD
DAA ÄÄ M M TM M TM
DAS ÄÄ M M TM M TM
DEC M M M M M
DIV ÄÄ ÄÄ ÄÄ ÄÄ ÄÄ ÄÄ
ENTER
ESC
HLT
IDIV ÄÄ ÄÄ ÄÄ ÄÄ ÄÄ ÄÄ
IMUL M ÄÄ ÄÄ ÄÄ ÄÄ M
IN
INC M M M M M
INS T
INT 0 0
INTO T 0 0
IRET R R R R R R R R R T
Jcond T T T T T
JCXZ
JMP
LAHF
LAR M
LDS/LES/LSS/LFS/LGS
LEA
LEAVE
LGDT/LIDT/LLDT/LMSW
LOCK
LODS T
LOOP
LOOPE/LOOPNE T
LSL M
LTR
MOV
MOV control, debug ÄÄ ÄÄ ÄÄ ÄÄ ÄÄ ÄÄ
MOVS T
MOVSX/MOVZX
MUL M ÄÄ ÄÄ ÄÄ ÄÄ M
NEG M M M M M M
NOP
NOT
OR 0 M M ÄÄ M 0
OUT
OUTS T
POP/POPA
POPF R R R R R R R R R R
PUSH/PUSHA/PUSHF
RCL/RCR 1 M TM
RCL/RCR count ÄÄ TM
REP/REPE/REPNE
RET
ROL/ROR 1 M M
ROL/ROR count ÄÄ M
SAHF R R R R R
SAL/SAR/SHL/SHR 1 M M M ÄÄ M M
SAL/SAR/SHL/SHR count ÄÄ M M ÄÄ M M
SBB M M M M M TM
SCAS M M M M M M T
SET cond T T T T T
SGDT/SIDT/SLDT/SMSW
SHLD/SHRD ÄÄ M M ÄÄ M M
STC 1
STD 1
STI 1
STOS T
STR
SUB M M M M M M
TEST 0 M M ÄÄ M 0
VERR/VERRW M
WAIT
XCHG
XLAT
XOR 0 M M ÄÄ M 0
Appendix C Status Flag Summary
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
Status Flags' Functions
Bit Name Function
0 CF Carry Flag ÄÄ Set on high-order bit carry or borrow; cleared
otherwise.
2 PF Parity Flag ÄÄ Set if low-order eight bits of result contain
an even number of 1 bits; cleared otherwise.
4 AF Adjust flag ÄÄ Set on carry from or borrow to the low order
four bits of AL; cleared otherwise. Used for decimal
arithmetic.
6 ZF Zero Flag ÄÄ Set if result is zero; cleared otherwise.
7 SF Sign Flag ÄÄ Set equal to high-order bit of result (0 is
positive, 1 if negative).
11 OF Overflow Flag ÄÄ Set if result is too large a positive number
or too small a negative number (excluding sign-bit) to fit in
destination operand; cleared otherwise.
Key to Codes
T = instruction tests flag
M = instruction modifies flag
(either sets or resets depending on operands)
0 = instruction resets flag
ÄÄ = instruction's effect on flag is undefined
blank = instruction does not affect flag
Instruction OF SF ZF AF PF CF
AAA ÄÄ ÄÄ ÄÄ TM ÄÄ M
AAS ÄÄ ÄÄ ÄÄ TM ÄÄ M
AAD ÄÄ M M ÄÄ M ÄÄ
AAM ÄÄ M M ÄÄ M ÄÄ
DAA ÄÄ M M TM M TM
DAS ÄÄ M M TM M TM
ADC M M M M M TM
ADD M M M M M M
SBB M M M M M TM
SUB M M M M M M
CMP M M M M M M
CMPS M M M M M M
SCAS M M M M M M
NEG M M M M M M
DEC M M M M M
INC M M M M M
IMUL M ÄÄ ÄÄ ÄÄ ÄÄ M
MUL M ÄÄ ÄÄ ÄÄ ÄÄ M
RCL/RCR 1 M TM
RCL/RCR count ÄÄ TM
ROL/ROR 1 M M
ROL/ROR count ÄÄ M
SAL/SAR/SHL/SHR 1 M M M ÄÄ M M
SAL/SAR/SHL/SHR count ÄÄ M M ÄÄ M M
SHLD/SHRD ÄÄ M M ÄÄ M M
BSF/BSR ÄÄ ÄÄ M ÄÄ ÄÄ ÄÄ
BT/BTS/BTR/BTC ÄÄ ÄÄ ÄÄ ÄÄ ÄÄ M
AND 0 M M ÄÄ M 0
OR 0 M M ÄÄ M 0
TEST 0 M M ÄÄ M 0
XOR 0 M M ÄÄ M 0
Appendix D Condition Codes
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
Note:
The terms "above" and "below" refer to the relation between two
unsigned values (neither SF nor OF is tested). The terms "greater" and
"less" refer to the relation between two signed values (SF and OF are
tested).
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
Definition of Conditions
(For conditional instructions Jcond, and SETcond)
Instruction Condition
Mnemonic Meaning Subcode Tested
O Overflow 0000 OF = 1
NO No overflow 0001 OF = 0
B Below
NAE Neither above nor equal 0010 CF = 1
NB Not below
AE Above or equal 0011 CF = 0
E Equal
Z Zero 0100 ZF = 1
NE Not equal
NZ Not zero 0101 ZF = 0
BE Below or equal
NA Not above 0110 (CF or ZF) = 1
NBE Neither below nor equal
NA Above 0111 (CF or ZF) = 0
S Sign 1000 SF = 1
NS No sign 1001 SF = 0
P Parity
PE Parity even 1010 PF = 1
NP No parity
PO Parity odd 1011 PF = 0
L Less
NGE Neither greater nor equal 1100 (SF xor OF) = 1
NL Not less
GE Greater or equal 1101 (SF xor OF) = 0
LE Less or equal
NG Not greater 1110 ((SF xor OF) or ZF) = 1
NLE Neither less nor equal
G Greater 1111 ((SF xor OF) or ZF) = 0