648

From C64-Wiki
Jump to navigationJump to search

Address 648 ($288) holds a "pointer" (or more precisely, half a pointer) that tells KERNAL where in RAM the text screen is currently located: The contents of address 648 is the most significant 8 bits, or the "high-byte", of the text screen's physical start address. For example, since the default location for this text screen is at 1024/$0400, the contents of 648 will be 1024 / 256 = 4.

Changing this address only tells KERNAL where to display text, blink the cursor etc. – it does not change the VIC-II configuration to actually display the new, re-located screen. The following example does both, in order to re-locate the text screen to begin at 15360/$3C00:

10 poke 648,60
20 poke 53272,244

After RUNning this short program, the screen will most likely be filled with a lot of "garbled" characters, usually lots of @'s and checkerboard pattern, but since KERNAL "knows" where the screen has been moved (it was told in line 10), it is able to display the READY. prompt and cursor on top of it all. And you may proceed to LIST and edit the program etc. as usual.

Apparantly nothing much (apart from the garbled characters) has happened, but of you try to POKE a screen character code directly into text screen RAM, you'll notice that the screen's start address has moved from the familiar 1024 to 15360. This means that

POKE 1024,34

will not cause a quotation mark to appear at the upper left-hand corner of the screen, whereas

POKE 15360,34

will.

Screen memory address on a C128[edit | edit source]

Due to a different memory layout, the C128 uses a different address for the exact same function. Instead of 648, the starting page for the 40-column screen memory is at address 2619 for the C128. Since the screen memory also starts at $0400, the default content of 2619 is 4 as well.

Also see[edit | edit source]

  • VIC bank has another example on moving the screen RAM, this time across VIC bank boundaries.
  • Sprites depend on pointers to their respective graphic patterns; these pointers move along whenever you move the text screen as described here!
  • Character sets are closely related to the text screen.