home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programming
/
powerprogramming1994.iso
/
progtool
/
dskutl
/
reform16.arc
/
REFORMAT.IN3
< prev
next >
Wrap
Text File
|
1990-03-03
|
7KB
|
160 lines
{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(windnr : INTEGER);
BEGIN
{ 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
}
Inline(
$B4/$0F/ { mov AH,$0F ;get current video mode}
$CD/$10/ { int $10}
$3C/$07/ { cmp al,7 ;mono?}
$B8/$00/$B0/ { mov AX,$B000 ;assume mono}
$74/$02/ { je S1 ; yep}
$B4/$B8/ { mov ah,$B8 ; nope, color}
{S1:}
$8E/$C0/ { mov ES,AX ;ES=video memory}
$BE/>WIN_SET/ { mov si,>win_set;base of window array}
$8B/$86/>WINDNR/ { mov AX,>windnr[BP] ;the window number parm}
$09/$C0/ { or AX,AX ;0?}
$74/$06/ { je S2 ; yep}
{; mov bl,4 ;size of a window array}
{; mul BL ;get offset in array 0..10}
$D1/$E0/ { shl ax,1 ;get offset in array 0..10}
$D1/$E0/ { shl ax,1 ;(same as * 4)}
$01/$C6/ { add SI,AX ;DS:SI=window[wind_nr]}
{S2:}
$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}
$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}
$8A/$44/$02/ { mov al,2[SI] ; top edge}
$48/ { dec AX}
$A2/>WTOP/ { mov [>wTop],AL ;save in global}
{; mov bl,160 ;ax = top_edge*160 + lf_edge*2}
{; mul bl}
$B9/$A0/$00/ { mov cx,160 ;handy constant, msb 0}
$F6/$E1/ { mul cl ;ax = top_edge*160 + lf_edge*2}
$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}
{; mov BX,AX}
$88/$F0/ { mov al,DH ; DH=height}
{; mov bl,160 ; ax = wd_height*160}
{; mul bl}
$F6/$E1/ { mul cl ;ax = wd_height*160}
$89/$C3/ { mov bx,ax ;BX=offset to bottom left}
$8A/$26/>COLOR/ { mov AH,[>color];get color back}
$B0/$C8/ { mov AL,$0C8 ;bottom left corner}
$26/ { ES:}
$89/$01/ { mov [DI+BX],AX ;bottom left}
$B0/$C9/ { mov AL,$0C9 ;top left corner,}
$AB/ { stosw ;stuff, bump to next scr word}
$88/$D1/ { mov cl,DL ; get width of window, minus 2}
$49/ { dec cx ;(msb already 0)}
$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 ;clear msb}
$88/$D0/ { mov AL,DL}
$48/ { dec AX}
$48/ { dec ax}
$A3/>WIDTH/ { mov [>width],AX}
$31/$C0/ { xor AX,AX ;clear msb}
$88/$F0/ { mov AL,DH}
$48/ { dec AX}
$A3/>HEIGHT/ { mov [>height],AX}
$B8/$01/$00/ { mov ax,1}
$A3/>TOADY); { mov [>ToadY],ax ;reset ToadY to 1}
END; {of Frame}