apple2idiot/examples/15_fixed_essid_weather-basic/WEATHER.BAS
2022-07-18 07:21:48 -07:00

87 lines
2.0 KiB
QBasic

10 CA = 49664
20 AA = CA +1
30 CC$ = ""
35 CITY$ = ""
100 PRINT
110 PRINT "----"
120 PRINT "MENU"
130 PRINT "(1) COUNTRY","",CC$
140 PRINT "(2) CITY","",CITY$
150 PRINT "(3) FETCH WEATHER"
160 PRINT "(4) SHOW WEATHER"
170 PRINT "(0) QUIT"
175 PRINT
180 INPUT "SELECT: ";S
190 IF S >4 THEN GOTO 100
200 IF S = 0 THEN END
210 IF S = 1 THEN GOTO 1000
220 IF S = 2 THEN GOTO 2000
230 IF S = 3 THEN GOTO 3000
240 IF S = 4 THEN GOTO 4000
250 GOTO 100
1000 INPUT "COUNTRY CODE: ";CC$
1010 WS$ = CC$
1020 WA = AA +1
1030 GOSUB 10000
1040 POKE AA,20 : REM SET COUNTRY
1050 GOTO 100
2000 INPUT "CITY: ";CITY$
2010 WS$ = CITY$
2020 WA = AA +1
2030 GOSUB 10000
2040 POKE AA,21 : REM SET CITY
2050 GOTO 100
3000 POKE AA,25 : REM FETCH WEATHER
3010 GOTO 100
4000 HOME
4005 MAXSTR = 0
4010 RA = AA +1
4015 GOSUB 11000
4020 TEMP$ = RS$
4025 RA = RA + LEN(RS$) +1
4030 GOSUB 11000
4035 FOOM$ = RS$
4040 RA = RA + LEN(RS$) +1
4045 GOSUB 11000
4050 WSPEED$ = RS$
4055 RA = RA + LEN(RS$) +1
4060 GOSUB 11000
4065 WDIR$ = RS$
4070 RA = RA + LEN(RS$) +1
4075 GOSUB 11000
4080 WD1$ = RS$
4085 RA = RA + LEN(RS$) +1
4090 GOSUB 11000
4095 WD2$ = RS$
4150 PRINT
4155 PRINT CITY$ +"/" +CC$ +" " +WD1$
4160 PRINT "-----------------------------"
4165 PRINT "TEMP: " +TEMP$ +"K"
4170 PRINT "HUMIDITY: " +FOOM$ +"%"
4175 PRINT "WIND SPEED: " +WSPEED$ +" m/s"
4177 REM PRINT
4180 REM PRINT WD1$ + ", " + WD2$
4500 GOTO 100
10000 REM WRITE WS$ TO WA
10010 FOR N = 0 TO LEN(WS$) -1
10020 P = WA +N
10030 C$ = MID$ (WS$,N +1,1)
10040 REM PRINT C$, ASC (C$)
10050 POKE P, ASC(C$)
10060 NEXT N
10070 POKE P +1,0
10080 RETURN
11000 REM ============ WRITE STRING TO RAM =================
11001 REM RA ADDRESS TO START READ
11002 REM MAXSTR IS LIMIT TO STR SIZE WE READ
11020 IF MAXSTR = 0 THEN MAXSTR = 250
11040 RS$ = ""
11060 FOR N = 0 TO MAXSTR
11080 P = RA +N
11100 C = PEEK(P)
11120 IF C = 0 THEN GOTO 11200
11140 RS$ = RS$ + CHR$(C)
11160 REM PRINT N+1,P,C, CHR$ (C)
11180 NEXT N
11200 RETURN