📄 8086_instruction_set.html
字号:
Load memory double word into word register and ES.<BR><BR>Algorithm:<BR><BR><FONT FACE="Fixedsys"><UL> <LI>REG = first word</LI> <LI>ES = second word</LI></UL></FONT><BR>Example:<PRE><FONT FACE="Fixedsys">#make_COM#ORG 100hLES AX, mRETm DW 1234h DW 5678hEND</FONT></PRE>AX is set to 1234h, ES is set to 5678h.<BR><BR><FONT FACE="Fixedsys"><TABLE BORDER=1 NOSHADE><TR> <TD>C</TD> <TD>Z</TD> <TD>S</TD> <TD>O</TD> <TD>P</TD> <TD>A</TD> </TR><TR> <TD COLSPAN=6>unchanged</TD> </TR></TABLE></FONT> <A NAME="LODSB"> </A></TD></TR><TR><TD><FONT FACE="Fixedsys">LODSB</FONT></TD><TD>No operands</TD><TD>Load byte at DS:[SI] into AL. Update SI.<BR><BR>Algorithm:<BR><BR><FONT FACE="Fixedsys"><UL><LI>AL = DS:[SI]<BR></LI><LI>if DF = 0 then <UL> <LI>SI = SI + 1</LI> </UL> else <UL> <LI>SI = SI - 1</LI> </UL></LI></UL></FONT>Example:<PRE><FONT FACE="Fixedsys">#make_COM#ORG 100hLEA SI, a1MOV CX, 5MOV AH, 0Ehm: LODSBINT 10hLOOP mRETa1 DB 'H', 'e', 'l', 'l', 'o'</FONT></PRE><FONT FACE="Fixedsys"><TABLE BORDER=1 NOSHADE><TR> <TD>C</TD> <TD>Z</TD> <TD>S</TD> <TD>O</TD> <TD>P</TD> <TD>A</TD> </TR><TR> <TD COLSPAN=6>unchanged</TD> </TR></TABLE></FONT> <A NAME="LODSW"> </A></TD></TR><TR><TD><FONT FACE="Fixedsys">LODSW</FONT></TD><TD>No operands</TD><TD>Load word at DS:[SI] into AX. Update SI.<BR><BR>Algorithm:<BR><BR><FONT FACE="Fixedsys"><UL><LI>AX = DS:[SI]<BR></LI><LI>if DF = 0 then <UL> <LI>SI = SI + 2</LI> </UL> else <UL> <LI>SI = SI - 2</LI> </UL></LI></UL></FONT>Example:<PRE><FONT FACE="Fixedsys">#make_COM#ORG 100hLEA SI, a1MOV CX, 5REP LODSW ; finally there will be 555h in AX.RETa1 dw 111h, 222h, 333h, 444h, 555h</FONT></PRE><FONT FACE="Fixedsys"><TABLE BORDER=1 NOSHADE><TR> <TD>C</TD> <TD>Z</TD> <TD>S</TD> <TD>O</TD> <TD>P</TD> <TD>A</TD> </TR><TR> <TD COLSPAN=6>unchanged</TD> </TR></TABLE></FONT> <A NAME="LOOP"> </A></TD></TR><TR><TD><FONT FACE="Fixedsys">LOOP</FONT></TD><TD><FONT FACE="Fixedsys"> <NOBR>label</NOBR></FONT></TD><TD>Decrease CX, jump to label if CX not zero. <BR><BR>Algorithm:<BR><BR><FONT FACE="Fixedsys"><UL><LI>CX = CX - 1<BR></LI><LI>if CX <> 0 then <UL> <LI>jump</LI> </UL> else <UL> <LI>no jump, continue</LI> </UL></LI></UL></FONT>Example:<PRE><FONT FACE="Fixedsys"> include 'emu8086.inc' #make_COM# ORG 100h MOV CX, 5label1: PRINTN 'loop!' LOOP label1 RET</FONT></PRE> <FONT FACE="Fixedsys"> <TABLE BORDER=1 NOSHADE> <TR> <TD>C</TD> <TD>Z</TD> <TD>S</TD> <TD>O</TD> <TD>P</TD> <TD>A</TD> </TR> <TR> <TD COLSPAN=6>unchanged</TD> </TR> </TABLE> </FONT> <A NAME="LOOPE"> </A></TD></TR><TR><TD><FONT FACE="Fixedsys">LOOPE</FONT></TD><TD><FONT FACE="Fixedsys"> <NOBR>label</NOBR></FONT></TD><TD>Decrease CX, jump to label if CX not zero and Equal (ZF = 1). <BR><BR>Algorithm:<BR><BR><FONT FACE="Fixedsys"><UL><LI>CX = CX - 1<BR></LI><LI>if (CX <> 0) and (ZF = 1) then <UL> <LI>jump</LI> </UL> else <UL> <LI>no jump, continue</LI> </UL></LI></UL></FONT>Example:<PRE><FONT FACE="Fixedsys">; Loop until result fits into AL alone,; or 5 times. The result will be over 255; on third loop (100+100+100),; so loop will exit. include 'emu8086.inc' #make_COM# ORG 100h MOV AX, 0 MOV CX, 5label1: PUTC '*' ADD AX, 100 CMP AH, 0 LOOPE label1 RET</FONT></PRE><FONT FACE="Fixedsys"><TABLE BORDER=1 NOSHADE><TR> <TD>C</TD> <TD>Z</TD> <TD>S</TD> <TD>O</TD> <TD>P</TD> <TD>A</TD> </TR><TR> <TD COLSPAN=6>unchanged</TD> </TR></TABLE></FONT> <A NAME="LOOPNE"> </A></TD></TR><TR><TD><FONT FACE="Fixedsys">LOOPNE</FONT></TD><TD><FONT FACE="Fixedsys"> <NOBR>label</NOBR></FONT></TD><TD>Decrease CX, jump to label if CX not zero and Not Equal (ZF = 0). <BR><BR>Algorithm:<BR><BR><FONT FACE="Fixedsys"><UL><LI>CX = CX - 1<BR></LI><LI>if (CX <> 0) and (ZF = 0) then <UL> <LI>jump</LI> </UL> else <UL> <LI>no jump, continue</LI> </UL></LI></UL></FONT>Example:<PRE><FONT FACE="Fixedsys">; Loop until '7' is found,; or 5 times. include 'emu8086.inc' #make_COM# ORG 100h MOV SI, 0 MOV CX, 5label1: PUTC '*' MOV AL, v1[SI] INC SI ; next byte (SI=SI+1). CMP AL, 7 LOOPNE label1 RET v1 db 9, 8, 7, 6, 5</FONT></PRE><FONT FACE="Fixedsys"><TABLE BORDER=1 NOSHADE><TR> <TD>C</TD> <TD>Z</TD> <TD>S</TD> <TD>O</TD> <TD>P</TD> <TD>A</TD> </TR><TR> <TD COLSPAN=6>unchanged</TD> </TR></TABLE></FONT> <A NAME="LOOPNZ"> </A></TD></TR><TR><TD><FONT FACE="Fixedsys">LOOPNZ</FONT></TD><TD><FONT FACE="Fixedsys"> <NOBR>label</NOBR></FONT></TD><TD>Decrease CX, jump to label if CX not zero and ZF = 0. <BR><BR>Algorithm:<BR><BR><FONT FACE="Fixedsys"><UL><LI>CX = CX - 1<BR></LI><LI>if (CX <> 0) and (ZF = 0) then <UL> <LI>jump</LI> </UL> else <UL> <LI>no jump, continue</LI> </UL></LI></UL></FONT>Example:<PRE><FONT FACE="Fixedsys">; Loop until '7' is found,; or 5 times. include 'emu8086.inc' #make_COM# ORG 100h MOV SI, 0 MOV CX, 5label1: PUTC '*' MOV AL, v1[SI] INC SI ; next byte (SI=SI+1). CMP AL, 7 LOOPNZ label1 RET v1 db 9, 8, 7, 6, 5</FONT></PRE><FONT FACE="Fixedsys"><TABLE BORDER=1 NOSHADE><TR> <TD>C</TD> <TD>Z</TD> <TD>S</TD> <TD>O</TD> <TD>P</TD> <TD>A</TD> </TR><TR> <TD COLSPAN=6>unchanged</TD> </TR></TABLE></FONT> <A NAME="LOOPZ"> </A></TD></TR><TR><TD><FONT FACE="Fixedsys">LOOPZ</FONT></TD><TD><FONT FACE="Fixedsys"> <NOBR>label</NOBR></FONT></TD><TD>Decrease CX, jump to label if CX not zero and ZF = 1. <BR><BR>Algorithm:<BR><BR><FONT FACE="Fixedsys"><UL><LI>CX = CX - 1<BR></LI><LI>if (CX <> 0) and (ZF = 1) then <UL> <LI>jump</LI> </UL> else <UL> <LI>no jump, continue</LI> </UL></LI></UL></FONT>Example:<PRE><FONT FACE="Fixedsys">; Loop until result fits into AL alone,; or 5 times. The result will be over 255; on third loop (100+100+100),; so loop will exit. include 'emu8086.inc' #make_COM# ORG 100h MOV AX, 0 MOV CX, 5label1: PUTC '*' ADD AX, 100 CMP AH, 0 LOOPZ label1 RET</FONT></PRE><FONT FACE="Fixedsys"><TABLE BORDER=1 NOSHADE><TR> <TD>C</TD> <TD>Z</TD> <TD>S</TD> <TD>O</TD> <TD>P</TD> <TD>A</TD> </TR><TR> <TD COLSPAN=6>unchanged</TD> </TR></TABLE></FONT> <A NAME="MOV"> </A></TD></TR><TR><TD><FONT FACE="Fixedsys">MOV</FONT></TD><TD><FONT FACE="Fixedsys"> <NOBR> REG, memory<BR> memory, REG<BR> REG, REG<BR> memory, immediate<BR> REG, immediate<BR><BR> SREG, memory<BR> memory, SREG<BR> REG, SREG<BR> SREG, REG </NOBR></FONT></TD><TD>Copy operand2 to operand1.<BR><BR>The MOV instruction <U>cannot</U>:<UL><LI>set the value of the CS and IP registers.</LI><LI>copy value of one segment register to another segment register (should copy to general register first).</LI><LI>copy immediate value to segment register (should copy to general register first).</LI></UL><BR>Algorithm:<BR><BR><FONT FACE="Fixedsys"><BLOCKQUOTE>operand1 = operand2</BLOCKQUOTE></FONT>Example:<PRE><FONT FACE="Fixedsys">#make_COM#ORG 100hMOV AX, 0B800h ; set AX = B800h (VGA memory).MOV DS, AX ; copy value of AX to DS.MOV CL, 'A' ; CL = 41h (ASCII code).MOV CH, 01011111b ; CL = color attribute.MOV BX, 15Eh ; BX = position on screen.MOV [BX], CX ; w.[0B800h:015Eh] = CX.RET ; returns to operating system.</FONT></PRE><FONT FACE="Fixedsys"><TABLE BORDER=1 NOSHADE><TR> <TD>C</TD> <TD>Z</TD> <TD>S</TD> <TD>O</TD> <TD>P</TD> <TD>A</TD> </TR><TR> <TD COLSPAN=6>unchanged</TD> </TR></TABLE></FONT> <A NAME="MOVSB"> </A></TD></TR><TR><TD><FONT FACE="Fixedsys">MOVSB</FONT></TD><TD>No operands</TD><TD>Copy byte at DS:[SI] to ES:[DI].Update SI and DI.<BR><BR>Algorithm:<BR><BR><FONT FACE="Fixedsys"><UL><LI>ES:[DI] = DS:[SI]<BR></LI><LI>if DF = 0 then <UL> <LI>SI = SI + 1</LI> <LI>DI = DI + 1</LI> </UL> else <UL> <LI>SI = SI - 1</LI> <LI>DI = DI - 1</LI> </UL></LI></UL></FONT>Example:<PRE><FONT FACE="Fixedsys">#make_COM#ORG 100hLEA SI, a1LEA DI, a2MOV CX, 5REP MOVSBRETa1 DB 1,2,3,4,5a2 DB 5 DUP(0)</FONT></PRE><FONT FACE="Fixedsys"><TABLE BORDER=1 NOSHADE><TR> <TD>C</TD> <TD>Z</TD> <TD>S</TD> <TD>O</TD> <TD>P</TD> <TD>A</TD> </TR><TR> <TD COLSPAN=6>unchanged</TD> </TR></TABLE></FONT> <A NAME="MOVSW"> </A></TD></TR><TR><TD><FONT FACE="Fixedsys">MOVSW</FONT></TD><TD>No operands</TD><TD>Copy <b>word</b> at DS:[SI] to ES:[DI].Update SI and DI.<BR><BR>Algorithm:<BR><BR><FONT FACE="Fixedsys"><UL><LI>ES:[DI] = DS:[SI]<BR></LI><LI>if DF = 0 then <UL> <LI>SI = SI + 2</LI> <LI>DI = DI + 2</LI> </UL> else <UL> <LI>SI = SI - 2</LI> <LI>DI = DI - 2</LI> </UL></LI></UL></FONT>Example:<PRE><FONT FACE="Fixedsys">#make_COM#ORG 100hLEA SI, a1LEA DI, a2MOV CX, 5REP MOVSWRETa1 DW 1,2,3,4,5a2 DW 5 DUP(0)</FONT></PRE><FONT FACE="Fixedsys"><TABLE BORDER=1 NOSHADE><TR> <TD>C</TD> <TD>Z</TD> <TD>S</TD> <TD>O</TD> <TD>P</TD> <TD>A</TD> </TR><TR> <TD COLSPAN=6>unchanged</TD> </TR></TABLE></FONT> <A NAME="MUL"> </A></TD></TR><TR><TD><FONT FACE="Fixedsys">MUL</FONT></TD><TD><FONT FACE="Fixedsys"> <NOBR> REG<BR> memory<BR> </NOBR></FONT></TD><TD>Unsigned multiply.<BR><BR>Algorithm:<BR><BR> <BLOCKQUOTE> when operand is a <B>byte</B>:<BR> <FONT FACE="Fixedsys">AX = AL * operand</FONT>. </BLOCKQUOTE> <BLOCKQUOTE> when operand is a <B>word</B>:<BR> <FONT FACE="Fixedsys">(DX AX) = AX * operand</FONT>. </BLOCKQUOTE> Example:<PRE><FONT FACE="Fixedsys">MOV AL, 200 ; AL = 0C8hMOV BL, 4MUL BL ; AX = 0320h (800)RET</FONT></PRE><FONT FACE="Fixedsys"><TABLE BORDER=1 NOSHADE><TR> <TD>C</TD> <TD>Z</TD> <TD>S</TD> <TD>O</TD> <TD>P</TD> <TD>A</TD> </TR><TR> <TD>r</TD> <TD>?</TD> <TD>?</TD> <TD>r</TD> <TD>?</TD> <TD>?</TD> </TR></TABLE>CF=OF=0 when high section of the result is zero.</FONT> <A NAME="NEG"> </A></TD></TR><TR><TD><FONT FACE="Fixedsys">NEG</FONT></TD><TD><FONT FACE="Fixedsys"> <NOBR> REG<BR> memory<BR> </NOBR></FONT></TD><TD>Negate. Makes operand negative (two's complement).<BR><BR>Algorithm:<BR><BR> <FONT FACE="Fixedsys"> <UL> <LI>Invert all bits of the operand</LI> <LI>Add 1 to inverted operand</LI> </UL> </FONT> Example:<PRE><FONT FACE="Fixedsys">MOV AL, 5 ; AL = 05hNEG AL ; AL = 0FBh (-5)NEG AL ; AL = 05h (5)RET</FONT></PRE><FONT FACE="Fixedsys"><TABLE BORDER=1 NOSHADE><TR> <TD>C</TD> <TD>Z</TD> <TD>S</TD> <TD>O</TD> <TD>P</TD> <TD>A</TD> </TR><TR> <TD>r</TD> <TD>r</TD> <TD>r</TD> <TD>r</TD> <TD>r</TD> <TD>r</TD> </TR></TABLE></FONT> <A NAME="NOP"> </A></TD></TR><TR><TD><FONT FACE="Fixedsys">NOP</FONT></TD><TD>No operands</TD><TD>No Operation.<BR><BR>Algorithm:<BR><BR><FONT FACE="Fixedsys"><UL><LI>Do nothing<BR></LI></UL></FONT> Example:<PRE><FONT FACE="Fixedsys">; do nothing, 3 times:NOPNOPNOPRET</FONT></PRE><FONT FACE="Fixedsys"><TABLE BORDER=1 NOSHADE><TR> <TD>C</TD> <TD>Z</TD> <TD>S</TD> <TD>O</TD> <TD>P</TD> <TD>A</TD> </TR><TR> <TD COLSPAN=6>unchanged</TD> </TR></TABLE></FONT> <A NAME="NOT"> </A></TD></TR><TR><TD><FONT FACE="Fixedsys">NOT</FONT></TD><TD><FONT FACE="Fixedsys"> <NOBR> REG<BR> memory<BR> </NOBR></FONT></TD><TD>Invert each bit of the operand.<BR><BR>Algorithm:<BR><BR><FONT FACE="Fixedsys"><UL><LI>if bit is 1 turn it to 0.<BR></LI><LI>if bit is 0 turn it to 1.<BR></LI></UL></FONT> Example:<PRE><FONT FACE="Fixedsys">MOV AL, 00011011bNOT AL ; AL = 11100100bRET</FONT></PRE><FONT FACE="Fixedsys"><TABLE BORDER=1 NOSHADE><TR> <TD>C</TD> <TD>Z</TD> <TD>S</TD> <TD>O</TD> <TD>P</TD> <TD>A</TD> </TR><TR> <TD COLSPAN=6>unchanged</TD> </TR></TABLE></FONT> <A NAME="OR"> </A></TD></TR><TR><TD><FONT FACE="Fixedsys">OR</FONT></TD><TD><FONT FACE="
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -