DECLARE SUB sb (sd$, a$)
c$ = LCASE$(COMMAND$)
sa = INSTR(c$, "/sa")
rewcfg = INSTR(c$, "/c")
u = INSTR(c$, "/c")
arm$ = " A M"
OPEN "o", #1, "con"
SCREEN 0
WIDTH 80
IF rewcfg > 0 THEN GOTO nc0
ON ERROR GOTO nocfg
OPEN "i", #2, "gfc.cfg"
LINE INPUT #2, sd$
INPUT #2, cfg
INPUT #2, tic
INPUT #2, sil
INPUT #2, arm1
INPUT #2, arm2
INPUT #2, arm$
CLOSE #2
arm$ = " " + arm$
IF sa <> 0 THEN CLS : GOTO sile
gotcfg:
ON ERROR GOTO nosay
OPEN "i", #2, "alarmsay.txt"
INPUT #2, say$
CLOSE #2
gotsay:
IF LEN(say$) > 78 THEN say$ = LEFT$(say$, 78)
si = LEN(say$) / 13
COLOR 0, 0
LOCATE 1, 1, 1: PRINT #1, " grand father clock by jim kitchen";
star = 1
gk:
CLS
g$ = ""
DO: LOOP UNTIL INKEY$ = ""
GOSUB gv
v3 = VAL(MID$(TIME$, 4, 2))
LOCATE 1, 1: PRINT " the time is ";
PRINT v1; v3;
PRINT ampm$;
LOCATE 1, 30: PRINT " space bar for time esc to exit s to shell to dos";
v2 = VAL(MID$(TIME$, 4, 2))
IF star = 1 THEN star = 0: g$ = " ": GOTO kp
DO
g$ = INKEY$
v2 = VAL(MID$(TIME$, 4, 2))
IF STRIG(4) <> 0 THEN CLS : SYSTEM
IF STRIG(0) <> 0 THEN sb sd$, "joystick": g$ = " "
LOOP UNTIL (g$ <> "" OR v2 <> v3)
IF g$ <> "" THEN GOTO kp
GOSUB gv
IF (v1 = arm1 AND v2 = arm2 AND arm$ = ampm$) THEN GOTO alarm
IF sil = 1 THEN IF (ampm$ = " A M" AND v1 < 6) THEN GOTO gk
IF sil = 1 THEN IF VAL(TIME$) = 0 THEN GOTO gk
IF tic = 1 THEN sb sd$, "tick"
IF (v2 = 15 OR v2 = 30 OR v2 = 45 OR v2 = 0) THEN GOTO good
dit = 0
GOTO gk
kp:
IF (g$ = "s" OR g$ = "S") THEN GOTO shellpro
IF ASC(g$) = 27 THEN CLS : SYSTEM
LOCATE 1, 1: PRINT #1, " the time is ";
PRINT #1, v1;
IF v2 = 0 THEN PRINT #1, " o'clock"; : GOTO sk1
IF v2 < 10 THEN PRINT #1, " o";
PRINT #1, v2;
sk1:
PRINT #1, ampm$;
IF ASC(g$) = 32 THEN GOTO gk
LOCATE 1, 30: PRINT #1, " space bar for time esc to exit s to shell to dos";
GOTO gk
good:
IF dit = 1 THEN GOTO gk
dit = 1
GOSUB jim
g$ = " "
GOTO kp
gv:
v1 = VAL(TIME$)
IF v1 < 12 THEN ampm$ = " A M" ELSE ampm$ = " P M"
IF v1 = 0 THEN v1 = 12
IF v1 > 12 THEN v1 = v1 - 12
RETURN
jim:
ON cfg GOTO g1, g2, g3, g4, g5, g6, g7, g8, g9, g10, g11, g12, g13
g1:
sb sd$, "gfc"
IF v2 = 15 THEN sb sd$, "bonk": RETURN
IF v2 = 30 THEN sb sd$, "bonk": sb sd$, "bonk": RETURN
IF v2 = 45 THEN sb sd$, "bonk": sb sd$, "bonk": sb sd$, "bonk": RETURN
FOR rep = 1 TO v1
sb sd$, "bong"
NEXT rep
RETURN
g2:
sb sd$, "gfc"
IF v2 = 15 THEN sb sd$, "bong": RETURN
IF v2 = 30 THEN sb sd$, "bong": sb sd$, "bong": RETURN
IF v2 = 45 THEN sb sd$, "bong": sb sd$, "bong": sb sd$, "bong": RETURN
FOR rep = 1 TO v1
sb sd$, "bonk"
NEXT rep
RETURN
g3:
IF v2 = 15 THEN sb sd$, "bonk": RETURN
IF v2 = 30 THEN sb sd$, "bonk": sb sd$, "bonk": RETURN
IF v2 = 45 THEN sb sd$, "bonk": sb sd$, "bonk": sb sd$, "bonk": RETURN
sb sd$, "gfc"
FOR rep = 1 TO v1
sb sd$, "bong"
NEXT rep
RETURN
g4:
IF v2 = 15 THEN sb sd$, "bong": RETURN
IF v2 = 30 THEN sb sd$, "bong": sb sd$, "bong": RETURN
IF v2 = 45 THEN sb sd$, "bong": sb sd$, "bong": sb sd$, "bong": RETURN
sb sd$, "gfc"
FOR rep = 1 TO v1
sb sd$, "bonk"
NEXT rep
RETURN
g5:
IF v2 = 15 THEN sb sd$, "bonk": RETURN
IF v2 = 30 THEN sb sd$, "bonk": sb sd$, "bonk": RETURN
IF v2 = 45 THEN sb sd$, "bonk": sb sd$, "bonk": sb sd$, "bonk": RETURN
FOR rep = 1 TO v1
sb sd$, "bong"
NEXT rep
RETURN
g6:
IF v2 = 15 THEN sb sd$, "bong": RETURN
IF v2 = 30 THEN sb sd$, "bong": sb sd$, "bong": RETURN
IF v2 = 45 THEN sb sd$, "bong": sb sd$, "bong": sb sd$, "bong": RETURN
FOR rep = 1 TO v1
sb sd$, "bonk"
NEXT rep
RETURN
g7:
IF v2 = 15 THEN sb sd$, "gfc": RETURN
IF v2 = 30 THEN sb sd$, "gfc": sb sd$, "gfc": RETURN
IF v2 = 45 THEN sb sd$, "gfc": sb sd$, "gfc": sb sd$, "gfc": RETURN
FOR rep = 1 TO v1
sb sd$, "gfc"
NEXT rep
RETURN
g8:
IF v2 = 15 THEN sb sd$, "bong": RETURN
IF v2 = 30 THEN sb sd$, "bong": sb sd$, "bong": RETURN
IF v2 = 45 THEN sb sd$, "bong": sb sd$, "bong": sb sd$, "bong": RETURN
FOR rep = 1 TO v1
sb sd$, "bong"
NEXT rep
RETURN
g9:
IF v2 = 15 THEN sb sd$, "bonk": RETURN
IF v2 = 30 THEN sb sd$, "bonk": sb sd$, "bonk": RETURN
IF v2 = 45 THEN sb sd$, "bonk": sb sd$, "bonk": sb sd$, "bonk": RETURN
FOR rep = 1 TO v1
sb sd$, "bonk"
NEXT rep
RETURN
g10:
sb sd$, "cuckoo"
IF v2 = 15 THEN RETURN
IF v2 = 30 THEN sb sd$, "booboo": RETURN
IF v2 = 45 THEN sb sd$, "cuckoo": sb sd$, "cuckoo": RETURN
FOR rep = 1 TO v1
sb sd$, "bird"
NEXT rep
RETURN
g11:
IF v2 = 15 THEN sb sd$, "bird": RETURN
IF v2 = 30 THEN sb sd$, "bird": sb sd$, "bird": RETURN
IF v2 = 45 THEN sb sd$, "bird": sb sd$, "bird": sb sd$, "bird": RETURN
FOR rep = 1 TO v1
sb sd$, "cuckoo"
NEXT rep
RETURN
g12:
IF v2 = 15 THEN sb sd$, "cuckoo": RETURN
IF v2 = 30 THEN sb sd$, "cuckoo": sb sd$, "cuckoo": RETURN
IF v2 = 45 THEN sb sd$, "cuckoo": sb sd$, "cuckoo": sb sd$, "cuckoo": RETURN
FOR rep = 1 TO v1
sb sd$, "cuckoo"
NEXT rep
RETURN
g13:
IF v2 = 15 THEN sb sd$, "bird": RETURN
IF v2 = 30 THEN sb sd$, "bird": sb sd$, "bird": RETURN
IF v2 = 45 THEN sb sd$, "bird": sb sd$, "bird": sb sd$, "bird": RETURN
FOR rep = 1 TO v1
sb sd$, "bird"
NEXT rep
RETURN
shellpro:
kps$ = CURDIR$
CLS
PRINT #1, " O K shelling to dos"
PRINT #1, " "
SHELL "command /k prompt=Type exit to return to the clock.$_$p$g"
FOR rep = 333 TO 666 STEP 111
SOUND rep, 2
NEXT rep
rdr$ = LEFT$(kps$, 2)
SHELL rdr$
ps = LEN(kps$)
rcd$ = "cd" + RIGHT$(kps$, (ps - 2))
SHELL rcd$
star = 1
GOTO gk
alarm:
sb sd$, "alarm"
LOCATE 25, 1: PRINT #1, say$;
st = TIMER + si
DO
g$ = INKEY$
IF g$ <> "" THEN stpal = 1
LOOP UNTIL (stpal = 1 OR TIMER > st)
IF stpal = 0 THEN GOTO alarm
star = 1
GOTO gk
gkey:
DO
g$ = INKEY$
LOOP UNTIL g$ <> ""
g = VAL(g$)
dd = ASC(RIGHT$(g$, 1))
g$ = LCASE$(g$)
RETURN
nosay:
RESUME nos
nos:
say$ = "Time to get up"
OPEN "o", #2, "alarmsay.txt"
PRINT #2, say$
CLOSE #2
GOTO gotsay
nocfg:
RESUME nc0
nc0:
ON ERROR GOTO 0
spt$(1) = "wplay /q": spt$(2) = "plany": spt$(3) = "playwav -b332255 -v30 -k"
nc1:
LOCATE 8, 1: PRINT #1, " Please press the number of the sound player program to try"
LOCATE 10, 1: PRINT #1, " 1 = wplay"
LOCATE 11, 1: PRINT #1, " 2 = plany"
LOCATE 12, 1: PRINT #1, " 3 = playwav"
GOSUB gkey
IF (g < 1 OR g > 3) THEN GOTO nc1
sd$ = spt$(g)
resb:
sb sd$, "cuckoo"
sb sd$, "bonk"
sb sd$, "bird"
LOCATE 15, 1: PRINT #1, " Press y to use this sound player"
LOCATE 16, 1: PRINT #1, " or if you didn't hear anything then press n to try a different player"
r = 1
GOSUB gkey
IF (dd > 58 AND dd < 62) THEN GOTO resb
IF g$ <> "y" THEN GOTO nc1
CLS
badk2:
REDIM p$(20)
LOCATE 2, 1: PRINT #1, " formats for sound output"
p$(1) = " grand bell with bongs to count the hours and bonks at the quarter hours"
p$(2) = " grand bell with bonks to count the hours and bongs at the quarter hours"
p$(3) = " grand bell only at the top of the hour with bongs and bonks"
p$(4) = " grand bell only at the top of the hour with bonks and bongs"
p$(5) = " bongs count the hours and bonks for the quarter hours"
p$(6) = " bonks count the hours and bongs for the quarter hours"
p$(7) = " grand bell for every thing"
p$(8) = " bongs for everything"
p$(9) = " bonks for every thing"
p$(10) = " cuckoo with bird squawk to count the hours"
p$(11) = " cuckoo with bird squawk at the quarter hours"
p$(12) = " cuckoo for everything"
p$(13) = " bird squawk for everything"
badk:
LOCATE 5, 1
FOR pr = 1 TO 13
PRINT p$(pr)
NEXT pr
hinum = 1
l2:
LOCATE 20, 1: PRINT #1, " use the arrow keys to highlight your choice and then press enter"
l1:
IF hinum = 0 THEN hinum = 13
IF hinum = 14 THEN hinum = 1
LOCATE 22, 1: PRINT SPC(78);
LOCATE 22, 1: PRINT #1, p$(hinum);
GOSUB gkey
IF dd > 58 AND dd < 69 THEN GOTO l2
IF dd = 72 THEN hinum = hinum - 1: GOTO l1
IF dd = 80 THEN hinum = hinum + 1: GOTO l1
IF dd = 13 THEN GOTO l3
GOTO l2
l3:
cfg = hinum
CLS
l5:
LOCATE 1, 1: PRINT #1, " Would you like the clock to tic every minute ( Y or N ) ?";
GOSUB gkey
IF g$ = "y" THEN tic = 1: GOTO gtic
IF g$ = "n" THEN tic = 0: GOTO gtic
GOTO l5
gtic:
LOCATE 3, 1: PRINT #1, " Would you like the clock to be silent from midnight until 6 A.M. ( y or n ) ?";
GOSUB gkey
IF g$ = "y" THEN sil = 1: GOTO sile
IF g$ = "n" THEN sil = 0: GOTO sile
GOTO gtic
sile:
LOCATE 5, 1: PRINT #1, " Would you like to set an alarm time ( y or n ) ?";
GOSUB gkey
IF g$ = "n" THEN arm1 = 0: arm2 = 0: GOTO l7
IF g$ <> "y" THEN GOTO sile
LOCATE 7, 1: PRINT #1, " Enter the hour for the alarm";
LOCATE 7, 31: LINE INPUT a$
arm1 = VAL(a$)
LOCATE 9, 1: PRINT #1, " Enter the minute for the alarm";
LOCATE 9, 33: LINE INPUT a$
arm2 = VAL(a$)
l6:
LOCATE 11, 1, 1: PRINT #1, " Press a for A M or p for P M";
GOSUB gkey
IF g$ = "a" THEN arm$ = " A M": GOTO l7
IF g$ = "p" THEN arm$ = " P M": GOTO l7
GOTO l6
l7:
OPEN "o", #2, "gfc.cfg"
PRINT #2, sd$
PRINT #2, cfg
PRINT #2, tic
PRINT #2, sil
PRINT #2, arm1
PRINT #2, arm2
PRINT #2, arm$
CLOSE #2
CLS
LOCATE 5, 1: PRINT #1, " If you wish to change the configuration of the clock"
LOCATE 6, 1: PRINT #1, " start the program with a slash c switch"
LOCATE 7, 1: PRINT #1, " To change the alarm time start the program with"
LOCATE 8, 1: PRINT #1, " a slash s a switch"
CLS
GOTO gotcfg

SUB sb (sd$, a$)
SHELL sd$ + " " + a$ + ".wav > nul"
END SUB

