OCTAL "Loading +CAPS" $PRINT CRLF ; Hijacking Streams - this example inserts a code-path into ; both the user and console IO streams ; Received input is stripped to 7 bits and converted to uppercase CREATE +CAPS LDA ZCHIN get console in vector CPA ACCCIN already installed? JMP END yes - exit STA CCIN save to chain console in LDA ACCCIN get address of chain console code in STA ZCHIN set console in vector STA ZIN also to general in JMP END exit, vectors set CCIN OCT 0 prev ZCIN ACCCIN DEF CCCIN address of chain console code in * constants and variables... LC127 DEC 127 7-bit mask C32645 DEC 32645 constants for input filter code C32671 DEC 32671 LCM32 DEC -32 * new console in handler sub... CCCIN NOP JSB CCIN,I call original console in sub * input filter code AND LC127 mask to 7-bit STA 1 save to B ADA C32645 SSA greater than "z"? JMP NIF yes - no convert LDA 1 ADA C32671 SSA,RSS less than "a"? JMP NIF yes - no convert LDA 1 ADA LCM32 convert to uppercase if lowercase RSS skip to return NIF LDA 1 restore char * end input filter code JMP CCCIN,I return * end of +CAPS END ; "Loading -CAPS" $PRINT CRLF ; restores previous console and general IO vectors CREATE -CAPS /KEEP LDA CCIN SZA,RSS JMP END STA ZCHIN STA ZIN END ; CONSOLE