Jump to content
IGNORED

Can anyone refer me to disassembled cart code?


Recommended Posts

I'm trying to find an example of how to program the header and the boot code for an 800XL cart, want to burn my own rom/make a cart.

 

If anyone can refer me to an example (i.e. a disassembled cart rom) it would be greatly appreciated.

 

Thanks in advance.

 

T

Edited by TonyA
Link to comment
Share on other sites

Just download the OS Manual from the thread I recently created.

 

To see what various carts use, just run some in the emulator and use the Monitor (F8).

 

There are different ways that some carts run. Star Raiders is an example of one which runs as a "diagnostic cart" ie - it gets control of the system straight away.

 

Language carts like BASIC and the Atari Asm/Ed allow the full boot process to take place unhindered.

 

Then there are carts which deviate from the standards and don't return when called via their Init vector.

 

You can sometimes tell what scheme a cart uses - if a text screen never appears when you press Reset, then it's usually a cart running as a "diag cart".

Link to comment
Share on other sites

OK. From the OS manual and translated into easier to understand terms, here's how cartridges operate:

 

Location $BFFC in ROM should contain value 00.

 

Location $BFFD determines the type of cartridge. If bit 7 is set to 1 then it is run as a "diagnostic cartridge".

The intention of this run-mode was initially for cartridges to be able to get control of the machine immediately upon powerup, something which can be important when doing more advanced diagnostics of a possibly faulty system.

Many game cartridges run in this mode due to the fact that if the cartridge flags are set such that a cassette/disk boot is permitted, it makes it very easy to copy the cartridge.

 

In such case that the cartridge is "diagnostic", then control is passed to the address contained in $BFFE-F. This is done before the system initializes, so RAM may contain anything, and virtually none of the OS referenced RAM locations from 0-3FF have been initialized. At this point, the cartridge can perform it's own initialization, and returning to the OS is optional.

 

In such case that the cartridge isn't a "diagnostic" then the OS performs most of it's initialization. Then, it performs an indirect JSR through $BFFC. Return is expected, although many games utlize this mode of running (and some don't bother returning) since the OS has performed much of it's startup housekeeping but has not yet attempted to boot from disk/tape.

Also, the E: device has not been opened yet, so taking control at this point allows a more seamless look for graphical games, rather than a blue-screen followed by the game screen.

 

In such case that the cart does RTS from this init stage, the E: device is then opened.

A cartridge controls whether a disk/ boot is allowed. When a cartridge is detected, disk booting is only attempted if bit 0 of $BFFD is 1. Of course, this is inconsequential if the cartridge assumes control and doesn't return from the initialization stages described before.

 

As the final stage of initialization, the cartridge is run by JMPing through the vector at $BFFA, as long as bit 2 of $BFFD is 1.

 

The cartridge, when run through ($BFFA) should use location 8 (WARMST) to determine if the system has just powered on, or the user has pressed Reset. 00 means the system has just coldstarted. Languages use it to perform their initial memory management, and games might use it to work out whether to setup initial high-score tables, etc.

 

So, to summarise - the cartridge vectors and flags:

BFFA-B  Run address vector
BFFC	 Should contain zero.  Even if the system determines that a cartridge is present, it won't run it unless this location is zero.
BFFD	 Cartridge flags
		  bit 7: 1 = run as a diagnostic cart
		  bit 2: 1 = run cartridge
		  bit 0: 1 = permit disk boot
BFFE-F  Initialize address vector

 

I think that lot's fairly accurate. Of course, the cassette and disk boot can be thrown into the mix, but the cartridge itself is the main focus of this thread.

Link to comment
Share on other sites

That's great, thank you.

 

 

Hi,

 

I was wondering if it might be possible to see an actual piece assembly language code using the above example?

 

Would like too see how it actually looks in a real piece of code. (I'm a beginner, the above example is confusing).

 

If I see what it really looks like in a simple piece of asm code, I can work backwards and study it.

 

Thanks for any help.

 

T

Link to comment
Share on other sites

  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...