LEX 'ESCPLEX' ID #5E MSG 0 POLL 0 ENTRY ESCP$ CHAR #F KEY 'ESCP$' TOKEN 1 NIBHEX 1FF ***************************************************** * * Syntax: A$=ESCP$($ [,#]) where $ stands for a string * parameter and # is a repeat multiplier. * For use with HP-IL video interfaces. * ESCP$("BC") ==> "1B421B43" or move the cursor down one * space and to the right one space. The repeat multiplier * will allow you to repeat this move # times. * To really see this work, first do DISPLAY IS *, otherwise * the operating system will send out control characters to * the display, messing up any fancy graphics you may want to * carry out. * * BUG: While you can easily do A$=ESCP$($,Y), you may find that * A$=ESCP$(string1,Y)&ESCP$(string2,Z) returns DATA TYPE ERR. This * seems to be linked with using the "&" concatenator AND the * optional parameter at the same time. While this is annoying, you * can work around this limitation with the ";" concatenator in * PRINT or DISP statments. Can anybody suggest a fix? * * coded by M. Markov, Ver. 2 ***************************************************** NIBHEX 8412 one mandatory $ & one opt. # parm ESCP$ P=C 15 # of parameters C=0 W clear C[W] - C[S] to hold flag for # parms C=C+1 A C[A] => default repeat multiplier = 1 CR1EX store it in R1 ?P= 1 if only one parm, GOYES ESCP2 skip handling opt. # parm GOSBVL MPOP1N pop it on stack GONC ESCP10 is it real& valid? ESCarg GOVLNG ARGERR no, error ESCmem C=RSTK D0=C GOVLNG MEMERR ESCP10 GOSBVL FLTDH let's convert it to hex A=0 S set #parm flag to 1 A=A+1 S AR1EX store it in R1, overwriting default D1=D1+ 16 move back to string parameter ESCP2 GOSBVL POP1S and pop it on the stack CD0EX save PC on RSTK RSTK=C CD1EX D1=C and set D0=D1 D0=C GOSBVL D=AVMS memory check set up D1=D1- 16 decrement to allow for string header C=R1 get repeat multiplier ?C=0 S only one parm, we can forget the opt. parm GOYES ESCP3 D1=D1- 16 no, must skip over ESCP3 R2=A save string parm. length GOSBVL A-MULT new string lenght=len*repeat GOC ESC99 if no overflow C=RSTK restore PC D0=C GOTO ESCarg ARGERR ESC99 C=D1 set D1 to new header, if enough mem C=C-A A decrement D1 value ?C