Re: tinyPascal in BASIC
Posted: Sun Nov 19, 2023 8:51 pm
In the interests of fun & exploration, I'm posting here the current working versions of the Tiny Pascal compiler and pCode interpreter.
NONE of the X16 functions are implemented, and there is no opportunity for the moment to manipulate memory directly.
I'll also post the original example test program that was part of the original 3 part series of articles in BYTE magazine starting September 1978.
For the compiler, when it asks for the RAM Bank - for now leave it at the default, so just press RETURN.
Ditto when it asks for the pCode starting address.
This means the pCode will be written to memory starting at address $A000 in RAM Bank 10 on the X16 and emulator.
When asked if you wish the pCodes displayed, answering Y means that as the compiler runs and compiles, it will print out the compiled pCode for each line it processes, and print out that line from the source.
Source code is expected to be a simple text file. Give it a file name - ideally locate it in the same folder as the compiler.
And then just sit back!
When compiled, the compiler will write the entirety of the RAM bank 10 from $A000 to $BFFF to disk using BSAVE.
It will have the same filename as the source code file BUT with ".OBJ" added on the end.
When you run the pCode interpreter, you will be asked for the pCode start address. For now, enter in 40960, and for the RAM bank stick with the default of 10.
Then give the full filename of the object pCode to run - including the ".OBJ" on the end.
It will then load that in to memory and examine and display the first pCode instruction.
You will be presented with the "INTERP>" prompt... pressing "?" and ENTER will display a list of all accepted commands. They are 1 character commands followed by the RETURN key. Any other info it needs it will ask for at the time.
Enjoy!!
NONE of the X16 functions are implemented, and there is no opportunity for the moment to manipulate memory directly.
I'll also post the original example test program that was part of the original 3 part series of articles in BYTE magazine starting September 1978.
For the compiler, when it asks for the RAM Bank - for now leave it at the default, so just press RETURN.
Ditto when it asks for the pCode starting address.
This means the pCode will be written to memory starting at address $A000 in RAM Bank 10 on the X16 and emulator.
When asked if you wish the pCodes displayed, answering Y means that as the compiler runs and compiles, it will print out the compiled pCode for each line it processes, and print out that line from the source.
Source code is expected to be a simple text file. Give it a file name - ideally locate it in the same folder as the compiler.
And then just sit back!
When compiled, the compiler will write the entirety of the RAM bank 10 from $A000 to $BFFF to disk using BSAVE.
It will have the same filename as the source code file BUT with ".OBJ" added on the end.
When you run the pCode interpreter, you will be asked for the pCode start address. For now, enter in 40960, and for the RAM bank stick with the default of 10.
Then give the full filename of the object pCode to run - including the ".OBJ" on the end.
It will then load that in to memory and examine and display the first pCode instruction.
You will be presented with the "INTERP>" prompt... pressing "?" and ENTER will display a list of all accepted commands. They are 1 character commands followed by the RETURN key. Any other info it needs it will ask for at the time.
Enjoy!!