I'm surprisingly not finding any specifics on how to format the first bytes of a cartridge binary image to have it autostart at reset! I have a game I wrote that I would like to burn into an EPROM for use with the cart PCB from TFW8B, but I'm stumped as to how to frame the start of the bytes at $A000!
I know there is a magic byte sequence that needs to appear at the start (?) of the binary (at $A000?), and the VIC will look for that sequence at reset. If it finds it, it runs the code. So where does the code start - immediately after the magic sequence? Is there anything special that the code needs to do, for example clear the interrupt flag, setup any interrupt vectors, etc?
If anyone could share a recipe with me I would most appreciate it!
how to make an autostart cartridge binary image?
Moderator: Moderators
- mrr19121970
- Vic 20 Nerd
- Posts: 885
- Joined: Tue Jan 19, 2016 9:22 am
- Location: Germany
- Occupation: IT service manager
Re: how to make an autostart cartridge binary image?
Look into a .bin file of an existing cart ?
It's probably like the c64
http://blog.worldofjani.com/?p=879
It's probably like the c64
http://blog.worldofjani.com/?p=879
Re: how to make an autostart cartridge binary image?
Thank you for your reply!
The procedure for creating the VIC autostart cart I'm sure is very simpliar to the C64 but must differ in details.
Thank for the link - I need a version of that, just for the VIC. I'm surprised how much difficulty I am having trying to locate the details.
The procedure for creating the VIC autostart cart I'm sure is very simpliar to the C64 but must differ in details.
Thank for the link - I need a version of that, just for the VIC. I'm surprised how much difficulty I am having trying to locate the details.
- Mike
- Herr VC
- Posts: 5130
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Re: how to make an autostart cartridge binary image?
A thorough look into the reset sequence beginning at $FD22 in the KERNAL ROM (using the ROM listing of your choice) is entirely sufficient to sort this out.llcameron wrote:I'm surprisingly not finding any specifics on how to format the first bytes of a cartridge binary image to have it autostart at reset! [...]
Bytes $A000..$A001 contain the cartridge Reset vector, i.e. the address of code which is immediately called by the KERNAL, just as the signature has been checked, before anything else (RAM, I/O) is initialised. If you want to use KERNAL I/O, you should at least copy part of the continued reset routine (what would normally run at $FD2F following) before entering your game, so zeropage and I/O are set up properly. If your game is written in BASIC, you'll need to copy a bit more code, but instead of showing the start-up prompt, transfer the program into RAM (including the values at $2B..$2E!) and then use a certain sequence of calls into the BASIC interpreter (JSR $C533, JSR $C659, JMP $C7AE) to start the payload.
Bytes $A002..$A003 contain the cartridge NMI vector, i.e. the address of code which is called by the KERNAL NMI routine in place of its own vector and I/O reinit routines - your game should either just acknowledge the NMI source and do nothing, or copy the relevant part of the NMI reinit beginning at $FEC7 and change it to your liking to 'restart' your game (without it losing highscore lists, or the like). Note this needs a proper initialised NMI vector at $0318 pointing to $FEAD.
Bytes $A004..$A008 contain the A0CBM signature (nothing 'magic' about it!): $41, $30, $C3, $C2, $CD.
...
For an example, take a look at my TRON lightcycles game, which I made into cartridge form quite some time ago. It has been a BASIC program for unexpanded VIC-20. I took some extra preparations to make the game proof against extra RAM expansions (it disables them as part of the extended reset sequence), also STOP and STOP/RESTORE are switched off.
...
It's no bad idea to test the cartridge image in VICE first, before burning it into an EPROM.

Re: how to make an autostart cartridge binary image?
Thanks for your reply! It was very helpful!
What ultimately worked for me (with the least amount of effort and thought!) is to disassemble with x65dasm a gorf cartridge and see how it did its initialization.
What ultimately worked for me (with the least amount of effort and thought!) is to disassemble with x65dasm a gorf cartridge and see how it did its initialization.