Browse Source

v3.20b General cleanup and bug fixes.

- Ken UNIX
tags/v3.20b
Jon Foster 2 years ago
parent
commit
2e38b5c3c3
100 changed files with 6575 additions and 19795 deletions
  1. +2
    -0
      .gitattributes
  2. +9
    -9
      .gitignore
  3. +5
    -0
      BAS-EXAMPLES/abs.bas
  4. +2
    -0
      BAS-EXAMPLES/alloff.inp
  5. +9
    -0
      BAS-EXAMPLES/allon.inp
  6. +0
    -0
      BAS-EXAMPLES/assign.bas
  7. +81
    -0
      BAS-EXAMPLES/bagels.bas
  8. +24
    -0
      BAS-EXAMPLES/bin-to-dec.bas
  9. +16
    -0
      BAS-EXAMPLES/binary.bas
  10. +39
    -0
      BAS-EXAMPLES/bubble-numbers.bas
  11. +37
    -0
      BAS-EXAMPLES/bubble-strings.bas
  12. +30
    -0
      BAS-EXAMPLES/calendar.bas
  13. +0
    -0
      BAS-EXAMPLES/callfunc.bas
  14. +0
    -0
      BAS-EXAMPLES/callsub.bas
  15. +0
    -0
      BAS-EXAMPLES/chain1.bas
  16. +0
    -0
      BAS-EXAMPLES/chain2.bas
  17. +18
    -0
      BAS-EXAMPLES/comdiv.bas
  18. +12
    -0
      BAS-EXAMPLES/curve.bas
  19. +1
    -0
      BAS-EXAMPLES/curve2.bas
  20. +30
    -0
      BAS-EXAMPLES/data-read-new.bas
  21. +15
    -0
      BAS-EXAMPLES/data-read.bas
  22. +0
    -0
      BAS-EXAMPLES/dataread.bas
  23. +14
    -0
      BAS-EXAMPLES/dec-to-bin.bas
  24. +39
    -0
      BAS-EXAMPLES/dec-to-hex.bas
  25. +30
    -0
      BAS-EXAMPLES/dechex.bas
  26. +0
    -0
      BAS-EXAMPLES/deffn.bas
  27. +0
    -0
      BAS-EXAMPLES/dim.bas
  28. +0
    -0
      BAS-EXAMPLES/doloop.bas
  29. +0
    -0
      BAS-EXAMPLES/dowhile.bas
  30. +0
    -0
      BAS-EXAMPLES/eliza.bas
  31. +0
    -0
      BAS-EXAMPLES/elseif.bas
  32. +0
    -0
      BAS-EXAMPLES/end.bas
  33. +0
    -0
      BAS-EXAMPLES/err.bas
  34. +0
    -0
      BAS-EXAMPLES/factorials.bas
  35. +13
    -0
      BAS-EXAMPLES/fibonacci.bas
  36. +191
    -0
      BAS-EXAMPLES/finance.bas
  37. +0
    -0
      BAS-EXAMPLES/fncallfn.bas
  38. +0
    -0
      BAS-EXAMPLES/fornext.bas
  39. +0
    -0
      BAS-EXAMPLES/function.bas
  40. +1
    -1
      BAS-EXAMPLES/gosub.bas
  41. +0
    -0
      BAS-EXAMPLES/gotolabl.bas
  42. +20
    -0
      BAS-EXAMPLES/guess.bas
  43. +1
    -0
      BAS-EXAMPLES/guess2.bas
  44. +83
    -0
      BAS-EXAMPLES/hello.bas
  45. +0
    -0
      BAS-EXAMPLES/ifline.bas
  46. +0
    -0
      BAS-EXAMPLES/input.bas
  47. +39
    -0
      BAS-EXAMPLES/interest.bas
  48. +60
    -0
      BAS-EXAMPLES/intrate.bas
  49. +0
    -0
      BAS-EXAMPLES/lof.bas
  50. +0
    -0
      BAS-EXAMPLES/loopuntl.bas
  51. +0
    -0
      BAS-EXAMPLES/main.bas
  52. +0
    -0
      BAS-EXAMPLES/mlifthen.bas
  53. +311
    -0
      BAS-EXAMPLES/ohmslaw.bas
  54. +0
    -0
      BAS-EXAMPLES/on.bas
  55. +0
    -0
      BAS-EXAMPLES/onerr.bas
  56. +0
    -0
      BAS-EXAMPLES/onerrlbl.bas
  57. +0
    -0
      BAS-EXAMPLES/ongosub.bas
  58. +0
    -0
      BAS-EXAMPLES/opentest.bas
  59. +0
    -0
      BAS-EXAMPLES/option.bas
  60. +0
    -0
      BAS-EXAMPLES/pascaltr.bas
  61. +11
    -0
      BAS-EXAMPLES/primes.bas
  62. +5
    -0
      BAS-EXAMPLES/profile.bas
  63. +0
    -0
      BAS-EXAMPLES/putget.bas
  64. +0
    -0
      BAS-EXAMPLES/random.bas
  65. +250
    -0
      BAS-EXAMPLES/relays.bas
  66. +4
    -0
      BAS-EXAMPLES/relays.pro
  67. +3
    -3
      BAS-EXAMPLES/res22.bas
  68. +10
    -0
      BAS-EXAMPLES/res24.bas
  69. +21
    -0
      BAS-EXAMPLES/selcase.bas
  70. +0
    -0
      BAS-EXAMPLES/snglfunc.bas
  71. +0
    -0
      BAS-EXAMPLES/stop.bas
  72. +13
    -0
      BAS-EXAMPLES/sum.bas
  73. +12
    -0
      BAS-EXAMPLES/sumfor.bas
  74. +14
    -0
      BAS-EXAMPLES/sumintexit.bas
  75. +12
    -0
      BAS-EXAMPLES/sumneg.bas
  76. +0
    -0
      BAS-EXAMPLES/tab.bas
  77. +0
    -0
      BAS-EXAMPLES/term.bas
  78. +174
    -0
      BAS-EXAMPLES/tictac.bas
  79. +0
    -0
      BAS-EXAMPLES/whilwend.bas
  80. +0
    -0
      BAS-EXAMPLES/width.bas
  81. +0
    -0
      BAS-EXAMPLES/writeinp.bas
  82. +0
    -441
      Bwbasic-1.1-Manual.txt
  83. +0
    -35
      DMCDOS32.CMD
  84. +0
    -35
      DMCWIN32.CMD
  85. +2
    -2
      GUI/bwbasic.desktop
  86. +0
    -0
      GUI/bwbasic.png
  87. +7
    -0
      GUI/bwbasic.sh
  88. +0
    -0
      INFO/Bwbasic-1.1-Manual.txt
  89. +0
    -0
      INFO/Bwbasic-2.1-Manual.txt
  90. +0
    -0
      INFO/Bwbasic-2.1.doc
  91. +2538
    -0
      INFO/Bwbasic-3.2-options.txt
  92. +1872
    -0
      INFO/Bwbasic-Doc-2.1.txt
  93. +481
    -0
      INFO/Bwbasic-changelog.txt
  94. +14
    -0
      INFO/Bwbasic-notes.txt
  95. +0
    -0
      INFO/Bwbasic.doc
  96. BIN
      INFO/Bwbasic_3.20_manual.docx
  97. +0
    -341
      Junk/COPYING
  98. +0
    -10219
      Junk/bwb_cmd.c
  99. +0
    -5068
      Junk/bwb_var.c
  100. +0
    -3641
      Junk/bwbasic.c

+ 2
- 0
.gitattributes View File

@@ -17,6 +17,8 @@
*.BAS text eol=crlf
*.bat text eol=crlf
*.BAT text eol=crlf
*.cmd text eol=crlf
*.CMD text eol=crlf
*.doc text eol=crlf
*.DOC text eol=crlf
*.txt text eol=crlf


+ 9
- 9
.gitignore View File

@@ -1,12 +1,12 @@
# compile artifcats
# compile artifcats
*.o
/bwbasic
/renum
# maintainer artifacts
editfl
editfl.bas
*.geany
*.orig
*.rej
/autom4te.cache/
# maintainer artifacts
editfl
editfl.bas
*.geany
*.orig
*.rej

+ 5
- 0
BAS-EXAMPLES/abs.bas View File

@@ -0,0 +1,5 @@
100 rem ABS.BAS -- Test ABS() function
110 X = -1.23456789
120 ABSX = ABS( X )
130 print "The absolute value of "; X; " is"; ABSX
140 print "Is that correct?"

+ 2
- 0
BAS-EXAMPLES/alloff.inp View File

@@ -0,0 +1,2 @@
ao
x

+ 9
- 0
BAS-EXAMPLES/allon.inp View File

@@ -0,0 +1,9 @@
1
20
1
7
1
112
1
115
x

bas/assign.bas → BAS-EXAMPLES/assign.bas View File


+ 81
- 0
BAS-EXAMPLES/bagels.bas View File

@@ -0,0 +1,81 @@
5 PRINT TAB(33);"BAGELS"
10 PRINT TAB(15);"CREATIVE COMPUTING MORRISTOWN, NEW JERSEY":PRINT:PRINT
15 REM *** BAGLES NUMBER GUESSING GAME
20 REM *** ORIGINAL SOURCE UNKNOWN BUT SUSPECTED TO BE
25 REM *** LAWRENCE HALL OF SCIENCE, U.C. BERKELY
30 DIM A1(6),A(3),B(3)
40 Y=0:T=255
50 PRINT:PRINT:PRINT
70 INPUT "WOULD YOU LIKE THE RULES (YES OR NO)";A$
90 IF LEFT$(A$,1)="N" THEN 150
100 PRINT:PRINT "I AM THINKING OF A THREE-DIGIT NUMBER. TRY TO GUESS"
110 PRINT "MY NUMBER AND I WILL GIVE YOU CLUES AS FOLLOWS:"
120 PRINT " PICO - ONE DIGIT CORRECT BUT IN THE WRONG POSITION"
130 PRINT " FERMI - ONE DIGIT CORRECT AND IN THE RIGHT POSITION"
140 PRINT " BAGELS - NO DIGITS CORRECT"
150 FOR I=1 TO 3
160 A(I)=INT(10*RND(1))
165 IF I-1=0 THEN 200
170 FOR J=1 TO I-1
180 IF A(I)=A(J) THEN 160
190 NEXT J
200 NEXT I
210 PRINT:PRINT "O.K. I HAVE A NUMBER IN MIND."
220 FOR I=1 TO 20
230 PRINT "GUESS #";I,
240 INPUT A$
245 IF LEN(A$)<>3 THEN 630
250 FOR Z=1 TO 3:A1(Z)=ASC(MID$(A$,Z,1)):NEXT Z
260 FOR J=1 TO 3
270 IF A1(J)<48 THEN 300
280 IF A1(J)>57 THEN 300
285 B(J)=A1(J)-48
290 NEXT J
295 GOTO 320
300 PRINT "WHAT?"
310 GOTO 230
320 IF B(1)=B(2) THEN 650
330 IF B(2)=B(3) THEN 650
340 IF B(3)=B(1) THEN 650
350 C=0:D=0
360 FOR J=1 TO 2
370 IF A(J)<>B(J+1) THEN 390
380 C=C+1
390 IF A(J+1)<>B(J) THEN 410
400 C=C+1
410 NEXT J
420 IF A(1)<>B(3) THEN 440
430 C=C+1
440 IF A(3)<>B(1) THEN 460
450 C=C+1
460 FOR J=1 TO 3
470 IF A(J)<>B(J) THEN 490
480 D=D+1
490 NEXT J
500 IF D=3 THEN 680
505 IF C=0 THEN 545
520 FOR J=1 TO C
530 PRINT "PICO ";
540 NEXT J
545 IF D=0 THEN 580
550 FOR J=1 TO D
560 PRINT "FERMI ";
570 NEXT J
580 IF C+D<>0 THEN 600
590 PRINT "BAGELS";
600 PRINT
605 NEXT I
610 PRINT "OH WELL."
615 PRINT "THAT'S TWNETY GUESSES. MY NUMBER WAS";100*A(1)+10*A(2)+A(3)
620 GOTO 700
630 PRINT "TRY GUESSING A THREE-DIGIT NUMBER.":GOTO 230
650 PRINT "OH, I FORGOT TO TELL YOU THAT THE NUMBER I HAVE IN MIND"
660 PRINT "HAS NO TWO DIGITS THE SAME.":GOTO 230
680 PRINT "YOU GOT IT!!!":PRINT
690 Y=Y+1
700 INPUT "PLAY AGAIN (YES OR NO)";A$
720 IF LEFT$(A$,1)="YES" THEN 150
730 IF Y=0 THEN 750
740 PRINT:PRINT "A";Y;"POINT BAGELS BUFF!!"
750 PRINT "HOPE YOU HAD FUN. BYE."
999 END

+ 24
- 0
BAS-EXAMPLES/bin-to-dec.bas View File

@@ -0,0 +1,24 @@
10 CALL SHELL("cls")
100 LET P = 0
: LET S = 0
110 INPUT "Enter binary number: ";N$
120 L = LEN (N$)
: IF L=0 GOTO 300
130 FOR I=1 TO L
135 IF (N$ = "0") GOTO 1000
140 LET B$ = MID$(N$, L-I+1, 1)
150 IF NOT (B$ = "0" OR B$ = "1") GOTO 300
160 LET K = VAL(B$)
170 IF (K > 0) THEN
: S = S + 2 ^ P
: END IF
180 LET P = P + 1
190 NEXT
200 GOTO 310
300 PRINT "Error, invalid binary entered"
: GOTO 100
310 PRINT
315 PRINT "Equals decimal ";S
320 PRINT
1000 END


+ 16
- 0
BAS-EXAMPLES/binary.bas View File

@@ -0,0 +1,16 @@
5 REM input a number, output its binary representation
10 CALL SHELL("cls")
30 LET X = 0
40 LET P = 1
50 INPUT "Enter an integer from 1 to 63: ";a
60 IF (A < 0 OR A<>INT(A)) GOTO 50
65 IF (A > 63) GOTO 30
70 LET B = A - INT (A/2) * 2
80 REM PRINT B
90 LET X = B * P + X
100 LET P = P * 10
110 LET A = (A - B) / 2
120 IF (A > 0) GOTO 70
130 PRINT "As binary: ";X
140 END


+ 39
- 0
BAS-EXAMPLES/bubble-numbers.bas View File

@@ -0,0 +1,39 @@
10 REM BUBBLESORT NUMBERS
80 CALL SHELL("cls")
90 DIM A(8)
: REM ARRAY WITH MAX 8 ELEMENTS
100 REM ASK FOR 8 NUMBERS
105 PRINT "You will be asked for 8 numbers"
110 FOR I = 1 TO 8
120 PRINT "TYPE NUMBER ";I;" : ";
130 INPUT A (I)
140 NEXT I
150 REM PASS THROUGH 8 NUMBERS, TESTING BY PAIRS
160 F = 0
: REM RESET THE ORDER INDICATOR
170 FOR I = 1 TO 7
: REM NOTE THAT ENDING INDEX IS 8 MINUS 1
180 IF A(I) <= A(I+1) THEN
: GOTO 240
: END IF
190 REM SWAP A (I) AND A (I+1)
200 T = A(I)
210 A(I) = A(I+1)
220 A(I+1) = T
230 F = 1
: REM ORDER WAS NOT PERFECT
240 NEXT I
250 REM F = 0 MEANS ORDER IS PERFECT
260 IF F = 1 THEN
: GOTO 160
: END IF
: REM TRY AGAIN
270 PRINT
: REM PRINT EMPTY LINE
280 REM PRINT ORDERED NUMBERS
290 FOR I = 1 TO 8
300 PRINT A (I)
310 NEXT I
315 PRINT
320 END


+ 37
- 0
BAS-EXAMPLES/bubble-strings.bas View File

@@ -0,0 +1,37 @@
10 REM BUBBLESORT FOR STRINGS
80 CALL SHELL("cls")
90 DIM A$(8)
: REM ARRAY WITH 8 STRINGS
100 REM ASK FOR 8 STRINGS
105 PRINT "You will be asked for 8 strings"
110 FOR I = 1 TO 8
120 PRINT "Type string ";I;" : ";
130 INPUT A$ (I)
140 NEXT I
150 REM PASS THROUGH 8 STRINGS, TESTING BY PAIRS
160 F = 0
: REM RESET THE ORDER INDICATOR
170 FOR I = 1 TO 7
180 IF A$(I) <= A$(I+1) THEN
: GOTO 240
: END IF
190 REM SWAP A$(I) AND A$(I+1)
200 T$ = A$(I)
210 A$(I) = A$(I+1)
220 A$(I+1) = T$
230 F = 1
: REM ORDER WAS NOT PERFECT
240 NEXT I
250 REM F = 0 MEANS ORDER IS PERFECT
260 IF F = 1 THEN
: GOTO 160
: END IF
: REM TRY AGAIN
270 PRINT
: REM PRINT EMPTY LINE
280 REM PRINT ORDERED STRINGS
290 FOR I = 1 TO 8
300 PRINT A$ (I)
310 NEXT I
320 print


+ 30
- 0
BAS-EXAMPLES/calendar.bas View File

@@ -0,0 +1,30 @@
10 REM PERPETUAL GREGORIAN CALENDAR
12 REM 4-13-2020 changed line 28 IF Y<100 1900 to 2000
14 DIM C$(42), D$(31), E(12)
16 FOR I=1 TO 31: READ D$(I): NEXT I
18 FOR I=1 TO 12: READ E(I): NEXT I
20 DATA " 1"," 2"," 3"," 4"," 5"," 6"," 7"," 8"," 9"," 10"
22 DATA " 11"," 12"," 13"," 14"," 15"," 16"," 17"," 18"," 19"," 20"
24 DATA " 21"," 22"," 23"," 24"," 25"," 26"," 27"," 28"," 29"," 30"," 31"
26 DATA 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
28 PRINT: INPUT "MONTH, 4 DIGIT YEAR";M,Y: IF Y<100 THEN Y=Y+2000
30 PRINT: PRINT " SU MO TU WE TH FR SA": PRINT
32 J=367*Y-INT(7*(Y+INT((M+9)/12))/4)+INT(275*M/9)+1721031
34 K=0: IF M<=2 THEN K=-1
36 J=J-INT(3*(INT((Y+K)/100)+1)/4)
38 K=E(M): IF M<>2 THEN 48
40 W=INT(Y-100*INT(Y/100)): X=INT(Y-4*INT(Y/4)): Z=INT(Y-400*INT(Y/400))
42 IF X<>0 THEN 48
44 IF W=0 AND Z<>0 THEN 48
46 K=29
48 X=J-7*INT(J/7)
50 FOR I=1 TO 42: C$(I)=" ": NEXT I
52 FOR I=1 TO K: C$(I+X)=D$(I): NEXT I
54 FOR I=1 TO 6: J=7*I
56 PRINT C$(J-6);C$(J-5);C$(J-4);C$(J-3);C$(J-2);C$(J-1);C$(J)
58 NEXT I
60 PRINT: INPUT "ANOTHER";A$: IF (A$="Y" or A$="y") THEN 28
62 END
63 REM ---------------------------------------------------------------
64 REM APPEARED IN ASTRONOMICAL COMPUTING, SKY & TELESCOPE, JULY, 1985
65 REM ---------------------------------------------------------------

bas/callfunc.bas → BAS-EXAMPLES/callfunc.bas View File


bas/callsub.bas → BAS-EXAMPLES/callsub.bas View File


bas/chain1.bas → BAS-EXAMPLES/chain1.bas View File


bas/chain2.bas → BAS-EXAMPLES/chain2.bas View File


+ 18
- 0
BAS-EXAMPLES/comdiv.bas View File

@@ -0,0 +1,18 @@
5 REM find greatest common divisor (Euclidean Algorithm)
10 CALL SHELL("cls")
20 LET A = 1071
: LET B = 462
30 IF A < B THEN
: C = A
: A=B
: B=C
: END IF
40 PRINT A,B
50 LET C = A - INT(A/B)*B
: REM C = A MOD B (A modulo B)
60 LET A = B
: B = C
70 IF B > 0 GOTO 40
80 PRINT "GCG is ";A
90 END


+ 12
- 0
BAS-EXAMPLES/curve.bas View File

@@ -0,0 +1,12 @@
100 REM PLOT A NORMAL DISTRIBUTION CURVE
120 DEF FNN(X) = EXP(-(X^2/2))/SQR(2*3.14159265)
140 FOR X = -2 TO 2 STEP .1
150 LET Y = FNN(X)
160 LET Y = INT(100*Y)
170 FOR Z = 1 TO Y
180 PRINT " ";
190 NEXT Z
200 PRINT "*"
210 NEXT X
220 END


bas/curve2.bas → BAS-EXAMPLES/curve2.bas View File

@@ -1,4 +1,5 @@
50 rem 12/13/2019 Ken curve
60 SHELL "cls"
100 REM PLOT A NORMAL DISTRIBUTION CURVE
120 DEF FNN(X) = EXP(-(X^2/2))/SQR(2*3.14159265)
140 FOR X = -2 TO 2 STEP .1

+ 30
- 0
BAS-EXAMPLES/data-read-new.bas View File

@@ -0,0 +1,30 @@
5 CALL SHELL("cls")
10 ON ERROR GOSUB 80
20 C = 0
: REM C will hold the number of data items
25 PRINT "Reading data elements"
30 READ N
40 PRINT N
50 C = C + 1
70 GOTO 30
80 print "Error line #, error number # ";erl;err
90 PRINT "Read ";C;" data elements"
: INPUT "Press enter :";w
100 DIM A(C)
: REM now we can allocate the array to hold all data
110 RESTORE
: REM MOVE data pointer to start
120 FOR I=1 TO C
130 READ A(I)
140 NEXT
150 print
: print
160 PRINT "Array:"
170 FOR I=1 TO C
180 PRINT A(I);" ";
190 NEXT
195 PRINT
200 END
1000 DATA 12,107,0,20,443,218,232,468,561
1010 DATA 71,187,936,436,4,50,110,320,120


+ 15
- 0
BAS-EXAMPLES/data-read.bas View File

@@ -0,0 +1,15 @@
100 CALL SHELL("cls")
110 on error gosub 170
120 C = 0
: REM C will hold the number of data items
130 READ N
140 PRINT N
150 C = C + 1
160 GOTO 130
170 print "Error number #, line # "; err; " , ";erl
180 PRINT "Read ";C;" data elements"
185 end
190 DATA 12,107,0,20,443,218,232,468,561
200 DATA 273,187,936,436,4,50,110,320,120
210 DATA 45,670,87


bas/dataread.bas → BAS-EXAMPLES/dataread.bas View File


+ 14
- 0
BAS-EXAMPLES/dec-to-bin.bas View File

@@ -0,0 +1,14 @@
5 REM input a number, output its binary representation
10 CALL SHELL("cls")
50 INPUT "Enter an integer greater than zero : ";A
60 IF (A < 0 OR A<>INT(A)) GOTO 50
65 IF (A = 0) GOTO 140
70 LET B = A - INT (A/2) * 2
90 LET X$ = STR$(B) + X$
110 LET A = (A - B) / 2
120 IF (A > 0) GOTO 70
125 PRINT
130 PRINT "As binary: ";X$
135 PRINT
140 END


+ 39
- 0
BAS-EXAMPLES/dec-to-hex.bas View File

@@ -0,0 +1,39 @@
10 CALL SHELL("cls")
30 PRINT "DECIMAL","HEX"
40 PRINT "-------","---"
50 FOR I = 0 TO 20
60 LET A = I
70 GOSUB 200
80 PRINT I, X$
90 NEXT I
100 END
200 LET X$ = ""
210 LET B = A - INT (A/16) * 16
220 IF B < 10 THEN
: H$ = STR$(B)
: END IF
230 IF B = 10 THEN
: H$ = " A"
: END IF
240 IF B = 11 THEN
: H$ = " B"
: END IF
250 IF B = 12 THEN
: H$ = " C"
: END IF
260 IF B = 13 THEN
: H$ = " D"
: END IF
270 IF B = 14 THEN
: H$ = " E"
: END IF
280 IF B = 15 THEN
: H$ = " F"
: END IF
290 LET X$ = H$ + X$
300 LET A = (A - B) / 16
310 IF (A > 0) THEN
: GOTO 210
: END IF
320 RETURN


+ 30
- 0
BAS-EXAMPLES/dechex.bas View File

@@ -0,0 +1,30 @@
10 REM this program prints decimal and corresponding hexadecimal numbers.
15 REM it shows 20 numbers per page. To show the next page press any key.
20 CALL SHELL("cls")
30 LET S = 4095
50 PRINT "Decimal","Hex"
60 PRINT "-------","---"
70 FOR I = S to (20 + S)
80 LET A = I
90 GOSUB 200
100 PRINT I, X$
110 NEXT I
130 LET S = S + 20
140 END
150 END
200 LET X$ = ""
210 LET B = A - INT (A/16) * 16
: REM B = A MOD 16
220 IF B < 10 THEN
: H$ = STR$(B)
: END IF
230 IF (B >= 10 AND B <= 15) THEN
: H$ = " " + CHR$(65 + B - 10)
: END IF
240 LET X$ = H$ + X$
250 LET A = (A - B) / 16
260 IF (A > 0) THEN
: GOTO 210
: END IF
270 RETURN


bas/deffn.bas → BAS-EXAMPLES/deffn.bas View File


bas/dim.bas → BAS-EXAMPLES/dim.bas View File


bas/doloop.bas → BAS-EXAMPLES/doloop.bas View File


bas/dowhile.bas → BAS-EXAMPLES/dowhile.bas View File


bas/eliza.bas → BAS-EXAMPLES/eliza.bas View File


bas/elseif.bas → BAS-EXAMPLES/elseif.bas View File


bas/end.bas → BAS-EXAMPLES/end.bas View File


bas/err.bas → BAS-EXAMPLES/err.bas View File


bas/factorials.bas → BAS-EXAMPLES/factorials.bas View File


+ 13
- 0
BAS-EXAMPLES/fibonacci.bas View File

@@ -0,0 +1,13 @@
5 REM Fibonacci numbers 4-13-2020 Ken
7 CALL SHELL("cls")
10 LET M = 5000
20 LET X = 1 : LET Y = 1
30 IF (X > M) GOTO 100
40 PRINT X
50 X = X + Y
60 IF (Y > M) GOTO 100
70 PRINT Y
80 Y = X + Y
90 GOTO 30
100 STOP


+ 191
- 0
BAS-EXAMPLES/finance.bas View File

