Unit AmigaPrinter;

Interface
Uses AmigaDOS, Serial, Parallel, Intuition, Graphics, Input, Timer, Exec;

Type
  tDeviceData = Record
		  dd_Device: tLibrary;
		  dd_Segment: Pointer;
		  dd_ExecBase: Pointer;
		  dd_CmdVectors: Pointer;
		  dd_CmdBytes: Pointer;
		  dd_NumCommands: Integer;
		End;

  pPrinterSegment = ^tPrinterSegment;
  tPrinterData = Record
		  pd_Device: tDeviceData;
		  pd_Unit: tMsgPort;
		  pd_PrinterSegment: LongInt;
		  pd_PrinterType: Integer;
		  pd_SegmentData: pPrinterSegment;
		  pd_PrintBuf: pShortInt;
		  pd_PWrite: pPointer;
		  pd_PBothReady: pPointer;
		Case Integer of
		0: (
		  pd_p: Record
		  IOR0: tIOExtPar;
		  IOR1: tIOExtPar;
		  End;
		);
		1: (
		  pd_s: Record
		  IOR0: tIOExtSer;
		  IOR1: tIOExtSer;
		  End;
		  pd_TIOR: ttimerequest;
		  pd_IORPort: tMsgPort;
		  pd_TC: tTask;
		  pd_Stk: Array [0..2047] of ShortInt;
		  pd_Flags: ShortInt;
		  pd_pad: ShortInt;
		  pd_Preferences: tPreferences;
		  pd_PWaitEnabled: ShortInt;
		);
		End;

  tPrinterExtendedData = Record
		  ped_PrinterName: pShortInt;
		  ped_Init: Pointer;
		  ped_Expunge: Pointer;
		  ped_Open: pPointer;
		  ped_Close: Pointer;
		  ped_PrinterClass: ShortInt;
		  ped_ColorClass: ShortInt;
		  ped_MaxColumns: ShortInt;
		  ped_NumCharSets: ShortInt;
		  ped_NumRows: Integer;
		  ped_MaxXDots: LongInt;
		  ped_MaxYDots: LongInt;
		  ped_XDotsInch: Integer;
		  ped_YDotsInch: Integer;
		  ped_Commands: pppShortInt;
		  ped_DoSpecial: pPointer;
		  ped_Render: pPointer;
		  ped_TimeoutSecs: LongInt;
		  ped_8BitChars: ppShortInt;
		  ped_PrintMode: LongInt;
		  ped_ConvFunc: pPointer;
		End;

  pDevice = ^tDevice;
  pUnit = ^tUnit;
  tIOPrtCmdReq = Record
		  io_Message: tMessage;
		  io_Device: pDevice;
		  io_Unit: pUnit;
		  io_Command: Integer;
		  io_Flags: ShortInt;
		  io_Error: ShortInt;
		  io_PrtCommand: Integer;
		  io_Parm0: ShortInt;
		  io_Parm1: ShortInt;
		  io_Parm2: ShortInt;
		  io_Parm3: ShortInt;
		End;

  tPrinterSegment = Record
		  ps_NextSegment: LongInt;
		  ps_runAlert: LongInt;
		  ps_Version: Integer;
		  ps_Revision: Integer;
		  ps_PED: tPrinterExtendedData;
		End;

  tcolorEntry = Record
		Case Integer of
		0: (
		  colorLong: LongInt;
		);
		1: (
		  colorByte: Array [0..3] of ShortInt;
		);
		2: (
		  colorSByte: Array [0..3] of ShortInt		);
		End;

  pRastPort = ^tRastPort;
  pColorMap = ^tColorMap;
  tIODRPReq = Record
		  io_Message: tMessage;
		  io_Device: pDevice;
		  io_Unit: pUnit;
		  io_Command: Integer;
		  io_Flags: ShortInt;
		  io_Error: ShortInt;
		  io_RastPort: pRastPort;
		  io_ColorMap: pColorMap;
		  io_Modes: LongInt;
		  io_SrcX: Integer;
		  io_SrcY: Integer;
		  io_SrcWidth: Integer;
		  io_SrcHeight: Integer;
		  io_DestCols: LongInt;
		  io_DestRows: LongInt;
		  io_Special: Integer;
		End;

  pcolorEntry = ^tcolorEntry;
  tPrtInfo = Record
		  pi_render: pPointer;
		  pi_rp: pRastPort;
		  pi_temprp: pRastPort;
		  pi_RowBuf: pInteger;
		  pi_HamBuf: pInteger;
		  pi_ColorMap: pcolorEntry;
		  pi_ColorInt: pcolorEntry;
		  pi_HamInt: pcolorEntry;
		  pi_Dest1Int: pcolorEntry;
		  pi_Dest2Int: pcolorEntry;
		  pi_ScaleX: pInteger;
		  pi_ScaleXAlt: pInteger;
		  pi_dmatrix: pShortInt;
		  pi_TopBuf: pInteger;
		  pi_BotBuf: pInteger;
		  pi_RowBufSize: Integer;
		  pi_HamBufSize: Integer;
		  pi_ColorMapSize: Integer;
		  pi_ColorIntSize: Integer;
		  pi_HamIntSize: Integer;
		  pi_Dest1IntSize: Integer;
		  pi_Dest2IntSize: Integer;
		  pi_ScaleXSize: Integer;
		  pi_ScaleXAltSize: Integer;
		  pi_PrefsFlags: Integer;
		  pi_special: LongInt;
		  pi_xstart: Integer;
		  pi_ystart: Integer;
		  pi_width: Integer;
		  pi_height: Integer;
		  pi_pc: LongInt;
		  pi_pr: LongInt;
		  pi_ymult: Integer;
		  pi_ymod: Integer;
		  pi_ety: Integer;
		  pi_xpos: Integer;
		  pi_threshold: Integer;
		  pi_tempwidth: Integer;
		  pi_flags: Integer;
		End;



