Classic Computer Magazine Archive COMPUTE! ISSUE 47 / APRIL 1984 / PAGE 108

Clearing The 64 Screen From ML

Our machine language class has been working on several small routines written in machine language for the 64. One of the subroutines we've written to clear the screen is somewhat lengthy—49 bytes. We feel there must be a shorter way. Can you help?

Art Lipina

Yes, there is a shorter, and an easier, way. There are many routines in both the 64's BASIC ROM ($A000-$BFFF) and Kernal ROM ($E000-$FFFF) that you can use. For example, there is a screen clearing routine at $E544 (decimal 58692). Here are two ways to clear the screen using ROM routines:

JSR $E544

This Kernal ROM routine clears both screen and color memory, and then resets the screen line link table. Clearing the screen using this technique uses only three bytes.

LDA #$93
JSR $FFD2

This method (which uses five bytes) first loads the accumulator with the ASCII character that clears the screen, then calls the Kernal PRINT routine ($FFD2). This is equivalent to the BASIC statement PRINT "{CLR}".

COMPUTE! welcomes questions, comments, or solutions to issues raised in this column. Write to: Readers' Feedback, COMPUTE! Magazine, P.O. Box 5406, Greensboro, NC 27403. COMPUTE! reserves the right to edit or abridge published letters.