home *** CD-ROM | disk | FTP | other *** search
- {REFORMAT.IN3, aka FRAMER.INC }
- {PC-specific direct screen writing to create frames.
- There are lots of examples on how to do this with Turbo and
- regular "Write" if you have an odd video setup.
- We make no effort to reduce "flicker" on slow or color
- screens, since this is not a video-oriented utility.
- Toad Hall.
- }
-
- TYPE
- Win_Set_Info
- = RECORD
- x,len,y,ht : Byte;
- END;
-
- Window_Array = ARRAY [0..2]
- OF Win_Set_Info;
- CONST
- win_set : Window_Array = (
- { x w y h }
- {0} ( x: 1; len:79; y: 1; ht:24),
- {1} ( x: 2; len:77; y:17; ht: 2),
- {2} ( x: 1; len:79; y: 2; ht:20)
- );
-
- VAR
- color,
- wLeft,wTop,
- width,height,
- ToadY : INTEGER;
-
- PROCEDURE Frame(nr : INTEGER);
- BEGIN
- InLine(
- {; window stack:}
- {; 0[win_set] = inner left edge of target window}
- {; 1[win_set] = length of target window}
- {; 2[win_set] = inner top edge of target window}
- {; 3[win_set] = height of target window}
-
- $1E { push DS}
- /$06 { push ES}
-
- /$B4/$0F { mov AH,$0F ;get current video mode}
- /$CD/$10 { int $10}
- /$89/$C3 { mov BX,AX}
- /$B8/$00/$B0 { mov AX,$B000 ;assume mono}
- /$80/$FB/$07 { cmp BL,7 ;mono?}
- /$74/$03 { je S1 ; yep}
- /$B8/$00/$B8 { mov AX,$B800 ; nope, color}
- {S1:}
- /$8E/$C0 { mov ES,AX ;ES=video memory}
-
- /$2E { CS:}
- /$B8/>WIN_SET { mov AX,>win_set;base of window array}
- /$89/$C6 { mov SI,AX ;DS:SI = array base}
- /$8B/$46/$04 { mov AX,4[BP] ;the window number parm}
- /$09/$C0 { or AX,AX ;0?}
- /$74/$07 { je S2 ; yep}
- /$BB/$04/$00 { mov BX,4 ;size of a window array}
- /$F6/$E3 { mul BL ;get offset in array 0..10}
- /$01/$C6 { add SI,AX ;DS:SI=window[wind_nr]}
- {S2:}
- /$2E { CS:}
- /$8B/$04 { mov AX,[SI] ;AL=left edge, AH=width}
- /$88/$E2 { mov DL,AH ;keep width in DL}
- /$A2/>WLEFT { mov [>wLeft],AL;save in global}
-
- /$2E { CS:}
- /$8B/$44/$02 { mov AX,2[SI] ;AL=top edge,AH=height}
- /$88/$E6 { mov DH,AH ;keep height in DH}
-
- {;find starting address of window}
- /$31/$C0 { xor AX,AX ;clear msb}
- /$89/$C3 { mov BX,AX}
- /$2E { CS:}
- /$8A/$44/$02 { mov al,2[SI] ; top edge}
- /$48 { dec AX}
- /$A2/>WTOP { mov [>wTop],AL ;save in global}
-
- /$B3/$A0 { mov bl,160 ;ax = top_edge*160 + lf_edge*2}
- /$F6/$E3 { mul bl}
- /$2E { CS:}
- /$8A/$1C { mov bl,[SI] ;left edge}
- /$4B { dec BX}
- /$D1/$E3 { shl BX,1}
- /$00/$D8 { add al,bl}
- /$80/$D4/$00 { adc ah,0}
- /$89/$C7 { mov DI,ax ;ES:DI= top left corner}
- /$57 { PUSH DI ;save for drawing verticals}
- {;find distance to bottom line of window}
- /$31/$C0 { xor AX,AX ;clear msb}
- /$89/$C3 { mov BX,AX}
- /$88/$F0 { mov al,DH ; DH=height}
- /$B3/$A0 { mov bl,160 ; ax = wd_height*160}
- /$F6/$E3 { mul bl}
- /$89/$C3 { mov bx,ax ;BX=offset to bottom left}
-
- /$8A/$26/>COLOR { mov AH,[>color];get color back}
- /$B0/$C9 { mov AL,$0C9 I ;top left corner,}
- /$26 { ES:}
- /$89/$05 { mov [DI],AX ;top left corner}
- /$B0/$C8 { mov AL,$0C8 ;bottom left corner}
- /$26 { ES:}
- /$89/$01 { mov [DI+BX],AX ;bottom left}
- /$81/$C7/$02/$00 { add DI,2 ;bump to next scr word}
-
- /$88/$D1 { mov cl,DL ; get width of window, minus 2}
- /$30/$ED { xor ch,ch}
- /$49 { dec cx}
- /$B0/$CD { mov al,$0CD ; get horizontal line into ax}
- /$50 { push AX ;save for bottom}
-
- {;draw the 2 horizontals}
- /$57 { PUSH DI ;ES:DI = top left corner+1}
- /$51 { PUSH CX}
- /$F2/$AB { rep stosw}
- /$B0/$BB { mov al,$0BB ; top right corner}
- /$26 { ES:}
- /$89/$05 { mov [DI],AX}
- /$59 { POP CX}
- /$5F { POP DI ;ES:DI=top left corner+1}
-
- /$58 { pop AX ;horizontal line char}
- /$01/$DF { add DI,BX ;now at bottom left+1}
- /$F2/$AB { rep stosw}
-
- /$B0/$BC { mov al,$0BC ; bottom right corner}
- /$26 { ES:}
- /$89/$05 { mov [DI],ax}
-
- /$5F { POP DI ;get back window starting
- address}
- /$88/$D3 { mov bl,DL ;get width of window minus 1
- into bx}
- /$30/$FF { xor bh,bh}
- /$D1/$E3 { shl bx,1}
- /$81/$C7/$A0/$00 { add DI,160 ; move down a line (don't
- overwrite corners)}
- /$88/$F1 { mov cl,DH ; get height of window, minus
- 2, into cx}
- /$30/$ED { xor ch,ch}
- /$49 { dec cx}
- /$B0/$BA { mov al,$0BA ; get vertical line into al}
- {;draw the two verticals}
- {V1:}
- /$26 { ES:}
- /$89/$05 { mov [DI],ax ;left side}
- /$26 { ES:}
- /$89/$01 { mov [DI+BX],ax ;right side}
- /$81/$C7/$A0/$00 { add DI,160 ;next row}
- /$E2/$F4 { loop V1}
-
- /$31/$C0 { xor AX,AX}
- /$88/$D0 { mov AL,DL}
- /$2D/$01/$00 { sub AX,2}
- /$A3/>WIDTH { mov [>width],AX}
- /$31/$C0 { xor AX,AX}
- /$88/$F0 { mov AL,DH}
- /$48 { dec AX}
- /$A3/>HEIGHT { mov [>height],AX}
- /$B8/$01/$00 { mov AX,1 ;reset ToadY}
- /$A3/>TOADY { mov [>ToadY],AX ;to 1}
- /$07 { pop ES}
- /$1F { pop DS}
- );
- END; {of Frame}
-