home *** CD-ROM | disk | FTP | other *** search
- { Global variables accessed by miscellaneous procedures and functions }
-
-
- Type
- String1 =String[1];
- String2 =String[2];
- String3 =String[3];
- String4 =String[4];
- String6 =String[6];
- String8 =String[8];
- String10 =String[10];
- String11 =String[11];
- String20 =String[20];
- String30 =String[30];
- String40 =String[40];
- String66 =String[66];
- String80 =String[80];
- String255=String[255];
- CharSetType=Set of char;
- ByteSetType=Set of Byte;
- HelpLineType=array [1..80] of integer;
- RegsType=record
- Case Integer of
- 1:(ax,bx,cx,dx,bp,si,di,ds,es,flags:integer);
- 2:(al,ah,bl,bh,cl,ch,dl,dh:byte);
- End; {record}
- GregType=Record { 4 }
- Day,Month:Byte;
- Year:Integer;
- End; {record}
- JulType=Record { 4 }
- Day,Year:Integer;
- End; {record}
- ClockType=Record { 3 }
- Hour,Minute,Second:Byte;
- End; {record}
- MonthTableType=Record
- Days:Byte;
- Jul:Integer;
- End;
-
-
- Const
- esckey = 1; BkSpkey = 14; tabkey = 15;
- enterkey = 28; f1key = 59; f2key = 60;
- f3key = 61; f4key = 62; f5key = 63;
- f6key = 64; f7key = 65; f8key = 66;
- f9key = 67; f10key = 68; homekey = 71;
- arrowupkey = 72; pageupkey = 73; arrowlfkey = 75;
- arrowrtkey = 77; endkey = 79; arrowdnkey = 80;
- pagednkey = 81; inskey = 82; delkey = 83;
- CtrlDelKey =166; ShiftEscKey=201; CtrlEscKey =202;
- ShiftBkSpKey =203; CtrlBkSpKey=204; ShiftTabKey=205;
- FullStringExit=206; CtrlHomeKey=119; CtrlEndKey =164;
- CtrlArrowRtKey=116; CtrlArrowLfKey=115; CtrlArrowUpKey=160;
- CtrlArrowDnKey=164; CtrlPageUpKey=132; CtrlPageDnKey=118;
-
- Alt_A_Key=30; Alt_B_Key=48; Alt_C_Key=46; Alt_D_Key=32; Alt_E_Key=18;
- Alt_F_Key=33; Alt_G_Key=34; Alt_H_Key=35; Alt_I_Key=23; Alt_J_Key=36;
- Alt_K_Key=37; Alt_L_Key=38; Alt_M_Key=50; Alt_N_Key=49; Alt_O_Key=24;
- Alt_P_Key=25; Alt_Q_Key=16; Alt_R_Key=19; Alt_S_Key=31; Alt_T_Key=20;
- Alt_U_Key=22; Alt_V_Key=47; Alt_W_Key=17; Alt_X_Key=45; Alt_Y_Key=21;
- Alt_Z_Key=44;
-
- Ctrl_A_Key=#1; Ctrl_B_Key=#2; Ctrl_C_Key=#3; Ctrl_D_Key=#4;
- Ctrl_E_Key=#5; Ctrl_F_Key=#6; Ctrl_G_Key=#7; Ctrl_H_Key=#8;
- Ctrl_I_Key=#9; Ctrl_J_Key=#10; Ctrl_K_Key=#11; Ctrl_L_Key=#12;
- Ctrl_M_Key=#13; Ctrl_N_Key=#14; Ctrl_O_Key=#15; Ctrl_P_Key=#16;
- Ctrl_Q_Key=#17; Ctrl_R_Key=#18; Ctrl_S_Key=#19; Ctrl_T_Key=#20;
- Ctrl_U_Key=#21; Ctrl_V_Key=#22; Ctrl_W_Key=#23; Ctrl_X_Key=#24;
- Ctrl_Y_Key=#25; Ctrl_Z_Key=#26;
-
- Var
- SCC,LFCC,NFCC,DFCC:Byte;
- DateSep,EdateSep1,EdateSep2:char;
- ValidMaskTokenSet:CharSetType;
- On,Off:Boolean;
- ToContinue:String[12];
- ToChangeTo,ToTryAgain:String[13];
- Regs:RegsType;
- BlankString:String[80];
- DayName:array [1..7] of String[9];
- MonthName:array [1..12] of String[9];
- MonthTable:array [1..12] of MonthTableType;
- WindowXL,WindowXR,WindowYT,WindowYB:Integer;
- OldWindow:Array [1..6,1..30] of Integer;
- WPL:Byte;
- WindowGarbage:Array[1..3000] of integer;
- WindowGarbageTop:Integer;
- PopUpArray:Array [0..16] of String[65];
- PopUpKey:Array [1..10] of char;
- BaseOfScreen:Integer;
- WaitForRetrace,CursorStatus,ProcessingHelp:Boolean;
- Maskey:Array [0..20] of CharSetType;
- HelpLine:Array [1..20] of HelpLineType;
- CurrentHelpStatus,OldKBStatus:Byte;
-
-
-
- { Miscellaneous procedures and functions }
-
-
-
- Procedure GotoXYA(X,Y:byte);
- Begin
- Regs.ah:=2; Regs.bh:=0;
- Regs.dl:=pred(X); Regs.dh:=pred(Y);
- Intr($10,Regs);
- End;
-
- Function WhereXA:Byte;
- Var WinX:Byte absolute DSeg:4;
- Begin
- WhereXA:=WhereX+WinX;
- End;
-
- Function WhereYA:Byte;
- Var WinY:Byte absolute DSeg:5;
- Begin
- WhereYA:=WhereY+WinY;
- End;
-
- Procedure QWriteA(St:String80;X,Y,Att,CursorCode:Byte);
- Var SLen:byte absolute St;
- Begin
- If X=0 then X:=WhereXA;
- If Y=0 then Y:=WhereYA;
- Inline($1E/$8B/$7E/<Y/$4F/$B9/$04/$00/$D3/$E7/$89/$F8/$D1/$E7/$D1/$E7/$01/$C7/
- $8B/$46/<X/$48/$01/$C7/$D1/$E7/$8D/$76/<ST/$8B/$16/>BASEOFSCREEN/$8E/$C2/
- $A0/>WAITFORRETRACE/$8C/$D2/$8E/$DA/$8A/$0C/$E3/$59/$46/$8A/$66/<ATT/$FC/
- $D0/$D8/$73/$3F/$BA/$DA/$03/$80/$FC/$00/$74/$1B/$AC/$89/$C3/$FA/$EC/$A8/$08/
- $75/$09/$D0/$D8/$72/$F7/$EC/$D0/$D8/$73/$FB/$89/$D8/$AB/$FB/$E2/$E8/$E9/$2D/
- $00/$AC/$88/$C3/$FA/$EC/$A8/$08/$75/$09/$D0/$D8/$72/$F7/$EC/$D0/$D8/$73/$FB/
- $88/$D8/$AA/$FB/$47/$E2/$E7/$E9/$11/$00/$80/$FC/$00/$74/$07/$AC/$AB/$E2/$FC/
- $E9/$05/$00/$AC/$AA/$47/$E2/$FB/$1F);
- {Brian Foley's fastwrite, butchered by me}
- Case CursorCode of
- 1:GotoXYA(X,Y);
- 2:GotoXYA(X+SLen,Y);
- End; {case}
- End;
-
- Procedure QWrite(St:String80;X,Y,Att,CursorCode:Byte);
- Var
- WinX:Byte absolute DSeg:4;
- WinY:Byte absolute DSeg:5;
- Begin
- If X<>0 then X:=X+WinX;
- If Y<>0 then Y:=Y+WinY;
- QWriteA(St,X,Y,Att,CursorCode);
- End;
-
- Procedure QWriteAttA(Len,X,Y,Att,CC:Byte);
- Begin
- If X=0 then X:=WhereXA;
- If Y=0 then Y:=WhereYA;
- Inline($8B/$46/<Y/$48/$B9/$50/$00/$F7/$E1/$03/$46/<X/$48/$D1/$E0/$89/$C7/$47/
- $8B/$16/>BASEOFSCREEN/$8E/$C2/$8B/$4E/<LEN/$E3/$2C/$8B/$46/<ATT/$FC/$8B/
- $1E/>WAITFORRETRACE/$D0/$DB/$73/$1C/$BA/$DA/$03/$88/$C3/$B4/$09/$EC/$D0/
- $D8/$72/$FB/$FA/$EC/$20/$E0/$74/$FB/$88/$D8/$AA/$FB/$47/$E2/$EE/$E9/$04/
- $00/$AA/$47/$E2/$FC/$90); {Brian Foley's FastWriteAtt}
- Case CC of
- 1:GotoXYA(X,Y);
- 2:GotoXYA(X+Len,Y);
- End; {case}
- End;
-
- Procedure QWriteAtt(Len,X,Y,Att,CC:Byte);
- Var
- WinX:Byte absolute DSeg:4;
- WinY:Byte absolute DSeg:5;
- Begin
- If X<>0 then X:=X+WinX;
- If Y<>0 then Y:=Y+WinY;
- QWriteAttA(Len,X,Y,Att,CC);
- End;
-
- Procedure MoveFromScreen(VAR Source, Dest; Length : Integer);
- Begin
- Length:=Length shr 1;
- Inline($8C/$DB/$A0/>WaitForRetrace/$C4/$7E/<Dest/$C5/$76/<Source/$8B/$4E/<Length
- /$FC/$D0/$D8/$73/$19/$BA/$DA/$03/$FA/$EC/$A8/$08/$75/$09/$D0/$D8/$72/$F7/$EC
- /$D0/$D8/$73/$FB/$AD/$FB/$AB/$E2/$EC/$EB/$02/$F2/$A5/$8E/$DB);
- END;
-
- Procedure MoveToScreen(VAR Source, Dest; Length : Integer);
- Begin
- Length:=Length shr 1;
- Inline($1E/$A0/>WaitForRetrace/$C4/$7E/<Dest/$C5/$76/<Source/$8B/$4E/<Length/$FC
- /$D0/$D8/$73/$1D/$BA/$DA/$03/$AD/$89/$C3/$FA/$EC/$A8/$08/$75/$09/$D0/$D8/$72/$F7
- /$EC/$D0/$D8/$73/$FB/$89/$D8/$AB/$FB/$E2/$E8/$EB/$02/$F2/$A5/$1F);
- End;
-
- Procedure BInc(var X:Byte);
- Begin
- X:=succ(X);
- End;
-
- Procedure BDec(var X:Byte);
- Begin
- X:=pred(X);
- End;
-
- Procedure IInc(var X:Integer);
- Begin
- X:=succ(X);
- End;
-
- Procedure IDec(var X:Integer);
- Begin
- X:=pred(X);
- End;
-
- Function BitCheck(BitNum,AnyByte:Byte):Boolean;
- Var BitVal:Byte;
- Begin
- BitVal:=1 shl BitNum;
- BitCheck:=((AnyByte and BitVal)=BitVal);
- End;
-
- Function ByteVal(TempString:String8):Byte;
- Var TempInt,Dummy:Integer;
- Begin
- Val(TempString,TempInt,Dummy);
- If (TempInt<256) and (TempInt>=0) then ByteVal:=TempInt Else ByteVal:=0;
- End;
-
- Procedure Cursor(Show:Boolean);
- Begin
- Regs.ah:=1;
- If Show then Regs.cx:=$0607 Else Regs.cx:=$2000;
- Intr($10,Regs);
- CursorStatus:=Show;
- End;
-
- Procedure Beep;
- Begin
- sound(1000); Delay(30);
- sound(1500); Delay(30);
- NoSound;
- End;
-
- Function Spaces(x:byte):String80;
- Var BLen:byte absolute BlankString;
- Begin
- if x>80 then x:=80;
- BLen:=x; Spaces:=BlankString;
- End;
-
- Function StringOf(HowMany:Byte;Chars:char):String80;
- Var
- Temp:String255;
- TLen:Byte absolute Temp;
- Begin
- If HowMany>80 then HowMany:=80;
- fillchar(Temp[1],HowMany,Chars);
- TLen:=HowMany;
- StringOf:=Temp;
- End;
-
- Function StMask(X:Byte):String80;
- Begin
- If X=1 then StMask:='}'
- Else StMask:='}'+StringOf(Pred(X),'#');
- End;
-
- Function LeftText(X:String80;FieldSize:Byte):String80;
- Var XLen:Byte absolute X;
- Begin
- If XLen>FieldSize then XLen:=FieldSize;
- LeftText:=X+Spaces(FieldSize-XLen);
- End;
-
- Function RSpaceWhack(X:String80):String80;
- Var XLen:Byte absolute X;
- Begin
- While (X[XLen]=' ') and (XLen>0) Do BDec(XLen);
- RSpaceWhack:=x;
- End;
-
- Function LSpaceWhack(X:String80):String80;
- Var XLen:Byte absolute X;
- Begin
- While (X[1]=' ') and (XLen>0) Do Delete(x,1,1);
- LSpaceWhack:=x;
- End;
-
- Function SpaceWhack(x:String80):String80;
- Begin
- SpaceWhack:=LSpaceWhack(RSpaceWhack(x));
- End;
-
- Procedure SetHelp(HLine,HNum:Byte);
- Var ScreenLine:HelpLineType absolute $B8F0:0;
- Begin
- If HNum<>0 then CurrentHelpStatus:=HNum;
- If HLine<>0 then MoveToScreen(HelpLine[HLine],ScreenLine,160);
- End;
-
- Procedure SetWindow(XL,YT,XR,YB:Byte);
- Begin
- If YB-YT<1 then YB:=succ(YT); If XR-XL<1 Then XR:=succ(XL);
- BInc(WPL);
- OldWindow[1,WPL]:=WindowXL;
- OldWindow[2,WPL]:=WindowXR;
- OldWindow[3,WPL]:=WindowYT;
- OldWindow[4,WPL]:=WindowYB;
- OldWindow[5,WPL]:=WhereX;
- OldWindow[6,WPL]:=WhereY;
- WindowXL:=XL;
- WindowXR:=XR;
- WindowYT:=YT;
- WindowYB:=YB;
- Window(WindowXL,WindowYT,WindowXR,WindowYB);
- GotoXY(1,1);
- End;
-
- Procedure RecallWindow;
- Begin
- WindowXL:=OldWindow[1,WPL];
- WindowXR:=OldWindow[2,WPL];
- WindowYT:=OldWindow[3,WPL];
- WindowYB:=OldWindow[4,WPL];
- Window(WindowXL,WindowYT,WindowXR,WindowYB);
- GotoXY(OldWindow[5,WPL],OldWindow[6,WPL]);
- BDec(WPL);
- End;
-
- Procedure TextBox(X,Y,Wide,High,Lines,att:Byte);
- Type Portion=(UL,UR,LL,LR,Vert,Horz);
- Const
- Piece:array [0..2,Portion] of char = (( #32, #32, #32, #32, #32, #32),
- (#218,#191,#192,#217,#179,#196),
- (#201,#187,#200,#188,#186,#205));
- Var
- I,Rcol:Byte;
- TempString:String[80];
- VertChar:char;
- Begin
- TempString:=StringOf(Wide-2,Piece[Lines,Horz]);
- QWriteA(Piece[Lines,UL]+TempString+Piece[Lines,UR],x,y,Att,0);
- VertChar:=Piece[Lines,Vert]; Rcol:=pred(x+wide);
- For I:=1 to High-2 do
- Begin
- QWriteA(VertChar,x,y+I,att,0); QWriteA(VertChar,Rcol,y+I,Att,0);
- End;
- QWriteA(Piece[Lines,LL]+TempString+Piece[Lines,LR],x,pred(y+high),att,0);
- End;
-
- Procedure WTextBox(X,Y,Wide,High,NumLines,LineAtt,WinAtt:Byte);
- Begin
- If High<4 then High:=4; If Wide<4 then Wide:=4;
- TextBox(x,y,Wide,High,NumLines,LineAtt);
- SetWindow(succ(X),succ(Y),X+Wide-2,Y+High-2);
- TextColor(WinAtt and 15); TextBackground(WinAtt shr 4);
- ClrScr;
- TextColor(SCC and 15); TextBackGround(SCC shr 4);
- End;
-
- Procedure LayWindow(x,y,wide,high,NumBordLines,BordAtt,WinAtt:Byte);
- Var
- I:Byte;
- Screen:array [1..25,1..80] of integer absolute $B800:0;
- Begin
- If Wide<4 then Wide:=4; If High<4 then High:=4;
- For I:=Y to pred(Y+High) do
- Begin
- MoveFromScreen(Screen[I,X],WindowGarbage[WindowGarbageTop],wide shl 1);
- WindowGarbageTop:=WindowGarbageTop+Wide;
- End;
- WTextBox(X,Y,Wide,High,NumBordLines,BordAtt,WinAtt);
- End;
-
- Procedure PeelWindow;
- Var
- I,x,wide:Byte;
- Screen:array [1..25,1..80] of integer absolute $B800:0;
- Begin
- wide:=WindowXR-WindowXL+3;
- X:=pred(WindowXL);
- For I:=succ(WindowYB) downto pred(WindowYT) Do
- Begin
- WindowGarbageTop:=WindowGarbageTop-Wide;
- MoveToScreen(WindowGarbage[WindowGarbageTop],Screen[I,X],Wide shl 1);
- End;
- RecallWindow;
- End;
-
- Procedure ScreenClock; forward;
- Procedure HelpNeeded; forward;
-
- Procedure GetKey(InsertStatusLine:Boolean; Var Scan:Byte; var Ascii:char);
- Var
- KeyGiven,ShiftKey,CtrlKey:Boolean;
- KBStatus:Byte absolute $40:$17 ;
-
- Procedure WriteInsertStatus;
- Const InsStat:Array [False..True] of String[9]=('Overwrite','Insert ');
- Begin
- QWriteA(InsStat[BitCheck(7,OldKBStatus)],71,1,7,0);
- End;
-
- Begin
- If InsertStatusLine then WriteInsertStatus;
- KeyGiven:=False;
- Repeat
- If KeyPressed Then
- Begin
- KeyGiven:=True;
- Regs.ax:=0; Intr(22,Regs);
- Ascii:=Char(Regs.al); Scan:=Regs.ah;
- OldKBStatus:=KBStatus;
- If (Scan=F1Key) and not ProcessingHelp then HelpNeeded;
- If (Scan=InsKey) and InsertStatusLine and (ascii<>'0') then
- Begin
- WriteInsertStatus;
- KeyGiven:=False;
- End;
- End
- Else ScreenClock;
- Until KeyGiven;
- ShiftKey:= Bitcheck(0,OldKBStatus) or Bitcheck(1,OldKBStatus);
- CtrlKey:= Bitcheck(2,OldKBStatus);
- Case Ascii of
- #0:if Scan=15 then Scan:=ShiftTabKey;
- #9:If Scan=15 then Ascii:=#0;
- #27:If Scan in [1,34] then
- Begin
- Ascii:=#0;
- If ShiftKey then Scan:=ShiftEscKey
- Else If CtrlKey then Scan:=CtrlEscKey;
- End;
- #8,#127:If Scan=14 then
- Begin
- Ascii:=#0;
- If ShiftKey then Scan:=ShiftBkSpKey
- Else If CtrlKey then Scan:=CtrlBkSpKey;
- End;
- #13,#10:If Scan=28 then Ascii:=#0;
- End; {case}
- If Ascii>#0 then Scan:=0;
- If InsertStatusLine then QWriteA(Spaces(9),71,1,7,0);
- End;
-
- Function MaskIndex(Token:Char):Byte;
- Var X:Byte;
- Begin
- Case Token of
- '!' : X:=1;
- '#' : X:=2;
- '&' : X:=3;
- '*'..'+' : X:=ord(Token)-38; {4..5}
- '/' : X:=6;
- '<'..'@' : X:=ord(Token)-53; {7..11} { <=>?@ }
- '['..'^' : X:=ord(Token)-79; {12..15} { [\]^ }
- '{'..'~' : X:=ord(Token)-107; {16..19} (* {|}~ *)
- #255 : X:=20;
- Else X:=0;
- End; {case}
- MaskIndex:=X;
- End;
-
- Procedure SetMask(Token:Char;M:String255);
- Var
- I,MI:Byte;
- MLen:Byte absolute M;
- Begin
- MI:=MaskIndex(Token);
- If MI in [1..19] then
- Begin
- Maskey[MI]:=[];
- If MLen>0 then
- For I:=1 to MLen Do
- If (M[I]='.') and (I>1) and not((M[pred(I)]='.') or (M[succ(I)]='.')) and (I<MLen) then
- Maskey[MI]:=Maskey[MI]+[M[pred(I)]..M[succ(I)]]
- Else Maskey[MI]:=Maskey[MI]+[M[I]];
- End;
- End;
-
- Procedure ReadKey(InsertStatusLine:Boolean;
- ScanExitSet:ByteSetType;
- AsciiExitSet:CharSetType;
- MaskToken:char;
- Var Scan:Byte;
- Var Ascii:Char);
- Var Mask:CharSetType;
- Begin
- Mask:=Maskey[MaskIndex(MaskToken)]+AsciiExitSet;
- Repeat
- GetKey(InsertStatusLine,Scan,Ascii);
- If not(Ascii in Mask) and (ascii in Maskey[1]) then
- If Ascii in [#65..#90] then Ascii:=char(ord(Ascii)+32)
- Else Ascii:=char(ord(Ascii)-32);
- Until (Scan in ScanExitSet) or (Ascii in Mask);
- End;
-
- Procedure ClearKBBuffer;
- Var key:char;
- Begin
- While Keypressed do read(kbd,key);
- End;
-
- Function AutoX(Wide:Byte):Byte;
- Var X:Integer;
- Begin
- X:=WhereXA-(wide div 4);
- If X<1 then X:=1;
- If X+wide>81 then X:=81-wide;
- AutoX:=lo(X);
- End;
-
- Function AutoY(High:Byte):Byte;
- Var Y:Integer;
- Begin
- Y:=WhereYA;
- If Y>13 then
- Begin
- Y:=Y-high-2;
- If Y<3 then Y:=3;
- End
- Else
- Begin
- Y:=Y+2;
- If Y+high>25 then Y:=25-high;
- End;
- AutoY:=lo(Y);
- End;
-
- Procedure PopNote(Nlines,Nkeys:byte; var key:char);
- Var
- OldCursorStatus:boolean;
- x,y,I,wide,high,Dummy:byte;
- AsciiExitSet:CharSetType;
- HelpLine:byte absolute $B8F0:0;
- TempHelpLine:array [1..160] of byte;
-
- Procedure CalcSize;
- Begin
- wide:=0;
- For I:=1 to Nlines Do
- If length(PopUpArray[I])+9>wide then wide:=length(PopUpArray[I])+9;
- For I:=succ(Nlines) to Nlines+NKeys Do
- If length(PopUpArray[I])+14>wide then wide:=length(PopUpArray[I])+14;
- high:=Nlines+Nkeys+2;
- End;
-
- Procedure CalcPos;
- Begin
- Y:=AutoY(High);
- X:=AutoX(Wide);
- End;
-
- Begin
- MoveFromScreen(HelpLine,TempHelpLine,160);
- OldCursorStatus:=CursorStatus; Cursor(Off); SetHelp(19,1);
- CalcSize; CalcPos;
- LayWindow(x,y,wide,high,1,$70,$70);
- QWrite('Note!:',1,1,0,0);
- For I := 1 to Nlines Do QWrite(PopUpArray[I],8,I,0,0);
- AsciiExitSet:=[];
- For I := 1 to Nkeys Do
- Begin
- QWrite(PopUpArray[I+Nlines],13,NLines+I,0,0);
- If I=1 then QWrite('ESC',8,NLines+I,$60,0)
- Else
- Begin
- AsciiExitSet:=AsciiExitSet+[PopUpKey[I]];
- QWrite(PopUpKey[I],9,NLines+I,$60,0);
- End;
- End;
- QWrite('Press:',1,succ(NLines),0,0);
- For I:=1 to 4 do Beep; Delay(300); ClearKBBuffer;
- ReadKey(off,[esckey],AsciiExitSet,#0,Dummy,key);
- PeelWindow; Cursor(OldCursorStatus);
- MoveToScreen(TempHelpLine,HelpLine,160);
- End;
-
-
-
-
- { * * * * * T I M E F U N C T I O N S * * * * * }
-
-
- Procedure DaypartToClock(DayPart:Integer; Var Clock:ClockType);
- Begin
- Clock.Hour:=DayPart div 720;
- Clock.Minute:=(DayPart mod 720) div 12;
- Clock.Second:=(DayPart mod 12)*5;
- End;
-
- Procedure ClockToDaypart(Clock:ClockType; Var DayPart:Integer);
- Begin
- DayPart:=((Clock.Second+2) div 5)+Clock.Minute*12+Clock.Hour*720;
- End;
-
- Procedure RawTime(Var Clock:ClockType);
- Begin
- regs.ax:=$2C00; MSDOS(regs);
- Clock.Hour:=regs.ch; Clock.Minute:=regs.cl; Clock.Second:=regs.dh;
- End;
-
- Function TimeString(Clock:ClockType;MilitaryTime:Boolean):String10;
- Const
- AmPm:Array[False..True,0..1] of String[2]=(('am','pm'),(' M',' N'));
- Var
- H:Byte absolute Clock;
- MinSec:String[5];
- Begin
- MinSec:=form('@@',Clock.Minute)+':'+form('@@',Clock.Second);
- If MilitaryTime Then TimeString:=form('@@',H)+':'+MinSec
- Else TimeString:=form('##',succ((H+11)mod 12))+':'+MinSec+
- AmPm[(Clock.Minute+Clock.Second+(H mod 12)=0),(H div 12)];
- End;
-
-
- { * * * * * D A T E F U N C T I O N S * * * * * }
-
-
- Procedure GregToJul(Greg:GregType;Var Jul:JulType);
- Begin
- Jul.Day:=MonthTable[Greg.Month].Jul+Greg.Day;
- If (Greg.Year mod 4=0) and (Greg.Month>2) Then IInc(Jul.Day);
- Jul.Year:=Greg.Year;
- End;
-
- Procedure JulToGreg(Jul:Jultype;Var Greg:GregType);
- Var I:Byte;
- Begin
- If (Jul.Year mod 4 = 0) and (Jul.Day > 59) Then
- If Jul.Day=60 Then
- Begin
- Greg.Day:=29; Greg.Month:=2; Greg.Year:=Jul.Year; Exit;
- End
- Else IDec(Jul.Day);
- I:=1; While Jul.Day>MonthTable[I].Jul do BInc(I);
- BDec(I); Greg.Month:=I; Greg.Day:=Jul.Day-MonthTable[I].Jul;
- Greg.Year:=Jul.Year;
- End; {Function}
-
- Procedure RawDate(Var Greg:GregType);
- Begin
- regs.ax:=$2A00; MSDOS(regs);
- Greg.Day:=regs.dl; Greg.Month:=regs.dh; Greg.Year:=regs.cx;
- End;
-
- Function Calendar(Greg:GregType;Style,Size:char):String30;
- Var
- Day:String[2];
- Month:String[9];
- Year:String[4];
- Begin
- Day:=form('@@',Greg.Day); Year:=form('####',Greg.Year);
- If size = 'S' Then Year:=copy(Year,3,2);
- Month:=MonthName[Greg.Month];
- If size='S' Then Month:=copy(Month,1,3);
- Case Style of
- 'N':Calendar:=form('@@',Greg.Month)+DateSep+Day+DateSep+Year;
- 'A':Calendar:=Month+' '+Day+', '+Year;
- 'E':Begin
- If size='S' Then Calendar:=Day+EdateSep1+Month+EDateSep2+Year
- Else Calendar:=Day+' '+Month+', '+Year;
- End;
- End; {Case}
- End; {Function}
-
- Procedure ScreenClock;
- Var
- Greg:GregType;
- Clock:ClockType;
- TempString:String[23];
- DayString:String[3];
- Begin
- RawDate(Greg);
- If Regs.AL=0 then DayString:='Sun' Else DayString:=DayName[Regs.AL];
- TempString:=DayString+' '+Calendar(Greg,'N','S');
- RawTime(Clock);
- QWriteA(TempString+' '+TimeString(Clock,off),1,1,7,0);
- End;
-
- Procedure HelpNeeded;
- Var
- dummy:char;
- TempHelpLine:array [1..160] of byte;
- HelpLine:byte absolute $B8F0:0;
- Begin
- MoveFromScreen(HelpLine,TempHelpLine,160);
- ProcessingHelp:=True;
- PopUpArray[1]:='No help screens are available at this time.';
- PopUpArray[2]:=ToContinue;
- PopNote(1,1,dummy);
- ProcessingHelp:=False;
- MoveToScreen(TempHelpLine,HelpLine,160);
- End;
-
-
- Procedure initialize;
-
- Procedure Necessary;
-
- Procedure LoadHelp;
- Type TwentyHelpLines=Array[1..20] of HelpLineType;
- Var
- X:TwentyHelpLines absolute HelpLine;
- Diskfile:File of TwentyHelpLines;
- Begin
- Assign(DiskFile,'HELP.SCR'); Reset(DiskFile);
- Read(DiskFile,X); Close(DiskFile);
- End;
-
- Var
- KBStatus : byte absolute $40:$17 ;
- I:Byte;
- Const
- TempArray1:array [1..7] of String[9]=('Monday','Tuesday','Wednesday',
- 'Thursday','Friday','Saturday','Sunday');
- TempArray2:array [1..12] of String[9]=('January','February','March','April',
- 'May','June','July','August','September','October','November','December');
- TempArray3:array [1..36] of Byte=(31,0,0,28,31,0,31,59,0,30,90,0,31,120,0,
- 30,151,0,31,181,0,31,212,0,30,243,0,31,17,1,30,48,1,31,78,1);
- Begin
- TextMode(C80); TextColor(7); TextBackGround(0);
- On:=True; Off:=False;
- WPL:=0; WindowGarbageTop:=1; setwindow(1,1,80,25); ClrScr; Cursor(on);
- BaseOfScreen:=$B800; WaitForRetrace:=True;
- BlankString:=StringOf(80,' ');
- LoadHelp;
- ValidMaskTokenSet:=['!','#','&','*','+','/','<'..'@','['..'^','{'..'~'];
- LFCC:=$7F; {Live Field Composite Color}
- NFCC:=$6E; {Neutral Field Composite Color}
- DFCC:=$27; {Dead Field Composite Color}
- SCC:=7; {Standard composite color}
- DateSep:='-'; { This is for AmericanNumeric only }
- EdateSep1:='-'; { Goes Between the European date's Day and Month AND }
- EdateSep2:='-'; { Month and Year respectively (Short version only) }
- ToContinue:='To continue.';
- ToChangeTo:='To change to ';
- ToTryAgain:='To try again.';
- Move(TempArray1,DayName,SizeOf(DayName));
- Move(TempArray2,MonthName,SizeOf(MonthName));
- Move(TempArray3,MonthTable,SizeOf(MonthTable));
- For I:=0 to 19 Do Maskey[I]:=[];
- Maskey[20]:=[#1..#254];
- OldKBStatus:=KBStatus;
- ProcessingHelp:=False;
- End;
-
- Procedure NotNecessary;
- Begin
- SetMask('#',' .~');
- SetMask('<','a.z');
- SetMask('>','A.Z');
- SetMask('{',' .@[.~');
- SetMask('}',' .`{.~');
- SetMask('!','A.Za.z');
- SetMask('&','0.9');
- SetMask('?',' !#.%(.+-.]');
- SetMask('@','A.Z0.9');
- End;
-
- Begin {procedure Initialize}
- Necessary;
- NotNecessary;
- End;
-
-