Turning compiled programs into carts

Basic and Machine Language

Moderator: Moderators

Post Reply
User avatar
eslapion
ultimate expander
Posts: 5458
Joined: Fri Jun 23, 2006 7:50 pm
Location: Canada
Occupation: 8bit addict

Turning compiled programs into carts

Post by eslapion »

This is a call to all good programmers who've used the Austro compiler or who knows a couple of things about it.

It has recently occured to me that it would be very useful for me to have a couple of my basic programs incorporated into the ROM of my Ultimate Expander, preferably in a compiled version to provide decent speed.

Now, I know that compiled programs generated by the Austro always require an 8k RAM expansion BUT there is both RAM and ROM on the UE and turning on RAM expansion in both BLK 1 and 2 is while having ROM in BLK5 is no problem at all.

Is there one very talented person among you programmers out there who happens to know exactly what memory areas the compiled programs generated by the Autro use and who would be kind enough to provide me with a method to take the compiled code into a self-starting BLK5 8k chunk?

Actually, what I am thinking of is a self starting BLK5 chunk that would simply configure the VIC properly and copy the data back into the original memory areas and start it.
Last edited by eslapion on Mon Apr 27, 2009 11:12 am, edited 1 time in total.
Be normal.
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

Alternatively you could have a short ML routine that simply copies the program from ROM to RAM and starts execution. It will perhaps take a second or so, but won't require altering the Austro compiler.

Actually there is a Basic ROM routine at $C3BF to copy memory blocks. See Thomas' message in this thread:
http://sleepingelephant.com/ipw-web/bul ... 2102#12102
Anders Carlsson

Image Image Image Image Image
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

Some time ago I wrote a simple header for an autostarting cartridge to copy a BASIC program from BLK5 to RAM.

Only the starting address in RAM needs be altered to $1200, otherwise it is no difference whether it is a BASIC program, or a compiled BASIC program which is copied to RAM and executed there.

http://www.sleepingelephant.com/ipw-web ... php?t=1360

This requires, of course, that the compiled code fits into BLK5, together with the header. If necessary, the header could be expanded to use BLK3 as source as well.

Greetings,

Michael
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

It may even be possible to use Pucrunch, relocate the crunched program and manually change its source pointers so it reads from ROM and outputs to RAM. I'm not sure if the cruncher already supports this feature, otherwise I'm sure it would be fairly simple to add.
Anders Carlsson

Image Image Image Image Image
Leeeeee
soldering master
Posts: 396
Joined: Fri Apr 23, 2004 8:14 am

Post by Leeeeee »

I'm pretty sure you can run BASIC code from ROM if you just change $2B/$2C to point to the BASIC code and change $2D/$2E to point to the start of RAM.

Guess I need to go find a BASIC program to try this with.

Lee.
User avatar
eslapion
ultimate expander
Posts: 5458
Joined: Fri Jun 23, 2006 7:50 pm
Location: Canada
Occupation: 8bit addict

Post by eslapion »

carlsson wrote:Alternatively you could have a short ML routine that simply copies the program from ROM to RAM and starts execution. It will perhaps take a second or so, but won't require altering the Austro compiler.

...
Maybe I did not express myself correctly.

Actually, what you're suggesting as an alternative is exactly what I want.

However, my main concern is the previous step... before I can copy the program from ROM to RAM (ideally with an autostarting routine, I need to know what areas of RAM (from the original compiled program) to first put into the ROM.

Concerning these suggestions:
Some time ago I wrote a simple header for an autostarting cartridge to copy a BASIC program from BLK5 to RAM.
And
I'm pretty sure you can run BASIC code from ROM if you just change $2B/$2C to point to the BASIC code and change $2D/$2E to point to the start of RAM.
I am already aware that it is possible to put a BASIC program into BLK5 and either copy it to ram then run it or directly run it from BLK5 however, this is not the same with COMPILED basic programs which will not run if relocated.

Also, as I said above, the memory usage for a standard BASIC program vs a compiled program is not the same at all.

My original question is specifically about compiled programs generated by the austro compiler, not normal basic programs.

Concerning:
It may even be possible to use Pucrunch, relocate the crunched program and manually change its source pointers so it reads from ROM and outputs to RAM. I'm not sure if the cruncher already supports this feature, otherwise I'm sure it would be fairly simple to add.
Once again, a relocated compiled program will not work easily, AFAIK.

However, it may be possible to use PuCrunch to compress the compiled program contained in the self starting BLK5 image and then decompress it back into the proper memory area and start it.

In other words, with some clever programming it may be possible to make some sort of BLK5 image generator that is smart enough to take a compiled program, compress it with Pucrunch and from it, generate a self-starting BLK5 image that will decompress the compiled program into the right place.
Be normal.
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

eslapion wrote:However, my main concern is the previous step... before I can copy the program from ROM to RAM (ideally with an autostarting routine, I need to know what areas of RAM (from the original compiled program) to first put into the ROM.

Concerning these suggestions:
Some time ago I wrote a simple header for an autostarting cartridge to copy a BASIC program from BLK5 to RAM.
And
I'm pretty sure you can run BASIC code from ROM if you just change $2B/$2C to point to the BASIC code and change $2D/$2E to point to the start of RAM.
I am already aware that it is possible to put a BASIC program into BLK5 and either copy it to ram then run it or directly run it from BLK5 however, this is not the same with COMPILED basic programs which will not run if relocated.

Also, as I said above, the memory usage for a standard BASIC program vs a compiled program is not the same at all.

My original question is specifically about compiled programs generated by the austro compiler, not normal basic programs.
Eslapion,

even from a compiled program's point of view, it is irrelevant, whether it was loaded to $1201 from disc, or copied down from BLK5, and the pointers 45/46 adjusted the same way, as if it had been LOADed from disc, and then started with RUN.
Actually, what I am thinking of is a self starting BLK5 chunk that would simply configure the VIC properly and copy the data back into the original memory areas and start it.
This is exactly, what my header does. It initialises all zeropage locations necessary for BASIC to work, and then imitates the LOAD and RUN process.

For the rest of available RAM, of course any program must make sure, that any extra memory it uses is properly initialised by itself.

Michael
Post Reply