Commodore Machine Language Clear
I have been trying to develop a monitor program for the VIC-20 and am having a difficult time creating a routine to clear the screen. Is there any way to clear the screen without getting the READY prompt?
There are several ways to clear the screen from machine language. The easiest way is to assemble the following:
LDA #$93 ;the equivalent of CHR$(147) JSR $FFD2 ;print it
This routine will work on both the VIC and 64. Incidentally, you can also use it to home the cursor. Just replace the $93 with $13. The hex number 93 is the same as the character that clears the screen in BASIC and $13 is the same as CHR$(19) which homes the cursor.
Another way to accomplish the same result is to assemble the following:
JSR $E55F ;clear the screen and home the cursor
On the 64 the routine is located at a different location, thus the coding is different:
JSR $E544 ; clear and home
If you just wanted to home the cursor on either machine you could JSR to $E581 on the VIC or $E566 on the 64. Although these are two quick, easy ways to clear the screen, there is yet another. You could write your own routine to clear the screen. The routine would need to store a $20 at every screen location. $20 is the number for a blank character.