问题描述
我正在从事有关编写简单汇编程序引导加载程序的教育项目。 我在用什么:
- fasm
- bochs
- 构建脚本
fasm.exe boot.asm boot.bin
del disk.img
fsutil file createnew disk.img 1474560
dd if=boot.bin of=disk.img
- 运行bochs的命令
bochs.exe -q -f bochsrc.bxrc
我需要在右侧设置秒计时器。
经过研究,我需要通过替换 0x08
末尾的 0x1c
来捕获 0x08
中断并处理它,默认情况下返回 iret
。
在程序开始时我试图替换中断向量表中的 0x1c
use16
org 0x7c00
boot__code16:
offset_1ch equ 0x1c * 4
cli
xor ax,ax
mov es,ax
mov es,ax
mov ds,ax
mov ss,ax
mov ax,boot__code16
mov sp,ax
mov ax,offset_1ch
mov [es:offset_1ch],ax
push cs
pop ax
mov [es:offset_1ch+2],ax
sti
然后显示smth:
mov ax,0002h
int 10h
mov dx,0h
call SetCursor
mov bp,loading_str
mov cx,10
call Print
我现在有什么问题:
如果我替换 0x1c
,模拟器将不显示任何内容。
如果我尝试替换另一个中断(例如 0x1f),它会一直工作,直到我在代码中调用它,然后它才会显示任何内容。
我做错了什么?
更新 我更改了一些代码:
cli
xor ax,timer
mov [offset_1ch],ax
sti
timer:
iret
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)