Screen RAM

From C64-Wiki
(Redirected from Screen Memory)
Jump to navigationJump to search

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

Use in BASIC[edit | edit source]

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 | edit source]

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 | edit source]

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 addresses[edit | edit source]

Hex Address Dec Address Description
Screen RAM
$0400 -
$07e7
1024 -
2023
1 kB (1000 bytes) Screen RAM used for setting the characters to be displayed. The values placed in each location are "screen codes" (not PETSCII); the character displayed for a particular screen code is determined by the current character set. In the default character set values 128-255 display the same glyphs as values 0-127 but with inverted foreground and background colours. All of the character cells in the 40 columns by 25 row grid are directly accessible, e.g. POKE 1024,1 will show the character A in the left upper corner of the screen. (The color will be determined by the 4-bit value set in the 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