;LCD2LJ (c) R.H.Pigford 1991 ; - updated 9/9/2002 -released 12/05/03 ;PIDPLJ.DO for T200 & PID2LJ.BA 4/23/97 ;from GRF2J2.DO =vJ.2 src code 12/22/93 ;For LaserJet III support ;From GRF202.DO 11/21/92 for Epson Prt. ;From GRF200 v0.1 (c) 5/91 RHP ;for T200, adapted from GRAFIX.CO(c)RHP ;for M100 (c) 1989 RHPigford, for use ;with SKT200.BA (SKETCH.BA) ; T200 M100 ; ---- ---- CURSON: EQU 20328 ;4249H ESC "P" CUROFF: EQU 20333 ;424EH ESC "Q" TOPRT: EQU 33993 ;6D3FH A to LPT PLOT: EQU 36214 ;744CH pixel on UNPLOT: EQU 36215 ;744DH pixel off POSIT: EQU 20379 ;427CH H=col,L=row LCD: EQU 23045 ;4B44H A to LCD, ret KYREAD: EQU 35587 ;7242H INKEY$ CAPS: EQU 4115 ;0FE8H 2/89 P100 pg22 BEEP: EQU 20293 ;4229H ruins BC PUTTXT: EQU 28155 ;11A2H to LCD pointed ;to by HL, ended by 0 ERAEOL: EQU 20348 ;425DH Opndl pg225 CURVAL: EQU 64864 ;65516 ? ;--[ start MENU loop ]----------------- ORG 60000;savem 60000,xxxxx,0 ;xxxxx=60000+lth-240 START: LXI H,0 ;set H=0, L=0 DAD SP ;put SP in HL SHLD MENU+1 ;stuff SP in below MENU: LXI SP,0 ;re-establish SP MVI A,1 STA PRFLAG LXI H,0110H ;row 01D,col 16D CALL GETROW MENU1: CALL CLR16 LXI H,MSG1 CALL PUTTXT MENU2: CALL GETKY CPI 'P' JZ PSXY CPI 27 JZ MENU3 JMP MENU2 MENU3: CALL RSL1P MVI E,120 CALL PUTROW RET ;end Menu MSG1: DB 27,'pLCD2LJ',27,'q',' ',171, DB 'RHP