Const
  PCC_YMCB = $4;
  aSTBM = $40;
  aCAM = $42;
  PCMWHITE = $3;
  P_BUFSIZE = $100;
  SPECIAL_FULLCOLS = $4;
  PCC_BGRW = $C;
  aSBC = $D;
  aSLRM = $41;
  SPECIAL_FRACROWS = $20;
  PPCB_GFX = $0;
  aSLPP = $39;
  aIND = $2;
  aSFC = $C;
  PDERR_DIMENSIONOVFLOW = $5;
  PPCF_GFX = $1;
  PCMBLUE = $0;
  aNEL = $3;
  aPLD = $21;
  PCMCYAN = $2;
  aBMS = $3F;
  aFNT10 = $2C;
  PCC_BGR = $A;
  PRD_QUERY = $C;
  PDERR_TOOKCONTROL = $8;
  P_STKSIZE = $800;
  PPC_BWALPHA = $0;
  PPC_COLORGFX = $3;
  aTBCALL = $49;
  PCMMAGENTA = $1;
  aRIN = $1;
  aRAW = $4C;
  SPECIAL_MILCOLS = $1;
  aSGR22 = $B;
  aSGR23 = $7;
  aLMS = $3C;
  aSGR24 = $9;
  PRD_DUMPRPORT = $B;
  aRIS = $0;
  aHTS = $43;
  SPECIAL_FULLROWS = $8;
  aPLU = $20;
  aSHORP0 = $E;
  aRMS = $3D;
  SPECIAL_NOFORMFEED = $800;
  aSHORP1 = $10;
  PCC_YMC = $2;
  PCC_4COLOR = $4;
  aSHORP2 = $F;
  aTMS = $3E;
  SPECIAL_DENSITYMASK = $700;
  aSHORP3 = $12;
  PDERR_INTERNALMEMORY = $6;
  PCMRED = $2;
  aSHORP4 = $11;
  PDERR_BADDIMENSION = $4;
  aSHORP5 = $14;
  aSHORP6 = $13;
  aPERF0 = $3B;
  aTBSALL = $4A;
  aTSS = $30;
  PRD_RAWWRITE = $9;
  SPECIAL_ASPECT = $80;
  aVTS = $44;
  SPECIAL_CENTER = $40;
  aEXTEND = $4B;
  aRI = $4;
  SPECIAL_NOPRINT = $2000;
  PDERR_INVERTHAM = $3;
  SPECIAL_DIMENSIONSMASK = $BF;
  PPC_COLORALPHA = $2;
  SPECIAL_MILROWS = $2;
  aDEN1 = $1A;
  aVERP0 = $37;
  PDERR_NOERR = $0;
  PCC_BW = $1;
  PCC_WB = $9;
  aDEN2 = $19;
  aVERP1 = $38;
  aTBC0 = $45;
  aDEN3 = $18;
  aTBC1 = $47;
  aDEN4 = $17;
  SPECIAL_TRUSTME = $1000;
  aDEN5 = $16;
  aPROP0 = $2F;
  aTBC3 = $46;
  aDEN6 = $15;
  aPROP1 = $2E;
  aTBC4 = $48;
  aPROP2 = $2D;
  PPCB_COLOR = $1;
  PPCF_COLOR = $2;
  PCMBLACK = $3;
  PCC_BGR_WB = $B;
  P_SAFESIZE = $80;
  PRD_PRTCOMMAND = $A;
  aFNT0 = $22;
  aFNT1 = $23;
  aJFY0 = $34;
  aFNT2 = $24;
  aJFY1 = $36;
  aFNT3 = $25;
  aSGR0 = $5;
  aFNT4 = $26;
  aJFY3 = $35;
  PDERR_BUFFERMEMORY = $7;
  aSGR1 = $A;
  aFNT5 = $27;
  aFNT6 = $28;
  aJFY5 = $31;
  aSGR3 = $6;
  aFNT7 = $29;
  aJFY6 = $33;
  aSGR4 = $8;
  aFNT8 = $2A;
  aJFY7 = $32;
  aFNT9 = $2B;
  PCC_YMC_BW = $3;
  SPECIAL_FRACCOLS = $10;
  PCC_ADDITIVE = $8;
  PCMGREEN = $1;
  SPECIAL_DENSITY1 = $100;
  PDERR_CANCEL = $1;
  SPECIAL_DENSITY2 = $200;
  SPECIAL_DENSITY3 = $300;
  aSUS0 = $1F;
  SPECIAL_DENSITY4 = $400;
  aSUS1 = $1C;
  SPECIAL_DENSITY5 = $500;
  PCMYELLOW = $0;
  aSUS2 = $1B;
  aPERF = $3A;
  SPECIAL_DENSITY6 = $600;
  aSUS3 = $1E;
  SPECIAL_DENSITY7 = $700;
  aSUS4 = $1D;
  PDERR_NOTGRAPHICS = $2;
  PPC_BWGFX = $1;
  PCC_MULTI_PASS = $10;




End.
