home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / CPM / PARASOL / VIDEOSTO.ARK / SELPRINT.LIB < prev    next >
Text File  |  1986-08-28  |  2KB  |  62 lines

  1. byte        printer.to.select;
  2. {-----------------------------------------------------------}
  3. procedure    select.printer:
  4. begin
  5. byte            wk.byte;
  6. byte pointer    prn.init.bp;
  7. external    byte    IOBYTE        address ^h0003;
  8. external    label    entry        address ^h0005;
  9.  
  10.     move "N" to wk.byte;
  11.     switch on printer.to.select:
  12.         0 - 15,
  13.         "0" - "9":    begin
  14.             and printer.to.select with ^h0f;
  15.             move "Y" to wk.byte;
  16.             end;
  17.         endswitch;
  18.     if wk.byte = "Y" then
  19.         {----------------------------------------------------------
  20.         {    Locate Printer Parameters
  21.         {----------------------------------------------------------
  22.         mcall entry using 14,0;
  23.         mcall entry using 32,0;
  24.         open startup.file shared error standard;
  25.         add 1 to printer.to.select giving startup.key;
  26.         read startup.file error begin
  27.             display "Internal Error: Invalid Printer Init";
  28.             goto end;
  29.             end;
  30.         {----------------------------------------------------------
  31.         {    Select the indicated printer
  32.         {----------------------------------------------------------
  33.         if startup.prn.unit > 15 then
  34.             move default.printer to startup.prn.unit;
  35.             fi;
  36.         switch on operating.system:
  37.             os.MPM:
  38.                 mcall entry using 160,startup.prn.unit;
  39.             else begin
  40.                 multiply startup.prn.unit by ^h40 giving wk.word;
  41.                 and IOBYTE with ^h3f;
  42.                 or IOBYTE with wk.word[byte] giving IOBYTE;
  43.                 end;
  44.             endswitch;
  45.         {----------------------------------------------------------
  46.         {    Initialize the Printer if needed
  47.         {----------------------------------------------------------
  48.         move #startup.prn.init to prn.init.bp;
  49.         while @prn.init.bp <> ^hff do
  50.             move @prn.init.bp to wk.byte;
  51.             mcall entry using 5,wk.byte;
  52.             add 1 to prn.init.bp;
  53.             od;
  54.         close startup.file error standard;
  55.         mcall entry using 32,prog.user;
  56.         subtract "A" from prog.drive giving wk.byte;
  57.         mcall entry using 14,wk.byte;
  58.         mcall entry using 5,^h1a;    {--detach printer--}
  59.         fi;
  60. end;
  61. {-----------------------------------------------------------
  62.