Skip to content
systemcoding.dev
Assembly

Clear the Commodore 64 screen by calling KERNAL $E544

Clear the C64 text screen from machine code with jsr $e544, which fills screen RAM with spaces and homes the cursor; know the portable alternative.

1 min read
Summarize in AI

A machine-language program on the Commodore 64 can clear the text screen with one call into the KERNAL ROM. $E544 is the routine that fills screen RAM with spaces, sets the colour RAM and puts the cursor at the top left.

asm
        * = $c000          ; load at 49152, start with SYS 49152
        jsr $e544          ; clear screen, home cursor
        rts
Text
READY.
SYS 49152
(screen clears; the cursor returns to the top left)

$E544 is an internal address, not one of the documented jump-table entries at $FF81 and up, so it is tied to the KERNAL version. It has stayed at the same place across the common C64 ROM revisions, but a replacement ROM such as a cartridge-based one need not keep it. The portable way is to print the clear-screen control code through the official output routine: lda #147 followed by jsr $ffd2, where 147 is the PETSCII code for clear screen. Either way the KERNAL ROM has to be mapped in, which it is after a normal power-on but not if a program has switched it out through location $01. See the KERNAL notes on C64-Wiki.

Share

More snippets

Get new posts by email

We send one email when a new post is published. No spam.

Unsubscribe in one click. No spam, ever.