Write an assembly language program that clears the computer screen?
; clear the screen
[org 0x0100]
mov ax, 0xb800 ; load video base in ax
mov es, ax ; point es to video base
mov di, 0 ; point di to top left column
nextchar: mov word [es:di], 0x0720 ; clear next char on screen
add di, 2 ; move to next screen location
cmp di, 4000 ; has the whole screen cleared
jne nextchar ; if no clear next position
mov ax, 0x4c00 ; terminate program
int 0x21
[org 0x0100]
mov ax, 0xb800 ; load video base in ax
mov es, ax ; point es to video base
mov di, 0 ; point di to top left column
nextchar: mov word [es:di], 0x0720 ; clear next char on screen
add di, 2 ; move to next screen location
cmp di, 4000 ; has the whole screen cleared
jne nextchar ; if no clear next position
mov ax, 0x4c00 ; terminate program
int 0x21
Assembly language program that clears the computer screen?
Reviewed by MCH
on
December 26, 2012
Rating:
No comments: