* SETPRT PTDOS command to configur a TI 810 printer * by Tom M Quinn on 7/12/79 * format: * SETPRT n1,n2,n3,n4{,.,.,.,0},n5{,.,.,.,0} * all parameters are optional and will default to TI 810 * initialized values. * n1 = form length (4-112 lines) defaults to 66 * n2 = line width (2-126 characters) defaults to 132 * n3 = lines/inch (6 or 8 lines) defaults to 6 * n4 = horizontal tabs (this program allows up to 16 character * position tabs to be set ending with a null) defaults to none * n5 = vertical tabs (this program allows up to 16 line position * tabs to be set ending with a null) defaults to none * ex. SETPRT 100:D,,8,,27:D,0 * COPY NPTDEFS get system definitions ORG 0D000H load address XEQ 0D000H start address * control characters CR EQU 0DH DC1 EQU 11H ESC EQU 1BH * initialization of printer LXI SP,STACK set up stack MVI A,1 reset TUART OUT 52H serial port XRA A block out all OUT 53H interupts MVI A,08H set baud rate OUT 50H to 1200 baud MVI A,DC1 put printer OUT 51H on line * read parameters following command and take appropriate action CALL PSCNN check for a parameter JZ NEXT2 default first parameter LXI H,PARM1+2 point to chr sequence and patch MOV M,E store binary # DCX H point to start DCX H of chr sequence CALL OUT send it NEXT2 CALL PSCNN check for next parameter JZ NXT2D default second parameter LXI H,PARM2+2 point to chr sequence and patch MOV M,E store binary # DCX H point to start DCX H of chr sequence CALL OUT send it JMP NEXT3 continue NXT2D LXI H,LWDEF point to line width chr default sequence CALL OUT send it NEXT3 CALL PSCNN check for next parameter JZ NEXT4 default third parameter MOV A,E get binary reply CPI 6 match 6 chrs/inch JZ NXT3 yes CPI 8 no, try 8 chrs/inch JNZ ERRSY neither? must be a syntax error MVI A,'5' patch for 8 JMP NXT3F go do it NXT3 MVI A,'4' patch for 6 NXT3F STA PARM3+1 do it LXI H,PARM3 point to chr sequence CALL OUT send it NEXT4 CALL PSCNN check for next parameter JZ NEXT5 default fourth parameter LHLD PAR4 get address of PARM4+2+.... MOV M,E patch binary # INX H point to next patch location SHLD PAR4 store this address XRA A zero A CMP E done if null JNZ NEXT4 no, loop until DCR A yes, make 0 into -1 (FF) MOV M,A patch a delimiter LXI H,PARM4 point to chr sequence CALL OUT send it NEXT5 CALL PSCNN check for last parameter JZ RETN default fifth parameter, done LHLD PAR5 get address of PARM5+2+.... MOV M,E patch binary # INX H point to next patch location SHLD PAR5 store this address XRA A zero A CMP E done if null JNZ NEXT5 no, loop until DCR A yes, make 0 into -1 (FF) MOV M,A patch a delimiter LXI H,PARM5 point to chr sequence CALL OUT send it * subroutines follow * RETN CALL SYS system call DB RETOP normal return to system * output a string pointed to by HL and delimited by -1 OUT IN 50H check status port ANI 80H transmit buffer empty yet? JZ OUT no, loop until MOV A,M get a character CPI -1 delimiter yet JZ DELM yes, now check delimiter OUT 51H no, send it INX H point to next chr JMP OUT send another chr * parameter scanner and delimiter checker PSCNN MVI A,PSOPT read chrs until delimiter LXI D,BUFPS point to PS output buffer CALL PSCAN parameter scanner call JC ERRPS PS error STA DELT temporarily store delimiter JZ DELM no chrs scanned, check delimiter MVI A,PSV+40H convert # in user buffer to binary LXI H,BUFPS point to # delimited by a null LXI D,BUFSP point to PS output buffer CALL PSCAN parameter scanner call JC ERRPS PS error MOV A,D check high byte ORA A for zero JNZ DELL not zero, error, # too large POP H get return address INX H bump INX H 3 INX H times PCHL . return to just past jump DELM LDA DELT retrieve delimiter CPI ',' comma? RZ . yes, return LXI H,RETN set up stack for possible return if done XTHL . switch stack & HL CPI ';' semicolon? RZ . yes, done CPI CR carriage return? RZ . yes, done DELL LXI H,ERRSY set up stack for syntax error return XTHL . switch stack and HL RET . off to syntax error * parameter scanner error handler ERRPS POP H fix stack MOV A,E get error code ORA A zero? JZ ERRSY syntax error STA ERRCD patch error code for report * syntax error handler ERRSY MVI A,0 reset sys, CRLF, and LXI H,-1 no 2nd line message CALL UTIL system utility call DB UXOP explain error JMP ABORT error return DB -1 no operation code ERRCD DB ERIOS illegal option specifier * ABORT CALL SYS system call DB RESOP drastic return, reset all * ram storage area follows DELT DB 0 delimiter storage LWDEF DB ESC,';',-1 sets line width to 132 PAR4 DW PARM4+2 parameter 5 patch pointer PAR5 DW PARM5+2 parameter 6 patch pointer PARM1 DB ESC,'2',0,-1 form length chr code PARM2 DB ESC,':',0,-1 line width chr code PARM3 DB ESC,0,-1 lines/inch chr code PARM4 DB ESC,'3' horizontal tabs chr code DS 16 PARM5 DB ESC,'1' vertical tabs chr code DS 16 BUFPS DS 20 parameter scanner buffer BUFSP DS 20 same STACK EQU $+16 stack location END