Chapter 4 - July 22th, 2013

Memory allocation

Before we can start any serious coding, we must firstly define the memory map for the game. Things like where the display screen will be, where the graphics and sound samples will be stored and where the program will reside.

The video display will be using double buffering so I will need to allocate 2 areas for this and because I am enabling horizontal scrolling with a 320x225 16 color screen, this will mean each screen needs 57K. 

The block size that the GIME chip's Memory Management Unit (MMU) works with is 8K. There are 64 of these blocks defined in the Color Computer 3's 512K memory space. The 6809 can only address 64K so the MMU lets me choose any 8 of these blocks to construct the 64K address space that the 6809 can address.

Having access to only 64K complicates things because the video display almost consumes all of that space. I therefore need to bank in different 8K blocks frequently during the running of the game in order to access different parts of the total 512K.

To fit the display, I divide the screen into seven 8K blocks. The top block (seen at the top of the screen) will contain the score and level displays while the bottom 8K (seen at the bottom of the screen) will contain other displays such as a fuel gauge and lives counter. That leaves me with 5 blocks for the active game play area. This makes my actual game screen area 40K (5 x 8K) which is a bit more manageable in the 6809 address space and leaves me with enough space for the actual game code to reside. 

The two tables below show the memory allocation of each screen within the GIME's 512K address space.

 

SCREEN 1 

MMU BLOCKS

MEMORY LOCATIONS

DESCRIPTION

$00 (00)

$00000 - $01FFF

SCORE AND LEVEL DISPLAY

$01 (01)

$02000 - $03FFF

GAME SCROLLING AREA

$02 (02)

$04000 - $05FFF

$03 (03)

$06000 - $07FFF

$04 (04)

$08000 - $09FFF

$05 (05)

$0A000 - $0BFFF

$06 (06)

$0C000 - $0DFFF

FUEL AND LIVES DISPLAY

 

SCREEN 2

MMU BLOCKS

MEMORY LOCATIONS

DESCRIPTION

$07 (07)

$0E000 - $0FFFF

SCORE AND LEVEL DISPLAY

$08 (08)

$10000 - $11FFF

GAME SCROLLING AREA

$09 (09)

$12000 - $13FFF

$0A (10)

$14000 - $15FFF

$0B (11)

$16000 - $17FFF

$0C (12)

$18000 - $19FFF

$0D (13)

$1A000 - $1CFFF

 FUEL AND LIVES DISPLAY

  

The table below shows the MMU mapping for the 64K address space the 6809 will see when accessing the video display screen memory.

MMU MAPPING

BLOCK

MMU REG

0

$FFA0

$0000 - $1FFF

SCREEN

1

$FFA1

$2000 - $3FFF

SCREEN

2

$FFA2

$4000 - $5FFF

SCREEN

3

$FFA3

$6000 - $7FFF

SCREEN

4

$FFA4

$8000 - $9FFF

SCREEN

5

$FFA5

$A000 - $BFFF

6

$FFA6

$C000 - $DFFF

MAIN PROGRAM

7

$FFA7

$E000 - $F000

 

There are still more areas to define such as where the graphics used in the game and sound samples will be stored.

 

                                 

Copyright 2013 by Nickolas Marentes