@@ -0,0 +1,191 @@
10 L1=9
20 DEF FNR(X)=INT(X*100+.5)/100
30 CL$=CHR$(26):REM SCREEN CLEAR CHAR.
40 REM ********************************************************
50 REM
60 PRINT CL$;"THIS PROGRAM IS A COLLECTION OF BUSINESS"
70 PRINT "APPLICATIONS. HERE IS A LIST OF THE VALUES THAT"
80 PRINT "CAN BE COMPUTED GIVEN SUPPORTING DATA:"
90 PRINT
100 PRINT "1) FUTURE VALUE OF AN INVESTMENT"
110 PRINT "2) FUTURE VALUE OF REGULAR DEPOSITS (ANNUITY)"
120 PRINT "3) REGULAR DEPOSITS"
130 PRINT "4) REGULAR DEPOSITS FROM AN INVESTMENT"
140 PRINT "5) INITIAL INVESTMENT"
150 PRINT "6) MINIMUM INVESTMENT FOR WITHDRAWALS"
160 PRINT "7) NOMINAL INTEREST RATE ON INVESTMENTS"
170 PRINT "8) EFFECTIVE INTEREST RATE ON INVESTMENTS"
180 PRINT "9) EARNED INTEREST TABLE"
190 PRINT
200 PRINT "WHICH OF THE ABOVE VALUES WOULD YOU LIKE"
210 PRINT "TO COMPUTE ( 1 TO";L1;", OR 0 TO END RUN )";
220 INPUT X
230 PRINT CL$
240 IF X=0 THEN 1860
250 ON X GOSUB 270,360,470,590,690,800,910,1010,1150
260 GOTO 90
270 PRINT "FUTURE VALUE OF AN INVESTMENT"
280 PRINT:INPUT "INITIAL INVESTMENT (0 TO STOP) ";P:IF P=0 THEN RETURN
290 GOSUB 1130
300 GOSUB 1140
310 GOSUB 1110
320 I=I/N/100
330 T=P*(I+1)^(N*Y)
340 GOSUB 1100
350 GOTO 280
360 PRINT "FUTURE VALUE OF REGULAR DEPOSITS (ANNUITY)"
370 PRINT
380 INPUT "AMOUNT OF REGULAR DEPOSITS (0 TO STOP)";R
390 IF R=0 THEN RETURN
400 GOSUB 1130
410 INPUT "NUMBER OF DEPOSITS PER YEAR";N
420 GOSUB 1110
430 I=I/N/100
440 T=R*((I+1)^(N*Y)-1)/I
450 GOSUB 1100
460 GOTO 370
470 PRINT "REGULAR DEPOSITS"
480 PRINT
490 INPUT "TOTAL VALUE AFTER Y YEARS (0 TO STOP) ";T
500 IF T=0 THEN RETURN
510 GOSUB 1130
520 DEF FNR(X)=INT(X*100+.5)/100
530 INPUT "NUMBER OF DEPOSITS PER YEAR";N
540 GOSUB 1110
550 I=I/N/100
560 R=T*I/((I+1)^(N+Y)-1)
570 PRINT "REGULAR DEPOSITS: $";INT(R*100+.5)/100
580 GOTO 480
590 PRINT "REGULAR WITHDRAWALS FROM AN INVESTMENT"
600 PRINT:INPUT"INITIAL INVESTMENT (0 TO STOP) ";P
610 IF P=0 THEN RETURN
620 GOSUB 1130
630 INPUT "NUMBER OF WITHDRAWALS PER YEAR";N
640 GOSUB 1110
650 I=I/N/100
660 R=P*(I/((I+1)^(N*Y)-1)+I)
670 PRINT "AMOUNT OF EACH WITHDRAWAL = $";INT(R*100+.5)/100
680 GOTO 600
690 PRINT "INITIAL INVESTMENT"
700 PRINT
710 INPUT "TOTAL VALUE AFTER Y YEARS (0 TO STOP) ";T
720 IF T=0 THEN RETURN
730 GOSUB 1140
740 GOSUB 1110
750 GOSUB 1130
760 I=I/N/100
770 P=T/(I+1)^(N*Y)
780 PRINT "INITIAL INVESTMENT = $";INT(P*100+.5)/100
790 GOTO 700
800 PRINT "MINIMUM INVESTMENT FOR WITHDRAWALS"
810 PRINT
820 INPUT "AMOUNT OF WITHDRAWALS (0 TO STOP) ";R
830 IF R=0 THEN RETURN
840 GOSUB 1130
850 INPUT "NUMBER OF WITHDRAWALS PER YEAR";N
860 GOSUB 1110
870 I=I/100
880 P=R*N/I*(1-1/((1+I/N)^(N*Y)))
890 PRINT "MINIMUM INVESTMENT = $";INT(100*P+.5)/100
900 GOTO 810
910 PRINT "NOMINAL INTEREST RATE ON INVESTMENTS"
920 PRINT
930 INPUT "PRINCIPAL (0 TO STOP)";P
940 IF P=0 THEN RETURN
950 INPUT "TOTAL VALUE";T
960 GOSUB 1110
970 GOSUB 1140
980 I2=N*((T/P)^(1/(N*Y))-1)*100
990 PRINT "NOMINAL INTEREST RATE = ";I2;"%"
1000 GOTO 920
1010 PRINT "EFFECTIVE INTEREST RATE ON INVESTMENTS"
1020 PRINT
1030 INPUT "INITIAL INVESTMENT (0 TO STOP) ";P
1040 IF P=0 THEN RETURN
1050 INPUT "TOTAL VALUE AFTER Y YEARS";T
1060 GOSUB 1110
1070 PRINT "ANNUAL INTEREST RATE = ";((T/P)^(1/Y)-1)*100;"%"
1080 GOTO 1020
1090 REM *******
1100 PRINT "FUTURE VALUE = $"; INT(T*100+.5)/100:RETURN
1110 INPUT "NUMBER OF YEARS AND MONTHS (2 NUMBERS WITH A COMMA BETWEEN THEM)";Y0,M
1120 Y=(12*Y0+M)/12:RETURN
1130 INPUT "NOMINAL INTEREST RATE (0 TO 100) ";I:RETURN
1140 INPUT "NUMBER OF COMPOUNDING PERIODS PER YEAR";N:RETURN
1150 PRINT "**** EARNED INTEREST TABLE GENERATOR ***"
1160 PRINT
1170 INPUT "PRINCIPAL";P
1180 GOSUB 1130
1190 I=I/100
1200 INPUT "NUMBER OF DEPOSITS/WITHDRAWALS PER YEAR";N1
1210 IF N1=0 THEN 1260
1220 INPUT "AMOUNT OF DEPOSIT/WITHDRAWAL";R
1230 N=360
1240 L2=N1
1250 GOTO 1290
1260 GOSUB 1140
1270 N1=0
1280 L2=4
1290 INPUT "START WITH WHAT YEAR (WHERE 1 MEANS THE FIRST, 2 THE SECOND, ETC.) ";X
1300 INPUT "END WITH WHAT YEAR";Y
1310 X=INT(X)
1320 B0=P:I1=0:I2=0:I3=0:K=66:P1=4
1330 FOR J0=1 TO INT(Y)+1
1340 IF J0<X THEN 1510
1350 IF K<55 THEN 1500
1360 REM SPACE TO NEXT PAGE, PRINT HEADINGS (ASSUMING 66 LINES/PAGE)
1370 FOR K1=K TO 66
1380 PRINT
1390 NEXT K1
1400 K=6
1410 PRINT " EARNED INTEREST TABLE"
1420 PRINT " PRINCIPAL= $";P;" AT ";I*100;"% NOMINAL FOR ";Y;"YEARS"
1430 IF N1=0 THEN 1460
1440 PRINT "REGULAR DEPOSIT/WITHDRAWAL $";R;". ";N1;" TIMES PER YEAR"
1450 K=K+1
1460 PRINT " EFFECTIVE INTEREST RATE";FNR(100*((1+I/N)^N-1));"% PER YEAR"
1470 PRINT
1480 PRINT "YEAR","BALANCE","INTEREST","ACCUM. INTEREST"
1490 PRINT
1500 PRINT J0,
1510 L1=1
1520 N2=1
1530 P2=1
1540 FOR J1=1 TO N
1550 IF N2>N1 THEN 1590
1560 IF N2/N1>J1/N THEN 1590
1570 B0=B0+R
1580 N2=N2+1
1590 B2=B0*(1+I/N)
1600 I1=B2-B0
1610 I3=I3+I1
1620 I2=I2+I1
1630 IF P2/P1>J1/N THEN 1670
1640 I2=FNR(I2)
1650 B2=FNR(B2)
1660 P2=P2+1
1670 IF J0<X THEN 1750
1680 IF J1/N<L1/L2 THEN 1750
1690 L1=L1+1
1700 PRINT TAB(17);
1710 PRINT FNR(B2),FNR(I3),FNR(I2)
1720 I3=0
1730 K=K+1
1740 REM
1750 B0=B2
1760 IF J0+J1/N-1>=Y THEN 1820
1770 NEXT J1
1780 IF J0<X THEN 1810
1790 PRINT
1800 K=K+1
1810 NEXT J0
1820 PRINT
1830 PRINT "CHANGE DATA AND RECOMPUTE ";
1840 INPUT A$:IF LEFT$(A$,1)="Y" THEN 1160
1850 RETURN
1860 REM RUN "DIR"
1870 END
2000 REM -------------------------------
2010 REM commented out line 1860
2020 REM added space after IF stmts
2999 END

bas/fncallfn.bas → BAS-EXAMPLES/fncallfn.bas View File


bas/fornext.bas → BAS-EXAMPLES/fornext.bas View File


bas/function.bas → BAS-EXAMPLES/function.bas View File


bas/gosub.bas → BAS-EXAMPLES/gosub.bas View File

@@ -16,7 +16,7 @@
134 IF c$ = "X" then end
140 GOTO 10
150 END
160 REM subroutine to clear screen
160 REM subroutine to cls screen
170 PRINT
180 PRINT
190 PRINT

bas/gotolabl.bas → BAS-EXAMPLES/gotolabl.bas View File


+ 20
- 0
BAS-EXAMPLES/guess.bas View File

@@ -0,0 +1,20 @@
100 REM GUESSING GAME
120 PRINT "GUESS THE NUMBER BETWEEN 1 AND 100."
140 LET X = INT(100*RND(0)+1)
150 LET N = 0
160 PRINT "YOUR GUESS";
170 INPUT G
180 LET N = N+1
190 IF G = X THEN 300
200 IF G < X THEN 250
210 PRINT "TOO LARGE, GUESS AGAIN"
220 GOTO 160
250 PRINT "TOO SMALL, GUESS AGAIN"
260 GOTO 160
300 PRINT "YOU GUESSED IT, IN"; N; "TRIES"
310 PRINT "ANOTHER GAME (YES = 1, NO = 0)";
320 INPUT A
330 IF A = 1 THEN 140
340 PRINT "THANKS FOR PLAYING"
350 END


bas/guess2.bas → BAS-EXAMPLES/guess2.bas View File

@@ -1,5 +1,6 @@
10 rem 12/13/2019 Ken guess a number game
100 REM GUESSING GAME
110 SHELL "cls"
120 PRINT "GUESS THE NUMBER BETWEEN 1 AND 100."
140 LET X = INT(100*RND(0)+1)
150 LET N = 0

+ 83
- 0
BAS-EXAMPLES/hello.bas View File

@@ -0,0 +1,83 @@
2 PRINT TAB(33);"HELLO"
4 PRINT TAB(15);"CREATIVE COMPUTING MORRISTOWN, NEW JERSEY"
6 PRINT: PRINT: PRINT
10 PRINT "HELLO. MY NAME IS CREATIVE COMPUTER."
20 PRINT: PRINT: INPUT "WHAT'S YOUR NAME";N$: PRINT
30 PRINT "HI THERE, ";N$;", ARE YOU ENJOYING YOURSELF HERE";
40 INPUT B$: PRINT
50 IF B$="YES" THEN 70
55 IF B$="NO" THEN 80
60 PRINT N$;", I DON'T UNDERSTAND YOUR ANSWER OF '";B$;"'."
65 PRINT "PLEASE ANSWER 'YES' OR 'NO'. DO YOU LIKE IT HERE";: GOTO 40
70 PRINT "I'M GLAD TO HEAR THAT, ";N$;".": PRINT
75 GOTO 100
80 PRINT "OH, I'M SORRY TO HEAR THAT, ";N$;". MAYBE WE CAN"
85 PRINT "BRIGHTEN UP YOUR VISIT A BIT."
100 PRINT
105 PRINT "SAY, ";N$;", I CAN SOLVE ALL KINDS OF PROBLEMS EXCEPT"
110 PRINT "THOSE DEALING WITH GREECE. WHAT KIND OF PROBLEMS DO"
120 PRINT "YOU HAVE (ANSWER SEX, HEALTH, MONEY, OR JOB)";
125 INPUT C$
126 PRINT
130 IF C$="SEX" THEN 200
132 IF C$="HEALTH" THEN 180
134 IF C$="MONEY" THEN 160
136 IF C$="JOB" THEN 145
138 PRINT "OH, ";N$;", YOUR ANSWER OF ";C$;" IS GREEK TO ME."
140 GOTO 250
145 PRINT "I CAN SYMPATHIZE WITH YOU ";N$;". I HAVE TO WORK"
148 PRINT "VERY LONG HOURS FOR NO PAY -- AND SOME OF MY BOSSES"
150 PRINT "REALLY BEAT ON MY KEYBOARD. MY ADVICE TO YOU, ";N$;","
153 PRINT "IS TO OPEN A RETAIL COMPUTER STORE. IT'S GREAT FUN."
155 GOTO 250
160 PRINT "SORRY, ";N$;", I'M BROKE TOO. WHY DON'T YOU SELL"
162 PRINT "ENCYCLOPEADIAS OR MARRY SOMEONE RICH OR STOP EATING"
164 PRINT "SO YOU WON'T NEED SO MUCH MONEY?"
170 GOTO 250
180 PRINT "MY ADVICE TO YOU ";N$;" IS:"
185 PRINT " 1. TAKE TWO ASPRIN"
188 PRINT " 2. DRINK PLENTY OF FLUIDS (ORANGE JUICE, NOT BEER!)"
190 PRINT " 3. GO TO BED (ALONE)"
195 GOTO 250
200 INPUT "IS YOUR PROBLEM TOO MUCH OR TOO LITTLE";D$: PRINT
210 IF D$="TOO MUCH" THEN 220
212 IF D$="TOO LITTLE" THEN 230
215 PRINT "DON'T GET ALL SHOOK, ";N$;", JUST ANSWER THE QUESTION"
217 INPUT "WITH 'TOO MUCH' OR 'TOO LITTLE'. WHICH IS IT";D$:GOTO 210
220 PRINT "YOU CALL THAT A PROBLEM?!! I SHOULD HAVE SUCH PROBLEMS!"
225 PRINT "IF IT BOTHERS YOU, ";N$;", TAKE A COLD SHOWER."
228 GOTO 250
230 PRINT "WHY ARE YOU HERE IN SUFFERN, ";N$;"? YOU SHOULD BE"
235 PRINT "IN TOKYO OR NEW YORK OR AMSTERDAM OR SOMEPLACE WITH SOME"
240 PRINT "REAL ACTION."
250 PRINT
255 PRINT "ANY MORE PROBLEMS YOU WANT SOLVED, ";N$;
260 INPUT E$: PRINT
270 IF E$="YES" THEN 280
273 IF E$="NO" THEN 300
275 PRINT "JUST A SIMPLE 'YES' OR 'NO' PLEASE, ";N$;"."
277 GOTO 255
280 PRINT "WHAT KIND (SEX, MONEY, HEALTH, JOB)";
282 GOTO 125
300 PRINT
302 PRINT "THAT WILL BE $5.00 FOR THE ADVICE, ";N$;"."
305 PRINT "PLEASE LEAVE THE MONEY ON THE TERMINAL."
307 FOR I=1 TO 2000: NEXT I
310 PRINT: PRINT: PRINT
315 PRINT "DID YOU LEAVE THE MONEY";
320 INPUT G$: PRINT
325 IF G$="YES" THEN 350
330 IF G$="NO" THEN 370
335 PRINT "YOUR ANSWER OF '";G$;"' CONFUSES ME, ";N$;"."
340 PRINT "PLEASE RESPOND WITH 'YES' OR 'NO'.": GOTO 315
350 PRINT "HEY, ";N$;"??? YOU LEFT NO MONEY AT ALL!"
355 PRINT "YOU ARE CHEATING ME OUT OF MY HARD-EARNED LIVING."
360 PRINT:PRINT "WHAT A RIP OFF, ";N$;"!!!":PRINT
365 GOTO 385
370 PRINT "THAT'S HONEST, ";N$;", BUT HOW DO YOU EXPECT"
375 PRINT "ME TO GO ON WITH MY PSYCHOLOGY STUDIES IF MY PATIENTS"
380 PRINT "DON'T PAY THEIR BILLS?"
385 PRINT:PRINT "TAKE A WALK, ";N$;".":PRINT:PRINT:GOTO 999
390 PRINT "NICE MEETING YOU, ";N$;", HAVE A NICE DAY."
400 REM
999 END

bas/ifline.bas → BAS-EXAMPLES/ifline.bas View File


bas/input.bas → BAS-EXAMPLES/input.bas View File


+ 39
- 0
BAS-EXAMPLES/interest.bas View File

@@ -0,0 +1,39 @@
2 PRINT TAB(30);"INTEREST"
4 PRINT
8 PRINT
9 PA=0
10 REM -PROGRAM TO COMPUTE INTEREST PAYMENTS
20 PRINT "INTEREST IN PERCENT";
25 INPUT J
26 J=J/100
30 PRINT "AMOUNT OF LOAN";
35 INPUT A
40 PRINT "NUMBER OF YEARS";
45 INPUT N
50 PRINT "NUMBER OF PAYMENTS PER YEAR";
55 INPUT M
60 N=N*M
65 I=J/M
70 B=1+I
75 R=A*I/(1-1/B^N)
78 PRINT
80 PRINT "AMOUNT PER PAYMENT=";INT(R*100)/100
85 PRINT "TOTAL INTEREST =";INT((R*N-A)*100)/100
90 B=A
95 PRINT "PAYMENT NO.";TAB(15);"INTEREST";TAB(30);"PRINCIPAL";TAB(45);"BALANCE"
100 L=B*I
110 P=R-L
120 B=B-P
122 L=INT(L*100)/100
124 P=INT(P*100)/100
126 B=INT(B*100)/100
128 PA=PA+1
130 PRINT PA;TAB(15);"$";L;TAB(30);"$";P;TAB(45);"$";B
140 IF B>=R THEN 100
150 PRINT TAB(30);"$";INT((B*1)*100)/100;TAB(45);"$";INT((R-B*I)*100)/100
155 PRINT
160 PRINT PA+1;"LAST PAYMENT =";TAB(30);"$";INT((B*I+B)*100)/100
170 PRINT
180 PRINT
190 PRINT
200 END

+ 60
- 0
BAS-EXAMPLES/intrate.bas View File

