Hello,
I'm starting on Assembly and i want to know how i can clear the screen in Assembly, because of my OS. When i run it in Bochs, that boot messages are there and i want to clear they, for a better visual of my OS.

Thanks,
Nathan Paulino Campos

Recommended Answers

All 5 Replies

Different ways.
One is to clear the screen yourself by writing to the display Segment:Offset.


Using Video Services interrupt 10h, command ah=0 Set the video mode again! (Not really the best way to do it but should work!) I prefer the write to memory myself method!


It's been many years so I don't remember if writing a 0Ch to the display clears it or not!

How i have to use this, like this ?:

MOV AH, 0

Thanks,
Nathan Paulino Campos

I don't understand your question. If you have to clear it yourself and are working in an old style Real Mode code where the BIOS services are exposed.

I'm kind of rusty at this...

mov ax,0b800h     ; Assuming text screen not graphics
  mov  es,ax
  mov di,0
  mov  cx,25*80
; mov  ax, ???
  mov al, 0               ; 0 or ' '   I forget which
  mov ah, ????        ; Attribut byte ?

Clr:   mov   es:[di],ax        ; Write text char and attribut byte
   add di,2
   dec cx
   jne Clr

Thanks, now it's working!

  mov al, 0               ; 0 or ' '   I forget which
  mov ah, ????        ; Attribut byte ?
   mov  ah, 7          ;Means white-on-black text
   mov  al, ' '        ;print this char with above attribute
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.