Jump to content
IGNORED

Part 1 - CDFJ+ Overview


SpiceWare

Recommended Posts

CDFJ+

 

CDFJ+ is an updated version of CDFJ that has some additional features, such as optionally also using LDX # and LDY # as fast fetchers, plus support for larger programs:

  • 32K ROM & 8K RAM
  • 64K ROM & 16K RAM
  • 128K ROM & 16K RAM
  • 256K ROM & 32K RAM
  • 512K ROM & 32K RAM

 

The 32K ROM & 8K RAM is compatible with 48-Pin LPC210X Family (Harmony, Harmony Encore, Melody).

 

Larger sizes require new hardware, based on the 64-Pin LPC213X Family, which also uses its own version of the CDFJ+ driver.

 

 

CDFJ+ layout

364138450_CDFJCartLayout.thumb.png.26562d9724ef4c66a7c5aa23b1a1da5a.png

 

For CDFJ the C Code is before the 6507 banks. As the C code grows it takes over banks 0, 1, 2, 3, 4, and then 5. Because of this, the CDFJ 6507 code always starts in bank 6

 

For CDFJ+ the C Code is after the 6507 banks.  As the C code grows it takes over banks 6, 5, 4, 3, 2, and then 1. Because of this, the CDFJ+ 6507 code always starts in bank 0.

 

If a game grows to need more than 32K of ROM the additional ROM is added after the existing ROM. This simplifies usage for the C code - if the original CDFJ was used then the extra ROM would be discontiguous from the C code.

 

 

 

CDFJ+ Driver

 

The CDFJ+1 Driver is the ARM code that emulates a CDFJ+ coprocessor.
 
The 6507 in the Atari has no access to the driver. Likewise the ARM has no access to the internals of the Atari.
 
While the driver is located in ROM, it is copied into RAM when the Harmony/Melody first powers up. This is because the code runs faster when located in RAM and the extra speed is required in order for the coprocessor emulation to keep up with the Atari.

 

 

 

Bank 0

 

Bank 0 is always used for 6507 code. When a CDFJ+ cartridge is powered up bank 0 will already be selected. If you've selected another bank then access $FFF42 to reselect bank 0.

 

 

 

 

Bank 1

 

The 6507 can select bank 1 by accessing memory location $FFF52.

 

 

 

 

Bank 2

 

The 6507 can select bank 2 by accessing memory location $FFF62.

 

 

 

 

Bank 3

 

The 6507 can select bank 3 by accessing memory location $FFF72.

 

 

 

 

Bank 4

 

The 6507 can select bank 4 by accessing memory location $FFF82.

 

 

 

 

Bank 5

 

The 6507 can select bank 5 by accessing memory location $FFF92.

 

 

 

 

Bank 6

 

The 6507 can select bank 6 by accessing memory location $FFFA2.

 

 

 

 

C code & data

 

 

CDFJ+ has a dedicated section in the ROM for the compiled C code and its data.  The size depends up on size of the ROM:

 

  • 2K on a 32K ROM
  • 34K on a 64K ROM
  • 98K on a 128K ROM
  • 226K on a 256K ROM
  • 482K on a 512K ROM

 

The C code & data can also expand downward into the 6507 banks of ROM.

 

 

 

Display Data, C Variables & Stack

 

While the chart shows 4K and 2K, with CDFJ+ the size of Display Data is no longer locked to 4K. This is because larger ROM configurations include additional RAM, so you now get to control how RAM is divided between Display Data and C Variables & Stack.

When the Harmony/Melody is first powered on the RAM holding Display Data is not initialized, so it's up to your code to do so.  This was done to keep the CDFJ+ driver 2K in size.

 
While the Atari cannot "bank in" the Display Data, it can read its contents using Data Streams3. This is how the custom C code will pass information to the 6507.
 
The Atari can also write to Display Data by using a Data Stream. This is how the 6507 code will pass information, such as the current state of the joysticks and console switches, to the custom C code.

 

 

 

1 CDFJ+ stands for Chris (@cd-w) Darrell (@SpiceWare) Fred (@batari) and John (@johnnywc), who were involved in its creation.

 

 

2 due to the 6507's 8K addressing space, these locations are mirrored multiple times in memory. The mirrors are $1FFx, $3FFx, $5FFx, $7FFx, $9FFx, $BFFx and $DFFx. Any of the mirror addresses may be used. I think of them being located at $FFF4-FFFA due them being just before the RESET and IRQ vectors. The 6507 is a reduced package version of the 6502, which I first learned to program in the early 80s on my Vic 20. On a 6502 these vectors are, by definition, located at addresses $FFFC-FFFD and $FFFE-FFFF.

 

 

3 Data Streams will be covered in Part 2

  • Like 6
Link to comment
Share on other sites

  • Recently Browsing   0 members

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