home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / lambda / soundpot / f / nbasic.lbr / NBASXMPL.ZZZ / NBASXMPL.
Encoding:
Text File  |  1993-10-26  |  1.8 KB  |  44 lines

  1. 10 'Comprehensive NBASIC Demonstration Program 
  2. 20 'COPYRIGHT 1984 Merrill W. Hulse. ALL RIGHTS RESERVED.
  3. 30 'Permission granted for non-commercial use and distribution.
  4. 40 'Commercial use without the author's written permission is forbidden.
  5. 50 [LBL:DO_AGAIN] 'Example of a target label with required remark following.
  6. 60 INPUT "ENTER X ";X
  7. 70 PRINT:PRINT "Your test entry is:'TEST'";X 
  8. 80 CASE OF (X)' Example of CASE OF [expression].
  9. 90 !(0) DO 
  10. 100 GOTO [TEST0]'Example of GOTO [label]
  11. 110 [LBL:TEST0A] 'Stand-alone label needs remark.
  12. 120 !(1) DO
  13. 130 A = X:GOSUB [TEST1]'Example of GOSUB [label]
  14. 140 PRINT B$
  15. 150 !(2) DO
  16. 160 IF X = 2 THEN [TEST2]'Example of THEN [label]
  17. 170 [LBL:TEST2A] 'Stand-alone label needs a remark.
  18. 180 !ELSE DO'Example of an `ELSE DO' followed by an ELSE [label]
  19. 190 IF X < 9 PRINT "Number is between 3 and 8." ELSE [TEST3] 
  20. 200 [LBL:TEST3A] 'Stand-alone label needs a remark.
  21. 210 ENDCASE
  22. 220 CALL "TEST4" TAKES X GIVES WRDS$;A
  23. 230 REM' REM gets converted to "'". Example of CALL follows.
  24. 240 PRINT WRDS$;A
  25. 250 INPUT;"Would you like to try another test (Y/N)";ANSWER$
  26. 260 IF ANSWER$="Y" GOTO [DO_AGAIN] ELSE END
  27. 270 [LBL:TEST0] PRINT "TEST";X
  28. 280 GOTO [TEST0A]
  29. 290 [LBL:TEST1] PRINT "TEST";X
  30. 300 RETURN
  31. 310 [LBL:TEST2] PRINT "TEST";X
  32. 320 GOTO [TEST2A] 
  33. 330 [LBL:TEST3] PRINT "TEST";X
  34. 340 REPEAT'Example of REPEAT...UNTIL loop.
  35. 350 A=1
  36. 360 PRINT "TEST";A,:A=A+1
  37. 370 UNTIL (A=5)
  38. 380 GOTO [TEST3A]
  39. 390 'Example of a SUB vectored from a CALL follows. 
  40. 400 SUB "TEST4" TAKES NUMBER GIVES STRNG$;OTHERNUMBER
  41. 410 STRNG$="Little number":OTHERNUMBER=X
  42. 420 IF NUMBER>5 THEN STRNG$="Twice your number is:":OTHERNUMBER=2*NUMBER
  43. 430 RETURN
  44.