From: Mervyn Baldwin
Subject: Re: Redirection
Barry,
>There were typing errors in the second listing concerning the init data.
>A . instead of a , and another one I don't remember now.
If so sorry about that. It's what comes from trying to tidy-up a
listing and then not testing it again. Down with pretty-printing!
BUT I just checked and the init string for my printer (in IBM mode at
least) is
01b,040,01b,'S0',01b,'A',5,01b,'2$'
^
|
It works fine on my printer. Maybe different on yours. Maybe different
in Epson mode.
>More important, it looks like you set the line spacing twice.
Don't see where. Where?
>Anyhow, this is what works for my LC-20 Star 9-dot.
>I can draw a box that looks like one and there is white space between lines
>when printing characters.
>
>init db 01Bh, 40h ;Esc@ ->reset printer
> db 01Bh,'S0' ;EscS0 ->set Superscript
> db 01Bh,'3',0Dh,24h ;Esc3 13 ->set 13/216" linespace
> ; and string terminator
I'll certainly try your line-spacing. Thanks!
--------------------------------------------------------------
Here's the latest version. Still working on a check for the output
redirection. Several people sent promising code but not got it
incorporated yet.
;--------------------------------------------------------------
;CRAMP.8 ->CRAMP.COM
;Use as: CRAMP PRN (or outfile)
;Prints text file compressed 150 lines + 8 empty lines
;Would need to change linecounter for B.Blocks linespace.
jmp short start
init db 01b,040 ;Esc @ -> Reset Printer
db 01b,'S0' ;Set Superscript
db 01b,'A',5 ;Set Linespace= 5/72 inch
db 01b,'2$' ;Execute Esc A command
;Barry Blocks linespace. Comment out last two db lines above.
;and use instead...
; db 01b,'3',0d,'$' ; sets 13/216 linespace
;This works. Tighter spacing still but (on my printer) gets a bit
;confused with first two/three lines.
erm db 'USAGE: CRAMP outfile.ext (or >PRN)',0d,0a,'$'
feed db 9 dup(0a),'$' ;(8 gets 1 line short in 4 pages)
buffer db '?'
start:
;Courtesy of J. Vahn. Added routine
mov ah,0b ;to check for correct input.
int 021 ;Func 0B: Check STDIN status
or al,al ;if redirection in use there will
jz error ;be no char in kbd buffer
lea dx,init ;send init string
mov ah,9
int 21h
xor si,si
again:
mov ah,03f
mov bx,0 ;handle=STDIN
mov cx,1 ;1 char
lea dx,buffer ;to buffer
int 21h
cmp ax,0 ;AX=number of chars read
je exit ;If none then end
mov dl,b[buffer] ;else get buffer contents
cmp dl,0a ;is it a LF
jne pit ;if not then print char
call counter ;else...
pit:
mov ah,2 ;print char (may be the LF)
int 21h
jmp again ;go for next char
exit:
mov dl,0dh ;clear buffer
mov ah,2
int 21h
mov ax,4c00h
int 21h
error:
lea dx,erm
mov ah,9
int 021
jmp exit
counter:
push dx ;preserve char in DL
inc si ;count
cmp si,150 ;is it EOP yet
jne quit ;quit if not
lea dx,feed ;else send 8 linefeeds
mov ah,9
int 021
xor si,si ;and zero counter
quit:
pop dx ;get char back
ret
;--------------------------------------------------------------
--
vyn@abaldwin.demon.co.uk
-!-
---
---------------
* Origin: (1:346/100)
|