diff --git a/README.md b/README.md index 8395e37..a1314b9 100644 --- a/README.md +++ b/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 diff --git a/bin/8ball20.prg b/bin/8ball20.prg index 51b8b2b..76aefaf 100644 Binary files a/bin/8ball20.prg and b/bin/8ball20.prg differ diff --git a/bin/8ball64.prg b/bin/8ball64.prg index 7e656fa..7d4398c 100644 Binary files a/bin/8ball64.prg and b/bin/8ball64.prg differ diff --git a/bin/8ballvm20.prg b/bin/8ballvm20.prg index 9baf373..3acb9b6 100644 Binary files a/bin/8ballvm20.prg and b/bin/8ballvm20.prg differ diff --git a/bin/8ballvm64.prg b/bin/8ballvm64.prg index 95e75ae..67f61c3 100644 Binary files a/bin/8ballvm64.prg and b/bin/8ballvm64.prg differ diff --git a/bin/disass b/bin/disass index 87fc6a7..b98a8e7 100755 Binary files a/bin/disass and b/bin/disass differ diff --git a/bin/disass20.prg b/bin/disass20.prg index 5c5bfe3..2a277ef 100644 Binary files a/bin/disass20.prg and b/bin/disass20.prg differ diff --git a/bin/disass64.prg b/bin/disass64.prg index b1cc1be..9630a85 100644 Binary files a/bin/disass64.prg and b/bin/disass64.prg differ diff --git a/bin/eightball b/bin/eightball index 326546f..e931c93 100755 Binary files a/bin/eightball and b/bin/eightball differ diff --git a/bin/eightballvm b/bin/eightballvm index bc9ab0b..e6fdc64 100755 Binary files a/bin/eightballvm and b/bin/eightballvm differ diff --git a/disk-images/eightball.d64 b/disk-images/eightball.d64 index ddaad01..772ca5d 100644 Binary files a/disk-images/eightball.d64 and b/disk-images/eightball.d64 differ diff --git a/disk-images/eightball.dsk b/disk-images/eightball.dsk index 2c01241..c8f2039 100644 Binary files a/disk-images/eightball.dsk and b/disk-images/eightball.dsk differ diff --git a/eightball.c b/eightball.c index f579de9..7696664 100644 --- a/eightball.c +++ b/eightball.c @@ -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; diff --git a/eightballutils.h b/eightballutils.h index b22f121..c7c1920 100644 --- a/eightballutils.h +++ b/eightballutils.h @@ -37,7 +37,7 @@ /* */ /**************************************************************************/ -#define VERSIONSTR "0.73" +#define VERSIONSTR "0.74" void print(char *str);