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
int 0x10
popa
ret
I read that setting al
to 0 and calling the scroll screen interrupt would clean the screen but it only seems to change the colour of the first line to grey.
Thanks to anyone who can explain why this is not working.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With