Hub Memory Map
Title:Hub Memory Map
Author:Dpeschel
Published:Wed, 12 Nov 2008 20:02:47 GMT

Hub Memory Map


Hub memory contains 65536 bytes (or 32768 words, or 16384 longs). Hub Ram uses half of this space ($0000-$7FFF) and ROM uses the other half ($8000-$FFFF).

$0000
LONG ClkFreq
This value is created by the spin compiler, and is equivalent to the system variable _CLKFREQ that may be set in the Spin Top Object. If a user program changes the frequency using the CLKSET command, it should also update this value. Default is 12,000,000 which is the approximate frequency of RCFAST mode.
$0004
BYTE Clk
Equivalent to the system variable _CLKMODE that may be set in the Spin Top Object. If a user program changes the frequency using the CLKSET command, it should also update this value. Default is 0 which corresponds to RCFAST mode.
$0005
BYTE Checksum

$0006
WORD TopObjectBaseAddress
Start address of the top object in a spin program. PropTool currently always sets this to $0010
$0008
WORD VariablesBaseAddress
Start address of Spin variables.
$000A
WORD StackBaseAddress
Start address of stack. Stack grows upwards from here.
$000C
WORD Main
Address of first PUB method in top object. Program execution starts here.
$000E
WORD InitialStackPointer
Initial value of stack pointer. Live stack pointer is kept in the interpreter Cog RAM, so this value doesn't get updated.
$0010-
Top object
Usual start of top object.
$8000-$BFFF
Character Set
256 characters of 16x32 (width x height) pixels in two colours. In fact that isn't the whole truth. The "characters" numbered 0, 1, 8, 9, 10, 11, 12, 13 are really eight patterns of 16x16 pixels in four colours. A fancy video driver can give a coloured background to a rectangle of 32x16 characters, and use the 16x16 patterns to add beveled edges and corners to the rectangle. The patterns also provide underlines, overlines, and triangular marks inside the corners, made visible or invisible by changing one of the four colours.
$C000-$CFFF
Log Table
2048 word values
$D000-$DFFF
Anti-log Table
2048 word values
$E000-$F001
Sine Table
2049 word values
$F002-$F003
Unused (padding)
The sine table contains word values while the Spin interpreter and boot loader are stored as long words. They must be aligned as described in Hub Ram. The change in alignment creates this unused space.
$F004-$F7C3
Spin Interpreter
To start the Spin interpreter, a cog is initialised with $F004 as the entry point and PAR pointing to $0004. The hardware copies 496 long words from this address range into the new cog's Cog Ram. The hardware loads the rest of the Cog Ram with zeros.
$F7C4-$F7FF
Unused
These long words are part of the space allocated for the Spin interpreter but are not copied.
$F800-$FFBF
Boot Loader
On reset, the hardware copies 496 long words from this address range into cog 0's Cog Ram. $FBB4-$FFBF (cog $0ED-$1EF) are copied but the boot loader doesn't use them in any way. $FF00-$FF5F (cog $1C0-$1D7) contain a copyright notice.
$FFC0-$FFFF
Unused
These long words are part of the space allocated for the boot loader but are not copied.

See Also

Hub Ram
Cog Ram