⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 masm4.htm

📁 本单片机教程是平凡老师花了大量时间
💻 HTM
📖 第 1 页 / 共 4 页
字号:
    <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"> 0000 7423 MOV A,#23H</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> 0002 CHK #65H,R3</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+0002 6465 XRL A,#65H</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+0004 6005 JZ MATCH10001</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+0006 6B XRL A,R3</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+0007 7005 JNZ NOMATCH0001</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+0009 2415 ADD A,#15H</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+ MATCH10001:</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+000B 2407 ADD A,#7</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+000D FC MOV R4,A</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+ NOMATCH0001:</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+000E FD MOV R5,A</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> 000F E6 MOV A,@R0</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> 0010 CHK R2,#23H</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+0010 6A XRL A,R2</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+0011 6006 JZ MATCH10002</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+0013 6423 XRL A,#23H</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+0015 7005 JNZ NOMATCH0002</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+0017 2415 ADD A,#15H</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+ MATCH10002:</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+0019 2407 ADD A,#7</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+001B FC MOV R4,A</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+ NOMATCH0002:</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+001C FD MOV R5,A</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> 001D 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"> CHK . . . . . . . . . . . . . . M 0000</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> MATCH10001. . . . . . . . . . . L 000B</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> MATCH10002. . . . . . . . . . . L 0019</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> NOMATCH0001 . . . . . . . . . . L 000E</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> NOMATCH0002 . . . . . . . . . . L 001C</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>从列表文件中我们可以看到,汇编程序已对宏指令中的标号作了处理,在第一次引用时,宏指令中的标号MATCH1及NOMATCH分别衩扩展为MATCH1001及NOMATCH0001,而第二次被引用时相应的标号被扩展为MATCH1002及NOMATCH0002,从而避免在同一程序中标号的重复。</font></p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"><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> CON MACRO X1,X2,SI,L1</i></p> 
    <i> 
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> MOV R2,#X1</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> MOV R2,#X1</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> ADD A,#X1+5-X2</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> DB 'STRING&amp;SI&amp;'</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> JNZ LAB&amp;L1</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> LAB&amp;L1:</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> XRL A,R3</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"> CLR A</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> CON 23H,65H,SPECIAL,57</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>列表文件如下:</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"> CON MACRO X1,X2,SI,L1</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> MOV R2,#X1</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> MOV R2,#X1</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> ADD A,#X1+5-X2</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> DB 'STRING&amp;SI&amp;'</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> JNZ LAB&amp;L1</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> LAB&amp;L1:</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> XRL A,R3</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"> 0000 E4 CLR A</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> 0001 CON 23H,65H,SPECIAL,57</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+0001 7A23 MOV R2,#23H</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+0003 7A23 MOV R2,#23H</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+0005 24C3 ADD A,#23H+5-65H</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+0007 53 54 52 DB 'STRINGSPECIAL'</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+000A 49 4E 47 53 50 45 43 49 41 4C</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+0014 7000 JNZ LAB57</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+ LAB57:</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0">+0016 6B XRL A,R3</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"> CON . . . . . . . . . . . . . . M 0000</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> LAB57 . . . . . . . . . . . . . L 0016</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"> CON MACRO C1,C2,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"> IF C1</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> INC R3</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"> ENDIF</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> IF C2</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> MOV R5,P2</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> ADDC A,P3</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> ELSE</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> MOV R1,P2</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> XRL A,R3</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> ENDIF</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> MOV @R1,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"> CLR A</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> MOV R3,#2AH</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> CON 0,0,#23H,#65H,R6</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>列表文件如下:</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"> CON MACRO C1,C2,P1,P2,P3</p>
    <p align="JUSTIFY" style="line-height: 150%; margin-top: 0; margin-bottom: 0"> MOV A,P1</p>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -