This program wouldn't have been possible without the addition of the line-routine to MINIGRAFIK. It displays a wall clock, with hands for seconds, minutes, and hours. TI$ is set in the first line, so set time can be easily synchronised with RUN+{RETURN}. As the clock face is drawn, some arrays are too being initialised. The main loop insists on making redraw fast.
There is still enough time left at line 26 to add some effects. Maybe an alarm function, or a Westminster Gong?
Greetings,
Michael
Code: Select all
10 REM ** WALL CLOCK
11 TI$="123456":DIMSX(59),SY(59),BX(59),BY(59):MX=80:MY=96:@ON:@CLR
12 FORT=0TO59:S=SIN({PI}*T/30):C=COS({PI}*T/30)
13 SX(T)=MX+INT(33*S+.5):SY(T)=MY-INT(55*C+.5)
14 BX(T)=MX+INT(48*S+.5):BY(T)=MY-INT(80*C+.5)
15 RX=54:RY=90:IFT=5*INT(T/5)THENRX=51:RY=85
16 @1,MX+INT(RX*S+.5),MY-INT(RY*C+.5)TOMX+INT(57*S+.5),MY-INT(95*C+.5)
17 NEXT:H=0:M=0:S=0:A$=TI$
18 :
19 B$=TI$:IFB$=A$THEN19
20 S=VAL(MID$(B$,5,2)):M=VAL(MID$(B$,3,2))
21 H=VAL(MID$(B$,1,2)):H=INT(0.5+5*H+M/12):H=H-60*INT(H/60)
22 IFG<>HTHEN:@0,MX,MYTOSX(G),SY(G)
23 IFL<>MTHEN:@0,MX,MYTOBX(L),BY(L)
24 @0,MX,MYTOBX(R),BY(R):@1,MX,MYTOBX(S),BY(S)
25 @1,MX,MYTOBX(M),BY(M):@1,MX,MYTOSX(H),SY(H)
26 G=H:L=M:R=S:A$=B$:GOTO19