任务1:汇编程序及仿真
假设Device:STC15F2K60S2系列,工作时钟频率:12MHz。
汇编程序如下:
MyID EQU 201909070110 ;以学号为201909070110的学生为例
ORG 0000H
LJMP MAIN
ORG 0030H
MAIN: MOV A, #MyID ;A=2F 02B7 E9(1E)A累加器只有1字节
MOV B, #5
DIV AB ;A=A/B=1E/5=6,B=A%B=1E%5=0
MOV P0, B ;P0=0
MOV R0, #23H ;R0=23H
L1: MOV R1, #(MyID/5);R1=E91E/5=2E(9F)寄存器1字节,编译器运算2字节
L2: NOP
DJNZ R1, L2 ;R1=0
DJNZ R0, L1 ;R0=0,共运行23H*9FH次
MOV 30H, #0F0H ;(30H)=F0H
MOV R0, #30H ;R0=30H
RL A ;A*2=0CH
ANL A, @R0 ;A=00H
MOV P1, A ;P1=00H
L3: LJMP L3
END
试用以下两种方法:
1.通过查阅STC15系列指令集方法(不用计算机)(原期中考试题)
2.用Keil软件模拟方法(uVision4\project\options for…设置debug中选项use simulator)
回答以下问题:
问题1:什么是伪指令?本程序中哪些是伪指令?
伪指令(Pseudo Instruction)是用于对汇编过程进行控制的指令,该类指令并不是可执行指令,没有机器代码,只用于汇编过程中为汇编程序提供汇编信息
本程序中EQU,ORG,END是伪指令
问题2:下载到程序存储器时,相关单元地址、内容是什么?
地址 内容 指令 补充
C:0x0000 020030 LJMP MAIN(C:0030)
C:0x0003 00 NOP
C:0x0004 00 NOP
C:0x0005 00 NOP
C:0x0006 00 NOP
C:0x0007 00 NOP
C:0x0008 00 NOP
C:0x0009 00 NOP
C:0x000A 00 NOP
C:0x000B 00 NOP
C:0x000C 00 NOP
C:0x000D 00 NOP
C:0x000E 00 NOP
C:0x000F 00 NOP
C:0x0010 00 NOP
C:0x0011 00 NOP
C:0x0012 00 NOP
C:0x0013 00 NOP
C:0x0014 00 NOP
C:0x0015 00 NOP
C:0x0016 00 NOP
C:0x0017 00 NOP
C:0x0018 00 NOP
C:0x0019 00 NOP
C:0x001A 00 NOP
C:0x001B 00 NOP
C:0x001C 00 NOP
C:0x001D 00 NOP
C:0x001E 00 NOP
C:0x001F 00 NOP
C:0x0020 00 NOP
C:0x0021 00 NOP
C:0x0022 00 NOP
C:0x0023 00 NOP
C:0x0024 00 NOP
C:0x0025 00 NOP
C:0x0026 00 NOP
C:0x0027 00 NOP
C:0x0028 00 NOP
C:0x0029 00 NOP
C:0x002A 00 NOP
C:0x002B 00 NOP
C:0x002C 00 NOP
C:0x002D 00 NOP
C:0x002E 00 NOP
C:0x002F 00 NOP
C:0x0030 741E MOV A,#0x1E
C:0x0032 75F005 MOV B(0xF0),#0x05
C:0x0035 84 DIV AB
C:0x0036 85F080 MOV P0(0x80),B(0xF0)
C:0x00