BASIC compilers
Moderator: Moderators
- LoadError
- Vic 20 Hobbyist
- Posts: 120
- Joined: Sat Feb 17, 2007 2:44 pm
- Website: http://digilander.libero.it/pyrotech/
- Location: Italy
- Occupation: FG Soft
BASIC compilers
Looking for a way to compile a BASIC game to gain speed, I found just a single solution which is to use Austrocompiler on the VIC itself, which will generate pseudocode.
I haven't found any other solution. I've found a few cross compilers for 6502, but none seems to work with CBM BASIC.
Is Austrocompiler really the only solution?
I haven't found any other solution. I've found a few cross compilers for 6502, but none seems to work with CBM BASIC.
Is Austrocompiler really the only solution?
Commodore VIC-20 n. WG-C-275517 - manufactured in Western Germany in 1983
Re: BASIC compilers
I think so.
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
- Mike
- Herr VC
- Posts: 4856
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Re: BASIC compilers
As you are the OP of a similar thread, "Redefine the charset with 8K+ RAM", it would be really interesting to know what followed up upon that.
Indeed, Austro-Comp is the only known BASIC compiler for the VIC-20, and as you've noted, it doesn't even compile to machine code, but only intermediary P-code. This is executed somewhat faster than by the BASIC interpreter, but it is nowhere as fast as machine code.
The obstacles in using AC had been clearly laid out in said thread, a rather moderate speed increase but added hassles when it comes to adding a custom character set, etc. ... ... you find my opinion to that over there as well.
So, when it comes to your current project, what are your objections to instrument it with machine code sub-routines?
Indeed, Austro-Comp is the only known BASIC compiler for the VIC-20, and as you've noted, it doesn't even compile to machine code, but only intermediary P-code. This is executed somewhat faster than by the BASIC interpreter, but it is nowhere as fast as machine code.
The obstacles in using AC had been clearly laid out in said thread, a rather moderate speed increase but added hassles when it comes to adding a custom character set, etc. ... ... you find my opinion to that over there as well.
So, when it comes to your current project, what are your objections to instrument it with machine code sub-routines?
- Kweepa
- Vic 20 Scientist
- Posts: 1315
- Joined: Fri Jan 04, 2008 5:11 pm
- Location: Austin, Texas
- Occupation: Game maker
Re: BASIC compilers
You can use Sink-20 to profile your BASIC to see which lines are expensive, if it's not immediately obvious.
It's a work in progress but for simple profiling it should fit the bill.
It's a work in progress but for simple profiling it should fit the bill.
- LoadError
- Vic 20 Hobbyist
- Posts: 120
- Joined: Sat Feb 17, 2007 2:44 pm
- Website: http://digilander.libero.it/pyrotech/
- Location: Italy
- Occupation: FG Soft
Re: BASIC compilers
@Mike: thanks for pointing me at the old thread. I'd somehow forgotten about its existence I have no objections to writing some routines in machine code, other than I am totally green on the subject. My plan is to start with reading the old VIC 20 Programmers' Guide and move the first steps, then maybe at some point get to a 2.0 release with machine code routines.
@Kweepa: thanks, I didn't know about Sink-20, will give it a spin. Here?
@Kweepa: thanks, I didn't know about Sink-20, will give it a spin. Here?
Commodore VIC-20 n. WG-C-275517 - manufactured in Western Germany in 1983
Re: BASIC compilers
Another (much better IMO) option to consider is switching to C. C is also a much more useful language in the wider context and games written in it are closer to ML performance as the releases from the Misfit stable aptly demonstrate.
I created a wrapper for Robert Hurts's Sprite Libary at the end of this thread.
If there was any interest I could develop this bootstrap project a bit more adding a soundplayer etc giving newcomers to the Vic 20 an easy route to develop high quality games without the ardour of learning ML and writing a sprite engine.
I created a wrapper for Robert Hurts's Sprite Libary at the end of this thread.
If there was any interest I could develop this bootstrap project a bit more adding a soundplayer etc giving newcomers to the Vic 20 an easy route to develop high quality games without the ardour of learning ML and writing a sprite engine.
Last edited by beamrider on Fri Jan 05, 2018 4:50 am, edited 1 time in total.
- Mike
- Herr VC
- Posts: 4856
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Re: BASIC compilers
@beamrider: PM sent.
-
- Vic 20 Hobbyist
- Posts: 107
- Joined: Wed Oct 02, 2013 1:54 am
- Location: Italy
Vic Compiler Program
Hello
I have a "Vic Compiler" program
does anyone know how to use it?
Attached for tests
Thank you
greetings Armando
I have a "Vic Compiler" program
does anyone know how to use it?
Attached for tests
Thank you
greetings Armando
- Mike
- Herr VC
- Posts: 4856
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Re: Vic Compiler Program
I took a quick peek. It's most probably the same breed of Tiny BASIC compiler that has been discussed in the thread 'Should these tapes be archived?', and to quote from there:
...
BTW, it's exactly the same "VIC compiler.prg" that's been archived on zimmers.net for ages ...
ftp://ftp.zimmers.net/pub/cbm/vic20/uti ... mpiler.prg
Not so useful beyond toy programs.vicist wrote:Apparently, this only compiles mathematical programs, like the sample provided within the program. It won't compile full basic programs.
A description of the compiler can be found here
...
BTW, it's exactly the same "VIC compiler.prg" that's been archived on zimmers.net for ages ...
ftp://ftp.zimmers.net/pub/cbm/vic20/uti ... mpiler.prg
Re: BASIC compilers
I would like to write a BASIC compiler with modern tools (e.g. compiling on the PC and generating a .prg file to be consumed), I think it would be a great fun to write. It could generate both p-code and pure machine language.
The only problem (aside the lack of time) is that I don't know very well the ROM BASIC interpreter, in order to simulate the needed calls (e.g. calling math functions). Can you suggest me a starting point? Is there an article, webpage or something?
The only problem (aside the lack of time) is that I don't know very well the ROM BASIC interpreter, in order to simulate the needed calls (e.g. calling math functions). Can you suggest me a starting point? Is there an article, webpage or something?
Re: BASIC compilers
There's a commented disassembly of the BASIC (and KERNAL) ROM here
https://eden.mose.org.uk/gitweb/?p=rom- ... kernal.asm
There is an extensive description of the BASIC routines in "Compute's Tool Kit: BASIC", PDF available on Bombjack
http://69.60.118.202/books/commodore/bo ... _Basic.zip
https://eden.mose.org.uk/gitweb/?p=rom- ... kernal.asm
There is an extensive description of the BASIC routines in "Compute's Tool Kit: BASIC", PDF available on Bombjack
http://69.60.118.202/books/commodore/bo ... _Basic.zip
Re: BASIC compilers
regarding the vic 20 kernal rom disassembly... I wasn't aware there was one! I always referenced C64's one!! that's absolutely great, thanks!
As for the PDF link, it gives me a 404 error.
As for the PDF link, it gives me a 404 error.
Re: BASIC compilers
Odd, I pasted it from the browser, try finding it manually in http://www.bombjack.org/commodore/books.htmnippur72 wrote: As for the PDF link, it gives me a 404 error.
Re: BASIC compilers
it looks like they have been removed (or protected) as it still gives me 404.
But I was able to get it from archive.org:
https://ia601705.us.archive.org/2/items ... ations.pdf
But I was able to get it from archive.org:
https://ia601705.us.archive.org/2/items ... ations.pdf
Re: BASIC compilers
I've mailed David to let him know about the broken links.