User Tools

Site Tools


midres_library:memory_layout
Translations of this page:


MEMORY LAYOUT USED BY MIDRES

In order to make the compiled code as efficient as possible, the MIDRES library introduces the fewest possible abstractions. In particular, it tries to exploit the similarities between different chipsets and architectures. One of the similarities is the memory mapping of the various features.

Therefore, here below we give a series of functional mapping primitives and their relative in-memory deployment for the various architectures.


FUNCTIONAL MAPPING

START ADDRESS

Each architecture has a starting address where the compiled C code (the assembly code) begins. As a rule, it begins at the start of the equivalent BASIC program. In fact, the cc65 compiler generates the appropriate “loader” which is nothing more than a “SYS” towards the first assembly instruction.

Sometimes, due to the overlap between the graphics memory and the BASIC program, it was necessary to relocate the starting address to a different location. In this case, a small loader (written in BASIC) is attached, which takes care of loading from disk the assembly in the correct location before starting it.

SCREENS

This type of memory maps a surface of letters (or “tiles”) made up of a certain number of rows and columns. Each letter (or “tile”) is represented by an 8-bit unsigned number. This number represents an index in the special memory (see below).

TILESETS

This type of memory contains the pixel-by-pixel and monochrome representation of each letter (or “tile”) indicated by the 8-bit unsigned number, as present in video (text) memory (see above).

BITBLITS

This type of memory can be used by displacement primitives (or “bitblits”), and does not necessarily correspond to anything visible on the screen.


ARCHITECTURES

COMMODORE VIC 20 (unexpanded)

  • START ADDRESS: $1000
  • SCREENS: 1
  • TILESETS: 4 (4 ROM)
  • BITBLITS: 0


COMMODORE VIC 20 (32KB expansion)

  • START ADDRESS: $2000
  • SCREENS: 7
  • TILESETS: 7 (3 RAM + 4 ROM)
  • BITBLITS: 6


COMMODORE 64

  • START ADDRESS: $0801
  • SCREENS: 16
  • TILESETS: 6 (4 RAM + 2 ROM)
  • BITBLITS: 15


COMMODORE 16

  • START ADDRESS: $1000
  • SCREENS: 3
  • TILESETS: 8 (4 RAM + 4 ROM)
  • BITBLITS: 2


COMMODORE PLUS/4

  • START ADDRESS: $4000
  • SCREENS: 7
  • TILESETS: 15 (11 RAM + 4 ROM)
  • BITBLITS: 6