-
Notifications
You must be signed in to change notification settings - Fork 1
/
clock.bas
58 lines (58 loc) · 1.43 KB
/
clock.bas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
1 REM CLOCK WITH SECOND HAND
10 CP=1:GOTO 1000
100 REM PRINT AT Y,X WITH KERNAL PLOT
110 S=0:POKE 781,Y:POKE 782,X:POKE 783,S:SYS $FFF0:RETURN
120 REM PRINT AT Y,X WITH CURSOR CHARACTERS
122 PRINT CHR$($13);
124 IF Y>0.5 THEN FOR J=1 TO Y:PRINT CHR$($11);:NEXT J
126 PRINT SPC(X);
130 RETURN
200 REM READ COORDINATES OF CURSOR POSITION
210 S=1
220 POKE 783,S:SYS $FFF0:Y=PEEK(781):X=PEEK(782)
230 RETURN
400 REM LINE FROM (A1,B1) TO (A2,B2) (ZX81 BASIC PROGRAMMING CH 18)
403 U=A2-A1
410 V=B2-B1
420 X1=SGN(U)
430 Y1=SGN(V)
440 X2=SGN(U)
450 Y2=0
460 M=ABS(U)
470 N=ABS(V)
480 IF M>N THEN GOTO 540
490 X2=0
500 Y2=SGN(V)
510 M=ABS(V)
520 N=ABS(U)
540 SU=INT(M/2)
550 FOR I=0 TO M
560 X=A1:Y=B1:ON CP GOSUB 110,122:PRINT A$;
570 SU=SU+N
580 IF SU<M THEN GOTO 630
590 SU=SU-M
600 A1=A1+X1
610 B1=B1+Y1
620 GOTO 650
630 A1=A1+X2
640 B1=B1+Y2
650 NEXT I
660 RETURN
1000 REM MAIN
1005 PI=4*ATN(1)
1007 A2=40:B2=30
1010 PRINT CHR$($93);CHR$($96):REM CLS LRED
1020 FOR I=0 TO 59
1021 H=(I+15)*PI/30
1022 X=-30*COS(H)+40:Y=-30*SIN(H)+30:ON CP GOSUB 110,122:PRINT CHR$($A1+I);
1024 NEXT I
1025 H=(VAL(RIGHT$(TI$,2))+15)*PI/30
1026 IF TI-T<60 THEN GOTO 1026:REM BUG: STOPS HERE WHEN 000000
1027 T=TI
1028 A1=XS:B1=YS:A$=" ":GOSUB 400
1029 PRINT CHR$($9E);:REM YELLOW
1030 A1=-28*COS(H)+40:B1=-28*SIN(H)+30:XS=A1:YS=B1:A$=CHR$($12)+" ":GOSUB 400
1040 T$=TI$:PRINT CHR$($13);CHR$($92);CHR$($05);T$;:REM HOME RVSOFF WHITE
1070 H=(VAL(RIGHT$(T$,2))+15)*PI/30
1080 GOTO 1026
1090 END