I\'m trying to clear the screen in my simple 16-bit real mode operating system. Below is the code:
clearScreen:
pusha
mov ah, 0x7
mov al, 0
The problem is that int 0x10
function 0x07
takes more parameters than you've given. Specifically,
Unless you set them, they'll just contain whatever happens to be there from previous instructions, which is very unlikely to be what you want!
So assuming that you're using the standard 80x25 character screen, your code should instead be written like this:
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
See this version of the famous Ralf Brown interrupt list for more details.