@@ -0,0 +1,60 @@
5 REM 12/16/2919 MINOR CORRECTIONS Ken intrate
10 K=0:T0=0:T1=0
20 INPUT "INTEREST RATE (%) ",I2
30 J=I2/1200
40 INPUT "TERM IN MONTHS " ,N
50 D=1-(1+J)^(-N)
60 R=1000*J/D
70 P=9.9995E-03
80 F=R+P
90 F=(INT(F*100)/100)
100 PRINT "RATE PER $1000 = $",
110 PRINT USING "#####.##";F ' %7F2
120 INPUT "AMOUNT OF MORTGAGE ",Z
130 INPUT "PAYMENT IF KNOWN, ELSE 0 ",B
140 IF B>0 THEN 190
150 B=(Z/1000)*F
160 INPUT "DO YOU WANT PAYMENT IN EVEN DOLLARS ",Y$
170 IF Y$="N" THEN 190 ' IF Y$(1,1) ="N" THEN 190
175 IF Y$="n" THEN 190 ' IF Y$(1,1) ="n" THEN 190
180 B=INT (B+.99)
190 PRINT "MONTHLY PAYMENT = $",
200 PRINT USING "#####.##";B ' %7F2
210 INPUT "DO YOU WANT TO AMORTIZE THIS LOAN ",Y$
220 IF Y$="N" THEN 10 ' IF Y$(1,1)="N" THEN 10
225 IF Y$="n" THEN 10 ' IF Y$(1,1)="n" THEN 10
230 INPUT "DO YOU WANT DETAIL DISPLAYED ",Y$
240 IF Y$="N" THEN S=1 ELSE S=0 ' IF Y$(1,1) ="N" THEN S=1 ELSE S=0
245 IF Y$="n" THEN S=1 ELSE S=0 ' IF Y$(1,1) ="n" THEN S=1 ELSE S=0
250 IF S=1 THEN 280
260 INPUT "DISPLAY INTERVAL ",D1
270 INPUT "DISPLAY START PERIOD ",D2
280 PRINT "PMT# BALANCE INT PRIN RED PER INT TOT INT"
290 I1=J*Z
300 I1=I1+5E-03:I1=(INT(I1*100)/100)
310 T0=T0+I1:T1=T1+I1
320 P1=Z
330 Q=B-I1
340 Z=Z-Q
350 X=P1:Y=Q:X=X-Y
360 IF X>0 THEN 380
370 Z=0:B=P1+I1:Q=B-I1
380 K=K+1
390 IF S=1 THEN 460
400 IF K<>D1+D2 THEN 420
410 PRINT USING "###";K, ' %3I
420 IF K<D1 THEN 460
430 IF D1+D2<> K THEN 460 ELSE D2=D2+D1
440 PRINT USING "#######.##";Z,I1,Q,T0,T1 ' %9F2
450 T0=0
460 IF Z>0 THEN 290
470 PRINT:PRINT "FINAL TOTALS":PRINT
480 PRINT USING "###";K, ' %3I
490 PRINT USING "#######.##";Z,I1,Q,T0,T1 ' %9F2
500 PRINT "LAST PAYMENT = $",: PRINT USING "#####.##";B ' %7F2
510 STOP
600 REM ---------------------------------------------------
610 REM Changed %... to PRINT USING "#"
620 REM Changed Y$(1,1) to Y$
699 END


bas/lof.bas → BAS-EXAMPLES/lof.bas View File


bas/loopuntl.bas → BAS-EXAMPLES/loopuntl.bas View File


bas/main.bas → BAS-EXAMPLES/main.bas View File


bas/mlifthen.bas → BAS-EXAMPLES/mlifthen.bas View File


+ 311
- 0
BAS-EXAMPLES/ohmslaw.bas View File

@@ -0,0 +1,311 @@
5 REM - COMPACTED:6/08/84
7 REM - Removed LPRINT references 4-13-2020 Ken
10 PRINT " -=*OHM'S LAW*=-"
40 PRINT " MENU"
50 PRINT:PRINT TAB(10);"(1) Find I, given VOLTAGE and RESISTANCE (E and R)"
70 PRINT TAB(10);"(2) Find R, given VOLTAGE and CURRENT (V and I)"
90 PRINT TAB(10);"(3) Find E, given CURRENT and RESISTANCE (I and R)"
110 PRINT TAB(10);"(4) Find P (POWER), given VOLTAGE and CURRENT (E and I)"
130 PRINT TAB(10);"(5) Find P (POWER), given CURRENT and RESISTANCE (I and R)"
150 PRINT TAB(10);"(6) Find P (POWER), given VOLTAGE and RESISTANCE (E and R)"
170 PRINT TAB(10);"(7) Find two resistances in parallel, given R1 and R2"
190 PRINT TAB(10);"(8) Find RT, given unequal R1, R2, R3, R4 in parallel"
270 PRINT TAB(10);"(9) Find RT, given R1,R2,R3,R4 in SERIES-PARALLEL"
290 PRINT TAB(10);"(10) Find TOTAL CAPACITANCE (CT), in series circuit"
310 PRINT TAB(10);"(11) Find TOTAL CAPACITANCE (CT), 2 caps, parallel circuit"
330 PRINT TAB(10);"(12) Find TOTAL CAPACITANCE (CT), 3 caps in parallel"
350 PRINT TAB(10);"(13) Find PEAK AC VOLTAGE, given RMS value"
370 PRINT TAB(10);"(14) Find RMS VOLTAGE, given PEAK value"
390 PRINT TAB(10);"(15) Find INDUCTIVE REACTANCE (XL)"
410 PRINT TAB(10);"(16) Find CAPACITIVE REACTANCE (XC)"
430 PRINT TAB(10);"(17) Find IMPEDANCE (Z) of a series circuit"
445 PRINT TAB(10);"(18) Find IMPEDANCE (Z) of a parallel circuit"
447 PRINT
450 PRINT " Select the number you require from the menu and press 'RETURN'"
485 PRINT
490 INPUT "Caps Lock ON. Enter choice from above or -1 to exit :",C
515 IF C = -1 THEN END
517 PRINT "Choice is:";C
520 IF C= 0 OR C> 18 THEN 10
530 ON C GOTO 540,710,880,1050,1220,1380,1540,1700,1930,2190,2360,2560,2770,2930,3070,3260,3430,3680
540 PRINT "Calculate CURRENT (I), given VOLTAGE and RESISTANCE (E and R)"
555 PRINT
560 INPUT "What is the value of E, in volts:",V
580 INPUT "Now enter the value of R, in ohms:",R
600 LET I= (V/R)
610 PRINT " I= ";(V/R);"amperes"
630 PRINT
640 PRINT " Do you wish to do this calculation again? (Y/N)":INPUT ANS$
660 IF ANS$="Y" THEN 540
670 PRINT "Do you wish to return to the menu? (Y/N)":INPUT ANS$
690 IF ANS$="Y" THEN 10
700 GOTO 10020
710 PRINT "Calculate RESISTANCE (R), given VOLTAGE and CURRENT (E and I)"
730 PRINT:PRINT
740 INPUT "Input the value of E, in volts:",V
760 INPUT "Now enter the value of I, in amperes:",I
780 LET R=(V/I):PRINT "R= ";(V/I);"ohms"
800 PRINT
810 PRINT "Do you wish to do this calculation again? (Y/N)":INPUT ANS$
830 IF ANS$="Y" THEN 710
835 PRINT
840 PRINT "Do you wish to return to the menu? (Y/N)":INPUT ANS$
860 IF ANS$="Y" THEN 10
870 GOTO 10020
875 PRINT
880 PRINT "Calculate VOLTAGE (E), given CURRENT and RESISTANCE (I and R)"
895 PRINT
900 INPUT "Enter the value for I, in amperes:",I
920 INPUT "Now enter the value for R, in ohms:",R
940 LET E=(I*R):PRINT "E= ";(I*R);"volts"
960 PRINT
970 PRINT "Do you wish to do this calculation again? (Y/N)":INPUT ANS$
990 IF ANS$="Y" THEN 880
995 PRINT
1000 PRINT "Do you wish to return to the menu? (Y/N)":INPUT ANS$
1020 IF ANS$="Y" THEN 10
1030 GOTO 10020
1040 PRINT
1050 PRINT "Calculate POWER(P), given VOLTAGE(E) and CURRENT(I)"
1065 PRINT
1070 INPUT "Input the value for E, in volts:",V
1090 INPUT "Now enter the value for I, in amperes:",I
1110 LET P=V*I:PRINT "I= ";(V*I);"watts"
1130 PRINT
1140 PRINT "Do you wish to do this calculation again? (Y/N)":INPUT ANS$
1160 IF ANS$="Y" THEN 1050
1175 PRINT
1180 PRINT "Do you wish to return to the menu? (Y/N)":INPUT ANS$
1200 IF ANS$="Y" THEN 10
1210 GOTO 10020
1220 PRINT "Calculate POWER(P), given CURRENT(I) and RESISTANCE(R)"
1235 PRINT
1240 INPUT "Enter the value for I, in amperes:",I
1260 INPUT "Now enter the value for R, in ohms:",R
1280 LET P=(I*I)*R:PRINT "P= ";(I*I)*R;"watts"
1300 PRINT
1310 PRINT "Do you wish to do this calculation again? (Y/N)":INPUT ANS$
1330 IF ANS$="Y" THEN 1220
1335 PRINT
1340 PRINT "Do you wish to return to the menu? (Y/N)":INPUT ANS$
1360 IF ANS$="Y" THEN 10
1370 GOTO 10020
1380 PRINT "Calculate POWER(P), given VOLTAGE(E) and RESISTANCE(R)"
1385 PRINT
1400 INPUT "Enter the value for E, in volts:",V
1420 INPUT "Now enter the value for R, in ohms:",R
1440 LET P=(V*V)/(R):PRINT "P= ";(V*V)/(R);"watts"
1460 PRINT
1470 PRINT "Do you wish to do this calculation again ? (Y/N)":INPUT ANS$
1490 IF ANS$="Y" THEN 1380
1495 PRINT
1500 PRINT "Do you wish to return to the menu? (Y/N)":INPUT ANS$
1520 IF ANS$="Y" THEN 10
1530 GOTO 10020
1535 PRINT
1540 PRINT "Calculate TOTAL RESISTANCE(RT) in parallel, given R1,R2"
1555 PRINT
1560 INPUT "Input the value for R1:",R1
1580 INPUT "Now input the value for R2:",R2
1600 LET RT= (R1*R2)/(R1+R2):PRINT "RT= ";(R1*R2)/(R1+R2);"ohms"
1620 PRINT
1630 PRINT "Do you wish to do this calculation again? (Y/N)":INPUT ANS$
1650 IF ANS$="Y" THEN 1540
1655 PRINT
1660 PRINT "Do you wish to return to the menu? (Y/N)":INPUT ANS$
1680 IF ANS$="Y" THEN 10
1690 GOTO 10020
1695 PRINT
1700 PRINT "Calculate TOTAL RESISTANCE(RT), given unequal R1,R2,R3,R4 values"
1715 PRINT
1720 PRINT "Enter the values for R1,R2,R3 and R4, in ohms"
1740 INPUT "R1=",R1
1750 INPUT "R2=",R2
1760 INPUT "R3=",R3
1770 INPUT "R4=",R4
1780 PRINT "R1=";R1;"ohms"
1790 PRINT "R2=";R2;"ohms"
1800 PRINT "R3=";R3;"ohms"
1810 PRINT "R4=";R4;"ohms"
1820 LET RT=(1)/(1/R1+1/R2+1/R3+1/R4)
1830 PRINT "RT= ";(1)/(1/R1+1/R2+1/R3+1/R4);"ohms"
1850 PRINT
1860 PRINT "Do you wish to do this calculation again? (Y/N)":INPUT ANS$
1880 IF ANS$="Y" THEN 1700
1885 PRINT
1890 PRINT "Do you wish to return to the menu? (Y/N)":INPUT ANS$
1910 IF ANS$="Y" THEN 10
1920 GOTO 10020
1925 PRINT
1930 PRINT "Calculate TOTAL RESISTANCE(RT), in series-parallel,"
1940 PRINT "given R1, R2, R3 and R4"
1965 PRINT
1970 PRINT "Enter the values for R1, R2, R3 and R4"
1990 INPUT "R1=",R1
2000 INPUT "R2=",R2
2010 INPUT "R3=",R3
2020 INPUT "R4=",R4
2030 PRINT "R1=";R1;"ohms"
2040 PRINT "R2=";R2;"ohms"
2050 PRINT "R3=";R3;"ohms"
2060 PRINT "R4=";R4;"ohms"
2070 PRINT
2080 LET RT=(1)/(1/(R1+R2))+(1/(R3+R4))
2090 PRINT "RT=";(1)/(1/(R1+R2))+(1/(R3+R4));"ohms"
2110 PRINT
2120 PRINT "Do you wish to do this calculation again? (Y/N)":INPUT ANS$
2140 IF ANS$="Y" THEN 1930
2145 PRINT
2150 PRINT "Do you wish to return to the menu? (Y/N)":INPUT ANS$
2170 IF ANS$="Y" THEN 10
2180 GOTO 10020
2185 PRINT
2190 PRINT "Calculate TOTAL CAPACITANCE(CT), in series circuit, given C1 and C2"
2205 PRINT
2210 INPUT "Enter value for C1, in MFD:",C1
2220 INPUT "Now enter the value for C2, in MFD:",C2
2240 PRINT "C1=";C1;"mfd"
2250 PRINT "C2=";C2;"mfd"
2260 LET CT=(C1*C2)/(C1+C2):PRINT "CT=";(C1*C2)/(C1+C2);"mfd"
2280 PRINT
2290 PRINT "Do you wish to do this calculation again? (Y/N)":INPUT ANS$
2310 IF ANS$="Y" THEN 2190
2315 PRINT
2320 PRINT "Do you wish to return to the menu? (Y/N)":INPUT ANS$
2340 IF ANS$="Y" THEN 10
2350 GOTO 10020
2355 PRINT
2360 PRINT "Calculate TOTAL CAPACITANCE(CT), parallel circuit, given C1 and C2"
2395 PRINT
2400 INPUT "Enter the value for C1, in mfd:",C1
2420 INPUT "Now enter the value for C2, in mfd:",C2
2440 PRINT "C1=";C1;"mfd"
2450 PRINT "C2=";C2;"mfd"
2460 LET CT=(C1*C2)/(C1+C2):PRINT "CT=";(C1*C2)/(C1+C2);"mfd"
2480 PRINT
2490 PRINT "Do you wish to do this calculation again? (Y/N)":INPUT ANS$
2510 IF ANS$="Y" THEN 2360
2515 PRINT
2520 PRINT "Do you wish to return to the menu? (Y/N)":INPUT ANS$
2540 IF ANS$="Y" THEN 10
2550 GOTO 10020
2555 PRINT
2560 PRINT "Calculate TOTAL CAPACITANCE(CT) for a parallel circuit,"
2570 PRINT "given C1, C2 and C3, in mfd"
2595 PRINT
2600 INPUT "C1=",C1
2610 INPUT "C2=",C2
2620 INPUT "C3=",C3
2630 PRINT "C1=";C1;"mfd"
2640 PRINT "C2=";C2;"mfd"
2650 PRINT "C3=";C3;"mfd"
2660 PRINT
2670 LET CT=(C1+C2+C3):PRINT "CT=";(C1+C2+C3);"mfd"
2690 PRINT
2700 PRINT "D0 you wish to do this calculation again? (Y/N)":INPUT ANS$
2720 IF ANS$="Y" THEN 2560
2725 PRINT
2730 PRINT "Do you wish to return to the menu? (Y/N)":INPUT ANS$
2750 IF ANS$="Y" THEN 10
2760 GOTO 10020
2765 PRINT
2770 PRINT "Calculate PEAK AC VOLTAGE, given RMS value"
2785 PRINT
2790 INPUT "Enter the RMS value, in volts:",RMS
2810 PRINT "RMS=";RMS;"volts"
2820 LET PEAK=(RMS*1.414):PRINT "PEAK=";(RMS*1.414);"volts"
2840 PRINT
2850 PRINT "Do you wish to do this calculation again? (Y/N)":INPUT ANS$
2870 IF ANS$="Y" THEN 2770
2875 PRINT
2880 PRINT "Do you wish to return to the menu? (Y/N)":INPUT ANS$
2900 IF ANS$="Y" THEN 10
2910 GOTO 10020
2920 PRINT
2930 PRINT "Calculate RMS VOLTAGE, given a value in PEAK VOLTS"
2945 PRINT
2950 INPUT "Enter the PEAK value, in volts AC:",PEAK
2960 PRINT "PEAK VOLTS=";PEAK
2970 LET RMS=(.707*PEAK):PRINT "RMS=";(.707*PEAK);"volts AC"
3000 PRINT "Do you wish to do this calculation again? (Y/N)":INPUT ANS$
3020 IF ANS$="Y" THEN 2930
3025 PRINT
3030 PRINT "Do you wish to return to the menu? (Y/N)":INPUT ANS$
3050 IF ANS$="Y" THEN 10
3060 GOTO 10020
3065 PRINT
3070 PRINT "Calculate INDUCTIVE REACTANCE (XL), given FREQUENCY and INDUCTANCE"
3090 PRINT
3100 INPUT "Enter FREQUENCY (F), in Hertz:",FREQ
3120 PRINT "FREQUENCY=";FREQ;"Hertz
3130 INPUT "Now enter the value for INDUCTANCE (L), in henrys:",L
3150 PRINT "INDUCTANCE=";L;"henrys"
3160 LET XL=(2*3.1416)*FREQ*L:PRINT "XL=";(2*3.1416)*FREQ*L;"ohms"
3180 PRINT
3190 PRINT "Do you wish to do this calculation again? (Y/N)":INPUT ANS$
3210 IF ANS$="Y" THEN 3070
3215 PRINT
3220 PRINT "Do you wish to return to the menu? (Y/N)":INPUT ANS$
3240 IF ANS$="Y" THEN 10
3245 GOTO 10020
3250 PRINT
3260 PRINT "Calculate CAPACITIVE REACTANCE (XC), given FREQ(F) and CAP(C)"
3275 PRINT
3280 INPUT "Enter the value for FREQ(F), in Hertz:",F
3290 PRINT "FREQ(F)=";F;"Hertz"
3300 INPUT "Now enter the value for CAP(C), in mfd:",C
3310 PRINT "CAP(C)=";C;"mfd"
3320 PRINT
3330 LET XC=(1)/((2*3.1416)*F*C):PRINT "XC=";(1)/((2*3.1416)*F*C);"ohms"
3350 PRINT
3360 PRINT "Do you wish to do this calculation again? (Y/N)":INPUT ANS$
3380 IF ANS$="Y" THEN 3260
3385 PRINT
3390 PRINT "Do you wish to return to the menu? (Y/N)":INPUT ANS$
3410 IF ANS$="Y" THEN 10
3415 GOTO 10020
3420 PRINT
3430 PRINT "Calculate IMPEDANCE(Z) of a series circuit, given values of"
3435 PRINT "RES(R), CAPACITIVE REACTANCE(XC) and INDUCTIVE REACTANCE(XL)"
3446 PRINT
3450 INPUT "Enter the value for RESISTANCE(R), in ohms:",R
3470 INPUT "Enter the value for CAPACITIVE REACTANCE(XC), in ohms:",XC
3490 INPUT "Enter the value for INDUCTIVE REACTANCE(XL), in ohms:",XL
3510 PRINT
3520 PRINT "RESISTANCE(R)=";R;"ohms"
3530 PRINT "CAPACITIVE REACTANCE(XC)=";XC;"ohms"
3540 PRINT "INDUCTIVE REACTANCE(XL)=";XL;"ohms"
3550 PRINT
3560 LET Z=SQR(R^2+((XL-XC)^2))
3570 PRINT "IMPEDANCE(Z)=";SQR(R^2+((XL-XC)^2));"ohms"
3590 PRINT
3600 PRINT "Do you wish to do this calculation again? (Y/N)":INPUT ANS$
3620 IF ANS$="Y" THEN 3430
3625 PRINT
3630 PRINT "Do you wish to return to the menu? (Y/N)":INPUT ANS$
3650 IF ANS$="Y" THEN 10
3660 GOTO 10020
3670 PRINT
3680 PRINT "Calculate IMPEDANCE (Z) of a parallel circuit"
3700 PRINT
3710 INPUT "Enter the value of L, in henrys:",L
3730 INPUT "Enter the value for FREQ (F), in Hertz:",F
3750 INPUT "Now enter the value for RESISTANCE (R) in ohms:",R
3765 PRINT "INDUCTANCE (L)=";L;"henrys"
3770 PRINT "FREQ (F)=";F;" Hertz"
3775 PRINT "RESISTANCE (R)=";R;"ohms"
3776 PRINT
3780 LET Z=((2*3.1416*F*L)^2)/(R)
3790 PRINT "IMPEDANCE (Z)=";((2*3.1416*F*L)^2)/(R);"ohms"
3810 PRINT "Do you wish to do this calculation again? (Y/N)":INPUT ANS$
3830 IF ANS$="Y" THEN 3680
3840 PRINT
3850 PRINT "Do you wish to return to the menu? (Y/N)":INPUT ANS$
3870 IF ANS$="Y" THEN 10
3880 GOTO 10020
3890 PRINT
10020 PRINT "Glad to have been of service! BYE!!
12000 REM --------------------------------------------------------------------------
12010 REM Change line number 0 to line number 5
12020 REM For automated testing, added 515 IF C = -1 THEN END
12999 END

bas/on.bas → BAS-EXAMPLES/on.bas View File


bas/onerr.bas → BAS-EXAMPLES/onerr.bas View File


bas/onerrlbl.bas → BAS-EXAMPLES/onerrlbl.bas View File


bas/ongosub.bas → BAS-EXAMPLES/ongosub.bas View File


bas/opentest.bas → BAS-EXAMPLES/opentest.bas View File


bas/option.bas → BAS-EXAMPLES/option.bas View File


bas/pascaltr.bas → BAS-EXAMPLES/pascaltr.bas View File


+ 11
- 0
BAS-EXAMPLES/primes.bas View File

@@ -0,0 +1,11 @@
20 PRINT "LIMIT";
30 INPUT L
40 FOR N = 3 TO L
50 FOR D = 2 TO (N-1)
60 IF N/D=INT(N/D) THEN GOTO 100
70 NEXT D
80 PRINT N;
90 GOTO 110
100 PRINT ".";
110 NEXT N
120 END

+ 5
- 0
BAS-EXAMPLES/profile.bas View File

@@ -0,0 +1,5 @@
OPTION TERMINAL ANSI
OPTION EDIT "nano"
OPTION DISABLE COMMAND "renum"
OPTION RENUM ""


bas/putget.bas → BAS-EXAMPLES/putget.bas View File


bas/random.bas → BAS-EXAMPLES/random.bas View File


+ 250
- 0
BAS-EXAMPLES/relays.bas View File

@@ -0,0 +1,250 @@
2 rem Relays control program in bwbasic 3.2 4-18-2020 ken.at.github@gmail.com
3 rem 4-18-2020 Added hardware check. Error traps and help.
4 rem As of 4-13-2020 Debian apt get install bwbasic installs an old 2.2.
5 rem Assumes bwbasic 3.2. bwbasic 2.2 has issues see changelog.
6 rem Download bwbasic-3.2a.tar file. Untar then cd bwbasic-3.2a then
7 rem make then sudo make install to uninstall sudo make remove
8 rem Set terminal to ANSI mode. Linux and Windows. Only 3.2 or newer
10 option terminal ANSI
11 call cls
: rem Clear screen on initial startup. Only 3.2 or newer
12 call close
: rem Close any open files. Again 3.2 or newer.
13 rem Trap errors
14 on error gosub 10000
15 gosub 9000
: rem Get Dogtag & Model & see if it's allowable hardware.
16 print
: print "=== Relay games on ";DATE$;" at ";TIME$;" ==="
: print " ";d$
17 print " ";o$
18 print
24 rem b$ = Base address as of Beaglebone Black Debian 10.3 3-26-2020
25 let b$="/sys/class/gpio/gpio"
50 print "0 Off, 1 On, s State, sa State All,";
52 print " ao All Off, l Label, h for Help or x Exit ";
: input m$
60 IF m$ = "0" or m$ = "1" or m$ = "l" or m$ = "s" then
: goto 70
: END IF
63 IF m$ = "x" or m$ = "e" then
: system
: END IF
: rem Stop program. Exit to system.
64 IF m$ = "sa" then
: print
: print "Currently:"
: gosub 500
: goto 16
: END IF
: rem State all
65 IF m$ = "ao" then
: print
: print "Was:"
: gosub 500
: print "Now:"
: gosub 600
: goto 16
: END IF
66 IF m$ = "q" then
: print "Bye"
: stop
: END IF
: rem Stop program
67 IF m$ = "h" then
: gosub 1000
: goto 16
: END IF
68 print "Mode error. Only 0, 1, s, l, ao All Off, sa State All ";
69 print "h Help or x allowed"
: goto 50
70 print "Relay # = gpio: 1 = 20, 2 = 7, 3 = 112, 4 = 115 or r to Return. ";
71 input "Enter gpio # ";s$
75 IF s$ = "20" or s$ = "7" or s$ = "112" or s$ = "115" then
: goto 80
: END IF
76 IF s$ = "r" then
: goto 16
: END IF
: rem Start over
78 print "Relay gpio number error. Only 20, 7, 112, 115 or r"
: goto 70
80 print
82 IF m$ = "l" then
: gosub 400
: goto 16
: END IF
: rem l = Label
84 IF m$ = "s" then
: gosub 300
: print
: goto 16
: END IF
: rem s = State
86 IF m$ = "0" or m$ = "1" then
: gosub 100
: goto 16
: END IF
: rem Change Relay state
90 print
: print "Error. Code fall through at line 90"
: print
: stop
100 rem Change state of a Relay.
101 rem p$ = Complete address to gpio. b$ is the Base + gpio# + end of string
102 let p$=b$ + s$ + "/value"
110 call open("O",#1,p$)
: rem Open for Output and write m$
150 print #1,m$
: rem Print to gpio string m$
160 call close(#1)
210 call open("I",#1,p$)
: rem Open for Input
250 read #1,x
: rem Read numeric result
255 call close(#1)
256 IF s$ = "20" then
: print "#1 ";
: END IF
257 IF s$ = "7" then
: print "#2 ";
: END IF
258 IF s$ = "112" then
: print "#3 ";
: END IF
259 IF s$ = "115" then
: print "#4 ";
: END IF
260 gosub 700
299 return
300 rem p$ = Complete address to gpio. b$ is the Base + gpio# + end of string
304 let p$=b$ + s$ + "/value"
310 call open("I",#1,p$)
: rem Open for Input
350 read #1,x
: rem Read numeric result
355 call close(#1)
360 gosub 700
396 return
: rem Start over
400 rem p$ = Complete address to gpio. b$ is the Base + gpio# + end of string
404 let p$=b$ + s$ + "/label"
410 call open("I",#1,p$)
420 read #1,l$
425 call close(#1)
430 print "Label for gpio ";s$;" is ";l$
440 return
500 rem Display the state of all Relays 'sa'
510 let s$ = "20"
: print "#1 ";
: gosub 300
520 let s$ = "7"
: print "#2 ";
: gosub 300
530 let s$ = "112"
: print "#3 ";
: gosub 300
540 let s$ = "115"
: print "#4 ";
: gosub 300
550 return
600 rem Turn all Relays off 'ao'
612 let m$ = "0"
: rem Set mode to '0' off
620 let s$ = "20"
: gosub 100
624 let s$ = "7"
: gosub 100
626 let s$ = "112"
: gosub 100
628 let s$ = "115"
: gosub 100
630 return
700 rem Print relay state gathered from 'read'
704 print "Relay gpio ";s$," state is now = ";x;
770 IF x = 0 then
: print " Off"
: END IF
780 IF x = 1 then
: print " On"
: END IF
790 IF x > 1 or x < 0 then
: print " Error"
: END IF
799 return
1000 rem Give them some help
1010 print
: print "Information"
: print
1020 print "To change the state of a relay use 0 for Off or 1 for On"
1022 print " Then enter the gpio number 20, 7, 112 or 115"
: print
1024 print "To check the state of a single relay use s"
1026 print " Then enter the gpio number"
: print
1028 print "To get the associated label (header pin) use l"
1030 print " Then enter the gpio number"
: print
1032 print "To get the state of all relays use sa"
: print
1034 print "To turn all relays off use ao"
: print
1035 print "For the latest updates goto:"
1036 print "https://github.com/kenmartin-unix/Bwbasic-3.2a-for-BeagleBone"
1038 print "ken.at.github@gmail.com"
1040 print
: input "Press enter ? ",h
1099 return
9000 rem Get Model & Dogtag d$ = Dogtag 0$ = MOdel. Check for Beaglebone 'Black'
9002 rem If we fail here we should not. This only runs once at startup.
9004 call open("I",#1,"/etc/dogtag")
: rem Open dogtag file
9008 read #1,d$
: call close(#1)
9014 call open("I",#1,"/proc/device-tree/model")
: rem Open model info
9018 read #1,o$
: call close(#1)
9020 rem Lets see if it's a 'Black'
9025 IF (instr(1,o$,"Black") > 0) then
: return
: END IF
9055 print
: print "Warning: It appears this is not a BeagleBone 'Black'"
: print
9056 print "It appears to be : ";o$
9057 print "Running : ";d$
9058 system
10000 rem Trap errors here. Hopefuly you will not get here.
10020 print
: print "Error code ";err;" Error line ";erl
10040 print
10041 IF (err = 2) then
: print "A program syntax error."
: print
: system
: END IF
10042 IF (err = 5) then
: print "Trouble working with files."
: print
: system
: END IF
10043 IF (erl > 9000) then
: print "Trouble during initial setup."
: print
: system
: END IF
10044 IF (err = 62) then
: print "Reading past the end of file attempted."
: print
: END IF
10048 IF (err = 64) then
: print "Invalid path. Verify open paths."
: system
: END IF
10060 rem CLOSE will fail on 2.2 and loop but not 3.2+
10070 call close
: rem Just in case something is open.
11100 system
: rem Stop program


+ 4
- 0
BAS-EXAMPLES/relays.pro View File

@@ -0,0 +1,4 @@
OPTION STDERR "relays-stderr.txt"
OPTION STDOUT "relays-stdout.txt"
OPTION TERMINAL NONE


Junk/res.bas → BAS-EXAMPLES/res22.bas View File

@@ -1,7 +1,7 @@
100 for j = 1 to 22
100 for j = 1 to 20
200 print j
300 next j
400 for j = 1 to 80
400 for j = 1 to 79
500 print "I";
600 next j
650 print "#"

+ 10
- 0
BAS-EXAMPLES/res24.bas View File

@@ -0,0 +1,10 @@
50 CALL shell("cls")
75 print "res.bas 4-13-2020 Ken run as bwbasic res.bas"
100 for j = 1 to 22
200 print j
300 next j
400 for j = 1 to 79
500 print "I";
600 next j
610 print "#"


+ 21
- 0
BAS-EXAMPLES/selcase.bas View File

@@ -0,0 +1,21 @@
100 rem SelCase.bas -- test SELECT CASE
110 SHELL "cls"
210 Print "SelCase.bas -- test SELECT CASE statement"
220 Input "Enter a number (0 to quit) "; d
225 If (d = 0) then end
230 Select Case d
240 Case 3 to 5
250 Print "The number is between 3 and 5."
260 Case 6
270 Print "The number you entered is 6."
280 Case 7 to 9
290 Print "The number is between 7 and 9."
300 Case If > 10
310 Print "The number is greater than 10"
320 Case If < 0
330 Print "The number is less than 0"
340 Case Else
350 Print "The number is 1, 2 or 10."
360 End Select
365 Print
370 Goto 220

bas/snglfunc.bas → BAS-EXAMPLES/snglfunc.bas View File


bas/stop.bas → BAS-EXAMPLES/stop.bas View File


+ 13
- 0
BAS-EXAMPLES/sum.bas View File

@@ -0,0 +1,13 @@
10 REM compute the sum of integers from 1 to 10 with GOTO loop
20 CALL SHELL("cls")
30 LET N=1
40 LET S = S + N
50 PRINT N,S
60 LET N = N + 1
70 IF N <= 10 GOTO 40
80 PRINT
: REM print empty line
90 PRINT "Final sum:";S
95 PRINT
100 END


+ 12
- 0
BAS-EXAMPLES/sumfor.bas View File

@@ -0,0 +1,12 @@
10 REM compute the sum of numbers with FOR loop.
20 CALL SHELL("cls")
30 FOR N=0.5 TO 10.1 STEP 0.75
40 LET S = S + N
50 PRINT N,S
70 NEXT N
80 PRINT
: REM print empty line
90 PRINT "Final sum:";S
95 PRINT
100 END


+ 14
- 0
BAS-EXAMPLES/sumintexit.bas View File

@@ -0,0 +1,14 @@
10 REM compute the sum of integers with FOR loop. Early exit.
20 CALL SHELL("cls")
30 FOR N=1 TO 10
35 IF (S + N > 25) GOTO 80
: REM exit the loop when S gets large enough
40 LET S = S + N
50 PRINT N,S
70 NEXT N
80 PRINT
: REM print empty line
90 PRINT "Final sum:";S
95 PRINT
100 END


+ 12
- 0
BAS-EXAMPLES/sumneg.bas View File

@@ -0,0 +1,12 @@
10 REM compute the sum of integers from 1 to 10 with FOR and negative STEP
20 CALL SHELL("cls")
30 FOR N=10 TO 1 STEP -2
40 LET S = S + N
50 PRINT N,S
70 NEXT N
80 PRINT
: REM print empty line
90 PRINT "Final sum:";S
95 PRINT
100 END


bas/tab.bas → BAS-EXAMPLES/tab.bas View File


bas/term.bas → BAS-EXAMPLES/term.bas View File


+ 174
- 0
BAS-EXAMPLES/tictac.bas View File

@@ -0,0 +1,174 @@
2 PRINT TAB(30);"TIC-TAC-TOE"
4 PRINT TAB(15);"CREATIVE COMPUTING MORRISTOWN, NEW JERSEY"
6 PRINT
: PRINT
: PRINT
8 PRINT "THE BOARD IS NUMBERED:"
10 PRINT " 1 2 3"
12 PRINT " 4 5 6"
14 PRINT " 7 8 9"
16 PRINT
: PRINT
: PRINT
20 DIM SS(9)
50 INPUT"DO YOU WANT 'X' OR 'O'";C$
55 IF C$="X"THEN 475
57 IF C$="x" THEN 475
60 P$="O"
: Q$="X"
100 G=-1
: H=1
: IF SS(5)<>0 THEN 103
102 SS(5)=-1
: GOTO 195
103 IF SS(5)<>1 THEN 106
104 IF SS(1)<>0 THEN 110
105 SS(1)=-1
: GOTO 195
106 IF SS(2)=1 AND SS(1)=0 THEN 181
107 IF SS(4)=1 AND SS(1)=0 THEN 181
108 IF SS(6)=1 AND SS(9)=0 THEN 189
109 IF SS(8)=1 AND SS(9)=0 THEN 189
110 IF G=1 THEN 112
111 GOTO 118
112 J=3*INT((M-1)/3)+1
113 IF 3*INT((M-1)/3)+1=M THEN
: K=1
: END IF
114 IF 3*INT((M-1)/3)+2=M THEN
: K=2
: END IF
115 IF 3*INT((M-1)/3)+3=M THEN
: K=3
: END IF
116 GOTO 120
118 FOR J=1 TO 7 STEP 3
: FOR K=1 TO 3
120 IF SS(J)<>G THEN 130
122 IF SS(J+2)<>G THEN 135
126 IF SS(J+1)<>0 THEN 150
128 SS(J+1)=-1
: GOTO 195
130 IF SS(J)=H THEN 150
131 IF SS(J+2)<>G THEN 150
132 IF SS(J+1)<>G THEN 150
133 SS(J)=-1
: GOTO 195
135 IF SS(J+2)<>0 THEN 150
136 IF SS(J+1)<>G THEN 150
138 SS(J+2)=-1
: GOTO 195
150 IF SS(K)<>G THEN 160
152 IF SS(K+6)<>G THEN 165
156 IF SS(K+3)<>0 THEN 170
158 SS(K+3)=-1
: GOTO 195
160 IF SS(K)=H THEN 170
161 IF SS(K+6)<>G THEN 170
162 IF SS(K+3)<>G THEN 170
163 SS(K)=-1
: GOTO 195
165 IF SS(K+6)<>0 THEN 170
166 IF SS(K+3)<>G THEN 170
168 SS(K+6)=-1
: GOTO 195
170 GOTO 450
171 IF SS(3)=G AND SS(7)=0 THEN 187
172 IF SS(9)=G AND SS(1)=0 THEN 181
173 IF SS(7)=G AND SS(3)=0 THEN 183
174 IF SS(9)=0 AND SS(1)=G THEN 189
175 IF G=-1 THEN
: G=1
: H=-1
: GOTO 110
: END IF
176 IF SS(9)=1 AND SS(3)=0 THEN 182
177 FOR I=2 TO 9
: IF SS(I)<>0 THEN 179
178 SS(I)=-1
: GOTO 195
179 NEXT I
181 SS(1)=-1
: GOTO 195
182 IF SS(1)=1 THEN 177
183 SS(3)=-1
: GOTO 195
187 SS(7)=-1
: GOTO 195
189 SS(9)=-1
195 PRINT
: PRINT"THE COMPUTER MOVES TO..."
202 GOSUB 1000
205 GOTO 500
450 IF G=1 THEN 465
455 IF J=7 AND K=3 THEN 465
460 NEXT K
: NEXT J
465 IF SS(5)=G THEN 171
467 GOTO 175
475 P$="X"
: Q$="O"
500 PRINT
: INPUT"WHERE DO YOU MOVE";M
502 IF M=0 THEN
: PRINT"THANKS FOR THE GAME."
: GOTO 2000
: END IF
503 IF M>9 THEN 506
505 IF SS(M)=0 THEN 510
506 PRINT"THAT SQUARE IS OCCUPIED."
: PRINT
: PRINT
: GOTO 500
510 G=1
: SS(M)=1
520 GOSUB 1000
530 GOTO 100
1000 PRINT
: FOR I=1 TO 9
: PRINT" ";
: IF SS(I)<>-1 THEN 1014
1012 PRINT Q$;" ";
: GOTO 1020
1014 IF SS(I)<>0 THEN 1018
1016 PRINT" ";
: GOTO 1020
1018 PRINT P$;" ";
1020 IF I<>3 AND I<>6 THEN 1050
1030 PRINT
: PRINT"---+---+---"
1040 GOTO 1080
1050 IF I=9 THEN 1080
1060 PRINT"!";
1080 NEXT I
: PRINT
: PRINT
: PRINT
1095 FOR I=1 TO 7 STEP 3
1100 IF SS(I)<>SS(I+1)THEN 1115
1105 IF SS(I)<>SS(I+2)THEN 1115
1110 IF SS(I)=-1 THEN 1350
1112 IF SS(I)=1 THEN 1200
1115 NEXT I
: FOR I=1 TO 3
: IF SS(I)<>SS(I+3)THEN 1150
1130 IF SS(I)<>SS(I+6)THEN 1150
1135 IF SS(I)=-1 THEN 1350
1137 IF SS(I)=1 THEN 1200
1150 NEXT I
: FOR I=1 TO 9
: IF SS(I)=0 THEN 1155
1152 NEXT I
: GOTO 1400
1155 IF SS(5)<>G THEN 1170
1160 IF SS(1)=G AND SS(9)=G THEN 1180
1165 IF SS(3)=G AND SS(7)=G THEN 1180
1170 RETURN
1180 IF G=-1 THEN 1350
1200 PRINT"YOU BEAT ME!! GOOD GAME."
: GOTO 2000
1350 PRINT"I WIN, TURKEY!!!"
: GOTO 2000
1400 PRINT"IT'S A DRAW. THANK YOU."
2000 END


bas/whilwend.bas → BAS-EXAMPLES/whilwend.bas View File


bas/width.bas → BAS-EXAMPLES/width.bas View File


bas/writeinp.bas → BAS-EXAMPLES/writeinp.bas View File


+ 0
- 441
Bwbasic-1.1-Manual.txt View File

@@ -1,441 +0,0 @@


Bywater BASIC Interpreter/Shell, version 1.10
---------------------------------------------

Copyright (c) 1992, Ted A. Campbell
for bwBASIC version 1.10, 1 November 1992


CONTENTS:

1. DESCRIPTION
2. TERMS OF USE
3. COMMANDS AND FUNCTIONS IMPLEMENTED
4. SOME NOTES ON USAGE
5. UNIMPLEMENTED COMMANDS AND FUNCTIONS
6. SOME NOTES ON COMPILATION
7. THE STORY OF BYWATER BASIC
8. COMMUNICATIONS


1. DESCRIPTION

The Bywater BASIC Interpreter (bwBASIC) implements a large
superset of the ANSI Standard for Minimal BASIC (X3.60-1978)
in ANSI C and offers shell program facilities as an extension
of BASIC.

The set of BASIC commands and functions implemented is fairly
limited (see section three below), although more commands and
functions are implemented than appear in the specification
for Minimal BASIC. There are no commands that are terminal- or
hardware specific. (Seriously -- CLS may work under bwBASIC
on your DOS-based pc, but that is because bwBASIC shells
out to DOS when it does not recognize CLS and executes CLS there.)

The interpreter is slow. Whenever faced with a choice between
conceptual clarity and speed, I have consistently chosen
the former. The interpreter is the simplest design available,
and utilizes no system of intermediate code, which would speed
up considerably its operation. As it is, each line is interpreted
afresh as the interpreter comes to it.

bwBASIC implements one feature not available in previous BASIC
interpreters: a shell command can be entered interactively at the
bwBASIC prompt, and the interpreter will execute it under a
command shell. For instance, the command "dir *.bas" can be
entered in bwBASIC (under DOS, or "ls -l *.bas" under UNIX) and
it will be executed as from the operating system command line.
Shell commands can also be given on numbered lines in a bwBASIC
program, so that bwBASIC can be used as a shell programming
language. bwBASIC's implementation of the RMDIR, CHDIR, MKDIR,
NAME, KILL, ENVIRON, and ENVIRON$() commands and functions
offer further shell-processing capabilities.


2. TERMS OF USE:

The bwBASIC source code and executables produced from it can be
used subject to the following statement which is included in
the header to all the source code files:

All U.S. and international copyrights are claimed by the
author. The author grants permission to use this code
and software based on it under the following conditions:
(a) in general, the code and software based upon it may be
used by individuals and by non-profit organizations; (b) it
may also be utilized by governmental agencies in any country,
with the exception of military agencies; (c) the code and/or
software based upon it may not be sold for a profit without
an explicit and specific permission from the author, except
that a minimal fee may be charged for media on which it is
copied, and for copying and handling; (d) the code must be
distributed in the form in which it has been released by the
author; and (e) the code and software based upon it may not
be used for illegal activities.


3. BASIC COMMANDS AND FUNCTIONS IMPLEMENTED:

ABS( number )
ASC( string$ )
ATN( number )
CHAIN [MERGE] file-name [, line-number] [, ALL]
CHR$( number )
CINT( number )
CLEAR
CLOSE [[#]file-number]...
COMMON variable [, variable...]
COS( number )
CSNG( number )
CVD( string$ )
CVI( string$ )
CVS( string$ )
DATA constant[,constant]...
DATE$
DEF FNname(arg...)] = expression
DEFDBL letter[-letter](, letter[-letter])...
DEFINT letter[-letter](, letter[-letter])...
DEFSNG letter[-letter](, letter[-letter])...
DEFSTR letter[-letter](, letter[-letter])...
DELETE line[-line]
DIM variable(elements...)[variable(elements...)]...
END
ENVIRON variable-string = string
ENVIRON$( variable-string )
EOF( device-number )
ERASE variable[, variable]...
ERL
ERR
ERROR number
EXP( number )
FIELD [#] device-number, number AS string-variable [, number AS string-variable...]
FOR counter = start TO finish [STEP increment]
GET [#] device-number [, record-number]
GOSUB line
GOTO line
HEX$( number )
IF expression THEN statement [ELSE statement]
INPUT [# device-number]|[;]["prompt string";]list of variables
INSTR( [start-position,] string-searched$, string-pattern$ )
INT( number )
KILL file-name
LEFT$( string$, number-of-spaces )
LEN( string$ )
LET variable = expression
LINE INPUT [[#] device-number,]["prompt string";] string-variable$
LIST line[-line]
LOAD file-name
LOC( device-number )
LOF( device-number )
LOG( number )
LSET string-variable$ = expression
MERGE file-name
MID$( string$, start-position-in-string[, number-of-spaces ] )
MKD$( double-value# )
MKI$( integer-value% )
MKS$( single-value! )
NAME old-file-name AS new-file-name
NEW
NEXT counter
OCT$( number )
ON variable GOTO|GOSUB line[,line,line,...]
ON ERROR GOSUB line
OPEN O|I|R, [#]device-number, file-name [,record length]
file-name FOR INPUT|OUTPUT|APPEND AS [#]device-number [LEN = record-length]
OPTION BASE number
POS
PRINT [# device-number,][USING format-string$;] expressions...
PUT [#] device-number [, record-number]
RANDOMIZE number
READ variable[, variable]...
REM string
RESTORE line
RETURN
RIGHT$( string$, number-of-spaces )
RND( number )
RSET string-variable$ = expression
RUN [line][file-name]
SAVE file-name
SGN( number )
SIN( number )
SPACE$( number )
SPC( number )
SQR( number )
STOP
STR$( number )
STRING$( number, ascii-value|string$ )
SWAP variable, variable
SYSTEM
TAB( number )
TAN( number )
TIME$
TIMER
TROFF
TRON
VAL( string$ )
WEND
WHILE expression
WIDTH [# device-number,] number
WRITE [# device-number,] element [, element ]....

If DIRECTORY_CMDS is set to TRUE when the program is compiled,
then the following commands will be available:

CHDIR pathname
MKDIR pathname
RMDIR pathname

If DEBUG is set to TRUE when the program is compiled then
the following debugging commands (unique to bwBASIC) will
be available:

VARS (prints a list of all variables)
CMDS (prints a list of all commands)
FNCS (prints a list of all functions)

If COMMAND_SHELL is set to TRUE when the program is compiled,
then the user may enter a shell command at the bwBASIC prompt.


4. SOME NOTES ON USAGE:

An interactive environment is provided, so that a line with a
line number can be entered at the bwBASIC prompt and it will be
added to the program in memory.

Line numbers are not strictly required, but are useful if the
interactive enviroment is used for programming. For longer
program entry one might prefer to use an ASCII text editor, and
in this case lines can be entered without numbers. In this case,
however, one will not be able to alter the numberless lines
within the interactive environment.

Command names and function names are not case sensitive,
so that "Run" and "RUN" and "run" are equivalent and "abs()"
and "ABS()" and "Abs()" are equivalent. HOWEVER: variable
names ARE case sensitive in bwbASIC, so that "d$" and "D$"
are different variables. This differs from some BASIC
implementations where variable names are not case sensitive.

A filename can be specified on the command line and will be
LOADed and RUN immediately, so that the command line

bwbasic prog.bas

will load and execute "prog.bas".

All programs are stored as ASCII text files.

TRUE is defined as -1 and FALSE is defined as 0 in the default
distribution of bwBASIC. These definitions can be changed by
those compiling bwBASIC (see file BWBASIC.H).

Assignment must be made to variables. This differs from some
implementations of BASIC where assignment can be made to a
function. Implication: "INSTR( 3, x$, y$ ) = z$" will not
work under bwBASIC.

Notes on the implementation of specific commands:

CVI(), CVD(), CVS(), MKI$(), MKD$(), MKS$(): These functions
are implemented, but are dependent on a) the sizes for integer,
float, and double values on particular systems, and b) how
particular versions of C store these numerical values. The
implication is that data files created using these functions
on a DOS-based microcomputer may not be translated correctly
by bwBASIC running on a Unix-based computer. Similarly, data
files created by bwBASIC compiled by one version of C may not be
readable by bwBASIC compiled by another version of C (even under
the same operating system). So be careful with these.

ENVIRON: The ENVIRON command requires BASIC strings on either
side of the equals sign. Thus:

environ "PATH" = "/usr/bin"

It might be noted that this differs from the implementation
of ENVIRON in some versions of BASIC, but bwBASIC's ENVIRON
allows BASIC variables to be used on either side of the equals
sign. Note that the function ENVIRON$() is different from the
command, and be aware of the fact that in some operating systems
an environment variable set within a program will not be passed
to its parent shell.

ERR: Note that if PROG_ERRORS has been defined when bwBASIC is
compiled, the ERR variable will not be set correctly upon
errors. It only works when standard error messages are used.

FOR and NEXT: In this implementation of bwBASIC, a NEXT
statement must appear in the first position in a program
line; it cannot appear in a line segment beyond a colon.

INPUT: bwBASIC cannot support the optional feature of INPUT
that suppresses the carriage-return and line-feed at the end
of the input. This is because ANSI C does not provide for any
means of input other than CR-LF-terminated strings.


5. UNIMPLEMENTED COMMANDS AND FUNCTIONS

There are a few items not implemented that have been so long
a part of standard BASICs that their absence will seem surprising.
In each case, though, their implementation would require opera-
ting-system-specific functions or terminal-specific functions
that ANSI C cannot provide. Some specific examples:

CALL In some versions of BASIC, CALL is used to call a
machine language subroutine, but machine language
routines are highly system-specific. In other
BASICs (conforming to the more complete ANSI
definition of BASIC), CALL is used to call a
named subroutine. Although it's possible that
bwBASIC could develop as a numberless BASIC
with named subroutine calls, these features
are not implemented in this earliest released
version.

CLOAD See CALL above (machine language subroutines).

CONT See RESUME below (programmer ignorance?).

DEF USR See CALL above (machine language subroutines).

EDIT EDIT would be especially nice, but requires some
specific knowledge of how particular computers
handle interaction between the screen and the
keyboard. This knowledge isn't available within
the bounds of ANSI C alone ("innerhalb die Grenzen
der reinen Vernunft," with apologies to Immanuel
Kant).

FRE() The ability to report the amount of free memory
remaining is system-specific due to varying patterns
of memory allocation and access; consequently this
ability is not present in ANSI C and this function
is not available in bwBASIC.

FILES The FILES command requires a list of files conforming
to a specifier; ANSI C does not provide this. When
COMMAND_SHELL is defined as TRUE, users might want
to issue operating-system commands such as "DIR"
(DOS) or "ls -l" (Unix) to get a list of files.

INKEY$ This function requires a keyboard scan to indicate
whether a key is pending. Although this facility
is easily available on microcomputers (it is part
of the minimal CP/M Operating System), it is not
easily available on some more complex systems.
Consequently, it's not part of the C standard and
bwBASIC has not implemented INKEY$.

INPUT$() Similar to INKEY$ above, ANSI C by itself is not
able to read unechoed keyboard input, and can read
keyboard input only after a Carriage-Return has
been entered.

INP Calls to hardware ports, like machine-language
routines, are highly system-specific and cannot
be implemented in ANSI C alone.

LLIST See LPRINT below.

LPOS See LPRINT below.

LPRINT and LLIST, etc., require access to a printer device,
and this varies from one system to another. Users
might try OPENing the printer device on their own
operating system (e.g., "/dev/lp" on Unix systems,
or "PRN" under DOS) and see if printing can be done
from bwBASIC in this way.

NULL In this case, I am convinced that NULL is no longer
necessary, since very few printers now require NULLs
at the end of lines.

OUT See INP above (calls to hardware ports).

PEEK() PEEK and POKE enabled earlier BASICs to address
particular memory locations. Although bwBASIC
could possibly implement this command (POKE) and
this function (PEEK()), the limitation would be
highly limited by the different systems for
memory access in different systems.

POKE see PEEK() above.

RENUM Since unnumbered lines can be entered and
executed under bwBASIC, it would not be
possible to implement a RENUM routine.

RESUME Is this possible under ANSI C? If so, I
simply have failed to figure it out yet.
Mea culpa (but not maxima).

USR See CALL and DEF USR above (machine language
subroutines).

VARPTR See PEEK and POKE above.

WAIT See INP and OUT above.

6. SOME NOTES ON COMPILATION

bwBASIC is written in ANSI C and takes advantage of some of the
enhancements of ANSI C over the older K&R standard. The program
expects to find standard ANSI C include files (such as ).
Because there is nothing terminal- or hardware-specific about it,
I should hope that it would compile correctly under any ANSI C
compiler, but you may have to construct your own makefile.

Two makefiles are currently provided: "makefile.qcl" will compile
the program utilizing the Microsoft QuickC (tm) line-oriented
compiler on DOS-based p.c.'s, and "makefile.gcc" will compile
the program utilizing the ANSI option of Gnu C++. I have also
compiled the program utilizing Borland's Turbo C++ (tm) on DOS-
based machines.

No alterations to flags are necessary for varied environments,
but the beginning of file allows the user to set
some debugging flags and to control some program defaults.
The file has a number of language-specific message
sets that can be controlled by setting the appropriate language
flag.


7. THE STORY OF BYWATER BASIC

This program was originally begun in 1982 by my grandmother, Mrs.
Verda Spell of Beaumont, TX. She was writing the program using
an ANSI C compiler on an Osborne I CP/M computer and although my
grandfather (Lockwood Spell) had bought an IBM PC with 256k of
RAM my grandmother would not use it, paraphrasing George Herbert
to the effect that "He who cannot in 64k program, cannot in 512k."
She had used Microsoft BASIC and although she had nothing against
it she said repeatedly that she didn't understand why Digital
Research didn't "sue the socks off of Microsoft" for version 1.0
of MSDOS and so I reckon that she hoped to undercut Microsoft's
entire market and eventually build a new software empire on
the North End of Beaumont. Her programming efforts were cut
tragically short when she was thrown from a Beaumont to Port
Arthur commuter train in the summer of 1986. I found the source
code to bwBASIC on a single-density Osborne diskette in her knitting
bag and eventually managed to have it all copied over to a PC
diskette. I have revised it slightly prior to this release. You
should know, though, that I myself am an historian, not a programmer.

8. COMMUNICATIONS:

Ted A. Campbell
Bywater Software
P.O. Box 4023
Duke Station
Durham, NC 27706
USA

email: tcamp@acpub.duke.edu



+ 0
- 35
DMCDOS32.CMD View File

@@ -1,35 +0,0 @@
@echo off
rem Filename: DMCDOS32.CMD
rem Purpose: Build Bywater BASIC for MS-DOS (32-bit) using Digital Mars Compiler Version 8.42n
rem Author: Howard Wulf, AF5NE
rem Date: 2015-01-29
rem Uasage: implementation defined
rem Example:
rem cd \sdcard\Download\BASIC\bwbasic3\
rem DMCDOS32.CMD
rem
rem This is the location of DMC.EXE
rem
set BINDIR=C:\DOS\dm\bin;
rem
rem Cleanup before compile
rem
DEL BW*.EXE 1> NUL 2> NUL
DEL BW*.OBJ 1> NUL 2> NUL
DEL BW*.MAP 1> NUL 2> NUL
rem
rem Compile
rem
set OLDPATH=%PATH%
set PATH=%BINDIR%;%PATH%
dmc.exe > DMCDOS32.TXT
dmc.exe -mx -A89 -oBWBASIC.EXE -DHAVE_MSDOS=1 bwbasic.c bwb_cmd.c bwb_cnd.c bwb_dio.c bwb_exp.c bwb_fnc.c bwb_inp.c bwb_int.c bwb_prn.c bwb_stc.c bwb_str.c bwb_tbl.c bwb_var.c bwd_cmd.c bwd_fun.c bwx_tty.c X32.LIB >> DMCDOS32.TXT
set PATH=%OLDPATH%
set OLDPATH=
set BINDIR=
rem
rem Cleanup after compile
rem
DEL BW*.OBJ 1> NUL 2> NUL
DEL BW*.MAP 1> NUL 2> NUL
rem EOF

+ 0
- 35
DMCWIN32.CMD View File

@@ -1,35 +0,0 @@
@echo off
rem Filename: DMCWIN32.CMD
rem Purpose: Build Bywater BASIC for MS-WINDOWS (32-bit) using Digital Mars Compiler Version 8.42n
rem Author: Howard Wulf, AF5NE
rem Date: 2015-01-29
rem Uasage: implementation defined
rem Example:
rem cd \sdcard\Download\BASIC\bwbasic3\
rem DMCWIN32.CMD
rem
rem This is the location of DMC.EXE
rem
set BINDIR=C:\DOS\dm\bin
rem
rem Cleanup before compile
rem
DEL BW*.EXE 1> NUL 2> NUL
DEL BW*.OBJ 1> NUL 2> NUL
DEL BW*.MAP 1> NUL 2> NUL
rem
rem Compile
rem
set OLDPATH=%PATH%
set PATH=%BINDIR%;%PATH%
dmc.exe > DMCWIN32.TXT
dmc.exe -mn -A89 -oBWBASIC.EXE -DHAVE_MSDOS=1 bwbasic.c bwb_cmd.c bwb_cnd.c bwb_dio.c bwb_exp.c bwb_fnc.c bwb_inp.c bwb_int.c bwb_prn.c bwb_stc.c bwb_str.c bwb_tbl.c bwb_var.c bwd_cmd.c bwd_fun.c bwx_tty.c >> DMCWIN32.TXT
set PATH=%OLDPATH%
set OLDPATH=
set BINDIR=
rem
rem Cleanup after compile
rem
DEL BW*.OBJ 1> NUL 2> NUL
DEL BW*.MAP 1> NUL 2> NUL
rem EOF

Junk/bwbasic.desktop → GUI/bwbasic.desktop View File

@@ -4,8 +4,8 @@ Encoding=UTF-8
Name=Bywater BASIC
GenericName=Bywater BASIC
Type=Application
Exec=bwbasic
Icon=/usr/share/pixmaps/bwbasic.png
Exec=<File Location Example /home/username/bin/>bwbasic.sh
Icon=<File Location Example /home/username/png/>bwbasic.png
StartupNotify=true
Terminal=true
Categories=Development

bwbasic.png → GUI/bwbasic.png View File

Before After
Width: 48  |  Height: 48  |  Size: 3.8 KiB Width: 48  |  Height: 48  |  Size: 3.8 KiB

+ 7
- 0
GUI/bwbasic.sh View File

@@ -0,0 +1,7 @@
# 12/14/2019 Ken
trap 'echo " "; echo "PROGRAM INTERRUPTED"; echo "Press Enter "; read j; exit 1' INT
cd /home/$USER/source/bwbasic-3.2a/BAS-EXAMPLES
bwbasic
# -n = no newline -e interpret special octel numbers \007 = Bell
/bin/echo -n -e "Bwbasic terminated. Press Enter \007"
read j

Junk/Bwbasic-1.1-Manual.txt → INFO/Bwbasic-1.1-Manual.txt View File


Junk/Bwbasic-2.1-Manual.txt → INFO/Bwbasic-2.1-Manual.txt View File


Bwbasic-2.1-Manual.txt → INFO/Bwbasic-2.1.doc View File


+ 2538
- 0
INFO/Bwbasic-3.2-options.txt
File diff suppressed because it is too large
View File


+ 1872
- 0
INFO/Bwbasic-Doc-2.1.txt
File diff suppressed because it is too large
View File


+ 481
- 0
INFO/Bwbasic-changelog.txt View File

@@ -0,0 +1,481 @@


README file for


Bywater BASIC Interpreter, version 3.20
---------------------------------------------

Copyright (c) 1993, Ted A. Campbell
for bwBASIC version 2.10, 11 October 1993

Version 2.20 modifications by Jon B. Volkoff,
25 November 1995

Patch level 1 release by Jon B. Volkoff,
15 March 1996

Patch level 2 release by Jon B. Volkoff,
11 October 1997

Version 2.30 modifications by Paul Edwards,
5 March 2008

Version 2.40 modifications by Paul Edwards,
26 Jan 2009

Version 2.50 modifications by Paul Edwards,
4 June 2009

Version 2.60 modifications by Paul Edwards,
6 November 2012

Version 2.61 modifications by Paul Edwards,
4 August 2014

Version 3.00 modifications by Howard Wulf, AF5NE
12 May 2015

Version 3.10 modifications by Howard Wulf, AF5NE
27 July 2016

Version 3.20 modifications by Howard Wulf, AF5NE
4 June 2017




DESCRIPTION:

The Bywater BASIC Interpreter (bwBASIC) implements a large
superset of the ANSI Standard for Minimal BASIC (X3.60-1978),
a significant subset of the ANSI Standard for Full BASIC
(X3.113-1987), and many classic BASIC dialects in C. bwBASIC
seeks to be as portable as possible.

This version of Bywater BASIC is released under the terms of the
GNU General Public License (GPL), which is distributed with this
software in the file "COPYING". The GPL specifies the terms
under which users may copy and use the software in this distribution.

A separate license is available for commercial distribution,
for information on which you should contact the author.



OBTAINING THE SOURCE CODE:

The source code for bwBASIC is available from
http://bwbasic.sourceforge.net


COMMUNICATIONS:

email: tcamp@delphi.com (for Ted Campbell)
eidetics@cerf.net (for Jon Volkoff)
mutazilah@gmail.com (for Paul Edwards)


A LIST OF BASIC COMMANDS AND FUNCTIONS IMPLEMENTED in bwBASIC:

The complete list of over 500 commands, functions and operators is
in the file "ALL.txt" in the DOCS directory. Documentation for each
dialect is also in the DOCS directory. Be aware that the commands,
functions and operators available depend upon the particular BASIC
dialect selected using the OPTION VERSION command.


CHANGE HISTORY

CHANGES FROM 3.10 to 3.20

* Implements most of the following BASIC dialects:
OPTION VERSION "BYWATER" ' Bywater BASIC 3
OPTION VERSION "BYWATER-2" ' Bywater BASIC 2
OPTION VERSION "CALL/360" ' SBC CALL/360 Mainframe BASIC
OPTION VERSION "CBASIC-II" ' CBASIC-II for CP/M
OPTION VERSION "DARTMOUTH" ' Dartmouth DTSS BASIC
OPTION VERSION "ECMA-55" ' ANSI Minimal BASIC
OPTION VERSION "ECMA-116" ' ANSI Full BASIC
OPTION VERSION "GCOS" ' GE 600 Mainframe BASIC
OPTION VERSION "HAARDT" ' bas 2.4 by Michael Haardt
OPTION VERSION "HANDBOOK1" ' The BASIC Handbook, 1st Edition
OPTION VERSION "HANDBOOK2" ' The BASIC Handbook, 2nd Edition
OPTION VERSION "HEATH" ' Heath Benton Harbor BASIC
OPTION VERSION "MARK-I" ' GE 265 Mainframe BASIC
OPTION VERSION "MARK-II" ' GE 435 Mainframe BASIC
OPTION VERSION "MBASIC" ' Microsoft BASIC-80 for Xenix
OPTION VERSION "PDP-8" ' DEC PDP-8 BASIC
OPTION VERSION "PDP-11" ' DEC PDP-11 BASIC
OPTION VERSION "RBASIC" ' Micronics RBASIC for 6809 FLEX
OPTION VERSION "RSTS-11" ' DEC RSTS-11 BASIC-PLUS
OPTION VERSION "SYSTEM/360" ' IBM System/360 Mainframe BASIC
OPTION VERSION "SYSTEM/370" ' IBM System/370 Mainframe BASIC
OPTION VERSION "TRS-80" ' TRS-80 Model I/III/4 LBASIC
OPTION VERSION "VINTAGE" ' Vintage BASIC 1.0.1
OPTION VERSION "XBASIC" ' TSC XBASIC for 6800 FLEX
* CONST variable [, ...] = value
Assigns the value to variable.
Any later assignment to the variable causus a VARIABLE NOT DECLARED error.

* DIM now supports lower and upper bounds.
OPTION BASE 1
DIM X( 9 ) ' lower bound is 1
DIM Y( 5 TO 9 ) ' lower bound is 5

* DIM now supports virtual variables.
OPTION BASE 1
OPEN "VIRTUAL.DAT" FOR VIRTUAL AS # 3 ' virtual data file
DIM # 3, A( 1000 ) ' array is virtual
LET A( 1000 ) = 0 ' value is written to the file
LET X = A( 1000 ) ' value is read from the file
CLOSE # 3 ' array is no longer valid

* ERROR 27, "Bad DATA"
Occurs when the READ command detects garbage in a DATA command.

* INPUT LINE
Same as LINE INPUT.

* MAT now supports lower and upper bounds.
OPTION BASE 1
MAT X( 9 ) = ZER ' lower bound is 1
MAT Y( 5 TO 9 ) = ZER ' lower bound is 5
MAT X = ZER( 9 ) ' lower bound is 1
MAT Y - ZER( 5 TO 9 ) ' lower bound is 5

* MAXLEN()
Returns the maximum string length.

* OPTION DIGITS integer
Sets the number of significant digits for PRINT.
Setting the value to zero restores the default.
* OPTION EDIT string$
Sets the program name used by the EDIT command.
Setting this to "" disables EDIT command.

* OPTION FILES string$
Sets the program name used by the FILES command.
Setting this to "" disables FILES command.
* OPTION PROMPT string$
Sets the prompt.

* OPTION PUNCT AT char$
Sets the PRINT AT character, commonly "@".
Setting this to "" disables PRINT AT.
Setting this to a non-punctuation character is not supported.

* OPTION PUNCT BYTE char$
Sets the BYTE type suffix, commonly "~".
Setting this to "" disables BYTE suffix.
Setting this to a non-punctuation character is not supported.

* OPTION PUNCT COMMENT char$
Sets the trailing COMMENT character, commonly "'".
Setting this to "" disables trailing comments.
Setting this to a non-punctuation character is not supported.

* OPTION PUNCT CURRENCY char$
Sets the CURRENCY type suffix, commonly "@".
Setting this to "" disables CURRENCY suffix.
Setting this to a non-punctuation character is not supported.

* OPTION PUNCT DOUBLE char$
Sets the DOUBLE type suffix, commonly "#".
Setting this to "" disables DOUBLE suffix.
Setting this to a non-punctuation character is not supported.

* OPTION PUNCT FILENUM char$
Sets the FILE NUMBER prefix, commonly "#".
Setting this to "" disables the FILE NUMBER prefix.
Setting this to a non-punctuation character is not supported.

* OPTION PUNCT IMAGE char$
Sets the shortcut IMAGE character, commonly ":".
Setting this to "" disables the shortcut IMAGE character.
Setting this to a non-punctuation character is not supported.

* OPTION PUNCT INPUT char$
Sets the shortcut INPUT character, commonly "!".
Setting this to "" disables the shortcut INPUT character.
Setting this to a non-punctuation character is not supported.

* OPTION PUNCT INTEGER char$
Sets the INTEGER type suffix, commonly "%".
Setting this to "" disables INTEGER suffix.
Setting this to a non-punctuation character is not supported.

* OPTION PUNCT LONG char$
Sets the LONG type suffix, commonly "&".
Setting this to "" disables LONG suffix.
Setting this to a non-punctuation character is not supported.

* OPTION PUNCT LPAREN char$
Sets the LEFT PARENTHESIS character, commonly "(".
Setting this to a non-punctuation character is not supported.

* OPTION PUNCT PRINT char$
Sets the shortcut PRINT character, commonly "?".
Setting this to "" disables the shortcut PRINT character.
Setting this to a non-punctuation character is not supported.

* OPTION PUNCT QUOTE char$
Sets the QUOTE character, commonly """".
Setting this to a non-punctuation character is not supported.

* OPTION PUNCT RPAREN char$
Sets the RIGHT PARENTHESIS character, commonly ")".
Setting this to a non-punctuation character is not supported.

* OPTION PUNCT SINGLE char$
Sets the SINGLE type suffix, commonly "!".
Setting this to "" disables SINGLE suffix.
Setting this to a non-punctuation character is not supported.

* OPTION PUNCT STATEMENT char$
Sets the shortcut STATEMENT seperator character, commonly ":".
Setting this to "" disables the STATEMENT seperator.
Setting this to a non-punctuation character is not supported.

* OPTION PUNCT STRING char$
Sets the STRING type suffix, commonly "$".
Setting this to "" disables STRING suffix.
Setting this to a non-punctuation character is not supported.

* OPTION RECLEN integer
Sets the default record length for RANDOM files, commonly 128.
Setting thisto zero means there is no default RANDOM record
length, so the record length must be specified in the OPEN
statement.
With OPTION RECLEN 128:
OPEN "FILE.DAT" FOR RANDOM AS #3
is considered to be the same as
OPEN "FILE.DAT" FOR RANDOM AS #3 LEN 128
With OPTION RECLEN 0:
OPEN "FILE.DAT" FOR RANDOM AS #3
causes an error.
* OPTION RENUM string$
Sets the program name used by the RENUM command.
Setting this to "" disables RENUM command.
* OPTION SCALE integer
Sets the number of digits to round after the decimal point for PRINT.
Setting the value to zero disables rounding.
* OPTION USING DIGIT
* OPTION USING COMMA
* OPTION USING PERIOD
* OPTION USING PLUS
* OPTION USING MINUS
* OPTION USING EXRAD
* OPTION USING DOLLAR
* OPTION USING FILLER
* OPTION USING LITERAL
* OPTION USING FIRST
* OPTION USING ALL
* OPTION USING LENGTH
Sets the characters recognized by PRINT USING.
Setting these to a non-punctuation character is not supported.
* OPTION VERSION now requires a string instead of a literal.
Some version names have changed.

* OPTION VERSION "PDP-8"
Added LPT, PTP, PTR, TTY, TTY IN and TTY OUT commands.
Added GET() and PUT() functions.

* OPTION VERSION "CALL/360"
* OPTION VERSION "SYSTEM/360"
* OPTION VERSION "SYSTEM/370"
Added alphabet extenders. $ is a string variable.

* OPTION ZONE integer
Sets the PRINT zone width.
Setting the value to zero restores the default.
* REPEAT - UNTIL added
REPEAT
...
EXIT REPEAT
...
UNTIL expression ' exits when expression != 0

* SPC( X ) and TAB( X )
No longer use control codes.
* UNTIL - UEND removed (to add REPEAT - UNTIL)
Here is a work-around for existin code using UNTIL-UEND:
UNITL expression -->> WHILE NOT expression
... ...
EXIT UNTIL -->> EXIT WHILE
... ...
UEND -->> WEND
* from Howard Wulf, AF5NE


CHANGES FROM 3.00 to 3.10

* Implements most of the following BASIC dialects:
OPTION VERSION DARTMOUTH ' Dartmouth DTSS BASIC
OPTION VERSION MARK-I ' GE 265 Mainframe BASIC
OPTION VERSION MARK-II ' GE 435 Mainframe BASIC
OPTION VERSION SYSTEM-360 ' IBM System/360 BASIC
OPTION VERSION SYSTEM-370 ' IBM System/370 BASIC
OPTION VERSION CBASIC-II ' CBASIC-II for CP/M
OPTION VERSION ECMA-55 ' ANSI Minimal BASIC
OPTION VERSION HANDBOOK1 ' The BASIC Handbook, 1st Edition
OPTION VERSION HANDBOOK2 ' The BASIC Handbook, 2nd Edition
OPTION VERSION TRS-80 ' TRS-80 Model I/III/4 LBASIC
OPTION VERSION BASIC-80 ' Microsoft BASIC-80 for Xenix
OPTION VERSION ECMA-116 ' ANSI Full BASIC
* from Howard Wulf, AF5NE


CHANGES FROM 2.61 to 3.00

* Code redesign from Howard Wulf, AF5NE


CHANGES FROM 2.60 to 2.61

* Bug fix from Matthias Rustler


CHANGES FROM 2.50 to 2.60

* New maths functions and append mode support from Edmond Orignac
* Bug fixes


CHANGES FROM 2.40 to 2.50

* Bug fixes
* New compilation procedure for MVS and CMS


CHANGES FROM 2.30 to 2.40

* Bug fixes from Bill Chatfield
* Updated documentation

* Added support for compiling on CMS (another IBM mainframe OS)


CHANGES FROM 2.20pl2 to 2.30

* Minor bug fixes, cosmetic improvements and portability improvements

* Added support for compiling on MVS (IBM mainframe)


CHANGES FROM 2.20pl1 to 2.20pl2

bwb_cmd.c
Fixed calling stack level logic in RETURN statement to prevent erroneous
"RETURN without GOSUB" messages.

bwb_cnd.c
bwb_stc.c

Changed continuation condition for WHILE, ELSEIF, and LOOP UNTIL
to be != FALSE, not == TRUE. More in line with common commercial
BASIC implementations.

bwb_mth.c
Fixed initialization in VAL function so that old results are not later
returned as values.

bwb_var.c
Added parenthesis level checking to dim_getparams. Using multi-level
expressions as array subscripts was causing the program to bomb.

bwx_iqc.c
bwx_tty.c
bwb_mes.h
Added second copyright notice.

bwb_dio.c
bwb_str.c
Added support for strings longer than 255 characters.

bwb_prn.c
Disabled tab expansion and print width checks when not printing to a file.

bwb_inp.c
Fixed LINE INPUT file reads to accommodate strings of length MAXSTRINGSIZE.

bwx_ncu.h
bwx_ncu.c
New files. Code for UNIX ncurses interface, compliments of L.C. Benschop,
Eindhoven, The Netherlands.

Makefile.ncu
New files. Sample makefile for ncurses implementation.

bwbasic.h
Revised defines for MININTSIZE and MAXINTSIZE from 16-bit to 32-bit limits.
Revised define for MAXSTRINGSIZE from 255 to 5000 characters.
Changed string length from unsigned char to unsigned int to support strings
longer than 255 characters.
Added support for new ncurses package.
Revised VERSION define to reflect above changes.


CHANGES FROM 2.20 to 2.20pl1

bwb_cnd.c

Moved init routine for bwb_while so that it would be initialized regardless
of expression value, not just if TRUE. This was causing some segmentation
faults in WHILE-WEND loops.

bwb_elx.c

Plugged gaping memory leak. Temp variable space for expression evaluation
was being allocated but not freed when done (oops!).

bwb_fnc.c

Added check for NULL return from getenv to prevent segmentation faults.

bwbasic.h
Revised VERSION define to reflect above changes.



CHANGES FROM 2.10 to 2.20:

* Plugged numerous memory leaks, resolved memory overruns and allocation
difficulties.

* General cleanup and bug fixes, too many to list in detail here.
The major problem areas addressed were:

- RUN command with file name argument
- nested and cascaded FOR-NEXT loops
- PRINT USING
- EOF, LOF functions
- string concatenation
- operator hierarchy
- multi-level expression evaluation
- hex constant interpretation
- hex and octal constants in INPUT and DATA statements

* Added a CLOSE all files feature (when no argument supplied).

* Added a unary minus sign operator.

* Added a MID$ command to complement the MID$ function.

* Added a RENUM facility in a standalone program.

* Added checking in configure for unistd.h (important on Sun systems).

+ 14
- 0
INFO/Bwbasic-notes.txt View File

@@ -0,0 +1,14 @@
04-14-2020 Ken

Since Linux does not have a "cls" command that Windows/DOS
does have do this once

sudo ln /usr/bin/clear /usr/bin/cls

Then in your bwbasic 3.20b program to clear the screen use
SHELL "cls"

Or at the start of you bwbasic 3.20b program include
OPTION TERMINAL ANSI
then CLS will work


bwbasic.doc → INFO/Bwbasic.doc View File


BIN
INFO/Bwbasic_3.20_manual.docx View File


+ 0
- 341
Junk/COPYING View File

@@ -1,341 +0,0 @@

GNU GENERAL PUBLIC LICENSE
Version 2, June 1991

Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

Preamble

The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.

When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.

To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.

For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.

We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.

Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.

Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.

The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".

Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.

1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.

You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.

2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:

a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.

b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.

c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.

Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.

In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.

3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:

a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,

b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,

c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)

The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.

If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.

5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.

6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.

7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.

If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.

It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.

This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.

9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.

10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.

NO WARRANTY

11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.

12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.

END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs

If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

Also add information on how to contact you by electronic and paper mail.

If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:

Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.

You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:

Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.

<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice

This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.


+ 0
- 10219
Junk/bwb_cmd.c
File diff suppressed because it is too large
View File


+ 0
- 5068
Junk/bwb_var.c
File diff suppressed because it is too large
View File


+ 0
- 3641
Junk/bwbasic.c
File diff suppressed because it is too large
View File


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save