$title ('MP/M II V2.0  Console Identification')
console:
do;

$include (copyrt.lit)
/*
  Revised:
    14 Sept 81  by Thomas Rolander
*/

  declare start label;
  declare jmp$to$start structure (
    jmp$instr byte,
    jmp$location address ) data  (
    0C3H,
    .start-3);

  mon1:
    procedure (func,info) external;
      declare func byte;
      declare info address;
    end mon1;

  mon2:
    procedure (func,info) byte external;
      declare func byte;
      declare info address;
    end mon2;

  /**************************************
   *                                    *
   *       B D O S   Externals          *
   *                                    *
   **************************************/

  print$console$buffer:
    procedure (buffer$address);
      declare buffer$address address;
      call mon1 (9,buffer$address);
    end print$console$buffer;

  /**************************************
   *                                    *
   *       X D O S   Externals          *
   *                                    *
   **************************************/

  terminate:
    procedure;
      call mon1 (143,0);
    end terminate;

  get$console$number:
    procedure byte;
      return mon2 (153,0);
    end get$console$number;


  /*
    Main Program
  */

  declare cnsmsg (*) byte initial
    (0dh,0ah,'Console = x','$');

start:
  do;
    cnsmsg(12) = get$console$number + '0';
    call print$console$buffer (.cnsmsg);
    call terminate;
  end;

end console;