rint to LazrJet ' DB '',0 ;= GETKY: ORA A ;clear carry CALL KYREAD JZ GETKY CALL CAPS RET ;= CLR16: LXI H,0110H ;16d=10h CALL POSIT CALL ERAEOL RET ;= ; PIDPLJ (c)1997 RHP ; Store val from last row, send prompt. PSXY: CALL CLR16 LXI H,RESMSG CALL PUTTXT PSXYH: CALL GETKY CPI 27 JNZ PSXYH1 CALL RSL1P MVI E,120 CALL PUTROW JMP MENU PSXYH1: CPI '1' JM PSXYH CPI '5' JP PSXYH SUI 30H STA PRFLAG CALL CLR16 LXI H,MGNMSG ;margin question CALL PUTTXT PSXYMR: CALL GETKY CPI 27 JZ PSXY CPI '0' JM PSXYMR CPI '6' JP PSXYMR CPI '3' JZ PSXYMR CPI '4' JZ PSXYMR STA MGNVAL CALL STMGN JC FINISH ; BRK pressed? ; --- Start the printing from here --- LXI H,LJPRES ;set rsn to portra CALL LJCMD CALL RSL1P MVI E,120 CALL PUTROW ;restore last row CALL PIKRES ;set rast gra mode LXI H,STRTRG ;start graphics CALL LJCMD LXI H,0101H SCNROW: CALL GETROW PUSH H CALL PRTLJ ;if any PRFLAG set ENDROW: POP H NXTROW: INR L MVI A,11H ;17d=11h CMP L JZ FINISH MVI H,01H JMP SCNROW ; --- End main printing loop ------ ;===================================== ; PIKRES checks PRFLAG, 1,2 3, or 4 ; sends raster graphics command ; resoln msg to LJ printer. ; Somewhat CRUDE CODE, but it works. PIKRES: LDA PRFLAG ;a 1 or a 2 CPI 1 JZ PIKRS1 CPI 2 JZ PIKRS2 CPI 3 JZ PIKRS3 CPI 4 JZ PIKRS4 PIKRS1: LXI H,LJRES1 JMP PIKRS5 PIKRS2: LXI H,LJRES2 ;if not, must be 2 JMP PIKRS5 PIKRS3: LXI H,LJRES3 JMP PIKRS5 PIKRS4: LXI H,LJRES4 PIKRS5: CALL LJCMD RET LJRES1: DB 27,'*t300R',255 LJRES2: DB 27,'*t150R',255 LJRES3: DB 27,'*t100R',255 LJRES4: DB 27,'*t75R',255 ;==================================== ; Set Left Margin to preset values STMGN: LDA MGNVAL CPI '0' JZ STMGN0 CPI '5' JZ STMGN5 CPI '1' JZ STMGN1 CPI '2' JZ STMGN2 STMGN0: LXI H,MGN0 JMP STMGN9 STMGN5: LXI H,MGN5 JMP STMGN9 STMGN1: LXI H,MGN10 JMP STMGN9 STMGN2: LXI H,MGN20 STMGN9: CALL LJCMD RET ;MGNVAL: DS 1 MGN0: DB 27,'&a0C',255 MGN5: DB 27,'&a5C',255 MGN10: DB 27,'&a10C',255 MGN20: DB 27,'&a20C',255 MGNMSG: DB 'Left Margin? <0> <5> ' DB '<1>0 <2>0 ',0 ;==== Messages ======================== RESMSG: DB 'Prt Size? ' DB '<1>X <2>X <3>X <4>X' DB ' or ',0 ; LJPRES: DB 27,'*r0F',255 ; STRTRG: DB 27,'*r1A',255 ;at curs ; TRNRSD: DB 27,'*b' DB '60' ;60 bytes of values DB 'W',255 ; ENDRG: DB 27,'*rB',255 ;==== send cmd strings to LaserJet === LJCMD: MOV A,M CPI 255 RZ CALL TOPRT ;consider using ;existing print routine ;with Crtl-C test JC MENU INX H JMP LJCMD ;====================================== ; PRTLJ ; -- test 240 BUFFFER bytes, make 60 ; -- new bytes & send to LzrJet Prt ; B - the test bit/row for test across ; C - build new byte ; D - keep 8 tests of BUFF bit count ; BYTCNT - keep 60 byte count ; E - move the "or" bit with BUFF Mem ; PIXROW 8>0 count of test byte usage ; PRTLJ: MVI A, 9 ;do 8 rows of pixels STA PIXROW ;row grphs line cnt MVI A,00000001B MOV B,A ;set test byte in B ROWCNT: MVI A,2 STA ROWPAS ;# times row printed LDA PIXROW ;get the row count DCR A ;subtract 1 RZ ;done 8 if ln#=0, go ;back to base prog to ;refill buffer w/ LCD ;data STA PIXROW ;if not go on MOV A,B ;get test byte RRC ;start first w/ MSB MOV B,A ;save test byte ROWAGN: LXI H,TRNRSD ;trans rast data CALL LJCMD ;prep for 30 bytes LXI H,BUFFER-1 ;LCD data area MVI A,61 STA BYTCNT DOLIN: LDA BYTCNT DCR A ;prt 60 bytes yet? JNZ DOLIN1 ;not yet LDA ROWPAS ;yes, chk for twice DCR A JZ ROWCNT ;yes, done row twice STA ROWPAS ;no, repeat JMP ROWAGN ;since yet not twice DOLIN1: STA BYTCNT DOBYT: MVI A,0 MOV C,A ;clear new byte val MVI A,5 ;test only 4 bytes MOV D,A ;bit test counter MVI A,00000011B MOV E,A ;set "OR" byte's bits DOBYT1 MOV A,E ;positioned "or" bit RRC RRC MOV E,A DCR D ;done all pick offs ;4 bits of BUFFER vals JZ DOBYT3 ;if yes, print INX H ;if no, do next LCD val MOV A,M ;get a byte from buffer ANA B ;is this bit/row a 1? ;If yes, add 2 bits to ;the new byte in C JZ DOBYT2 ;not a 1, skip over, ;leave the 0 bit in C ;unchanged MOV A,C ;get the new byte ORA E ;add the bit in slot MOV C,A DOBYT2: JMP DOBYT1 DOBYT3: MOV A,C ;get the good new byte CALL TOPRT JC MENU JMP DOLIN ;go to next bit row ;===================================== ;PIXROW: DS 1 ;BYTCNT: DS 1 ;ROWPAS: DS 1 ;PRFLAG: DS 1 ;==== store row graphic vals GETROW: CALL RSL1P CALL CURSON NXTCOL: CALL POSIT PUSH PSW CALL TIMER POP PSW PUSH H CALL TWSTCR POP H INR H MVI A,41 CMP H JNZ NXTCOL CALL CUROFF RET ;===================================== ;PUTROW puts the graphics back by pixs ; assumes E = start row (0-120) for 16 ; rows of pixels PUTROW: MVI B,10000000B MVI C,0 NXTY: MVI D,0 LHLD L1PNTR INR C MOV A,C CPI 9 RZ BYTE: PUSH H MOV A,M ANA B PUSH D PUSH B JNZ PSET JZ PRESET BACK: POP B POP D POP H INX H INR D MOV A,D CPI 240 JNZ BYTE MOV A,B RRC MOV B,A INR E JMP NXTY PSET: CALL PLOT JMP BACK PRESET: CALL UNPLOT JMP BACK ;==== TWSTCR ========================= ; Cursor value holds 6 columns, each ; column is a byte containing 8 vert ; bits representing the pixels, but ; they are upside down and have to be ; fliped over (create new byte) before ; the new rightside-up bytes can be put ; in the CBUFer memory (6 bytes long). TWSTCR: LXI H,CBUF SHLD CBPNTR MVI B,00000001B MVI D,6 ;column byte counter NX_BUF: LHLD CBPNTR XRA A ;A=0 MOV M,A ;clear RAM addr MVI E,8 ;vert bit counter MVI C,10000000B;first test byte LXI H,CURVAL-1 NX_CUR: INX H ;point to curs byte-row MOV A,M ;get orig val ANA B ;is this pix on? JZ BYPASS ;no, bypass some code ;because no need to ;add 0s to a 0 bit PUSH H ;yes, add it to the byte ;under construction LHLD CBPNTR MOV A,M ;get the CBUF val ORA C ;add a corresponding bit MOV M,A;save back to mem CBUF POP H BYPASS: MOV A,C RRC ;increment test to next bit MOV C,A DCR E; done all 8 bits? JNZ NX_CUR ;no, do next byte LHLD CBPNTR ;yes save in BUFFER MOV A,M ;get the new byte CMA ;reverse video LHLD L1PNTR ;pointer for BUFFER MOV M,A ;save it where L1PNTR ;points in BUFFER mem INX H ;add 1 to L1PNTR SHLD L1PNTR LHLD CBPNTR INX H ;go to next row-byte SHLD CBPNTR MOV A,B RLC ;rot to next build bit MOV B,A DCR D ;last of 6 bytes? JNZ NX_BUF ;no, do another RET ;yes, done all 6, all done ;CBPNTR: DS 2 ;pointer to CBUF ;CBUF: DS 6 ;to build 6 new bytes ;==== time to illuminate TIMER: MVI A,200 TIME?: NOP NOP NOP NOP NOP DCR A RZ JMP TIME? ;==== FINISH: LXI H,ENDRG ;reset out of ;raster graphics CALL LJCMD BEEP1: CALL BEEP CALL CUROFF JMP MENU ;= reset mem pointer RSL1P: PUSH H LXI H,BUFFER SHLD L1PNTR POP H RET ;=== variables & buffer MGNVAL: DS 1 PIXROW: DS 1 BYTCNT: DS 1 ROWPAS: DS 1 PRFLAG: DS 1 CBPNTR: DS 2 ;pointer to CBUF CBUF: DS 6 ;to build 6 new bytes L1PNTR: DS 2 BUFFER: DS 240 ;only need for 1 row of ;LCD byte values END: END