v074: comp command now accepts argument for bytecode filename
This commit is contained in:
parent
a79611f6d8
commit
e3f5558b00
29
README.md
29
README.md
|
@ -81,12 +81,12 @@ You can then enter and run the [test program](#simple-test-program) below.
|
|||
One you have entered the test program and run it in the interpreter, you can compile it to bytecode as follows:
|
||||
|
||||
```
|
||||
comp
|
||||
comp "test"
|
||||
quit
|
||||
```
|
||||
The compiled code is written to the file `bytecode` on the floppy diskette containing the EightBall system.
|
||||
The compiled code is written to the file `test` on the floppy diskette containing the EightBall system.
|
||||
|
||||
If you then invoke the EightBall Virtual Machine `EBVM.SYSTEM`, it will load and execute this bytecode. The VM is much faster than the interpreter.
|
||||
If you then invoke the EightBall Virtual Machine `EBVM.SYSTEM`, it will prompt you for the name of the bytecode file to load. Enter `test` at the prompt to run the code you just compiled. The VM is much faster than the interpreter.
|
||||
|
||||
## Commodore 64
|
||||
For the Commodore 64, the file `eightball.d64` can be written to a real C1541 floppy, or to a solid state drive such as SD2IEC.
|
||||
|
@ -104,12 +104,13 @@ You can then enter and run the [test program](#simple-test-program) below.
|
|||
One you have entered the test program and run it in the interpreter, you can compile it to bytecode as follows:
|
||||
|
||||
```
|
||||
comp
|
||||
comp "test"
|
||||
quit
|
||||
```
|
||||
The compiled code is written to the file `bytecode` on the floppy diskette containing the EightBall system. (Note that if this file already exists an error will occur. This is a known deficiency which I will address in due coure.)
|
||||
The compiled code is written to the file `test` on the floppy diskette containing the EightBall system. (Note that if this file already exists an error will occur. This is a known deficiency which I will address in due course.)
|
||||
|
||||
If you then invoke the EightBall Virtual Machine `8BALLVM64.PRG`, it will prompt you for the name of the bytecode file to load. Enter `test` at the prompt to run the code you just compiled. The VM is much faster than the interpreter.
|
||||
|
||||
If you then invoke the EightBall Virtual Machine `8BALLVM64.PRG`, it will load and execute this bytecode. The VM is much faster than the interpreter.
|
||||
```
|
||||
LOAD"8BALLVM64.PRG",8
|
||||
RUN
|
||||
|
@ -131,10 +132,10 @@ You can then enter and run the [test program](#simple-test-program) below.
|
|||
One you have entered the test program and run it in the interpreter, you can compile it to bytecode as follows:
|
||||
|
||||
```
|
||||
comp
|
||||
comp "bytecode"
|
||||
quit
|
||||
```
|
||||
The compiled code is written to the file `bytecode` on the floppy diskette containing the EightBall system. (Note that if this file already exists an error will occur. This is a known deficiency which I will address in due coure.)
|
||||
The compiled code is written to the file `bytecode` on the floppy diskette containing the EightBall system. (Note that if this file already exists an error will occur. This is a known deficiency which I will address in due course.)
|
||||
|
||||
If you then invoke the EightBall Virtual Machine `8BALLVM20.PRG`, it will load and execute this bytecode. The VM is much faster than the interpreter.
|
||||
```
|
||||
|
@ -229,18 +230,20 @@ run
|
|||
```
|
||||
Then to compile it, and save the bytecode to the file `bytecode`:
|
||||
```
|
||||
comp
|
||||
comp "bytecode"
|
||||
quit
|
||||
```
|
||||
And finally, to run the bytecode under the VM:
|
||||
```
|
||||
$ ./eightballvm
|
||||
```
|
||||
The bytecode disassember may be used to examine the bytecode in a human-readable format:
|
||||
The bytecode disassembler may be used to examine the bytecode in a human-readable format:
|
||||
```
|
||||
$ ./disass
|
||||
```
|
||||
|
||||
Both the VM and the disassembler prompt for the name of the bytecode file to load (`bytecode` in this example.)
|
||||
|
||||
## Running Apple //e Version with MAME
|
||||
You will have to find the Apple II ROMs online for use with MAME.
|
||||
|
||||
|
@ -719,11 +722,11 @@ Program runs until it hits an `end` statement, an error occurs or it is interrup
|
|||
|
||||
### Compile Stored Program
|
||||
|
||||
comp
|
||||
comp "bytecodefile"
|
||||
|
||||
The program in memory is compiled to EightBall VM bytecode. This is written to a file `bytecode`.
|
||||
The program in memory is compiled to EightBall VM bytecode. This is written to a file specified.
|
||||
|
||||
The `bytecode` file may be executed using the EightBall Virtual Machine that is part of this package.
|
||||
The bytecode file may be executed using the EightBall Virtual Machine that is part of this package.
|
||||
|
||||
### Quit EightBall
|
||||
|
||||
|
|
BIN
bin/8ball20.prg
BIN
bin/8ball20.prg
Binary file not shown.
BIN
bin/8ball64.prg
BIN
bin/8ball64.prg
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
bin/disass
BIN
bin/disass
Binary file not shown.
BIN
bin/disass20.prg
BIN
bin/disass20.prg
Binary file not shown.
BIN
bin/disass64.prg
BIN
bin/disass64.prg
Binary file not shown.
BIN
bin/eightball
BIN
bin/eightball
Binary file not shown.
BIN
bin/eightballvm
BIN
bin/eightballvm
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -173,8 +173,11 @@ char onlyconstants = 0; /* 0 is normal, 1 means only allow const exprs *
|
|||
char compiletimelookup = 0; /* When set to 1, getintvar() will do lookup */
|
||||
/* rather than code generation */
|
||||
|
||||
#define FILENAMELEN 15
|
||||
|
||||
char readbuf[255]; /* Buffer for reading from file */
|
||||
char lnbuf[255]; /* Input text line buffer */
|
||||
char filename[FILENAMELEN+1]; /* Name of bytecode file */
|
||||
char *txtPtr; /* Pointer to next character to read in lnbuf */
|
||||
|
||||
#define STACKSZ 16 /* Size of expression stacks */
|
||||
|
@ -1802,7 +1805,7 @@ void writebytecode()
|
|||
#else
|
||||
p = (unsigned char *) CODESTART;
|
||||
#endif
|
||||
strcpy(readbuf, "bytecode");
|
||||
strcpy(readbuf, filename);
|
||||
printchar('\n');
|
||||
openfile(1);
|
||||
print("...\n");
|
||||
|
@ -4251,7 +4254,7 @@ struct stmnttabent stmnttab[] = {
|
|||
{"byte", TOK_BYTE, CUSTOM}, /* 15 */
|
||||
{"const", TOK_CONST, CUSTOM}, /* 16 */
|
||||
{"run", TOK_RUN, NOARGS}, /* 17 */
|
||||
{"comp", TOK_COMPILE, NOARGS}, /* 18 */
|
||||
{"comp", TOK_COMPILE, ONESTRARG}, /* 18 */
|
||||
{"new", TOK_NEW, NOARGS}, /* 19 */
|
||||
{"sub", TOK_SUBR, INITIALNAMEARG}, /* 20 */
|
||||
{"endsub", TOK_ENDSUBR, NOARGS}, /* 21 */
|
||||
|
@ -4717,6 +4720,8 @@ unsigned char parseline()
|
|||
run(0); /* Start from beginning */
|
||||
break;
|
||||
case TOK_COMPILE:
|
||||
strncpy(filename, readbuf, FILENAMELEN);
|
||||
filename[FILENAMELEN] = 0; /* Just in case not terminated */
|
||||
compile = 1;
|
||||
subsbegin = subsend = NULL;
|
||||
callsbegin = callsend = NULL;
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
#define VERSIONSTR "0.73"
|
||||
#define VERSIONSTR "0.74"
|
||||
|
||||
void print(char *str);
|
||||
|
||||
|
|
Loading…
Reference in New Issue