see Bank Switching
There are six 4K program banks, a 4K display bank, 1K frequency table and the DPC chip. DPC chip access is mapped to $1000 - $1080 ($1000 - $103F is read port, $1040 - $107F is write port). Program banks are accessible by read/write to $1FF6 - $1FFB.
Bank Switching
24K ROM available in 4K banks:
4K bank 0 $xFF6 to select
4K bank 1 $xFF7 to select
4K bank 2 $xFF8 to select
4K bank 3 $xFF9 to select
4K bank 4 $xFFA to select
4K bank 5 $xFFB to select
Not selectable:
4K Display Data
1k music frequency table
3k DPC+ ARM driver
Data Fetcher
There are 8 Data Fetchers which are used to access data stored in the Display
Data bank. Before using, you must point the Data Fetcher at the data to read
via DFxLOW and DFxHI. After each read the Data Fetcher will update to point
to the next byte of data to return.
The 8 Data Fetchers can also be read in a "windowed" mode, which is most
commonly used to update sprites. To use windowed mode, point the Data
Fetcher the same as above, but then also set the Top and Bottom of the
Window using DFxTOP and DFxBOT. When reading via the DFxDATAW registers, a 0
value will be returned for anything that's outside of the window.
Fractional Data Fetcher
Another 8 Data Fetchers exist which work differently than the first 8.
These allow you to fractionally increment the Data Fetcher so a single
value can be read a set number of times before advancing to the next value.
This is commonly used to draw asymmetrical playfields without needing to
use 1200 bytes of data (200 scanlines * 6 playfield updates).
Before using, you must point the Fractional Data Fetcher at the data to read
via DFxFRACLOW and DFxFRACHI. You must also set the increment value via
DFxFRACINC.
Data Fetcher Window Flag
The Data Fetcher Window Flag allows you to dual-purpose the first four
Data Fetchers. The Window is not required when a Data Fetcher is used to
update a sprite's color. The Flag will return $FF if it's within the window,
or 0 if it's not - this value can be used to control the display of the ball
and missiles. The Data Fetcher will NOT increment when reading the flag.
Fast Fetch Mode
Fast Fetch Mode enables the fastest way to read DPC+ registers. Normal
reads use LDA Absolute addressing (LDA DF0DATA) which takes 4 cycles to
process. Fast Fetch Mode intercepts LDA Immediate addressing (LDA #<DF0DATA)
which takes only 2 cycles! Only immediate values < $28 are intercepted
Waveforms
Waveforms are 32 byte tables that define a waveform. Waveforms must be 32
byte aligned, and can only be stored in the 4K Display Data Bank. You MUST
define an "OFF" waveform, comprised of all zeros. The sum of all waveforms
being played should be <= 15, so typically you'll use a maximum of 5 for any
given value.
Valid values are 0-127 and point to the 4K Display Data bank. The formula
(* & $1fff)/32 as shown below will calculate the value for you
Random Numbers
DPC+ provides a 32 bit LFSR (Linear feedback shift register)
which is used as a random number generator. Each individual byte of the
random number will return values from 0-255. The random numbers will follow
an exact sequence, so it's best to clock them at least once per frame even if
you don't need the value (this allows the amount of time it takes the user to
start the game to select a random starting point in the sequence)
Random Number Initialization
The random number generate defaults to a value that spells out DPC+.
Store any value to RRESET to set the random number back to DPC+, or you
can use RWRITE0-3 to change the 32 bit value to anything you desire.
Function Support
Currently only Function 255 is defined, and it is used to call user
written ARM routines (or C code compiled for the ARM processor.)
PARAMETER is not used by function 255, it may be used by future functions.
call custom ARM routine
LDA #$FF
STA CALLFUNCTION
Read Registers ($1000-$1027)
Addr | Name | Description |
00 | RANDOM0NEXT | Move to next random number and return byte 0 of the number |
01 | RANDOM0PRIOR | Move to previous random number and return byte 0 of the number |
02-04 | RANDOMx | Returns bytes 1,2 and 3 of Random Number |
05 | AMPLITUDE | Current Amplitude of Mixed Waveform |
06-07 | — | Reserved |
08-0F | DFxDATA | Read Data Fetcher |
10-17 | DFxDATAW | Read Display Fetcher, Windowed |
18-1F | DFxFRACDATA | Read Fractional Data Fetcher |
20-23 | DFxFLAG | Flag values |
24-27 | — | Reserved |
Write Registers ($1028-$107F)
Addr | Name | Description |
28-2F | DFxFRACLOW | Fractional Data Fetcher, Low Pointer |
30-37 | DFxFRACHI | Fractional Data Fetcher, High Pointer |
38-3F | DFxFRACINC | Fractional Data Fetcher, Increment |
40-47 | DFxTOP | Data Fetcher, Window Top |
48-4F | DFxBOT | Data Fetcher, Window Bottom |
50-57 | DFxLOW | Data Fetcher, Low Pointer |
58 | FASTFETCH | Fast Fetch Mode Toggle |
59 | PARAMETER | Parameter (ARM Function Support) |
5A | CALLFUNCTION | Call Function (ARM Function Support) |
5B-5C | — | Reserved |
5D-5F | WAVEFORMx | Select waveform |
60-67 | DFxPUSH | Data Fetcher Push (stack) |
68-6F | DFxHIGH | Data Fetcher, High Pointer |
70 | RRESET | Random number reset (random) |
71-74 | RWRITEx | Random number reset (user specified value) |
75-77 | NOTEx | Select Note |
78-7F | DFxWRITE | Data Fetcher Write (queue) |
Additional Resources
AtariAge: DPC Cartridge Layout