Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
WinClose
◄Example► ◄Back► ◄Contents► ◄Index►
──────────────────────────────────────────────────────────────────────────────
;* WinClose - "Closes" a window previously opened by the WinOpen procedure.
;* See also the WinOpen procedure.
;*
;* Shows: DOS Function - 49h (Release Memory Block)
;* Instructions - lodsw
;* Operators - : (segment override) SEG
;*
;* Uses: vconfig - Video configuration structure, declared in the
;* DEMO.INC include file. The structure must first be
;* initialized by calling the GetVidConfig procedure.
;*
;* Params: addr - Segment address of buffer that holds screen contents
;* saved in WinOpen procedure
;*
;* Return: None
WinClose PROC \
USES ds di si, \
addr:WORD
mov ds, addr ; DS:SI points to buffer
sub si, si
lodsw
mov di, ax ; DI = video offset of window
lodsw
mov bx, ax ; BX = number of window rows
lodsw
mov cx, ax ; CX = number of columns
mov ax, SEG vconfig.sgmnt
mov es, ax ; Point ES to data segment
push es:vconfig.sgmnt
pop es ; ES = video segment
mov ax, 160 ; Number of video cells/row
loop1: push di ; Save ptr to start of line
push cx ; and number of columns
cmp vconfig.adapter, CGA ; CGA adapter?
jne @F ; No? Skip video disable
; Disable CGA video prior to memory move to avoid screen snow. (See the
; WinOpen and StrWrite procedures for further discussions on CGA snow.)
call DisableCGA ; Yes? Disable video
@@: rep movsw ; Copy one row to buffer
cmp vconfig.adapter, CGA
jne @F
call EnableCGA ; Reenable CGA video
@@: pop cx ; Recover number of columns
pop di ; and start of line
add di, ax ; Point to start of next line
dec bx ; Decrement row counter
jnz loop1 ; Loop while rows remain
mov ah, 49h ; Request DOS Function 49h
mov es, addr
int 21h ; Release Memory Block
ret
WinClose ENDP
-♦-