home *** CD-ROM | disk | FTP | other *** search
- PROC jpprint:
- global ax%,bx%,cx%,dx%,si%,di%,name$(16),val$(255),c$(128),p$(128),fsp$(3),dr$(1),pfile$(64),curid$(10),d$(128),env$(4),buff$(255),r%,p1%
- print "JPprint Background Print Spooler"
- print "(c) J.Portwin 1995"
- ax%=$2100
- name$="JP"+chr$(0)
- di%=addr(name$)+1
- dx%=len(name$)-1
- si%=addr(val$)+1
- ax%=$2100
- bx%=0
- if os($8b,addr(ax%)) and 1
- if (ax% or $ff00)=-33
- print "Please start JPprint from within JPcli v1.6" :get :stop
- endif
- raise (ax% or $ff00)
- endif
- pokeb addr(val$),ax%
- c$=mid$(val$,1,loc(val$,"«")-1)
- val$=mid$(val$,loc(val$,"«")+1,len(val$))
- p$=mid$(val$,1,loc(val$,"«")-1)
- val$=mid$(val$,loc(val$,"«")+1,len(val$))
- fsp$=mid$(val$,1,loc(val$,"«")-1)
- val$=mid$(val$,loc(val$,"«")+1,len(val$))
- dr$=mid$(val$,1,loc(val$,"«")-1)
- val$=mid$(val$,loc(val$,"«")+1,len(val$))
- curid$=mid$(val$,1,loc(val$,"«")-1)
- val$=mid$(val$,loc(val$,"«")+1,len(val$))
- if loc(c$," ")=0 :help: :endif
- c$=mid$(c$,loc(c$," ")+1,len(c$))
- if loc(c$," ")=0 :help: :endif
- pfile$=mid$(c$,1,loc(c$," ")-1)
- setpath fsp$+"::"+dr$+":"+p$
- if loc(c$,"/P")>0 :print "Printing to Parallel"
- lopen "PAR:A"
- elseif loc(c$,"/S")>0 :print "Printing to Serial"
- lopen "TTY:A"
- rsset:(16,0,8,1,0)
- elseif loc(c$,"/F")>0 :print "Printing to File ";
- env$="P$F"
- ax%=$2100
- bx%=0
- di%=addr(env$)+1
- dx%=len(env$)
- si%=addr(d$)+1
- os($008b,addr(ax%))
- pokeb addr(d$),ax%
- print d$
- lopen d$
- else
- print "Error - no device specified." :help: :stop
- endif
- if mid$(pfile$,1,1)<>"\" :pfile$=p$+pfile$ :endif
- if loc(pfile$,":")=0 :pfile$=dr$+":"+pfile$ :endif
- if loc(pfile$,"::")=0 :pfile$=fsp$+"::"+pfile$ :endif
- print pfile$
- ax%=$0300
- bx%=val(curid$)
- os($88,addr(ax%))
- r%=ioopen(p1%,pfile$,$420)
- if r%<0 :raise r% :endif
- do
- r%=ioread(p1%,addr(buff$)+1,255)
- if r%=-36 :lprint chr$(12); :lclose :r%=ioclose(p1%) :r%=ioopen(p1%,pfile$,$420) :stop :endif
- if r%<0 :raise r% :endif
- pokeb addr(buff$),r%
- lprint buff$
- until 1=0
- ENDP
- PROC rsset:(baud%,parity%,data%,stop%,hand%,term&)
- local tstore%(5)
- if exist ("\jpcli\com.dat")
- r%=ioopen(p1%,"\jpcli\com.dat",$420)
- c:
- r%=ioread(p1%,addr(d$),127)
- if r%=-36 :goto ca2ll :endif
- c:
- pokeb addr(d$),r%
- tstore%(1)=val(d$)
- r%=ioread(p1%,addr(d$),127)
- if r%=-36 :goto ca2ll :endif
- c:
- pokeb addr(d$),r%
- tstore%(2)=val(d$)
- r%=ioread(p1%,addr(d$),127)
- if r%=-36 :goto ca2ll :endif
- c:
- pokeb addr(d$),r%
- tstore%(3)=val(d$)
- r%=ioread(p1%,addr(d$),127)
- if r%=-36 :goto ca2ll :endif
- c:
- pokeb addr(d$),r%
- tstore%(4)=val(d$)
- r%=ioread(p1%,addr(d$),127)
- if r%=-36 :goto ca2ll :endif
- c:
- pokeb addr(d$),r%
- tstore%(5)=val(d$)
- ca2ll::
- if tstore%(5)=0 :tstore%(5)=hand% :endif
- if tstore%(4)=0 :tstore%(4)=hand% :endif
- if tstore%(3)=0 :tstore%(3)=hand% :endif
- if tstore%(2)=0 :tstore%(2)=hand% :endif
- if tstore%(1)=0 :tstore%(1)=hand% :endif
- rssett:(tstore%(1),tstore%(2),tstore%(3),tstore%(4),tstore%(5),term&)
- else
- rssett:(baud%,parity%,data%,stop%,hand%,term&)
- endif
- ENDP
- PROC rssett:(baud%,parity%,data%,stop%,hand%,term&)
- local frame%,srchar%(6),dummy%,err%
- frame%=data%-5
- if stop%=2 :frame%=frame% or 16 :endif
- if parity% :frame%=frame% or 32 :endif
- srchar%(1)=baud% or (baud%*256)
- srchar%(2)=frame% or (parity%*256)
- srchar%(3)=(Hand% and 255) or $1100
- srchar%(4)=$13
- pokel addr(srchar%(5)),term&
- r%=iow(-1,7,srchar%(1),dummy%)
- c:
- ENDP
- PROC help:
- print "JPprint must be started specifying the file"
- print "to print followed by the device. Ie:"
- print
- print "JPPRINT JP.TXT /P - Prints JP.TXT to parallel"
- print "JPPRINT L.DOC /S - Prints L.DOC to serial"
- print "JPPRINT JPCLI.TXT /F - Prints JPCLI.TXT to file"
- print
- print "Press a key"
- get
- stop
- ENDP
-