bigbeebrian
Programmer
Can anyone tell me why this program doesn't work. I'm writing a program that captures the screen contents then clear the screen then prompts the user to "press any key". After the user presses a key the original contents should pop back to the screen.
This is what I have so far.
.MODEL SMALL
.386
.STACK 1024
.DATA
Message DB 'Press Any Key$'
videoSeg = 0B800h
scrnStorage DW (25*80*2)
buffer DW 4000 dup(?)
.CODE
main PROC
mov ax,@data ;setup data segment
mov ds,ax
mov si,videoSeg ;point DS:SI to video segment
mov di,si
mov si,0
mov di,seg buffer ;point ESI to buffer
mov es,di
mov di,offset buffer
cld ;direction = up
mov cx,scrnStorage ;number of words to copy
rep movsw ;copy DS:SI to ESI
;Clear Screen
mov ah,0fh ;function
int 10h ;bios video interrupt
;current video mode returned in AL
mov ah,0 ;function 0 = set current video mode
;al = desired video mode
int 10h ;bios video interrupt
;Wait for Keystroke
mov ah,9 ;display "press any key"
mov dx,offset Message
int 21h
mov ah,010h ;wait for keystroke
int 16h ;call keyboard interrupt
mov ah,4ch ;give control back
mov al,0 ;and end program
int 21h
main ENDP
END main
This is what I have so far.
.MODEL SMALL
.386
.STACK 1024
.DATA
Message DB 'Press Any Key$'
videoSeg = 0B800h
scrnStorage DW (25*80*2)
buffer DW 4000 dup(?)
.CODE
main PROC
mov ax,@data ;setup data segment
mov ds,ax
mov si,videoSeg ;point DS:SI to video segment
mov di,si
mov si,0
mov di,seg buffer ;point ESI to buffer
mov es,di
mov di,offset buffer
cld ;direction = up
mov cx,scrnStorage ;number of words to copy
rep movsw ;copy DS:SI to ESI
;Clear Screen
mov ah,0fh ;function
int 10h ;bios video interrupt
;current video mode returned in AL
mov ah,0 ;function 0 = set current video mode
;al = desired video mode
int 10h ;bios video interrupt
;Wait for Keystroke
mov ah,9 ;display "press any key"
mov dx,offset Message
int 21h
mov ah,010h ;wait for keystroke
int 16h ;call keyboard interrupt
mov ah,4ch ;give control back
mov al,0 ;and end program
int 21h
main ENDP
END main