Re: [stella] ? memory ?

Subject: Re: [stella] ? memory ?
From: Erik Mooney <erik@xxxxxxxxxx>
Date: Thu, 19 Jul 2001 15:22:08 -0400
>I have a few questions about memory in stella
>programming.  Some of the things I will write
>are statements, hoping you'll correct me if I'm wrong.
>You write to TIA addresses or registers for graphics,
>etc.  Are these really registers, or is it just some
>memory space.

Same thing, sort of.  The TIA registers are accessed by writing to what
the 6502 sees as memory locations.

>Is this really in the TIA, or is it
>writing into the 6502's memory?  If its really in the
>TIA, why can I say $06 for COLUP0 and not have it just
>reference the the 6th byte in the 6502's memory?

The 6502 (6507 actually in the VCS) acts as if it is writing to a memory
location.  The TIA registers basically behave as write-only (cannot read)
memory locations.

>The 6502 has 65535 byte-sized locations.  Where is it
>safe to store stuff without messing up other stuff?

The 2600 only has 128 bytes of RAM.  They are accessed at addresses $80 to
$FF.  The same 128 bytes can also be accessed at $180 through $1FF (that
is, $95 is the same as $195 and so on) but it takes an extra cycle to
access them this way.  There isn't anything in the RAM to mess up.  All
128 bytes are available to do whatever you want; the only caveat being
that subroutine calls store their return addresses at the stack pointer,
which is almost always at (though your program has to set it) the top few
bytes of that memory area.

Remember that the 2600 has no operating system that would be using any
RAM, unlike programmable computers.

>In the PIA part of the Stella guide, it says "The PIA has
>128 bytes of RAM located in the Stella memory map from HEX
>address 80 to FF."  So the PIA writes to memory on the 6502
>to get its work done, right?

Nope, the PIA doesn't write to memory.

>It also says the stack is
>normally located from FF on down
>The book I got out of the library, _6502 Software Design_
>by Leo Scanlon says the stack is in $0100 thru $01FF which
>seems to contradict what the Stella guide says.  Is this a
>difference in the 6502 vs 6507?

It's a difference in the 2600's architecture.  The same memory is accessed
at $80 through $FF as at $180 through $1FF.  The stack goes through the
latter address window on the 2600.

>program memory
>I get that your program and game data is in the .bin file,
>or on the cartridge.  When you turn on the 2600, I suppose
>it just starts reading the first byte off the cartridge?
>(maybe after doing a little initialization ?)

When the VCS powers up, it reads the 16-bit number at memory locations
$FFFC and $FFFD.  It then sets the program counter to that number.

>I've seen stuff about different cartridge sizes, 4K 8K etc
>what are the space limitations for the game?

4K unless you code in bankswitching logic; don't worry about that just yet

Archives (includes files) at
Unsub & more at

Current Thread