; What the console's attribute register says down a serial line. ; ; The attribute has always meant something to the SCREEN and nothing to a terminal: its low ; nibble picks one of sixteen ink and paper pairs, and only videoPutCell ever read it. So a ; fault printed in red was red in the window and grey down the wire, and every program that ; chose a colour was choosing it for half its audience. ; ; This walks all sixteen schemes and then stops WITH ONE STILL SET, which is the second half ; of what is being checked: the machine has to put the terminal back to plain on its way out, ; and the reset has to come out AFTER the text rather than in front of it. An atexit handler ; runs before stdio flushes what is buffered, so a reset written straight to the file ; descriptor would arrive first and colour nothing. ; ; Written by Anachronaut #Include print.asm #Program start: ; Banks 0 to 7 are ink on black. Nought is plain and is expected to say nothing at all: a ; terminal is assumed to start plain, so a machine that never asks for a colour must be ; silent rather than opening every session with a reset nobody wanted. RSTA SETD Scheme STA inkNext: SETD Scheme LDA OUTA 0x06 SETD InkText CALL printString SETD Scheme LDA CALL printDigit CALL lineFeed SETD Scheme LDA INCA STA INIB 0d16 CCF SUB BNQ inkNext ; ---- And it stops in colour, on purpose ---- ; ; Fifteen is the last of them and nothing puts it back. What follows this in the recording ; is whatever the machine says on its way out, which is the check. HALT ; A is nought to fifteen, said as ONE HEX CHARACTER. The scheme is a nibble, so a nibble is ; what it should read as - and one character means no scratch byte to hold the second digit ; while the first goes out, which is what the decimal version needed and got wrong. printDigit: INIB 0d10 CCF SUB BRC digitLow ; Borrowed, so it is below ten. MVQA ; What is left once the ten is taken off. INIB 0d65 ; 'A', because the ten has already gone. CCF ADD MVQA OUTA 0x00 RET digitLow: INIB 0d48 CCF ADD MVQA OUTA 0x00 RET #Data InkText: "scheme " Scheme: 0x00