$sysprog$
program cursorsw (input,output);
var
  regselect [hex('510001')]:    char;
  crtreg    [hex('510003')]:    char;
  reg,byte:  char;
  x: integer;
  instr: string[50];

{    Note:  the compiler accesses type 'char' as a byte, 
     but type '0..255' as a word; it won't make an 
     unsigned subrange.                                  }

begin
  repeat
    writeln;
    write('What register number (enter in decimal)? ');  
    readln(x);  
    if (x<10) or (x>15) then writeln('Bad register number')
    else
      begin
        reg := chr(x);
        write('Write what value (enter 8-bit binary pattern)? ');
        readln(instr);  byte := chr(binary(instr));
        regselect := reg;
        crtreg := byte;
      end;
  until not true;
end.
