home *** CD-ROM | disk | FTP | other *** search
- mov AH,$0F ;get current video mode
- int $10
- cmp al,7 ;mono?
- mov AX,$B000 ;assume mono
- je S1 ; yep
- mov ah,$B8 ; nope, color
- S1:
- mov ES,AX ;ES=video memory
- ;
- mov si,>win_set;base of window array
- mov AX,>windnr[BP] ;the window number parm
- or AX,AX ;0?
- je S2 ; yep
- ; mov bl,4 ;size of a window array
- ; mul BL ;get offset in array 0..10
- shl ax,1 ;get offset in array 0..10
- shl ax,1 ;(same as * 4)
- add SI,AX ;DS:SI=window[wind_nr]
- S2:
- mov AX,[SI] ;AL=left edge, AH=width
- mov DL,AH ;keep width in DL
- mov [>wLeft],AL;save in global
- ;
- mov AX,2[SI] ;AL=top edge,AH=height
- mov DH,AH ;keep height in DH
- ;
- ;find starting address of window
- xor AX,AX ;clear msb
- mov BX,AX
- mov al,2[SI] ; top edge
- dec AX
- mov [>wTop],AL ;save in global
- ;
- ; mov bl,160 ;ax = top_edge*160 + lf_edge*2
- ; mul bl
- mov cx,160 ;handy constant, msb 0
- mul cl ;ax = top_edge*160 + lf_edge*2
- mov bl,[SI] ;left edge
- dec BX
- shl BX,1
- add al,bl
- adc ah,0
- mov DI,ax ;ES:DI= top left corner
- PUSH DI ;save for drawing verticals
- ;find distance to bottom line of window
- xor AX,AX ;clear msb
- ; mov BX,AX
- mov al,DH ; DH=height
- ; mov bl,160 ; ax = wd_height*160
- ; mul bl
- mul cl ;ax = wd_height*160
- mov bx,ax ;BX=offset to bottom left
- ;
- mov AH,[>color];get color back
- mov AL,$0C8 ;bottom left corner
- ES:
- mov [DI+BX],AX ;bottom left
- mov AL,$0C9 ;top left corner,
- stosw ;stuff, bump to next scr word
- ;
- mov cl,DL ; get width of window, minus 2
- dec cx ;(msb already 0)
- mov al,$0CD ; get horizontal line into ax
- push AX ;save for bottom
- ;
- ;draw the 2 horizontals
- PUSH DI ;ES:DI = top left corner+1
- PUSH CX
- rep stosw
- mov al,$0BB ; top right corner
- ES:
- mov [DI],AX
- POP CX
- POP DI ;ES:DI=top left corner+1
- ;
- pop AX ;horizontal line char
- add DI,BX ;now at bottom left+1
- rep stosw
- ;
- mov al,$0BC ; bottom right corner
- ES:
- mov [DI],ax
- ;
- POP DI ;get back window starting
- ;address
- mov bl,DL ;get width of window minus 1
- ;into bx
- xor bh,bh
- shl bx,1
- add DI,160 ; move down a line (don't
- ; overwrite corners)
- mov cl,DH ; get height of window, minus
- ; 2, into cx
- xor ch,ch
- dec cx
- mov al,$0BA ; get vertical line into al
- ;draw the two verticals
- V1:
- ES:
- mov [DI],ax ;left side
- ES:
- mov [DI+BX],ax ;right side
- add DI,160 ;next row
- loop V1
- ;
- xor AX,AX ;clear msb
- mov AL,DL
- dec AX
- dec ax
- mov [>width],AX
- xor AX,AX ;clear msb
- mov AL,DH
- dec AX
- mov [>height],AX
- mov ax,1
- mov [>ToadY],ax ;reset ToadY to 1