Page 1 of 1

CLS in ASM

Posted: Wed Aug 29, 2007 12:34 pm
by Frosty480
Is there any way of clearing the screen in ASM?

The reason why I ask is because im working on a OS in ASM, and I need to clear the screen when the PC boots....

Posted: Wed Aug 29, 2007 2:41 pm
by Stoves
I don't know ASM, but I think I can give a possible method.

Code: Select all

Point to video memory address: 0 offset.
Get each byte of video memory and XOR it with itself.
That will reset all video memory to 0. Hence, blank screen. (Assuming of course that color zero is black.)

Posted: Wed Aug 29, 2007 2:50 pm
by Frosty480
I already knew that, its just that would take a whole bunch of code, compared maybe to some sorta video interupt?

Posted: Wed Aug 29, 2007 3:34 pm
by Stoves
lol sorry.

maybe try this: (from http://www.codeguru.com/forum/archive/i ... 26197.html)
mov ax,3
int 10h

This one set 80x25 text mode. I don't know if you're working i that one and if no, here are some other modes:

0 -> 40x25
1 -> 40x25
2 -> 80x25
3 -> 80x25

It looks as if XP is blocking the interrupt call so that any other mode cannot be set. Blocked or not, this method still clears the screen.

Posted: Wed Aug 29, 2007 6:37 pm
by Frosty480
Oh, ok, sweet!!! Thanks!!!