📄 masm4.htm
字号:
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> 08-27-96</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> ABC MACRO P1,P2,P3</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> MOV A,P1</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> MOV R4,P2</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> P3</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> DEC R5</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> ENDM</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"></p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> JK MACRO P1,X5,OPC1,ARG1,ARG2</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> INC X5</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> MOV A,P1</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> OPC1 ARG1,ARG2</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> ENDM</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"></p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> 0000 00 NOP</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> 0001 JK #33H,R3,NOP</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+0001 0B INC R3</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+0002 7433 MOV A,#33H</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+0004 00 NOP ,</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> 0005 C4 SWAP A</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> 0006 00 NOP</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> 0007 JK R4,R2,ADDC,A,@R1,#66H</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+0007 0A INC R2</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+0008 EC MOV A,R4</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+0009 37 ADDC A,@R1</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> 000A 00 NOP</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> 000B JK #40H,R4,,DEC R2</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+000B 0C INC R4</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+000C 7440 MOV A,#40H</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+000E 1A DEC R2,</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> 000F 00 NOP</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> 0000 END</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"></p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">The Cybernetic Micro Systems 8051 Family Assembler, Version
3.03 Page 2</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> 08-27-96</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> ;%T Symbol Name Type Value</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> ABC . . . . . . . . . . . . . . M 0B0D</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> JK. . . . . . . . . . . . . . . M 0000</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> ;%Z</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> 00 Errors (0000)</p>
</font></i>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"><font face="宋体" lang="ZH-CN" size=3>若在宏指信中使用标号,由于这些标号不是形参,所以不会被实参所替代。这样,在程序中多次引用是否会出现标号重复呢?在作宏汇编时,汇编程序会在所有标号尾部增加一个唯</font><font size=3>
</font><font face="宋体" lang="ZH-CN" size=3>一的四位数,以使多次引用时标号不会重复。例:</font></p>
<font face="Arial" size=3>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> <i> LMAC MACRO P1,P2,L1</i></p>
<i>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> ANL A,P1</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> JZ L1</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> ORL A,P2</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> L1: MOV @R1,A</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> INC R1</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> ENDM</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"></p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> MOV R1,#2AH</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> MOV A,#65H</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> LMAC R3,#0F0H,R3ANDA0</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> MOV A,#23H</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> LMAC R5,#07H,R5ANDA0</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> NOP</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> END</p>
</i></font>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"><font face="宋体" lang="ZH-CN" size=3>程序中有二个标号MATCH1及NOMATCH,宏指令被二次引用,经汇编后其列表文件如下:</font></p>
<i><font face="Arial" size=3>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">The Cybernetic Micro Systems 8051 Family Assembler, Version
3.03 Page 1</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> 08-27-96</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> LMAC MACRO P1,P2,L1</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> ANL A,P1</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> JZ L1</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> ORL A,P2</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> L1: MOV @R1,A</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> INC R1</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> ENDM</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"></p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> 0000 792A MOV R1,#2AH</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> 0002 7465 MOV A,#65H</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> 0004 LMAC R3,#0F0H,R3ANDA0</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+0004 5B ANL A,R3</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+0005 6002 JZ R3ANDA0</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+0007 44F0 ORL A,#0F0H</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+0009 F7 R3ANDA0: MOV @R1,A</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+000A 09 INC R1</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> 000B 7423 MOV A,#23H</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> 000D LMAC R5,#07H,R5ANDA0</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+000D 5D ANL A,R5</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+000E 6002 JZ R5ANDA0</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+0010 4407 ORL A,#07H</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+0012 F7 R5ANDA0: MOV @R1,A</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+0013 09 INC R1</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> 0014 00 NOP</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> 0000 END</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">The Cybernetic Micro Systems 8051 Family Assembler, Version
3.03 Page 2</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> 08-27-96</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> ;%T Symbol Name Type Value</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> LMAC. . . . . . . . . . . . . . M 0000</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> R3ANDA0 . . . . . . . . . . . . L 0009</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> R5ANDA0 . . . . . . . . . . . . L 0012</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> ;%Z</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> 00 Errors (0000)</p>
</font></i>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"><font face="宋体" lang="ZH-CN" size=3>若在宏指令中使用标号,由于这些标号不是形参,所以不会被实参所替代。这样,在程序中多次引用是否会出现标号重复呢,这一点宏汇编程序已作了考虑,在作宏汇编时,汇编程序会在所有标号尾部增加一个唯一的四位数,以使多次引用时标号不会重复。下面的例子说明了多次引用宏指令时内部标号的处理。</font></p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"><font face="宋体" lang="ZH-CN" size=3>例:</font></p>
<i><font face="Arial" size=3>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> CHK MACRO N1,N2</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> XRL A,N1</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> JZ MATCH1</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> XRL A,N2</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> JNZ NOMATCH</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> ADD A,#15H</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> MATCH1:</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> ADD A,#7</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> MOV R4,A</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> NOMATCH:</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> MOV R5,A</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> ENDM</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"></p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> MOV A,#23H</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> CHK #65H,R3</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> MOV A,@R0</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> CHK R2,#23H</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> NOP</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> END</p>
</font></i>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"><font face="宋体" lang="ZH-CN" size=3>程序中有二个标号MATCH1及NOMATCH。宏指令被二次引用。经汇编后其列表文件如下:</font></p>
<i><font face="Arial" size=3>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">The Cybernetic Micro Systems 8051 Family Assembler, Version
3.03 Page 1</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> 08-27-96</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> CHK MACRO N1,N2</p>
<p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> XRL A,N1</p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -