ChipMaster's bwBASIC This also includes history going back to v2.10. *WARN* some binary files might have been corrupted by CRLF.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

261 lines
5.9 KiB

  1. rem Purpose: verify comment character is honored for all commands
  2. rem Author: Howard Wulf, AF5NE
  3. rem Date: 2015-05-01
  4. rem Usage: implementation defined
  5. rem Example: ~/bwbasic E069.bas
  6. rem ---------------------------------------------
  7. rem
  8. rem cmds
  9. clear ' comment
  10. DEFDBL Z ' comment
  11. DEFINT I ' comment
  12. DEFSNG Y ' comment
  13. DEFSTR A ' comment
  14. COMMON z ' comment
  15. LET TRUE = -1 ' comment
  16. LET FALSE = 0 ' comment
  17. DATA a , b , c ' comment
  18. ? 1 ' COMMENT
  19. RESTORE ' comment
  20. read a$,b$,c$ ' comment
  21. print a$,b$,c$ ' comment
  22. print len(a$), len(b$), len(c$)
  23. call chr$(0) ' comment
  24. SELECT CASE 5 ' comment
  25. CASE IF = 1 ' comment
  26. CASE IS = 2 ' comment
  27. CASE 3 ' comment
  28. CASE ELSE ' comment
  29. END SELECT ' comment
  30. dim x(10) ' comment
  31. a$ = "1234567890" ' comment
  32. change a$ to x ' comment
  33. change x to a$ ' comment
  34. ' CMDS ' comment
  35. I = 0 ' comment
  36. DO ' comment
  37. I = I + 1 ' comment
  38. IF I > 2 THEN ' comment
  39. EXIT DO ' comment
  40. ELSE ' comment
  41. PRINT "I=";I ' comment
  42. END IF ' comment
  43. LOOP ' comment
  44. I = 0 ' comment
  45. DO WHILE TRUE ' comment
  46. I = I + 1 ' comment
  47. IF I > 2 THEN ' comment
  48. EXIT DO ' comment
  49. ELSE ' comment
  50. PRINT "I=";I ' comment
  51. END IF ' comment
  52. LOOP WHILE TRUE ' comment
  53. I = 0 ' comment
  54. DO UNTIL FALSE ' comment
  55. I = I + 1 ' comment
  56. IF I > 2 THEN ' comment
  57. EXIT DO ' comment
  58. ELSE ' comment
  59. PRINT "I=";I ' comment
  60. END IF ' comment
  61. LOOP UNTIL FALSE ' comment
  62. I = 0 ' comment
  63. UNTIL FALSE ' comment
  64. I = I + 1 ' comment
  65. IF I > 2 THEN ' comment
  66. EXIT UNTIL ' comment
  67. ELSE ' comment
  68. PRINT "I=";I ' comment
  69. END IF ' comment
  70. UEND ' comment
  71. I = 0 ' comment
  72. WHILE TRUE ' comment
  73. I = I + 1 ' comment
  74. IF I > 2 THEN ' comment
  75. EXIT WHILE ' comment
  76. ELSE ' comment
  77. PRINT "I=";I ' comment
  78. END IF ' comment
  79. WEND ' comment
  80. FOR I = 1 TO 3 ' comment
  81. IF I > 2 THEN ' comment
  82. EXIT FOR ' comment
  83. END IF ' comment
  84. NEXT I ' comment
  85. I = 3 + 4 ' comment
  86. IF I = 2 THEN ' comment
  87. PRINT "ERROR" ' comment
  88. ELSEIF I = 7 ' comment
  89. PRINT "Correct" ' comment
  90. ELSE ' comment
  91. PRINT "ERROR" ' comment
  92. END IF ' comment
  93. I = 5 * 6 ' comment
  94. IF I > 10 THEN 1000 ELSE 9000 ' comment
  95. ERROR 1 ' comment
  96. 1000 IF I < 99 THEN 2000 ELSE 9000 ' comment
  97. ERROR 1 ' comment
  98. 2000 ' comment
  99. GOTO 3000 ' comment
  100. 2100 IF I = 1 THEN PRINT "Good 1":RETURN ELSE PRINT "ERROR ON 1" : GOTO 9000 ' comment
  101. 2200 IF I = 2 THEN PRINT "Good 2":RETURN ELSE PRINT "ERROR ON 2" : GOTO 9000 ' comment
  102. 2300 IF I = 3 THEN PRINT "Good 3":RETURN ELSE PRINT "ERROR ON 3" : GOTO 9000 ' comment
  103. 3000 ' fncs ' comment
  104. 3010 GOTO 3400 ' comment
  105. 3100 IF I <> 1 THEN PRINT "ERROR ON 1" : GOTO 9000 ELSE PRINT "Good 1":GOTO 3500 ' comment
  106. 3200 IF I <> 2 THEN PRINT "ERROR ON 2" : GOTO 9000 ELSE PRINT "Good 2":GOTO 3500 ' comment
  107. 3300 IF I <> 3 THEN PRINT "ERROR ON 3" : GOTO 9000 ELSE PRINT "Good 3":GOTO 3500 ' comment
  108. 3310 PRINT "ERROR 4": STOP ' comment
  109. 3350 print "good 4"
  110. return ' comment
  111. 3400 FOR I = 1 TO 3 ' comment
  112. PRINT "I=";I ' comment
  113. ON I GOSUB 2100,2200,2300 ' comment
  114. ON I GOTO 3100,3200,3300 ' comment
  115. 3500 REM ' comment
  116. NEXT I ' comment
  117. gosub 3350 ' comment
  118. LPRINT A$; ' comment
  119. LPRINT B$, ' comment
  120. LPRINT C$ ' comment
  121. OPEN "test.dat" FOR RANDOM AS #1 LEN 12 ' comment
  122. FIELD #1, 5 AS D$, 7 AS E$ ' comment
  123. FIELD #1, 12 AS F$
  124. LSET D$ = "d" ' comment
  125. RSET E$ = "e" ' comment
  126. PRINT "[";D$;"]" ' comment
  127. PRINT "[";E$;"]" ' comment
  128. PUT #1 ' comment
  129. SEEK #1, 1 ' comment
  130. GET #1 ' comment
  131. PRINT "["; F$; "]" ' comment
  132. CLOSE #1
  133. OPEN "test.dat" for output as #1
  134. PRINT #1, A$ ' comment
  135. CLOSE #1 ' comment
  136. OPEN "test.dat" for INPUT as #1 ' comment
  137. INPUT #1, B$ ' comment
  138. CLOSE #1 ' comment
  139. PRINT "["; B$; "]" ' comment
  140. PRINT "Before SUB definition" ' comment
  141. ' MAINTAINER STACK
  142. 4000 SUB TestSub( X1, Y1 ) ' comment
  143. ' MAINTAINER STACK
  144. IF X1 > Y1 THEN ' comment
  145. PRINT "X1 > Y1",X1;">";Y1 ' comment
  146. ' LET TestSub = X1 - Y1
  147. EXIT SUB ' comment
  148. END IF ' comment
  149. PRINT "X1 <= Y1",X1;"<=";Y1 ' comment
  150. ' LET TestSub = X1 + Y1
  151. END SUB ' comment
  152. PRINT "After SUB definition" ' comment
  153. ' MAINTAINER STACK
  154. TestSub 1, 2 ' comment
  155. ' MAINTAINER STACK
  156. CALL TestSub(2,1) ' comment
  157. CALL ABS(2) ' comment
  158. 5000 FUNCTION TestFun( X2, Y2 ) ' comment
  159. 5010 IF X2 < Y2 THEN ' comment
  160. 5020 LET TestFun = X2 + Y2 ' comment
  161. 5025 PRINT "X2 < Y2",X2;"<";Y2 ' comment
  162. 5030 EXIT FUNCTION ' comment
  163. 5040 END IF ' comment
  164. 5050 LET TestFun = X2 - Y2 ' comment
  165. 5055 PRINT "X2 >= Y2",X2;">=";Y2 ' comment
  166. 5060 END FUNCTION ' comment
  167. TestFun 1, 2 ' comment
  168. CALL TestFun( 5, 1 ) ' comment
  169. LET Z = TestFun( 10, 3 ) ' comment
  170. PRINT "Z=";Z ' comment
  171. OPEN "test.dat" FOR INPUT AS #1 ' comment
  172. LINE INPUT #1, A$ ' comment
  173. CLOSE #1 ' comment
  174. PRINT "A$=";A$ ' comment
  175. SWAP A$,B$ ' comment
  176. PRINT "B$=";B$ ' comment
  177. REM vars ' comment
  178. OPEN "test.dat" FOR OUTPUT AS #1 ' comment
  179. WRITE #1, B$ ' comment
  180. CLOSE #1 ' comment
  181. OPEN "test.dat" FOR INPUT AS #1 ' comment
  182. LINE INPUT #1, A$ ' comment
  183. CLOSE #1 ' comment
  184. PRINT "A$=";A$ ' comment
  185. GOTO AnotherPlace ' comment
  186. PRINT "ERROR 7" ' comment
  187. STOP ' comment
  188. AnotherPlace: ' comment
  189. 5100 REM STOP ' comment
  190. ON ERROR GOTO HELL ' comment
  191. PRINT "firing..." ' comment
  192. ERROR 51 ' comment
  193. IF I = 17 THEN 6000 ' OK
  194. STOP ' ERROR
  195. Hell: ' comment
  196. PRINT "caught..."
  197. IF ERR <> 51 THEN STOP ' ERROR
  198. LET I = 17:RESUME NEXT ' OK
  199. STOP ' ERROR
  200. 6000 ' OK
  201. ERROR 0 ' clear
  202. PRINT "Throw" ' comment
  203. ON ERROR RESUME NEXT ' comment
  204. ERROR 77 ' comment
  205. IF ERR = 77 THEN ' comment
  206. PRINT "Caught" ' comment
  207. ERROR 0 ' clear
  208. ELSE ' comment
  209. PRINT "Missed" ' comment
  210. STOP ' comment
  211. END IF ' comment
  212. REM HELP ' COMMENT
  213. help help ' comment
  214. erase x ' comment
  215. dim x(23) ' comment
  216. DEF FNA(X4)=X4+X(22) ' comment
  217. LET X(22) = 2 ' comment
  218. PRINT "FNA=";FNA(7) ' comment
  219. CSAVE* X ' comment
  220. erase x ' comment
  221. dim X(23) ' comment
  222. CLOAD* X ' comment
  223. PRINT "X(22)=";X(22) ' comment
  224. A$ = "abcdefghijklmnop" ' comment
  225. B$ = "123456789" ' comment
  226. MID$( A$, 5, 2 ) = B$ ' comment
  227. PRINT "A$=";A$ ' comment
  228. A$ = "abcdefghijklmnop" ' comment
  229. B$ = "123456789" ' comment
  230. MID$( A$, 5 ) = B$ ' comment
  231. PRINT "A$=";A$ ' comment
  232. REM VARS ' COMMENT
  233. MAINTAINER STACK ' comment
  234. print "Ok" ' comment
  235. 9000 end ' comment