Model I

Recently, I bought a Star Micronics NX-1000 printer for my TRS-80.1 had quite a bit of trouble, because it had a bug in the ROM that prevented it from talking to computers that ran slower than about 4 Megahertz clock speed.

While I was debugging this problem, I wrote a handy little printer utility called LPRINT, which now is in constant use. It allows you not only to send any sequence of characters to the printer while you are in DOS, but also to monitor the status of the printer.

This routine does not use the standard printer driver, so it will not work with printers that require special drivers or are not mapped to the standard 37E8H location. It's output cannot be changed with commands like NEWDOS's ROUTE, but on the other hand, any character can be sent without being changed directly to the printer-something many drivers won't let you do.

To assemble the program, you can use most any Z-80 assembler. If you are not using Microsoft's M80 assembler, you can use uppercase and delete the H.z80" directive from the program. Also, make sure you delete the colons at the end of all labels.

To use the program, type LPRINT followed by the hexadecimal codes you want sent to the printer, optionally seperated by spaces and/or commas for readability. For example, LPRINT 07 0D sends the ASCII code for a bell (07) to the printer followed by a carraige return (0D).

While I have found the program useful to see if the printer is on or off line from NEWDOS/8O, it is especially great for sending control codes to the printer from inside a JCL file. For instance, when I turn on my computer, a JCL program runs that sets my printer to print zeroes with slashes (the printer defaults to no slashes).

Some printers will let you choose different text fonts or justification via control codes, and you could for example store commonly used printer settings in JCL files, and run them when you wished to choose a particular setting.

LPRINT/MAC 2.0 PRINTER UTILITY

by Ben Mesander 1137 E. Brooks Street, Apt. 4 Norman, Oklahoma, 73071

usage:

LPRINT xxyyzz... prints hex bytes xx yy zz on printer.

(xx yy zz are any valid hexadecimal 1 byte numbers)

Iprint xx yy zz... you can also use spaces or Iprint xx,yy,zz... commas for a more readable look Iprint xx, yy, zz.. or both for that WILD look! wheel

Iprint with no arguments displays detailed status of printer port.

if it locks up because printer is busy, press break to exit

EQU EQU

equates

EXIT PRINT DOSERR EQU BPARAM EQU DPRINT EQU

.Z80

ENTER:

LD LD

402DH ;dos ready exit

37E8H ¡address of printer port

4409H ;dos error exit

2FH ;bad param(s) error code

4467H ;dos print routine (video)

¡delete this if not using M80 ¡assembler from Microsoft

DE,BUFFER ¡place to store hex bytes

CP JP

START: LD CP JR CP JR CP JR

LOOP2: INC LD CP JR JR

NEXT: INC JP

GETBYT: CALL

Z.PRINIT

Z.NEXT 11

NZ,GETBYT HL

Z,LOOP2 GETBYT HL

START LEGAL

¡hi = command line ¡argument pointer ¡check for no arguments ¡if so, display status ¡else parse command line ¡check for end of line ¡if so, print out stuff ¡sip whitespace

;chk for comma delimeter

¡eliminate funny things ¡like 2 commas in a row

¡try again on next char ¡convert 1 nybble to hex

ADD

A,A ;store In upper 4 bits

ADD

A,A

ADD

A,A

ADD

A,A

LD

C,A

INC

HL

LD

A,(HL) ;get other nybble

CALL

LEGAL ;and store in lower

OR

C ¡order

LD

(DE),A

INC

DE

JP

NEXT

convert 1 ascii hex digit to binary

& check on its legality

LEGAL:

SUB

'0'

JR

C.ERR

CP

'F'-'O' +1

JR

NC.ERR

CP

10

RET

C

SUB

'A'-'9'-1

CP

10

RET

NC

ERR:

POP

AF

POP

AF

LD

A.BPARAM

JP

DOSERR

print out the buffer

PRINIT:

DEC

DE

LD

HL,BUFFER

LOOP:

LD

A,(PRINT) ¡check print status

CP

00111111B

JR

Z, NEXTC

LD

A,(3840H) ¡check for brk key

CP

04H ¡and exit if pressed

JP

Z .EXIT

JR

LOOP

NEXTC:

LD

A,(HL)

LD

(PRINT),A

RST

18H ¡compare de:hl

JP

Z.EXIT

INC

HL

JR

LOOP

stat is the routine that prints

out the status of the printer port.

STAT:

LD

HL.MESS0

CALL

RLCA

A, (PRINT) HL.MESS1A

;get status info

LD LD

RLCA

A, (PRINT) HL.MESS1A

C.OVER 1 HL.MESS1B

;get status info

OVER1 :

OVER2:

OVER3:

OVER4:

CALL LD

RLCA

CALL LD

RLCA

CALL LD

RLCA

CALL JP

PRINTS HL.MESS2A

C.OVER2 HL.MESS2B PRINTS HL.MESS3A

C.OVER3 HL.MESS3B PRINTS HL.MESS4A

C.OVER4 HL.MESS4B PRINTS EXIT

MESS0:

DEFM DEFB

•LPRINT/MAC 2.0' 0DH

MESS1B: MESS1A:

0DH

MESS2B: MESS2A:

'Out of Paper' 0DH

MESS3A: MESS3B:

'Selected'

0DH

MESS4A: MESS4B:

'Fault'

ODH

; print a display on

screen

PRINTS:

PUSH CALL POP

BUFFER

RET END

ENTER

0 0

Post a comment