home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / microcrn / issue_40.arc / SCANNER.ARC / SCRNSTUF.UPD < prev    next >
Text File  |  1988-01-11  |  1KB  |  47 lines

  1. (* Code from Pascal column in Micro Cornucopia Issue #40 *)
  2.  
  3. PROCEDURE StartPrinter(npoints:CARDINAL);
  4. CONST
  5. (* Change these constants and add or delete DOSCALLs to match your printer *)
  6.    ESC = 33C;
  7.    L = 'L';
  8. VAR
  9.    I, J : CARDINAL;
  10. BEGIN
  11.    DOSCALL(5H,ESC);    (* output graphics prefix *)
  12.    DOSCALL(5H, L);
  13.    DOSCALL(5H, npoints MOD 256); (* Low order byte of npoints *)
  14.    DOSCALL(5H, npoints DIV 256); (* high order of npoints *)
  15.    FOR I := 1 TO npoints DO
  16.       DOSCALL(5H,0);
  17.       END;
  18.  
  19.    FOR J := 0 TO 1 DO
  20.       FOR I := 0 TO 10000 DO END;  (* Short Delay to allow printhead to start *)
  21.       END;
  22. END StartPrinter;
  23.  
  24.  
  25. PROCEDURE Scan (VAR R : Buffer);
  26. VAR
  27.    A : ADDRESS;
  28.  
  29. BEGIN
  30.    StartPrinter(1); (* print one column, forces head to home *)
  31.    StartPrinter(Xsize);
  32.    A := ADR(R); (* address of where Modula needs the data *)
  33.    SETREG(AX,2);
  34.    SETREG(BX,A.OFFSET);
  35.    SETREG(DX,A.SEGMENT);
  36.    SETREG(CX,Xsize);
  37.    CODE(PUSHBP);
  38.    SWI(60H);
  39.    CODE(POPBP);
  40.  
  41.    WHILE Scanning^ DO END;    (* This is a quick and dirty method.  More
  42.                                  elegant would be to have the resident scan
  43.                                  software act as a M2 coroutine. *)
  44.    StepPrinter;
  45. END Scan;
  46.  
  47.