The console draws a tab instead of dropping it
consoleDraw gave meanings to newline, carriage return and backspace and dropped every other byte below the first glyph. A tab was one of those, so it left no mark on the screen at all - while the same byte went down the serial line, where a host terminal laid it out perfectly. That is why a tab separated file read correctly and displayed wrongly. Type and More were never at fault: they hand the file's bytes to the console unchanged, and the console is where the tabs stopped. An assembler symbol table came out with its fields run together. A tab now moves the cursor to the next stop, eight columns apart, and wraps when the next stop would reach or pass the last column - which is what an ordinary character does at the edge, rather than a rule only tabs obey. It MOVES rather than writing spaces, the way a terminal does: a carriage return followed by a tab steps over what is on the line and leaves it. Kept in the console rather than expanded by Type, More, and every future program that prints text. Three checks in video.sh, each of which fails on a different mistake: a tab renders the same screen as the spaces it stands for, one that runs off the edge renders the same screen as a newline, and sixteen letters tabbed across still have their ink - which is the one that fails if a tab is implemented by writing spaces. Verified with break.sh both ways. 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
7dca141aae
commit
019c93a587
@@ -888,15 +888,18 @@ A console on a machine with a screen sends every byte to both, because a machine
|
||||
|
||||
At reset the font is expanded into tile memory and the palette is given sixteen ink and paper pairs. See Colour below.
|
||||
|
||||
The font is in ASCII order, so a byte becomes a glyph by subtracting 32. Bytes below that have no glyph and are not drawn; three of them do something instead.
|
||||
The font is in ASCII order, so a byte becomes a glyph by subtracting 32. Bytes below that have no glyph and are not drawn; four of them do something instead.
|
||||
|
||||
| Byte | Does |
|
||||
| --- | --- |
|
||||
| 0x0A | Newline. The cursor goes to the start of the next row, and at the last row the screen scrolls instead. |
|
||||
| 0x0D | Carriage return. The cursor goes to the start of the row it is on. |
|
||||
| 0x08 | Backspace. The cursor steps back and rubs out what was there. |
|
||||
| 0x09 | Tab. The cursor moves to the next stop, eight columns apart. |
|
||||
|
||||
Writing past the last column wraps to the next row, the same as a newline.
|
||||
Writing past the last column wraps to the next row, the same as a newline. So does a tab whose next stop would reach or pass the last column.
|
||||
|
||||
**A tab moves the cursor and marks nothing.** It does not write spaces, which matters as soon as there is anything on the line already: a carriage return followed by a tab steps over what is there and leaves it, exactly as a terminal does. Something that wants the columns cleared has to write the spaces itself.
|
||||
|
||||
### Colour:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user