home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Share Gallery 1
/
share_gal_1.zip
/
share_gal_1
/
UT
/
UT043.ZIP
/
SETE
/
SETE.ASM
next >
Wrap
Assembly Source File
|
1988-11-29
|
7KB
|
171 lines
; SETE.ASM sends control codes to the Epson FX and similar printers.
;
; Use: SETE <cr> a menu will appear
; or SETE commands <cr> where commands are single letters, the last
; which should be q (quit). See the menu for
; a list of legal commands. The menu does not
; appear when SETE is used this way.
; Configuring SETE to your printer or changing the menu selections is
; easy. Here are a few guidelines:
; there are three areas of the program that may need modification if
; you want to make changes. These are the menu, the printer control
; strings, and the jump table (jtbl).
; all letters starting with 'a' up to one beyond the last letter used
; in a command should be present in the printer control section and
; the jump table. If a letter in this range is not used in the menu,
; put ' ' for it in the printer control table.
; lastcmd shold be set to the last command letter actually used.
; you should not have to alter the code beyond jtbl unless you want
; to change the 'quit' command. Notice that the quit command does
; not actually send any code to the printer, so ' ' appears in the
; printer control table for this command.
; this program assembles properly under tasm and probably other
; assemblers.
; this program is copyrighted. The intent of the copyright is to prevent
; commercial exploitation without the author's consent. Free academic,
; shareware and noncommercial use may be made of the source code and
; compiled programs. Attribution is appreciated. The author has received
; no compensation for this program and no warranty of any kind is given.
; Enjoy.
code segment
assume cs: code
org 100h ;setup as COM file
begin: jmp start ;skip over data area
numleft db ? ;# of chars from cmd tail not yet processed
lastcmd db 'r' ;last command letter used
; the screen menu is defined here. edit this and/or change the printer codes
; below jtbl as you wish. If you change the number of menu entries, be sure to
; change jtbl and the code in pchar accordingly.
menu db 13,10,10,10,10,10
db 9,9,'A Pica (10) J Cancel Italics',13,10,10
db 9,9,'B Elite (12) K Skip over perf 2 lines',13,10,10
db 9,9,'C Condensed L Set left margin at 10',13,10,10
db 9,9,'D Unidirectional Print M Expanded print',13,10,10
db 9,9,'E Emphasized N Cancel expanded',13,10,10
db 9,9,'F Cancel Emphasized P Print test line',13,10,10
db 9,9,'G Double strike Q Quit',13,10,10
db 9,9,'H Cancel double strike R Reset printer',13,10,10
db 9,9,'I Italics',13,10,10,'$'
crt db 'Copyright 1988 Joseph C. Hudson 4198 Warbler Dr. Flint Mi 48532'
; Here are the printer control strings. The strings are followed by a jump
; table that is used to access the strings.
a1 db 27,80,18
b1 db 27,77
c1 db 15
d1 db 27,85,1
e1 db 27,69
f1 db 27,70
g1 db 27,71
h1 db 27,72
i1 db 27,52
j1 db 27,53
k1 db 27,78,2
l1 db 27,108,10
m1 db 27,87,1
n1 db 27,87,0
o1 db ' '
p1 db 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLNO',13,10
q1 db ' '
r1 db 27,64
s1 db ' '
jtbl dw offset a1
dw offset b1
dw offset c1
dw offset d1
dw offset e1
dw offset f1
dw offset g1
dw offset h1
dw offset i1
dw offset j1
dw offset k1
dw offset l1
dw offset m1
dw offset n1
dw offset o1
dw offset p1
dw offset q1
dw offset r1
dw offset s1
start: mov si,80h ;point to command tail
mov al,[si] ;get length of command tail
cmp al,0 ;is there a tail?
jne tail ;yes
mov numleft,7fh ;no, put 127 in numleft to flag no tail
jmp short dmenu ;display menu
tail: mov numleft,al ;put length of tail in numleft
jmp getcht ;get character from tail
dmenu: mov dx,offset menu ;point to menu
mov ah,9 ;write to console function
int 21h ;call DOS
jmp getchk ;get character from keyboard
nextch: cmp numleft,7fh ;is there a tail?
jne getcht ;yes, get character from tail
jmp getchk ;no, get character from keyboard
getcht: cmp numleft,0 ;is there any tail left?
je quit ;no, quit
inc si ;point at next character in tail
dec numleft ;decrement counter
mov al,[si] ;get next character from tail
jmp pchar ;process character
getchk: mov ah,0Ch ;flush keyboard buffer
mov al,07h ;and get character from keyboard
int 21h
mov dl,al
mov ah,02h ;write character to screen
int 21h
pchar: or al,20h ;change to lower case
cmp al,'a' ;is it below a?
jge l2 ;no, keep going
jmp nextch ;yes, so not a command
l2: cmp al,lastcmd ;is it above last command letter?
jle chkq ;no, so is a command
jmp nextch ;yes, so not a command
chkq: cmp al,'q' ;want to quit?
jne prstr ;no, send code to printer
quit: mov ah,4Ch ;yes, quit
int 21h
prstr: sub al,'a' ;how many words into jtbl we should go
mov ah,0 ;just to be safe
shl ax,1 ;convert # of words to # of bytes
mov bx,ax ;save offset into jtabl in bx
mov ax,jtbl[bx] ;offset of command to ax
mov cx,jtbl[bx+2] ;offset of next command to cx
sub cx,ax ;length of command string is now in cx
mov bx,ax ;offset of command to bx
newchr: mov dl,[bx] ;character to dl
mov ah,5 ;printer output function
int 21h ;call DOS
inc bx ;point to next character
loop newchr ;loop until done
jmp nextch ;get next character
code ends
end begin