[stella] Atari 7800 programmers reference

Subject: [stella] Atari 7800 programmers reference
From: Keith Henrickson <flipper@xxxxxxxx>
Date: Fri, 5 Jun 1998 01:05:37 -0400 (EDT)
This is a preliminary programming doc for the atari 7800.  It is
incomplete and probably inaccurate if not just plain wrong.  I am well
aware that the documentation for the system was sold at one point, but
last I contacted the company that was selling it, they didn't think they
had any left after the backorders were filled.  Even if they did, I don't
have the $150 they wanted.  Since no one who was lucky enough to get one
of these kits has made a posting of any docs as far as I have seen, I've
started poking through the BIOS ROM to see how it worked.  If anyone can
fill in any details, or better yet post the docs that they have, that
would be great.

						Keith Henrickson
						flipper@xxxxxxxx
						6/1/98

------------------------------------------------------------------------

Memory map:

$0000-$0FFF - Probably IO devices, some RAM as well.
$1000-$3FFF - RAM, total of 4K, some kind of mirroring will occur.
$4000-$FFFF - Available to the cart port, all read/write?

------------------------------------------------------------------------

Startup of a cart:

There is a vector at $FFF8 that tells the authentication system where to
look for the 'signature block', although I do not currently have the
format of the block itself.  Several checks are performed to determine the
2600/7800 cart:

1. If the RESET vector ($FFFC) is $0000 then go 2600.
2. If the RESET vector ($FFFC) is $FFFF then go 2600.
3. If the low bit of $FFF8 is 0, then go 2600.
   This means the auth table must occupy an odd numbered address.
4. If the high nibble of $FFF8 is not $F, then go 2600.
   This means the auth table must occupy the $xxFx block of memory.
5. If the low nibble of $FFF9 is not $3 or $B then go 2600.
   This means the auth table must start at $x3xx or $xBxx.
6. If $FFF9 is less than $40, then go 2600.
   The auth table MUST sit higher than this, as $4000 is the start of ram.
7. If $FFF9 - 1 is less than the RESET vector ($FFFC) than go 2600.
   The auth table must sit somewhere between the start of program code
   and the end of ram.
8. Finally, if the low nibble of $FFF9 is $B, the title screen is skipped.

If all of these requirements are satisfied, then the BIOS will attempt to
authenticate a cart.  Unfortulately due to the 760 bit public key system
used for authentication, cracking the key is beyond the capibilities we
have today.  If someone has more details (key size less than 760 bits or
better yet, the key itself), then maybe something will open up along these
lines.

---------------------------------------------------------------------------

The 7800 seems to use a display list, as did the 5200, although it is far
more complicated.  The Maria chip is a little-endian processor, versus the
6502 microprocessor that is big-endian.  Be careful when specifying memory
addresses in your display lists.

The high byte of the master display list is stored at $002C, and the low
byte at $0030.  The format of the master display list is as follows.
There are a series of 3 byte entries.  I don't know yet how many 3 byte
entries there are supposed to be.  Each entry takes the following format:

+-----------+-----------+-----------+
|  byte 1   |  byte 2   |  byte 3   |
+-----------+-----------+-----------+
|  H  |  L  | High byte | Low byte  |
+-----+-----+ of second | of second |
|  C  |  R  | display   | display   |
|  o  |  e  | list      | list      |
|  m  |  p  +-----------+-----------+
|  a  |  e  |                       |
|  n  |  a  |                       |
|  d  |  t  |                       |
+-----+-----+-----------+-----------+

Each entry is used for 'repeat' lines on the screen.  The command nybble
is unknown, but so far my guesses are:

8 - Set bitmapped mode, one color per screen line.

--------------------------------------

The Secondary Display List

This seems to be a very powerful configuration list, but it has a very
difficult format.  However, this is where the actual drawing to the screen
happens.  Once you have a secondary display list to draw a certain type of
screen line (blank line, solid line, whatever your heart can come up
with), you can call it as many places you like in the master display list.

Each entry can have a variable number of bytes in it, but all entries end
with two consecutive zeros.  Separate sub-functions in one secondary
display list entry are separated by a single zero byte.

The basic 'mono bitmap' mode entry seems to be six bytes long:

+----------+-----------+-----------+--------+----------+----------+
| Low-byte | Data size | High-byte | Offset | zerobyte | zerobyte |
| of graph |           | of graph  |        |          |          |
| data     |           | data      |        |          |          |
+----------+-----------+-----------+--------+----------+----------+

The graphdata pointer simply points to the beginning of the
variable-length graphics data itself. To set how much graphics data is
drawn, set the 'data size' byte to $20-(number of bytes of graphdata).

INFO NEEDED: values greater than $20 seem to be valid too.  What is going
             on?

The offset is the horizontal delay in pixels times 2.  This is used to
align pieces of graphics data of varied size on the screen.  For instance,
the atari logo on the boot screen uses the fewest number of bytes needed
to hold the section of the 'arch', increasing as the logo symbol gets
wider.  Then they are centered on the screen by using the 'offset'
location.

INFO NEEDED: How does one set the colors??

---------------------------------------------------------------------------
Chip Registers:

$0028 -- VBLANK status.

+---+---+---+---+---+---+---+---+
| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
+---+---+---+---+---+---+---+---+
| V | --------UNUSED----------- |
| B |                           |
| L |                           |
| A |                           |
| N |                           |
| K |                           |
+---+---+---+---+---+---+---+---+

VBLANK - 0 : Not within VBLANK area.
         1 : Within VBLANK area.

------------------------------------------

$002C - High byte for master display list
$0030 - Low byte for master display list

------------------------------------------


--
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/stella.html

Current Thread