8086 assembly language program to clear the screen Edit

Murugan Andezuthu Dharmaratnam | 31 August 2020 | 145

sample code below is an 8086 program to clear the screen. this program clears the screen by direcrly writing into the video memory. b800 is the video memory address. below code write to the video memory and clears the screen

Sample Code

;Program  : clear screen
;FileName : clrscr.asm
;I/P 	 : Nill
;O/P 	 : clears the screen

org 100h
   mov ax,0b800h
   mov es,ax
   mov di,0
   mov al,' '
   mov ah,07d
        mov word ptr es:[di],ax
        inc di
        inc di
        cmp di,4000
   jle loop_clear_12
   mov ah,4ch  ; dos interrupt 21 function 4ch to terminate program
   mov al,00
   int 21h

Generate executable using

tasm filename.asm
tlink /t filename