Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I clear the screen without having to fill it

Does an interrupt service routine exist to help me clear the screen of the terminal? Will it work on windows?

like image 380
Gabriele Cirulli Avatar asked Nov 23 '11 08:11

Gabriele Cirulli


2 Answers

Setting a graphics mode through BIOS (int 10h with AH=0) will clear the screen.

Scrolling the screen up or down through BIOS (int 10h with AH=6 or 7) can clear the screen as well.

This will only work where you can invoke BIOS service functions.

MSDOS is where this will always work.

In Windows this will work only in DOS applications and if Windows can actually run them. 64-bit editions of Windows don't support DOS applications at all and starting with Windows Vista even in 32-bit editions of Windows many DOS apps don't work fully.

Remember also that if a DOS application runs in a window in Windows, only that window will get cleared, not the entire screen.

like image 121
Alexey Frunze Avatar answered Nov 18 '22 16:11

Alexey Frunze


I got this to work (used qemu, NASM)

(http://www.gabrielececchetti.it/Teaching/CalcolatoriElettronici/Docs/i8086_and_DOS_interrupts.pdf)

call cls
jmp $

cls:
  pusha
  mov ah, 0x00
  mov al, 0x03  ; text mode 80x25 16 colours
  int 0x10
  popa
  ret
like image 11
gfmoore Avatar answered Nov 18 '22 16:11

gfmoore