Screen RAM

From C64-Wiki
Jump to: navigation, search

By default, the 1 kB of screen RAM or screen memory resides in memory at 1024-2023 ($0400-$07E7).

Use in BASIC[edit]

By using the BASIC command POKE, any of the 256 chars of the C64 can be placed in the video matrix.

POKE 1024,1

This example will display the char A into the left upper corner (0 row, 0 column).

Limitations in extended color mode[edit]

By using the extended color mode the size of the character set is reduced. In this mode only 64 chars are available, because from 0, 64, 128, and 192 char value the chars (A-Z, 0-9 and punctuation marks) are printed with another background color.

Moving of screen RAM[edit]

The video matrix can be moved from its default location into other memory addresses with the following BASIC code:

POKE 53272,( PEEK(53272) AND 15) OR A

The memory that is addressed by variable A can be seen in the table below. The displaced screen memory has a handicap however, because the screen editor or the command code isn't viewable. That is a reason for using this feature only in programs.

A Start address of screen RAM
000 0 ($0000)
016 1024 ($0400) default
032 2048 ($0800)
048 3072 ($0C00)
064 4096 ($1000)
080 5120 ($1400)
096 6144 ($1800)
112 7168 ($1C00)
128 8192 ($2000)
144 9216 ($2400)
160 10240 ($2800)
176 11264 ($2C00)
192 12288 ($3000)
208 13312 ($3400)
224 14336 ($3800)
240 15360 ($3C00)

Memory adresses[edit]

Hex Adress Dec Adress Description
Screen RAM
$0400 -
$07e7
1024 -
2023
1 kB (1000 bytes) Screen RAM, is used for setting chars (values: 0-127); by adding 128 to a value, appears the reverse sign (128-255). All 40 column in the 25 rows of the screen ram are directly useable, e.g. with POKE 1024,1 appears the char A in the left upper corner of the screen (without setting a color!).
For setting color, see Color-RAM.
$07E8 -
$07F7
2024 -
2039
unused
Sprite block register
$07F8 2040 Pointer for sprite 1 in memory block: Blockno.*64
(e.g. sprite 1 in datasette I/O buffer $033C: Blockno. = 13 (13 * 64 = 832, in hex: $0340))
$07F9 2041 Pointer for sprite 2 in memory block: Blockno.*64
$07FA 2042 Pointer for sprite 3 in memory block: Blockno.*64
$07FB 2043 Pointer for sprite 4 in memory block: Blockno.*64
$07FC 2044 Pointer for sprite 5 in memory block: Blockno.*64
$07FD 2045 Pointer for sprite 6 in memory block: Blockno.*64
$07FE 2046 Pointer for sprite 7 in memory block: Blockno.*64
$07FF 2047 Pointer for sprite 8 in memory block: Blockno.*64