User Tools

Site Tools


running_a_bas_file_from_the_command_prompt

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
running_a_bas_file_from_the_command_prompt [2019/04/26 16:25]
richardrussell Initial creation
running_a_bas_file_from_the_command_prompt [2019/05/10 14:12] (current)
richardrussell Add to save the helper program from the IDE
Line 1: Line 1:
-===== Running a BAS file from the command ​prompt ​=====+===== Running a BAS file from the command ​line =====
  
 //by Richard Russell, April 2019// //by Richard Russell, April 2019//
  
-It is straighforward to run a BASIC program from the command ​prompt, using either the //BBC BASIC for Windows// or //BBC BASIC for SDL 2.0// run-time engine:+It is straighforward to run a BASIC program from the command ​line, using either the //BBC BASIC for Windows// or //BBC BASIC for SDL 2.0// run-time engine:
  
 <code dos> <code dos>
Line 12: Line 12:
 But this only works when the program is in internal '​tokenised'​ format, i.e. a .BBC file.  If you attempt to use the same method to run a program in 'plain text' (.BAS) format you will receive a 'Bad program'​ error message. But this only works when the program is in internal '​tokenised'​ format, i.e. a .BBC file.  If you attempt to use the same method to run a program in 'plain text' (.BAS) format you will receive a 'Bad program'​ error message.
  
-Fortunately there is a relatively simple solution, by using a helper program. ​ Save the program listed below as **basrun.bbc**,​ then run the BAS file as follows:+Fortunately there is a relatively simple solution, by using a helper program. ​ Save the program listed below as **basrun.bbc**,​ then run the BAS file as follows ​(the quotes are important):
  
 <code dos> <code dos>
Line 19: Line 19:
 </​code>​ </​code>​
  
-Here is the helper program, save it as **basrun.bbc**:​+Here is the helper program, save it from the IDE as **basrun.bbc**:​
  
 <code bb4w> <code bb4w>
Line 33: Line 33:
  
       REM. Open BAS file:       REM. Open BAS file:
-      F% = OPENINMID$(@cmd$,​P%+1)+      F% = OPENIN MID$(@cmd$,​P%+1)
       IF F% = 0 ERROR 0, "​Couldn'​t open file " + MID$(@cmd$,​P%+1)       IF F% = 0 ERROR 0, "​Couldn'​t open file " + MID$(@cmd$,​P%+1)
  
running_a_bas_file_from_the_command_prompt.1556295921.txt.gz ยท Last modified: 2019/04/26 16:25 by richardrussell