The zeropage address 212 ($D4 in hexadecimal) holds a flag to indicate whether control characters (such as Clear Home; PETSCII code 147/$93) should be "executed" or displayed (i.e. actually clear the screen, or display the S character as in a LISTing of a BASIC program): If the content of this byte is zero, any control characters are executed (i.e. Clear Home clears the screen, color control characters actually change the colors, etc.). Any non-zero value causes control characters to appear as visible, reverse characters.
Here is an example demonstrating the function of address 212:
print peek(212);chr$(34);peek(212) 0 " 1] ready.
Before printing the quotation mark (using the CHR$ function) the value in 212 is zero. After the quote, the value has changed to 1 – the trailing "cursor right" control character is also affected by the "quote mode", causing it to appear as a visible char rather than skipping a character right after the "1".
Another example to demonstrate the effect of writing to address 212:
poke 212,1:print chr$(34);"Hello" SHello ready.
Note that chr$(147) provides the CLR/HOME control character: This would normally clear the text screen and cause the "Hello" greeting to be printed at the upper left-hand corner of the screen, but the initial POKE in the command line engages the quote mode, causing the CLR/HOME to appear as a control char instead of clearing the screen.
ROM details[edit | edit source]
Kernal has a short subroutine (59012–59024/$E684–$E690) that checks whether the accumulator holds the PETSCII code for quotation mark (34/$22), and if so toggles the content of 212 between 0 and 1.
The general routine for printing to the text screen calls this routine for each printed character: When editing BASIC lines by typing and deleting quotation marks, this system sometimes ends up in a state where control chars for e.g. cursor movements are displayed rather than executied, even though the cursor is not inbetween quotation marks.
During printing either of the two carriage return characters (PETSCII codes 13/$0D and 141/$8D), address 212 is reset to zero for executing rather than displaying control characters: This is handled at 58905/$E619.