The Editors and Readers of COMPUTE!
Unwanted Commodore Messages
I have written a machine language routine that loads several program modules into the Commodore 64 from disk. However, the computer prints the usual SEARCHING FOR and LOADING messages during every load. How can I prevent these messages from appearing on the screen?
These messages are generated by the 64's operating system, which controls input/ output functions. Since Commodore calls the operating system the Kernal, they're known as Kernal control messages. One easy way to mask them is to change the character color to the same color as the screen background. The messages then print invisibly on the screen. However, since they may overprint an existing display or cause the screen to scroll, it's usually better to suppress them altogether.
Location $9D (157 decimal) holds a flag that tells the 64 what type of messages to display. When the flag contains 128 (bit 7 is set to 1), the computer prints Kernal control messages to tell you when it's searching, loading, saving, or verifying. When bit 7 is set to 0, control messages are not displayed. Though you rarely see them when using BASIC, the Kernal also has its own set of error messages. For instance, the Kernal equivalent of BASIC's FILE NOT FOUND message is I/O ERROR #4. Location $9D controls Kernal error messages as well: They're displayed when the flag contains 64 (bit 6 is set to 1), and suppressed when bit 6 is clear.
Thus, the machine language statement LDA #$00:STA $9D suppresses all Kernal messages. This is the normal con dition when a BASIC program is running. LDA #$80:STA $9D displays only the control messages (the normal condition when you're in BASIC direct mode), and LDA #$40:STA $9D displays only the special Kernal error messages. Note that Commodore computers also have a builtin routine (SETMSG, accessed at $FF90) to set the Kernal message control flag. To use it, load the accumulator with the value you want to put in location $9D, then JSR $FF90.