home *** CD-ROM | disk | FTP | other *** search
- Unit STI_SCRF; {Screen handling fucntions }
-
- Interface
-
- Uses Crt; {standard TP 5.0 unit }
-
- Const
- NOBORDER = '';
- SPACES = ' ';
- SINGLELINE = #$98#$9A#$99#$9B#$95#$95#$96#$96;
- ROUNDCORNERSINGLE = #$9C#$9E#$9D#$9F#$95#$95#$96#$96;
- BIGBLOCK = #$87#$87#$87#$87#$87#$87#$87#$87;
- THICKTOPTHINSIDES = #$83#$9A#$83#$9B#$83#$95#$96#$96;
- THICKDIAGONALCORNER = #$E4#$E6#$E5#$E7#$87#$87#$87#$87;
-
-
- Type
- TVRAM = array[0..$f9e] of word; {text screen array }
- WindowSave = record {saved screen record }
- TScr : TVRAM; {the text }
- TAttr : TVRAM; {the attributes }
- end;
- WindowPtr = ^WindowSave; {pointer to saved screen }
-
- Var
- Vram : TVRAM absolute $A000:$0; {video ram position }
- Attr : TVRAM absolute $A200:$0; {text attribute postion }
-
- procedure HiddenCursor; {procedure to hide the cursor }
- procedure NormalCursor; {procedure to display the cursor}
- procedure Frame(x1,y1,x2,y2,TCol,Attr:byte; Border : string);
- procedure DisposeWindow(Var Save : WindowSave);
- procedure MakeWindow(Var Save : WindowSave; X1,Y1,X2,Y2,Tcol,Fcol,TTCol : byte;
- Border,Title : string);
-
- Implementation
-
- {---------------------------------------------------------------------------}
-
- procedure HiddenCursor; {procedure to hide the cursor }
-
- begin
- port[$62] := $4b; {play around with the ports }
- port[$60] := $0f;
- port[$60] := $0f;
- port[$60] := $fb;
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure NormalCursor; {procedure to display the cursor}
-
- begin
- port[$0062] := $4b; {play around with the ports }
- port[$0060] := $8f;
- port[$0060] := $00;
- port[$0060] := $fb;
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure Frame(x1,y1,x2,y2,TCol,Attr:byte; Border : string);
-
- Var
- Loop : byte;
-
- begin
- TextColor(Tcol);
- Window(x1,y1,x2,y2);
- ClrScr;
- TextColor(Attr);
- Kanji := FALSE;
- Window(1,1,80,25);
- for Loop := x1 to x2 do
- begin
- GotoXY(Loop,y1);
- Write(Border[5]);
- GotoXY(Loop,y2);
- Write(Border[6]);
- end;
- for Loop := y1 to y2 do
- begin
- GotoXY(x1,Loop);
- Write(Border[7]);
- GotoXY(x2,Loop);
- Write(Border[8]);
- end;
- GotoXY(x1,y1); write(Border[1]);
- GotoXY(x2,y1); write(Border[3]);
- GotoXY(x1,y2); write(Border[2]);
- GotoXY(x2,y2); write(Border[4]);
- Kanji := TRUE;
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure DisposeWindow(Var Save : WindowSave);
-
- begin
- move(Save.TScr,Vram ,sizeof(Vram)); {save the text }
- move(Save.TAttr,Attr,sizeof(Attr)); {save the attributes }
- end;
-
- {---------------------------------------------------------------------------}
-
- procedure MakeWindow(Var Save : WindowSave; X1,Y1,X2,Y2,Tcol,Fcol,TTCol : byte;
- Border,Title : string);
-
- begin
- move(Vram,Save.TScr ,sizeof(Vram)); { save the text }
- move(Attr,Save.TAttr,sizeof(Attr)); { save the attributes }
- if Border <> '' then { check for border }
- Frame(X1,Y1,X2,Y2,TCol,Fcol,Border) { draw the border }
- else
- begin
- Window(X1,Y1,X2,Y2); { reset the window }
- TextColor(Tcol); { reset the color }
- ClrScr; { wipe the window }
- TextColor(White); { set to defaults }
- TextReverse(NoReverse); { default }
- Window(1,1,80,25); { default }
- end;
- if (Title <> '') and (Border <> '') then
- begin
- if length(Title) > (X2-X1)-2 then
- Title := copy(Title,1,(X2-X1)-2);
- GotoXY(X1+ (((X2-X1) div 2) - (length(Title) div 2)),Y1);
- TextColor(Tcol);
- TextReverse(Reverse);
- Write(Title);
- TextReverse(NoReverse);
- end;
- end;
-
- {---------------------------------------------------------------------------}
-
- begin
- end.