From 718a70d5186a1c94e4a96d2ff68fc9310f2e1267 Mon Sep 17 00:00:00 2001 From: Aleteoryx Date: Fri, 2 Oct 2026 23:48:21 +0200 Subject: [PATCH] init --- README.md | 1 + clock.b | 120 +++++++++++++++++++++++++++++++++++++++++++++++++++++ hello.b | 2 + keycodes.b | 23 ++++++++++ primes.b | 7 ++++ 5 files changed, 153 insertions(+) create mode 100644 README.md create mode 100644 clock.b create mode 100644 hello.b create mode 100644 keycodes.b create mode 100644 primes.b diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..5792bec32e294d4ce159e73c4e99c79dd22a7a49 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +some programs I've written for my CASIO PB-1000. type them in and enjoy!!!!!! diff --git a/clock.b b/clock.b new file mode 100644 index 0000000000000000000000000000000000000000..846dc086a0a1aaa2b612b3a6eeb3a46d2f0f166a --- /dev/null +++ b/clock.b @@ -0,0 +1,120 @@ + 9 'setup screen + 10 CLS + 11 PRINT"The date is ." + 12 PRINT"The time is ." + 14 LOCATE 0,3 + 15 PRINT"[exit ][change][redraw] "; + + 29 'test buttons. the touch buttons are mapped to keycodes 240-255 + 30 GOSUB 500 + 35 K=ASC(INKEY$) + 40 ON K-251 GOTO 60,100,10 + 45 GOTO 30 + + 59 'exit + 60 CLS + 65 PRINT"Bye!" + 70 END + + + 99 'date set menu +100 LOCATE 0,3 +105 PRINT"change? [date ][time ][cancel]" +110 GOSUB 500 +114 'debounce keypress, in theory +115 K=ASC(INKEY$) +116 IF ASC(INKEY$)<>0 GOTO 116 ELSE 120 +120 ON K-252 GOTO 200,300,30 +125 GOTO 110 + + +195 'set date +200 PMAX=9999 +205 PSTR$="year" +210 PVAL$=RIGHT$(DATE$,4) +215 GOSUB 600 +220 NY$=PVAL$ +225 NY=VAL(NY$) + +230 PMAX=12 +235 PSTR$="month" +240 PVAL$=LEFT$(DATE$,2) +245 GOSUB 600 +250 NM$=PVAL$ +255 NM=VAL(NM$) + +260 IF NM=2 AND NY MOD 4=0 AND NY MOD 100<>0 THEN PMAX=29 ELSE 400 +265 PSTR$="day" +270 PVAL$=MID$(DATE$,4,2) +275 GOSUB 600 + +280 DATE$=NM$+"-"+PVAL$+"-"+NY$ +285 GOTO 10 + + +299 'set time +300 PMAX=23 +305 PSTR$="hour" +310 PVAL$=LEFT$(TIME$,2) +315 GOSUB 600 +320 NH$=PVAL$ + +325 PMAX=59 +330 PSTR$="minute" +335 PVAL$=MID$(TIME$,4,2) +340 GOSUB 600 + +345 NT$=NH$+":"+PVAL$ +350 LOCATE 0,3 +355 PRINT "[set time to ";NT$;" ][cancel]"; + +360 GOSUB 500 +365 K=ASC(INKEY$) +370 IF K<252 GOTO 360 ELSE IF K<>255 GOTO 375 ELSE 100 + +375 TIME$=NT$ +380 GOTO 10 + + +399 'days in month +400 RESTORE 430 +405 FOR I=1 TO NM +410 READ PMAX +415 NEXT +420 GOTO 265 + +430 DATA 31,28,31,30,31,30,31,31,30,31,30,31 + + +499 'print time +500 LOCATE 12,0 +510 PRINT DATE$ +515 LOCATE 12,1 +520 PRINT TIME$ +525 RETURN + + +598 'prompting routine +599 PMAX=max val, PSTR$=prompt, PVAL$=result +600 LOCATE 0,3:PRINT" ";:LOCATE 0,0 +605 LOCATE 0,3:PRINT"set ";PSTR$;" ( 1 -";PMAX;")> ";PVAL$;"_"; + +610 GOSUB 500 +615 K=ASC(INKEY$) +620 IF K=13 AND VAL(PVAL$)<>0 GOTO 660 ELSE IF K=8 GOTO 625 ELSE IF K>=48 AND K<58 GOTO 640 ELSE 610 + +624 'backspace +625 PVAL$=LEFT$(PVAL$,LEN(PVAL$)-1) +630 GOTO 600 + +639 'digits. allow leading 0s, don't allow value >PMAX +640 NPV$=PVAL$+CHR$(K) +645 NPV=VAL(NPV$) +650 IF (NPV=0 AND K<>48) OR NPV>PMAX GOTO 610 ELSE PVAL$=NPV$:GOTO 600 + +659 'EXE=submit +660 PLEN=LEN(STR$(PMAX))-1 +664 'truncate or add leading 0s +665 IF LEN(PVAL$)0 GOTO 670 ELSE RETURN diff --git a/hello.b b/hello.b new file mode 100644 index 0000000000000000000000000000000000000000..e8fbc1a021b868e3ddb049f6fd31019ec734aff3 --- /dev/null +++ b/hello.b @@ -0,0 +1,2 @@ +10 PRINT "Hello, World!" +20 GOTO 10 diff --git a/keycodes.b b/keycodes.b new file mode 100644 index 0000000000000000000000000000000000000000..807a47127df519214ba0146b4ce0b2f14bd6cee9 --- /dev/null +++ b/keycodes.b @@ -0,0 +1,23 @@ +10 PRINT"Keycodes..." + +15 K$=INKEY$ +16 K=ASC(K$) + +20 N=K¥16 +21 GOSUB 50 +25 N2$=N$ + +30 N=K MOD 16 +31 GOSUB 50 + +35 PRINT "Pressed 0x";N2$;N$;" (";K;")" +40 GOTO 15 + +49 'hex codes, didn't realize this was a builtin :P +50 RESTORE 100 +55 FOR I=0 TO N +60 READ N$ +65 NEXT +70 RETURN + +100 DATA 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F diff --git a/primes.b b/primes.b new file mode 100644 index 0000000000000000000000000000000000000000..8b8f3bc6c2eddf84f6d5eadfe8cdb022ba818318 --- /dev/null +++ b/primes.b @@ -0,0 +1,7 @@ +10 X=1 + +20 Y=1 +21 X=X+2 + +30 Y=Y+2 +35 IF X