Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
8
8086
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸大学计算机学院
教师群组
赵鹏翀-zpc
8086
提交
4614dea2
提交
4614dea2
12月 06, 2018
创建
作者:
李川
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'romasm' into 'master'
更新rom源文件 See merge request
engintime/Dream-Logic/Intel-classic-chips/8086!14
上级
4b434cf0
6e28d60f
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
1405 行增加
和
1105 行删除
+1405
-1105
microasm.c
microasm.c
+1
-1
microasm.exe
microasm.exe
+0
-0
rom.dbg
rom.dbg
+0
-0
rom.lst
rom.lst
+1120
-970
rom.masm
rom.masm
+282
-132
rom.rxm
rom.rxm
+2
-2
没有找到文件。
microasm.c
浏览文件 @
4614dea2
...
@@ -18,7 +18,7 @@ typedef long BOOL;
...
@@ -18,7 +18,7 @@ typedef long BOOL;
#define MAX_LINE_LENGTH 256 // 一行代码最多可以有多少个字符
#define MAX_LINE_LENGTH 256 // 一行代码最多可以有多少个字符
#define MAX_LINE_COUNT
1024
// 源代码文件最多可以有多少行
#define MAX_LINE_COUNT
2048
// 源代码文件最多可以有多少行
#define MAX_SYMBOL_LENGTH 64 // 一个符号最多可以包含多少个字符
#define MAX_SYMBOL_LENGTH 64 // 一个符号最多可以包含多少个字符
#define MAX_SYMBOL_COUNT 256 // 源代码文件中最多可以包含多少个符号
#define MAX_SYMBOL_COUNT 256 // 源代码文件中最多可以包含多少个符号
...
...
microasm.exe
浏览文件 @
4614dea2
没有这种文件类型的预览
rom.dbg
浏览文件 @
4614dea2
没有这种文件类型的预览
rom.lst
浏览文件 @
4614dea2
这个 源代码变更 因为 太大 而不能显示。 你可以
浏览blob
。
rom.masm
浏览文件 @
4614dea2
; (C) 2008-2018 北京英真时代科技有限公司。保留所有权利。
; (C) 2008-2018 北京英真时代科技有限公司。保留所有权利。
; 所有指令的第一条微指令地址必须是8的倍数
; 每一条汇编指令,即8086指令对应一段微程序,每一段微程序分配的空间总是8的倍数
; 若一条指令对应微指令的条数少于8的倍数,那么使用占位微指令填充
; 因此,所有指令的第一条微指令地址必须是8的倍数
; 取指微指令,所有指令的第一步均为取指操作,都要执行该条微指令
; 取指微指令,所有指令的第一步均为取指操作,都要执行该条微指令
;===========================================================================
;0.取指指令
;0.取指指令
fetch instruction
fetch instruction
dup 7, null ; 7条占位微指令,本身没有意义,只起占位作用
dup 7, null
;===========================================================================
;1.mov reg, imm 将立即数imm传送到寄存器reg中
;1.mov reg, imm 将立即数imm传送到寄存器reg中
inc pc ; pc加1
path [pc], ir ; 将pc指定存储单元的字节传送到指令寄存器ir中
inc pc
inc pc
path [pc], ir
path [pc], rd ; 将pc指定存储单元的字节传送到目的寄存器中,目的寄存器由指令寄存器ir中的低4位指定
inc pc
path [pc], rd
inc pc
inc pc
check irq ;查询硬中断
reset upc
check irq ; 查询8086的硬中断请求输入INTR,若INTR为高电平,表示有中断请求,
; 那么uPC转去执行固定的硬中断处理微程序,完成断点入栈并加载中断服务程序入口地址到PC,
; 运行中断服务程序
reset upc ; 地址0传送到uPC寄存器输入端,下个时钟上升沿到来时,uPC写入0
; 微程序存储器ROM输出0地址处的微指令,即fetch instruction取指微指令,
; 在该微指令控制下,下个时钟上升沿到来时,取出PC指向的指令
dup 1, null
dup 1, null
;2.mov reg, reg 源与目标寄存器必须有相同的数据类型长度
;===========================================================================
;2.mov rd, rs 将源寄存器rs的内容传送到目的寄存器rd中
inc pc
inc pc
path [pc], ir
path [pc], ir
path rs, rd
path rs, rd ; 将rs的内容传送到rd中,指令寄存器ir中的低四位表示目的寄存器rd,
; 高四位表示源寄存器rs
inc pc
inc pc
check irq
check irq
reset upc
reset upc
dup 2, null
dup 2, null
;3.mov reg, symbol 将存储器内容复制到寄存器
;===========================================================================
;3.mov reg, symbol 将标号symbol指定存储单元的内容传送到寄存器中
inc pc
inc pc
path [pc], ir
path [pc], ir
inc pc
inc pc
path [pc], mar
path [pc], mar
; 把pc指定单元的数据(源操作数地址symbol)传送到地址寄存器mar中
path [mar], rd
path [mar], rd
; 把mar指定存储单元的数据传送到目的寄存器rd中
inc pc
inc pc
check irq
check irq
reset upc
reset upc
;4.mov reg, [reg] 将存储器内容复制到寄存器
;===========================================================================
;4.mov rd, [rs] 将源地址寄存器rs指定存储单元的数据传送到目的寄存器rd中
inc pc
inc pc
path [pc], ir
path [pc], ir
path rs, mar
path rs, mar
; 将源寄存器rs保存的地址转移到地址寄存器mar中
path [mar], rd
path [mar], rd
inc pc
inc pc
check irq
check irq
...
@@ -50,18 +70,22 @@ reset upc
...
@@ -50,18 +70,22 @@ reset upc
dup 1, null
dup 1, null
;5.mov [reg], reg 将寄存器内容传送到存储器
;===========================================================================
;5.mov [rd], rs 将源寄存器rs的数据传送到目的地址寄存器rd指定的存储单元中
inc pc
inc pc
path [pc], ir
path [pc], ir
path rd, mar
path rd, mar
; 将目的寄存器rd保存的地址转移到地址寄存器mar中
path rs, [mar]
path rs, [mar]
; 将源寄存器rs的数据传送到地址寄存器mar指定存储单元
inc pc
inc pc
check irq
check irq
reset upc
reset upc
dup 1, null
dup 1, null
;6.mov [reg], imm 将立即数传送到存储单元中
;===========================================================================
;6.mov [rd], imm 将立即数传送到目的寄存器rd指定存储单元中
inc pc
inc pc
path [pc], ir
path [pc], ir
inc pc
inc pc
...
@@ -72,7 +96,9 @@ reset upc
...
@@ -72,7 +96,9 @@ reset upc
dup 1, null
dup 1, null
;7. mov symbol, reg
;===========================================================================
;7. mov symbol, rs 将源寄存器rs的数据传送到标号symbol指定存储单元中
inc pc
inc pc
path [pc], ir
path [pc], ir
inc pc
inc pc
...
@@ -82,26 +108,32 @@ inc pc
...
@@ -82,26 +108,32 @@ inc pc
check irq
check irq
reset upc
reset upc
;8. add reg, reg
;===========================================================================
;8. add rd, rs 源寄存器rs与目的寄存器rd相加,无进位加法,结果写回rd中
inc pc
inc pc
path [pc], ir
path [pc], ir
path rd, a
path rd, a ; 将目的寄存器rd的数据传送到累加器a中
path rs, w
path rs, w ; 将源寄存器rs的数据传送到工作寄存器w中,
path alu_add, rd
; a和w均为alu运算单元中的操作数寄存器
path al_flag, flag
path alu_add, rd ; 将累加器a与工作寄存器w相加的结果写回目的寄存器rd中
path al_flag, flag ; 将运算标志位写入标志寄存器flag中
inc pc
inc pc
check irq
check irq
reset upc
reset upc
dup 7, null
dup 7, null
;10. add reg, [reg]
;===========================================================================
;10. add rd, [rs] 源寄存器rs指定存储单元的数据与目的寄存器rd相加,结果写回rd中
inc pc
inc pc
path [pc], ir
path [pc], ir
path rs, mar
path rs, mar
; 把源寄存器rs的内容作为地址传送到mar中
path [mar], w
path [mar], w
; 将mar指定存储单元的数据传送到alu的工作寄存器w中
path rd, a
path rd, a
; 把目的寄存器rd的数据传送到alu的累加器a中
path alu_add, rd
path alu_add, rd
path al_flag, flag
path al_flag, flag
inc pc
inc pc
check irq
check irq
...
@@ -109,7 +141,9 @@ reset upc
...
@@ -109,7 +141,9 @@ reset upc
dup 6, null
dup 6, null
;12. add reg, symbol
;===========================================================================
;12. add rd, symbol 将标号symbol指定存储单元的数据传送到目的寄存器rd中
inc pc
inc pc
path [pc], ir
path [pc], ir
inc pc
inc pc
...
@@ -124,7 +158,9 @@ reset upc
...
@@ -124,7 +158,9 @@ reset upc
dup 5, null
dup 5, null
;14. add reg, imm
;===========================================================================
;14. add rd, imm 将立即数imm传送到目的寄存器rd中
inc pc
inc pc
path [pc], ir
path [pc], ir
inc pc
inc pc
...
@@ -138,12 +174,14 @@ reset upc
...
@@ -138,12 +174,14 @@ reset upc
dup 6, null
dup 6, null
;16. adc reg, reg
;===========================================================================
;16. adc rd, rs rs与rd进行带进位的加法,结果写回目的寄存器rd中
inc pc
inc pc
path [pc], ir
path [pc], ir
path rd, a
path rd, a
path rs, w
path rs, w
path alu_adc, rd
path alu_adc, rd
; 将alu的累加器a与工作寄存器w进行无进位加法所得结果写回rd
path al_flag, flag
path al_flag, flag
inc pc
inc pc
check irq
check irq
...
@@ -151,7 +189,9 @@ reset upc
...
@@ -151,7 +189,9 @@ reset upc
dup 7, null
dup 7, null
;18. adc reg, [reg]
;===========================================================================
;18. adc rd, [rs]
inc pc
inc pc
path [pc], ir
path [pc], ir
path rs, mar
path rs, mar
...
@@ -165,7 +205,9 @@ reset upc
...
@@ -165,7 +205,9 @@ reset upc
dup 6, null
dup 6, null
;20. adc reg, symbol
;===========================================================================
;20. adc rd, symbol
inc pc
inc pc
path [pc], ir
path [pc], ir
inc pc
inc pc
...
@@ -180,7 +222,9 @@ reset upc
...
@@ -180,7 +222,9 @@ reset upc
dup 5, null
dup 5, null
;22. adc reg, imm
;===========================================================================
;22. adc rd, imm
inc pc
inc pc
path [pc], ir
path [pc], ir
inc pc
inc pc
...
@@ -194,12 +238,14 @@ reset upc
...
@@ -194,12 +238,14 @@ reset upc
dup 6, null
dup 6, null
;24. sub reg, reg
;===========================================================================
;24. sub rd, rs 将目的寄存器rd减去源寄存器rs,所得结果写回rd
inc pc
inc pc
path [pc], ir
path [pc], ir
path rd, a
path rd, a
path rs, w
path rs, w
path alu_sub, rd
path alu_sub, rd
; 无进位的减法,rd = rd - rs
path al_flag, flag
path al_flag, flag
inc pc
inc pc
check irq
check irq
...
@@ -207,7 +253,9 @@ reset upc
...
@@ -207,7 +253,9 @@ reset upc
dup 7, null
dup 7, null
;26. sub reg, [reg]
;===========================================================================
;26. sub rd, [rs]
inc pc
inc pc
path [pc], ir
path [pc], ir
path rs, mar
path rs, mar
...
@@ -221,12 +269,14 @@ reset upc
...
@@ -221,12 +269,14 @@ reset upc
dup 6, null
dup 6, null
;28. sub reg, symbol
;===========================================================================
;28. sub rd, symbol
inc pc
inc pc
path [pc], ir
path [pc], ir
inc pc
inc pc
path [pc], mar
path [pc], mar
path [mar], w
path [mar], w
; 将mar指定存储单元的数据传送到alu的工作寄存器w中
path rd, a
path rd, a
path alu_sub, rd
path alu_sub, rd
path al_flag, flag
path al_flag, flag
...
@@ -236,7 +286,9 @@ reset upc
...
@@ -236,7 +286,9 @@ reset upc
dup 5, null
dup 5, null
;30. sub reg, imm
;===========================================================================
;30. sub rd, imm
inc pc
inc pc
path [pc], ir
path [pc], ir
inc pc
inc pc
...
@@ -250,12 +302,16 @@ reset upc
...
@@ -250,12 +302,16 @@ reset upc
dup 6, null
dup 6, null
;32. sbb reg, reg
;===========================================================================
;32. sbb rd, rs 带进位的减法
inc pc
inc pc
path [pc], ir
path [pc], ir
path rd, a
path rd, a
path rs, w
path rs, w
path alu_sbb, rd
path alu_sbb, rd ; alu中的累加器a减去工作寄存器w,再减去低位的借位,
; 所得结果写回目的寄存器rd中
path al_flag, flag
path al_flag, flag
inc pc
inc pc
check irq
check irq
...
@@ -263,7 +319,9 @@ reset upc
...
@@ -263,7 +319,9 @@ reset upc
dup 7, null
dup 7, null
;34. sbb reg, [reg]
;===========================================================================
;34. sbb rd, [rs]
inc pc
inc pc
path [pc], ir
path [pc], ir
path rs, mar
path rs, mar
...
@@ -277,7 +335,9 @@ reset upc
...
@@ -277,7 +335,9 @@ reset upc
dup 6, null
dup 6, null
;36. sbb reg, symbol
;===========================================================================
;36. sbb rd, symbol
inc pc
inc pc
path [pc], ir
path [pc], ir
inc pc
inc pc
...
@@ -292,6 +352,8 @@ reset upc
...
@@ -292,6 +352,8 @@ reset upc
dup 5, null
dup 5, null
;===========================================================================
;38. sbb a, imm
;38. sbb a, imm
inc pc
inc pc
path [pc], ir
path [pc], ir
...
@@ -306,18 +368,22 @@ reset upc
...
@@ -306,18 +368,22 @@ reset upc
dup 6, null
dup 6, null
;40.
;===========================================================================
;40.空指令
dup 8, null
dup 8, null
;41.
;41.
空指令
dup 8, null
dup 8, null
;42. and reg, reg
;===========================================================================
;42. and rd, rs
inc pc
inc pc
path [pc], ir
path [pc], ir
path rd, a
path rd, a
path rs, w
path rs, w
path alu_and, rd
path alu_and, rd
; alu中的累加器a与工作寄存器w进行按位与运算,结果写回rd中
path al_flag, flag
path al_flag, flag
inc pc
inc pc
check irq
check irq
...
@@ -325,7 +391,9 @@ reset upc
...
@@ -325,7 +391,9 @@ reset upc
dup 7, null
dup 7, null
;44. and reg, [reg]
;===========================================================================
;44. and rd, [rs]
inc pc
inc pc
path [pc], ir
path [pc], ir
path rs, mar
path rs, mar
...
@@ -339,7 +407,9 @@ reset upc
...
@@ -339,7 +407,9 @@ reset upc
dup 6, null
dup 6, null
;46. and reg, symbol
;===========================================================================
;46. and rd, symbol
inc pc
inc pc
path [pc], ir
path [pc], ir
inc pc
inc pc
...
@@ -354,7 +424,9 @@ reset upc
...
@@ -354,7 +424,9 @@ reset upc
dup 5, null
dup 5, null
;48. and reg, immediate
;===========================================================================
;48. and rd, imm
inc pc
inc pc
path [pc], ir
path [pc], ir
inc pc
inc pc
...
@@ -368,12 +440,14 @@ reset upc
...
@@ -368,12 +440,14 @@ reset upc
dup 6, null
dup 6, null
;50. or reg, reg
;===========================================================================
;50. or rd, rs
inc pc
inc pc
path [pc], ir
path [pc], ir
path rd, a
path rd, a
path rs, w
path rs, w
path alu_or, rd
path alu_or, rd
; 将alu中的累加器a与工作寄存器w进行按位或运算,结果写回rd中
path al_flag, flag
path al_flag, flag
inc pc
inc pc
check irq
check irq
...
@@ -381,7 +455,9 @@ reset upc
...
@@ -381,7 +455,9 @@ reset upc
dup 7, null
dup 7, null
;52. or reg, [reg]
;===========================================================================
;52. or rd, [rs]
inc pc
inc pc
path [pc], ir
path [pc], ir
path rs, mar
path rs, mar
...
@@ -395,7 +471,9 @@ reset upc
...
@@ -395,7 +471,9 @@ reset upc
dup 6, null
dup 6, null
;54. or reg, symbol
;===========================================================================
;54. or rd, symbol
inc pc
inc pc
path [pc], ir
path [pc], ir
inc pc
inc pc
...
@@ -410,7 +488,9 @@ reset upc
...
@@ -410,7 +488,9 @@ reset upc
dup 5, null
dup 5, null
;56. or reg, immediate
;===========================================================================
;56. or rd, imm
inc pc
inc pc
path [pc], ir
path [pc], ir
inc pc
inc pc
...
@@ -424,12 +504,14 @@ reset upc
...
@@ -424,12 +504,14 @@ reset upc
dup 6, null
dup 6, null
;58. xor reg, reg
;===========================================================================
;58. xor rd, rs rs与rd进行异或运算,结果写回rd
inc pc
inc pc
path [pc], ir
path [pc], ir
path rd, a
path rd, a
path rs, w
path rs, w
path alu_xor, rd
path alu_xor, rd
; 将累加器a与工作寄存器w进行按位异或运算的结果写回rd
path al_flag, flag
path al_flag, flag
inc pc
inc pc
check irq
check irq
...
@@ -437,7 +519,9 @@ reset upc
...
@@ -437,7 +519,9 @@ reset upc
dup 7, null
dup 7, null
;60. xor reg, [reg]
;===========================================================================
;60. xor rd, [reg]
inc pc
inc pc
path [pc], ir
path [pc], ir
path rs, mar
path rs, mar
...
@@ -451,7 +535,9 @@ reset upc
...
@@ -451,7 +535,9 @@ reset upc
dup 6, null
dup 6, null
;62. xor reg, symbol
;===========================================================================
;62. xor rd, symbol
inc pc
inc pc
path [pc], ir
path [pc], ir
inc pc
inc pc
...
@@ -466,7 +552,9 @@ reset upc
...
@@ -466,7 +552,9 @@ reset upc
dup 5, null
dup 5, null
;64. xor reg, immediate
;===========================================================================
;64. xor rd, imm
inc pc
inc pc
path [pc], ir
path [pc], ir
inc pc
inc pc
...
@@ -480,44 +568,52 @@ reset upc
...
@@ -480,44 +568,52 @@ reset upc
dup 6, null
dup 6, null
;66. push reg 将sp寄存器作为源寄存器
;===========================================================================
;66. push rs 将rs寄存器的内容入栈保存
; 更新栈顶
; 更新栈顶
path sp, a
path sp, a
; 将栈寄存器sp传送到累加器a中
path alu_dec, sp
path alu_dec, sp
; sp = sp -1,入栈时,sp做减法,向低地址空间生长
; 入栈
; 入栈
path sp, mar
path sp, mar
; 把新的栈指针sp传送到地址寄存器mar中
path rs, [mar]
path rs, [mar]
; 把rs寄存器的内容传送到mar指定存储单元,完成入栈保存
inc pc
inc pc
check irq
check irq
reset upc
reset upc
dup 1, null
dup 1, null
;67. pop reg
;===========================================================================
;67. pop rd 将栈寄存器sp指定存储单元内容出栈,并写入目的寄存器rd中
; 出栈
; 出栈
path sp, mar
path sp, mar
; 把栈寄存器sp传送到地址寄存器mar中
path [mar], rd
path [mar], rd
; 把mar指定存储单元内容传送到目的寄存器rd中,完成出栈
; 更新栈顶
;
出栈后需要
更新栈顶
path sp, a
path sp, a
; 把sp传送到a
path alu_inc, sp
path alu_inc, sp
; 出栈时,栈顶向高地址空间生长,因此将sp加1
inc pc
inc pc
check irq
check irq
reset upc
reset upc
dup 1, null
dup 1, null
;68. not reg
;===========================================================================
;68. not reg 按位取反运算,reg既是源操作数也是目的操作数
inc pc
inc pc
path [pc], ir
path [pc], ir
path rd, a
path rd, a
; 把reg作为源操作数传送到a中
path alu_not, rd
path alu_not, rd
; 将a取反运算的结果写回目的寄存器rd
path al_flag, flag
path al_flag, flag
inc pc
inc pc
check irq
check irq
reset upc
reset upc
;===========================================================================
; test指令主要影响ZF标志
; test指令主要影响ZF标志
;69. test reg, imm
;69. test reg, imm
inc pc
inc pc
...
@@ -532,21 +628,26 @@ reset upc
...
@@ -532,21 +628,26 @@ reset upc
dup 7, null
dup 7, null
;71. cmp reg, immediate
;===========================================================================
;71. cmp reg, immediate 比较寄存器reg与立即数的大小,修改标志寄存器
inc pc
inc pc
path [pc], ir
path [pc], ir
path rd, a
path rd, a ; 把比较寄存器的内容传送到累加器a中
inc pc
inc pc ; PC加1,指向立即数字节
path [pc], w
path [pc], w ; 把立即数传送到工作寄存器w中
path alu_sub, a
path alu_sub, a ; 寄存器减去立即数的结果写回a中
path al_flag, flag
path al_flag, flag ; 把相减后的标志写入标志寄存器中
inc pc
inc pc
hold DMA ; 查询DMA请求,若有DMA请求,则停止运行,cpu让出总线给8237控制器使用
; DMA传送结束后,从该处继续运行微程序
check irq
check irq
hold DMA ;查询DMA请求
reset upc
reset upc
dup 5, null
dup 5, null
;===========================================================================
;73. cmp reg, reg
;73. cmp reg, reg
inc pc
inc pc
path [pc], ir
path [pc], ir
...
@@ -560,17 +661,21 @@ reset upc
...
@@ -560,17 +661,21 @@ reset upc
dup 7, null
dup 7, null
;75. in al, imm
;===========================================================================
;75. in al, imm 把立即数imm指定的外设端口数据读入cpu内部寄存器al中
inc pc
inc pc
path [pc], ir
path [pc], ir
inc pc
inc pc
path [pc], mar
path [pc], mar
path <mar>, rd
path <mar>, rd
; 把mar指定的外设端口寄存器的数据传送到目的寄存器rd中
inc pc
inc pc
reset upc
reset upc
dup 1, null
dup 1, null
;===========================================================================
;76. in al, dl
;76. in al, dl
inc pc
inc pc
path [pc], ir
path [pc], ir
...
@@ -581,6 +686,8 @@ reset upc
...
@@ -581,6 +686,8 @@ reset upc
dup 2, null
dup 2, null
;===========================================================================
;77. out dl, al
;77. out dl, al
inc pc
inc pc
path [pc], ir
path [pc], ir
...
@@ -591,18 +698,22 @@ reset upc
...
@@ -591,18 +698,22 @@ reset upc
dup 2, null
dup 2, null
;78. out imm, al
;===========================================================================
;78. out imm, al 把al的数据传送到imm指定的外设端口
inc pc
inc pc
path [pc], ir
path [pc], ir
inc pc
inc pc
path [pc], mar
path [pc], mar
path rs, <mar>
path rs, <mar>
; 把源寄存器rs的内容传送到mar指定的外设端口
inc pc
inc pc
reset upc
reset upc
dup 1, null
dup 1, null
;79. lea reg, symbol
;===========================================================================
;79. lea rd, symbol 把标号symbol表示的地址传送到寄存器rd中
inc pc
inc pc
path [pc], ir
path [pc], ir
inc pc
inc pc
...
@@ -613,6 +724,7 @@ reset upc
...
@@ -613,6 +724,7 @@ reset upc
dup 1, null
dup 1, null
;=====================================================================
;=====================================================================
;80. ja symbol
;80. ja symbol
check irq
check irq
...
@@ -745,8 +857,6 @@ path sp, w
...
@@ -745,8 +857,6 @@ path sp, w
path alu_dec, sp
path alu_dec, sp
path sp, mar
path sp, mar
path flag, [mar]
path flag, [mar]
; 关中断
cli
; 更新栈顶
; 更新栈顶
path sp, a
path sp, a
...
@@ -768,23 +878,25 @@ path sp, mar
...
@@ -768,23 +878,25 @@ path sp, mar
path a, [mar]
path a, [mar]
reset upc
reset upc
dup
5
, null
dup
6
, null
;====================================================================================================
;====================================================================================================
; 硬中断返回指令,执行出栈操作
;93. iret
;93. iret
; 先恢复标志寄存器内容
; 先恢复标志寄存器内容
,即标志寄存器FLAG出栈
inc pc
inc pc
path [pc], ir
path [pc], ir
path sp, a
path sp, a
path alu_inc, mar
path alu_inc, mar
path [mar], flag
path [mar], flag
; 恢复中断返回地址
; 恢复中断返回地址
,即中断返回地址出栈
path sp, mar
path sp, mar
path [mar], pc
path [mar], pc
;
计算新的
栈顶
;
更新
栈顶
path sp, a
path sp, a
path alu_inc, a
path alu_inc, a
path alu_inc, sp
path alu_inc, sp
...
@@ -792,9 +904,10 @@ reset upc
...
@@ -792,9 +904,10 @@ reset upc
dup 5, null
dup 5, null
;====================================================================================================
;====================================================================================================
;95. sal r
eg, reg
;95. sal r
d, rs 算术左移指令
inc pc
inc pc
path [pc], ir
path [pc], ir
path rs, w
path rs, w
...
@@ -807,7 +920,9 @@ reset upc
...
@@ -807,7 +920,9 @@ reset upc
dup 7, null
dup 7, null
;97. sar reg, reg
;===========================================================================
;97. sar rd, rs 算术右移指令
inc pc
inc pc
path [pc], ir
path [pc], ir
path rs, w
path rs, w
...
@@ -820,7 +935,9 @@ reset upc
...
@@ -820,7 +935,9 @@ reset upc
dup 7, null
dup 7, null
;99. shl reg, reg
;===========================================================================
;99. shl rd, rs 逻辑左移指令
inc pc
inc pc
path [pc], ir
path [pc], ir
path rs, w
path rs, w
...
@@ -833,7 +950,9 @@ reset upc
...
@@ -833,7 +950,9 @@ reset upc
dup 7, null
dup 7, null
;101. shr reg, reg
;===========================================================================
;101. shr rd, rs 逻辑右移指令
inc pc
inc pc
path [pc], ir
path [pc], ir
path rs, w
path rs, w
...
@@ -846,7 +965,9 @@ reset upc
...
@@ -846,7 +965,9 @@ reset upc
dup 7, null
dup 7, null
;103. rol reg, reg
;===========================================================================
;103. rol rd, rs 不带进位的循环左移指令
inc pc
inc pc
path [pc], ir
path [pc], ir
path rs, w
path rs, w
...
@@ -859,7 +980,9 @@ reset upc
...
@@ -859,7 +980,9 @@ reset upc
dup 7, null
dup 7, null
;105. ror reg, reg
;===========================================================================
;105. ror rd, rs 不带进位的循环右移指令
inc pc
inc pc
path [pc], ir
path [pc], ir
path rs, w
path rs, w
...
@@ -872,7 +995,9 @@ reset upc
...
@@ -872,7 +995,9 @@ reset upc
dup 7, null
dup 7, null
;107. rcl reg, reg
;===========================================================================
;107. rcl rd, rs 带进位的循环左移指令
inc pc
inc pc
path [pc], ir
path [pc], ir
path rs, w
path rs, w
...
@@ -885,7 +1010,9 @@ reset upc
...
@@ -885,7 +1010,9 @@ reset upc
dup 7, null
dup 7, null
;109. rcr reg, reg
;===========================================================================
;109. rcr rd, rs 带进位的循环右移指令
inc pc
inc pc
path [pc], ir
path [pc], ir
path rs, w
path rs, w
...
@@ -898,22 +1025,26 @@ reset upc
...
@@ -898,22 +1025,26 @@ reset upc
dup 7, null
dup 7, null
;111. nop
;===========================================================================
inc pc
;111. nop 空指令
inc pc
reset upc
reset upc
dup 6, null
dup 6, null
;112. hlt
;===========================================================================
;112. hlt 停机
reset upc
reset upc
dup 7, null
dup 7, null
;===========================================================================
;113. call symbol
;113. call symbol
;
计算新的
栈顶
;
更新
栈顶
path sp, a
path sp, a
path sp, w
path sp, w
path alu_dec, sp
path alu_dec, sp
; sp = sp - 1
path sp, mar
path sp, mar
; 将sp转移到mar中,为返回地址入栈做准备
; 读出标号指定的跳转地址并暂存到寄存器a中
; 读出标号指定的跳转地址并暂存到寄存器a中
inc pc
inc pc
...
@@ -923,74 +1054,93 @@ path [pc], a
...
@@ -923,74 +1054,93 @@ path [pc], a
inc pc
inc pc
path pc, [mar]
path pc, [mar]
; 将a中暂存的跳转地址置入pc,实现调用
; 将a中暂存的跳转地址置入pc,实现
子程序
调用
path a, pc
path a, pc
check irq
check irq
reset upc
reset upc
dup 5, null
dup 5, null
;115. ret
;===========================================================================
;115. ret 子程序调用返回指令
path sp, mar
path sp, mar
path [mar], pc
path [mar], pc ; 首先读出栈指针sp指向存储单元的内容,即返回地址,
; 将其加载到PC中,实现调用返回
path sp, a
path sp, a
path alu_inc, sp
path alu_inc, sp ; 然后将sp加1,sp指向新的栈顶,即出栈
; 出栈时,栈顶向高地址空间生长
reset upc
reset upc
dup 3, null
dup 3, null
;116. cli
cli
;===========================================================================
;116. cli 关中断指令
cli ; 清零中断标志允许位IF=0,禁止硬中断请求
inc pc
inc pc
reset upc
reset upc
dup 5, null
dup 5, null
;117. sti
;===========================================================================
sti
;117. sti 开中断指令
sti ; 设置中断允许标志位IF=1,允许硬中断请求
inc pc
inc pc
reset upc
reset upc
dup 5, null
dup 5, null
;===========================================================================
;118. 硬中断处理微指令程序
;118. 硬中断处理微指令程序
; 标志寄存器和断点地址入栈
; 标志寄存器和断点地址入栈
path sp, a
path sp, a
path sp, w
path sp, w
path alu_dec, sp
path alu_dec, sp
; sp减1,指向新的栈顶,为标志寄存器入栈做准备
path sp, mar
path sp, mar
path flag, [mar]
path flag, [mar]
; 将标志寄存器入栈,入栈时,栈向低地址空间生长
path sp, a
path sp, a
path alu_dec, sp
path alu_dec, sp
; sp减1,为返回地址入栈做准备
path sp, mar
path sp, mar
path pc, [mar]
path pc, [mar] ; 当前PC指向下一条指令,正是返回地址,将其入栈
; 从8259读取中断号,依据中断号得到对应中断向量
inta ; cpu 发出第一个中断应答信号INTA
dup 1, null ; 插入空闲周期,其目的是分开前后两次发出的中断应答信号,便于8259进行识别
; 使得INTA信号的变化情况为 低电平--高电平--低电平,其中低电平表示应答信号有效
path inta, mar ; cpu发出第二个中断应答信号INTA,读取中断向量并送入地址寄存器中
; 获取中断号中断服务程序入口地址
inta
dup 1, null ;插入空闲周期
path inta, mar ;读取中断号并送入地址寄存器中
; 转移到中断服务程序执行
; 转移到中断服务程序执行
path [mar], pc
path [mar], pc ; 将mar中的中断向量指向存储单元的内容传送到PC中,
; 中断向量指向的存储单元实际存储的就是该中断服务程序的入口地址(首条指令地址)
; 于是,PC转去执行中断服务程序
reset upc
reset upc
dup 2, null
dup 2, null
;120. inc reg
;===========================================================================
;120. inc rd 自增
inc pc
inc pc
path [pc], ir
path [pc], ir
path rd, a
path rd, a
path alu_inc, rd
path alu_inc, rd
; 将累加器a加1的结果写入目的寄存器rd中
path al_flag, flag
path al_flag, flag
inc pc
inc pc
check irq
check irq
reset upc
reset upc
;121. dec reg
;===========================================================================
;121. dec rd 自减
inc pc
inc pc
path [pc], ir
path [pc], ir
path rd, a
path rd, a
path rd, w
path rd, w
path alu_dec, rd
path alu_dec, rd
; 将累加器a减1的结果写入目的寄存器rd中
path al_flag, flag
path al_flag, flag
inc pc
inc pc
check irq
check irq
...
...
rom.rxm
浏览文件 @
4614dea2
GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG߿GGGGGGGGGGGGGG?_GG߿GGGGG?G?GGGG߿G߿߿GG
GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG߿GGGGGGGGGGGGGG?_GG߿GGGGG?G?GGGG߿G߿߿GG
\ No newline at end of file
\ No newline at end of file
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论