A colour reaches a terminal as well as the screen
The console's attribute has always meant something to the screen and nothing to the serial line: its low nibble picks one of sixteen ink and paper pairs, and only videoPutCell ever read it. So the fault screen's red was red in the window and grey down the wire, and Examples/colours printed " ordinary highlighted " with nothing to tell them apart. It is said in ANSI now, on the same terms the cursor is said in: a register write only marks it and the next character sends it, so setting a scheme and printing nothing says nothing, and setting the same scheme twice costs one sequence rather than two. Only the scheme nibble crosses - the page bits say which tiles a cell draws from, which is a fact about the screen's own art. THE ORDER WAS ALREADY RIGHT, which is worth saying because it looks like a borrowing and is not. Both sets enumerate a three-bit colour, red green blue counted in binary: one is red in both, three is yellow in both, six is cyan in both. The same arithmetic done twice, forty years apart. The one place they differ is slot 0, and that difference is forced - this screen is ink on black, so ink cannot be black, and slot 0 is grey where ANSI's is black. Every sequence begins with a reset, so going from bank 8 to bank 1 does not write red on the grey paper bank 8 left behind. Scheme 0 is a bare reset rather than grey on black, and a terminal is assumed to start plain - so a machine that never asks for a colour says nothing at all, and one that does put the terminal back on its way out. Two ways out, because the two endings have different rules: stopping on purpose goes through stdio, since atexit runs BEFORE the buffer is flushed and a reset written to the file descriptor would arrive in front of the text it is meant to follow. Dying on a signal writes the four bytes directly and accepts that the buffer may be lost. colourTest walks all sixteen and then halts WITH ONE STILL SET, so the recording shows the reset after the halt line rather than before it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E2JrLzFvuFX9fgi1LDRjrW
This commit is contained in:
co-authored by
Claude Opus 5
parent
94bdf71356
commit
b83ba5bf7a
@@ -931,6 +931,14 @@ The palette lives at 0xFC00 in video memory, four bytes an entry - red, green, b
|
||||
|
||||
`Programs/Examples/colours.asm` does all of that in eighty lines and prints the result. It shows the sixteen pairs, shows what XOR 8 does to each, and then changes one of them by writing three bytes into the palette, so that the difference between using the colours a machine wakes up with and choosing your own is visible in one program.
|
||||
|
||||
**And it reaches a terminal too.** The attribute used to mean something to the screen and nothing to the serial line, so a fault printed in red was red in the window and grey down the wire. The console now says the scheme in ANSI as well, on the same terms as it says the cursor: a register write only marks it and the next character sends it, so setting a scheme and printing nothing says nothing, and setting the same scheme twice costs one sequence rather than two.
|
||||
|
||||
The mapping is a table rather than a translation, because **the order was already right**. Both sets enumerate a three-bit colour - red, green and blue counted in binary - so one is red in both, three is yellow in both, six is cyan in both. The same arithmetic was done twice, forty years apart. The one place they differ is slot 0, and that difference is forced: this screen is ink on black, so ink cannot be black, and slot 0 is grey where ANSI's is black.
|
||||
|
||||
Scheme 0 is sent as a bare reset rather than as grey on black, and a terminal is assumed to start plain - so a machine that never asks for a colour says nothing at all. **Plain text on somebody's terminal means their plain text**, and forcing grey on black would fight a terminal set up the other way round, which is the kind of thing this console exists not to do. A machine that stops with a scheme still set puts the terminal back to plain on its way out, however it stops.
|
||||
|
||||
What does *not* cross is the page: the attribute's other nibble says which tiles a cell draws from, which is a fact about the screen's own art and means nothing to a terminal.
|
||||
|
||||
### Moving The Cursor:
|
||||
|
||||
Three more registers, because that is how this machine talks to everything else.
|
||||
|
||||
Reference in New Issue
Block a user