Digital clock.
{$A+,B+,D+,E-,F-,G+,I+,L+,N+,O-,P-,Q-,R-,S+,T-,V+,X+,Y+}
{$M 16384,0,600000}
Uses
crt, graph, dos, globals, general;
Function GetHighestCap(Table: Pointer; Modes: Word; Size: Integer): Integer;
near; assembler;
asm
XOR AX,AX
LES DI, Table
@@1:
MOV SI, Modes
ADD SI, Size
ADD SI, Size
MOV BX, ES:[DI]
CMP BX, 0FFFFH
JE @@4
INC DI
INC DI
MOV CX,Size
@@2:
CMP BX,[SI]
JZ @@3
DEC SI
DEC SI
LOOP @@2
@@3:
CMP AX,CX
JA @@1
MOV AX,CX
JMP @@1
@@4:
end;
function DetectVesa16: Integer; far; assembler;
var
VesaInfo: array[0..255] of Byte;
asm
MOV AX,SS
MOV ES,AX
LEA DI,VesaInfo
MOV AX,4F00H
INT 10H
CMP AX,004FH
MOV AX,grError
JNZ @@Exit
CMP ES:[DI].VgaInfoBlock.VESASignature.Word[0], 'EV'
JNZ @@Exit
CMP ES:[DI].VgaInfoBlock.VESASignature.Word[2], 'AS'
JNZ @@Exit
LES DI,ES:[DI].VgaInfoBlock.VideoModePtr
PUSH ES
PUSH DI
MOV AX, OFFSET Vesa16Modes
PUSH AX
MOV AX,3
PUSH AX
CALL GetHighestCap
@@Exit:
end;
Procedure SVGAinitialize;
Var
PathToDriver : string; {Stores the DOS path to *.BGI & *.CHR}
begin
PathToDriver:='';
VESA16 := InstallUserDriver('VESA', @DetectVesa16);
GD := IBM8514;
GM := IBM8514Hi;
GD := Detect; {Use autodetection}
InitGraph(GD,GM,PathToDriver);
end; { SVGA initialize }
Const
DIG_1 : array [ 0..13 ] of Byte = ( 10, 10, 10, 10, 10, 0, 10,
0, 0, 10, 10, 0, 0, 0 );
DIG_2 : array [ 0..13 ] of Byte = ( 10, 10, 10, 10, 10, 0, 10,
0, 10, 10, 0, 10, 10, 10 );
DIG_3 : array [ 0..13 ] of Byte = ( 10, 10, 10, 10, 10, 0, 10,
0, 0, 10, 10, 10, 10, 10 );
DIG_4 : array [ 0..13 ] of Byte = ( 10, 10, 10, 10, 10, 0, 10,
10, 0, 10, 10, 0, 10, 0 );
DIG_5 : array [ 0..13 ] of Byte = ( 10, 10, 10, 10, 10, 0, 10,
10, 0, 0, 10, 10, 10, 10 );
DIG_6 : array [ 0..13 ] of Byte = ( 10, 10, 10, 10, 10, 0, 10,
10, 10, 0, 10, 10, 10, 10 );
DIG_7 : array [ 0..13 ] of Byte = ( 10, 10, 10, 10, 10, 0, 10,
0, 0, 10, 10, 10, 0, 0 );
DIG_8 : array [ 0..13 ] of Byte = ( 10, 10, 10, 10, 10, 0, 10,
10, 10, 10, 10, 10, 10, 10 );
DIG_9 : array [ 0..13 ] of Byte = ( 10, 10, 10, 10, 10, 0, 10,
10, 0, 10, 10, 10, 10, 10 );
DIG_10 : array [ 0..13 ] of Byte = ( 0, 0, 10, 10, 0, 0, 0,
10, 10, 10, 10, 10, 0, 10 );
DIG_11 : array [ 0..13 ] of Byte = ( 0, 0, 10, 10, 0, 0, 0,
0, 0, 10, 10, 0, 0, 0 );
DIG_12 : array [ 0..13 ] of Byte = ( 0, 0, 10, 10, 0, 0, 0,
0, 10, 10, 0, 10, 10, 10 );
DIG_13 : array [ 0..13 ] of Byte = ( 0, 0, 10, 10, 0, 0, 0,
0, 0, 10, 10, 10, 10, 10 );
DIG_14 : array [ 0..13 ] of Byte = ( 0, 0, 10, 10, 0, 0, 0,
10, 0, 10, 10, 0, 10, 0 );
DIG_15 : array [ 0..13 ] of Byte = ( 0, 0, 10, 10, 0, 0, 0,
10, 0, 0, 10, 10, 10, 10 );
DIG_16 : array [ 0..13 ] of Byte = ( 0, 0, 10, 10, 0, 0, 0,
10, 10, 0, 10, 10, 10, 10 );
DIG_17 : array [ 0..13 ] of Byte = ( 0, 0, 10, 10, 0, 0, 0,
0, 0, 10, 10, 10, 0, 0 );
DIG_18 : array [ 0..13 ] of Byte = ( 0, 0, 10, 10, 0, 0, 0,
10, 10, 10, 10, 10, 10, 10 );
DIG_19 : array [ 0..13 ] of Byte = ( 0, 0, 10, 10, 0, 0, 0,
10, 0, 10, 10, 10, 10, 10 );
DIG_20 : array [ 0..13 ] of Byte = ( 0, 10, 10, 0, 10, 10, 10,
10, 10, 10, 10, 10, 0, 10 );
DIG_21 : array [ 0..13 ] of Byte = ( 0, 10, 10, 0, 10, 10, 10,
0, 0, 10, 10, 0, 0, 0 );
DIG_22 : array [ 0..13 ] of Byte = ( 0, 10, 10, 0, 10, 10, 10,
0, 10, 10, 0, 10, 10, 10 );
DIG_23 : array [ 0..13 ] of Byte = ( 0, 10, 10, 0, 10, 10, 10,
0, 0, 10, 10, 10, 10, 10 );
DIG_24 : array [ 0..13 ] of Byte = ( 0, 10, 10, 0, 10, 10, 10,
10, 0, 10, 10, 0, 10, 0 );
DIG_25 : array [ 0..13 ] of Byte = ( 0, 10, 10, 0, 10, 10, 10,
10, 0, 0, 10, 10, 10, 10 );
DIG_26 : array [ 0..13 ] of Byte = ( 0, 10, 10, 0, 10, 10, 10,
10, 10, 0, 10, 10, 10, 10 );
DIG_27 : array [ 0..13 ] of Byte = ( 0, 10, 10, 0, 10, 10, 10,
0, 0, 10, 10, 10, 0, 0 );
DIG_28 : array [ 0..13 ] of Byte = ( 0, 10, 10, 0, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10 );
DIG_29 : array [ 0..13 ] of Byte = ( 0, 10, 10, 0, 10, 10, 10,
10, 0, 10, 10, 10, 10, 10 );
DIG_30 : array [ 0..13 ] of Byte = ( 0, 0, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 0, 10 );
DIG_31 : array [ 0..13 ] of Byte = ( 0, 0, 10, 10, 10, 10, 10,
0, 0, 10, 10, 0, 0, 0 );
DIG_32 : array [ 0..13 ] of Byte = ( 0, 0, 10, 10, 10, 10, 10,
0, 10, 10, 0, 10, 10, 10 );
DIG_33 : array [ 0..13 ] of Byte = ( 0, 0, 10, 10, 10, 10, 10,
0, 0, 10, 10, 10, 10, 10 );
DIG_34 : array [ 0..13 ] of Byte = ( 0, 0, 10, 10, 10, 10, 10,
10, 0, 10, 10, 0, 10, 0 );
DIG_35 : array [ 0..13 ] of Byte = ( 0, 0, 10, 10, 10, 10, 10,
10, 0, 0, 10, 10, 10, 10 );
DIG_36 : array [ 0..13 ] of Byte = ( 0, 0, 10, 10, 10, 10, 10,
10, 10, 0, 10, 10, 10, 10 );
DIG_37 : array [ 0..13 ] of Byte = ( 0, 0, 10, 10, 10, 10, 10,
0, 0, 10, 10, 10, 0, 0 );
DIG_38 : array [ 0..13 ] of Byte = ( 0, 0, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10 );
DIG_39 : array [ 0..13 ] of Byte = ( 0, 0, 10, 10, 10, 10, 10,
10, 0, 10, 10, 10, 10, 10 );
DIG_40 : array [ 0..13 ] of Byte = ( 10, 0, 10, 10, 0, 10, 0,
10, 10, 10, 10, 10, 0, 10 );
DIG_41 : array [ 0..13 ] of Byte = ( 10, 0, 10, 10, 0, 10, 0,
0, 0, 10, 10, 0, 0, 0 );
DIG_42 : array [ 0..13 ] of Byte = ( 10, 0, 10, 10, 0, 10, 0,
0, 10, 10, 0, 10, 10, 10 );
DIG_43 : array [ 0..13 ] of Byte = ( 10, 0, 10, 10, 0, 10, 0,
0, 0, 10, 10, 10, 10, 10 );
DIG_44 : array [ 0..13 ] of Byte = ( 10, 0, 10, 10, 0, 10, 0,
10, 0, 10, 10, 0, 10, 0 );
DIG_45 : array [ 0..13 ] of Byte = ( 10, 0, 10, 10, 0, 10, 0,
10, 0, 0, 10, 10, 10, 10 );
DIG_46 : array [ 0..13 ] of Byte = ( 10, 0, 10, 10, 0, 10, 0,
10, 10, 0, 10, 10, 10, 10 );
DIG_47 : array [ 0..13 ] of Byte = ( 10, 0, 10, 10, 0, 10, 0,
0, 0, 10, 10, 10, 0, 0 );
DIG_48 : array [ 0..13 ] of Byte = ( 10, 0, 10, 10, 0, 10, 0,
10, 10, 10, 10, 10, 10, 10 );
DIG_49 : array [ 0..13 ] of Byte = ( 10, 0, 10, 10, 0, 10, 0,
10, 0, 10, 10, 10, 10, 10 );
DIG_50 : array [ 0..13 ] of Byte = ( 10, 0, 0, 10, 10, 10, 10,
10, 10, 10, 10, 10, 0, 10 );
DIG_51 : array [ 0..13 ] of Byte = ( 10, 0, 0, 10, 10, 10, 10,
0, 0, 10, 10, 0, 0, 0 );
DIG_52 : array [ 0..13 ] of Byte = ( 10, 0, 0, 10, 10, 10, 10,
0, 10, 10, 0, 10, 10, 10 );
DIG_53 : array [ 0..13 ] of Byte = ( 10, 0, 0, 10, 10, 10, 10,
0, 0, 10, 10, 10, 10, 10 );
DIG_54 : array [ 0..13 ] of Byte = ( 10, 0, 0, 10, 10, 10, 10,
10, 0, 10, 10, 0, 10, 0 );
DIG_55 : array [ 0..13 ] of Byte = ( 10, 0, 0, 10, 10, 10, 10,
10, 0, 0, 10, 10, 10, 10 );
DIG_56 : array [ 0..13 ] of Byte = ( 10, 0, 0, 10, 10, 10, 10,
10, 10, 0, 10, 10, 10, 10 );
DIG_57 : array [ 0..13 ] of Byte = ( 10, 0, 0, 10, 10, 10, 10,
0, 0, 10, 10, 10, 0, 0 );
DIG_58 : array [ 0..13 ] of Byte = ( 10, 0, 0, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10 );
DIG_59 : array [ 0..13 ] of Byte = ( 10, 0, 0, 10, 10, 10, 10,
10, 0, 10, 10, 10, 10, 10 );
DIG_00 : array [ 0..13 ] of Byte = ( 10, 10, 10, 10, 10, 0, 10,
10, 10, 10, 10, 10, 0, 10 );
Var
h,m,s,ms:word;
ClockX : Integer;
ClockY : Integer;
Key : char;
Procedure Points( EllX, EllY, Color : Integer );
begin
SetFillStyle( 1, Color );
FillEllipse( EllX + 10, EllY + 9, 2, 2 );
FillEllipse( EllX + 10, EllY + 24, 2, 2 );
end;
Procedure Digit( DigX, DigY : Integer; Seg : array of Byte );
begin
BarDeluxe( DigX, DigY + 4, 2, 10, 1, Seg[ 0 ] ); { Up left }
BarDeluxe( DigX, DigY + 20, 2, 10, 1, Seg[ 1 ] ); { Down left }
BarDeluxe( DigX + 16, DigY + 4, 2, 10, 1, Seg[ 2 ] ); { Up right }
BarDeluxe( DigX + 16, DigY + 20, 2, 10, 1, Seg[ 3 ] ); { Down right }
BarDeluxe( DigX + 4, DigY, 10, 2, 1, Seg[ 4 ] ); { Up }
BarDeluxe( DigX + 4, DigY + 16, 10, 2, 1, Seg[ 5 ] ); { Medium }
BarDeluxe( DigX + 4, DigY + 32, 10, 2, 1, Seg[ 6 ] ); { Down }
BarDeluxe( DigX + 25, DigY + 4, 2, 10, 1, Seg[ 7 ] ); { Up left }
BarDeluxe( DigX + 25, DigY + 20, 2, 10, 1, Seg[ 8 ] ); { Down left }
BarDeluxe( DigX + 41, DigY + 4, 2, 10, 1, Seg[ 9 ] ); { Up right }
BarDeluxe( DigX + 41, DigY + 20, 2, 10, 1, Seg[ 10 ] );{ Down right }
BarDeluxe( DigX + 29, DigY, 10, 2, 1, Seg[ 11 ] ); { Up }
BarDeluxe( DigX + 29, DigY + 16, 10, 2, 1, Seg[ 12 ] );{ Medium }
BarDeluxe( DigX + 29, DigY + 32, 10, 2, 1, Seg[ 13 ] );{ Down }
end;
Begin
SVGAinitialize; { *** Init video *** }
SetGraphMode(4);{ *** Set graphics mode by 800x600 pixels, 8 bit color *** }
SetColor( 12 );
SetTextStyle( 7, 0, 0 );
OutTextXY( 10, 10, '-=- Sergeant Skeleton -=-');
SetTextStyle( 7, 0, 2 );
OutTextXY( 20, 60, 'DOS Clock v.1.0');
ClockX := 420;
ClockY := 350;
SetColor( 10 );
Points( ClockX + 50, ClockY, 10 );
Points( ClockX + 125, ClockY, 10 );
repeat
gettime(h,m,s,ms);
case H of
1 : Digit( ClockX, ClockY, DIG_1 );
2 : Digit( ClockX, ClockY, DIG_2 );
3 : Digit( ClockX, ClockY, DIG_3 );
4 : Digit( ClockX, ClockY, DIG_4 );
5 : Digit( ClockX, ClockY, DIG_5 );
6 : Digit( ClockX, ClockY, DIG_6 );
7 : Digit( ClockX, ClockY, DIG_7 );
8 : Digit( ClockX, ClockY, DIG_8 );
9 : Digit( ClockX, ClockY, DIG_9 );
10 : Digit( ClockX, ClockY, DIG_10 );
11 : Digit( ClockX, ClockY, DIG_11 );
12 : Digit( ClockX, ClockY, DIG_12 );
13 : Digit( ClockX, ClockY, DIG_13 );
14 : Digit( ClockX, ClockY, DIG_14 );
15 : Digit( ClockX, ClockY, DIG_15 );
16 : Digit( ClockX, ClockY, DIG_16 );
17 : Digit( ClockX, ClockY, DIG_17 );
18 : Digit( ClockX, ClockY, DIG_18 );
19 : Digit( ClockX, ClockY, DIG_19 );
20 : Digit( ClockX, ClockY, DIG_20 );
21 : Digit( ClockX, ClockY, DIG_21 );
22 : Digit( ClockX, ClockY, DIG_22 );
23 : Digit( ClockX, ClockY, DIG_23 );
00 : Digit( ClockX, ClockY, DIG_00 );
end; { of case }
case M of
1 : Digit( ClockX + 75, ClockY, DIG_1 );
2 : Digit( ClockX + 75, ClockY, DIG_2 );
3 : Digit( ClockX + 75, ClockY, DIG_3 );
4 : Digit( ClockX + 75, ClockY, DIG_4 );
5 : Digit( ClockX + 75, ClockY, DIG_5 );
6 : Digit( ClockX + 75, ClockY, DIG_6 );
7 : Digit( ClockX + 75, ClockY, DIG_7 );
8 : Digit( ClockX + 75, ClockY, DIG_8 );
9 : Digit( ClockX + 75, ClockY, DIG_9 );
10 : Digit( ClockX + 75, ClockY, DIG_10 );
11 : Digit( ClockX + 75, ClockY, DIG_11 );
12 : Digit( ClockX + 75, ClockY, DIG_12 );
13 : Digit( ClockX + 75, ClockY, DIG_13 );
14 : Digit( ClockX + 75, ClockY, DIG_14 );
15 : Digit( ClockX + 75, ClockY, DIG_15 );
16 : Digit( ClockX + 75, ClockY, DIG_16 );
17 : Digit( ClockX + 75, ClockY, DIG_17 );
18 : Digit( ClockX + 75, ClockY, DIG_18 );
19 : Digit( ClockX + 75, ClockY, DIG_19 );
20 : Digit( ClockX + 75, ClockY, DIG_20 );
21 : Digit( ClockX + 75, ClockY, DIG_21 );
22 : Digit( ClockX + 75, ClockY, DIG_22 );
23 : Digit( ClockX + 75, ClockY, DIG_23 );
24 : Digit( ClockX + 75, ClockY, DIG_24 );
25 : Digit( ClockX + 75, ClockY, DIG_25 );
26 : Digit( ClockX + 75, ClockY, DIG_26 );
27 : Digit( ClockX + 75, ClockY, DIG_27 );
28 : Digit( ClockX + 75, ClockY, DIG_28 );
29 : Digit( ClockX + 75, ClockY, DIG_29 );
30 : Digit( ClockX + 75, ClockY, DIG_30 );
31 : Digit( ClockX + 75, ClockY, DIG_31 );
32 : Digit( ClockX + 75, ClockY, DIG_32 );
33 : Digit( ClockX + 75, ClockY, DIG_33 );
34 : Digit( ClockX + 75, ClockY, DIG_34 );
35 : Digit( ClockX + 75, ClockY, DIG_35 );
36 : Digit( ClockX + 75, ClockY, DIG_36 );
37 : Digit( ClockX + 75, ClockY, DIG_37 );
38 : Digit( ClockX + 75, ClockY, DIG_38 );
39 : Digit( ClockX + 75, ClockY, DIG_39 );
40 : Digit( ClockX + 75, ClockY, DIG_40 );
41 : Digit( ClockX + 75, ClockY, DIG_41 );
42 : Digit( ClockX + 75, ClockY, DIG_42 );
43 : Digit( ClockX + 75, ClockY, DIG_43 );
44 : Digit( ClockX + 75, ClockY, DIG_44 );
45 : Digit( ClockX + 75, ClockY, DIG_45 );
46 : Digit( ClockX + 75, ClockY, DIG_46 );
47 : Digit( ClockX + 75, ClockY, DIG_47 );
48 : Digit( ClockX + 75, ClockY, DIG_48 );
49 : Digit( ClockX + 75, ClockY, DIG_49 );
50 : Digit( ClockX + 75, ClockY, DIG_50 );
51 : Digit( ClockX + 75, ClockY, DIG_51 );
52 : Digit( ClockX + 75, ClockY, DIG_52 );
53 : Digit( ClockX + 75, ClockY, DIG_53 );
54 : Digit( ClockX + 75, ClockY, DIG_54 );
55 : Digit( ClockX + 75, ClockY, DIG_55 );
56 : Digit( ClockX + 75, ClockY, DIG_56 );
57 : Digit( ClockX + 75, ClockY, DIG_57 );
58 : Digit( ClockX + 75, ClockY, DIG_58 );
59 : Digit( ClockX + 75, ClockY, DIG_59 );
00 : Digit( ClockX + 75, ClockY, DIG_00 );
end; { of case }
case S of
1 : Digit( ClockX + 150, ClockY, DIG_1 );
2 : Digit( ClockX + 150, ClockY, DIG_2 );
3 : Digit( ClockX + 150, ClockY, DIG_3 );
4 : Digit( ClockX + 150, ClockY, DIG_4 );
5 : Digit( ClockX + 150, ClockY, DIG_5 );
6 : Digit( ClockX + 150, ClockY, DIG_6 );
7 : Digit( ClockX + 150, ClockY, DIG_7 );
8 : Digit( ClockX + 150, ClockY, DIG_8 );
9 : Digit( ClockX + 150, ClockY, DIG_9 );
10 : Digit( ClockX + 150, ClockY, DIG_10 );
11 : Digit( ClockX + 150, ClockY, DIG_11 );
12 : Digit( ClockX + 150, ClockY, DIG_12 );
13 : Digit( ClockX + 150, ClockY, DIG_13 );
14 : Digit( ClockX + 150, ClockY, DIG_14 );
15 : Digit( ClockX + 150, ClockY, DIG_15 );
16 : Digit( ClockX + 150, ClockY, DIG_16 );
17 : Digit( ClockX + 150, ClockY, DIG_17 );
18 : Digit( ClockX + 150, ClockY, DIG_18 );
19 : Digit( ClockX + 150, ClockY, DIG_19 );
20 : Digit( ClockX + 150, ClockY, DIG_20 );
21 : Digit( ClockX + 150, ClockY, DIG_21 );
22 : Digit( ClockX + 150, ClockY, DIG_22 );
23 : Digit( ClockX + 150, ClockY, DIG_23 );
24 : Digit( ClockX + 150, ClockY, DIG_24 );
25 : Digit( ClockX + 150, ClockY, DIG_25 );
26 : Digit( ClockX + 150, ClockY, DIG_26 );
27 : Digit( ClockX + 150, ClockY, DIG_27 );
28 : Digit( ClockX + 150, ClockY, DIG_28 );
29 : Digit( ClockX + 150, ClockY, DIG_29 );
30 : Digit( ClockX + 150, ClockY, DIG_30 );
31 : Digit( ClockX + 150, ClockY, DIG_31 );
32 : Digit( ClockX + 150, ClockY, DIG_32 );
33 : Digit( ClockX + 150, ClockY, DIG_33 );
34 : Digit( ClockX + 150, ClockY, DIG_34 );
35 : Digit( ClockX + 150, ClockY, DIG_35 );
36 : Digit( ClockX + 150, ClockY, DIG_36 );
37 : Digit( ClockX + 150, ClockY, DIG_37 );
38 : Digit( ClockX + 150, ClockY, DIG_38 );
39 : Digit( ClockX + 150, ClockY, DIG_39 );
40 : Digit( ClockX + 150, ClockY, DIG_40 );
41 : Digit( ClockX + 150, ClockY, DIG_41 );
42 : Digit( ClockX + 150, ClockY, DIG_42 );
43 : Digit( ClockX + 150, ClockY, DIG_43 );
44 : Digit( ClockX + 150, ClockY, DIG_44 );
45 : Digit( ClockX + 150, ClockY, DIG_45 );
46 : Digit( ClockX + 150, ClockY, DIG_46 );
47 : Digit( ClockX + 150, ClockY, DIG_47 );
48 : Digit( ClockX + 150, ClockY, DIG_48 );
49 : Digit( ClockX + 150, ClockY, DIG_49 );
50 : Digit( ClockX + 150, ClockY, DIG_50 );
51 : Digit( ClockX + 150, ClockY, DIG_51 );
52 : Digit( ClockX + 150, ClockY, DIG_52 );
53 : Digit( ClockX + 150, ClockY, DIG_53 );
54 : Digit( ClockX + 150, ClockY, DIG_54 );
55 : Digit( ClockX + 150, ClockY, DIG_55 );
56 : Digit( ClockX + 150, ClockY, DIG_56 );
57 : Digit( ClockX + 150, ClockY, DIG_57 );
58 : Digit( ClockX + 150, ClockY, DIG_58 );
59 : Digit( ClockX + 150, ClockY, DIG_59 );
00 : Digit( ClockX + 150, ClockY, DIG_00 );
end; { of case }
until keypressed;
CloseGraph;
End. { Written by Sergeant Skeleton 03.02.2000 }