ice*_*les 5 assembly operating-system real-mode 16-bit
我正试图在我简单的16位实模式操作系统中清除屏幕.以下是代码:
clearScreen:
pusha
mov ah, 0x7
mov al, 0
int 0x10
popa
ret
Run Code Online (Sandbox Code Playgroud)
我将该设置读al为0并调用滚动屏幕中断将清除屏幕,但它似乎只是将第一行的颜色更改为灰色.
感谢任何能解释为什么这不起作用的人.
问题是int 0x10函数0x07需要的参数多于你给出的参数.特别,
除非你设置它们,否则它们只包含之前指令中发生的任何事情,这不太可能是你想要的!
因此,假设您使用的是标准的80x25字符屏幕,则应将代码编写为:
clearScreen:
pusha
mov ax, 0x0700 ; function 07, AL=0 means scroll whole window
mov bh, 0x07 ; character attribute = white on black
mov cx, 0x0000 ; row = 0, col = 0
mov dx, 0x184f ; row = 24 (0x18), col = 79 (0x4f)
int 0x10 ; call BIOS video interrupt
popa
ret
Run Code Online (Sandbox Code Playgroud)
有关更多详细信息,请参阅此版本的着名Ralf Brown 中断列表.