perm filename SERTST.SAI[KBD,ROB] blob sn#451858 filedate 1979-06-18 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	begin "SERTST"
C00006 ENDMK
C⊗;
begin "SERTST"

comment
  ⊗
    This little program reads the DCA scanner port into which the
    prototype Keyboard Serializer is plugged.  The bits are converted into
    appropriate characters and printed out on your screen.  Typing any
    character on your keyboard will send that character to the serializer
    (which should return the current state of the serialized keyboard in
    Spacewar mode).
  ⊗;

  REQUIRE "{}<>" DELIMITERS;

  DEFINE SP={" "},
    CR={('15&"")},
    LF={('12&"")},
    ↓={('15&'12)},
    TAB={('11&"")},
    FF={('14&"")},
    QT={""""},
    ALT={('175&"")},
    VT={('13&"")},
    BS={('177&"")};

  DEFINE α = {COMMENT},
    ⊂ = {BEGIN},
    ⊃ = {END};

  DEFINE $DBUG = TRUE;
  DEFINE DBUGPRINT(str) = {IF $DBUG THEN PRINT(str)};
  DEFINE THROUGH = {STEP 1 UNTIL};
  DEFINE DOWNTO = {STEP -1 UNTIL};
  DEFINE DOWN = {STEP -1 UNTIL 0};

  DEFINE PI = {3.14159265358979};

  DEFINE InDev = {"TTY35"};
  DEFINE AsciiMode = {('0)};
  DEFINE ImageMode = {('10)};
  DEFINE IBuffs = {('01)};
  DEFINE OBuffs = {('01)};
  DEFINE EndOfFile = {('177)};
  DEFINE PageMark = {('14)};
  DEFINE NewLine = {('12)};


α data storage;

  integer TTYCHAN, CNT, BRK, EOF, CHAR;
  
α executable code;

α the main program;

  open(TTYCHAN←getchan, InDev, AsciiMode, IBuffs, OBuffs, CNT←'1, BRK, EOF);

  breakset(1,"","A");	α Append the break character to the input string;
  breakset(1,"","X");	α Don't break on nothing (break on everything);
  breakset(1,"","O");	α Omit nothing;
  breakset(1,"","Z");	α And zero bytes are really truly okay;


  while TRUE do
    ⊂ "just read in the characters"
      print(CVOS(input(TTYCHAN,1))," ",brk," ",eof,↓);
α     call(2,"sleep");
α     out(TTYCHAN,"!");
    ⊃ "just read in the characters";

end "SERTST"