/* DotsPerfect-MX80 special commands */ #include "exec/types.h" #include "devices/printer.h" #include "devices/prtbase.h" extern struct PrinterData *PD ; DoSpecial(command,OutputBuffer,vline,currentVMI,crlfFlag,Parms) UWORD *command ; /* command number as defined in printer.h */ char OutputBuffer[] ; /* buffer into which to return converted command */ BYTE *vline ; /* value of the current line position */ BYTE *currentVMI ; /* value of the current line spacing */ BYTE *crlfFlag ; /* setting of the add after flag */ UBYTE Parms[] ; /* parameters that came with ANSI command */ { int i = 0 ; int x = 0 ; BOOL DoubleStrike; static char initPrinter[]="\x1bx0\x1b2\x12\x1b5\x1b-\xfe\x1bF\x0d\x1bH\x1bW\xfe"; static char initMarg[]="\xfd\x1bQ\x50\xfd"; if (*command == aRIN ) { /* initialize output buffer */ while(x < 19) { OutputBuffer[x] = initPrinter[x] ; x++ ; } OutputBuffer[10] = '\000'; OutputBuffer[18] = '\000'; if((PD->pd_Preferences.PrintQuality) == LETTER) OutputBuffer[2] = '1'; *currentVMI = 36; /* initially 1/6" line spacing */ if ( (PD->pd_Preferences.PrintSpacing) == EIGHT_LPI ) { OutputBuffer[4] = '0' ; *currentVMI = 27; } if ( (PD->pd_Preferences.PrintPitch) == FINE ) OutputBuffer[5] = '\x0f' ; Parms[0] = (PD->pd_Preferences.PrintLeftMargin); Parms[1] = (PD->pd_Preferences.PrintRightMargin); *command = aSLRM; } /* Set left and right margins */ /* Actually only right margin set as this printer cannot set left margin */ if(*command == aSLRM) { PD->pd_PWaitEnabled = 253; initMarg[3] = Parms[1]; while( i < 5 ) OutputBuffer[x++] = initMarg[i++]; return(x); } if(*command == aDEN4) DoubleStrike = TRUE; if(*command == aDEN3) DoubleStrike = FALSE; if(*command == aSHORP3) { OutputBuffer[x++] = '\x12'; /* Turn off condensed mode */ OutputBuffer[x++] = '\x1b'; /* Reset right margin after... */ OutputBuffer[x++] = 'Q'; /* ....stopping condensed mode */ OutputBuffer[x++] = initMarg[3]; return(x); } if(*command == aPLU) { if((*vline)==0) {(*vline)=1; *command=aSUS2; return(0);} if((*vline)<0) {(*vline)=0; *command=aSUS3; return(0);} return(-1); } if(*command == aPLD) { if((*vline)==0) {(*vline)=(-1); *command=aSUS4; return(0);} if((*vline)>0) {(*vline)=0; *command=aSUS1; return(0);} return(-1); } if(*command == aSUS0) { if(DoubleStrike == FALSE) *command = aDEN3; /* Turn off... */ *vline = 0; /*..doublestrike if it's not supposed to be on */ } if(*command == aSUS1) { if(DoubleStrike == FALSE) *command = aDEN3; /* Turn off... */ *vline = 0; /*..doublestrike if it's not supposed to be on */ } if(*command == aSUS2) *vline = 1; if(*command == aSUS3) { if(DoubleStrike == FALSE) *command = aDEN3; *vline = 0; } if(*command == aSUS4) *vline = (-1); if(*command == aVERP0) *currentVMI = 27; if(*command == aVERP1) *currentVMI = 36; if(*command == aIND) { OutputBuffer[x++] = '\x1b'; OutputBuffer[x++] = 'J'; OutputBuffer[x++] = *currentVMI; return(x); } if(*command == aRIS) PD->pd_PWaitEnabled = 253; /* other special functions would follow here */ return(0) ; }