home *** CD-ROM | disk | FTP | other *** search
- * CheckForPrinter
- * written in 1991 by Stephan Fuhrmann
- * Contact : Stephan Fuhrmann / Erikstr.30 / 2380 Schleswig / Germany
- * DevPac-Source
-
- incdir dh0:include/
- include exec/exec_lib.i
- include exec/io.i
- include exec/ports.i
- include devices/parallel.i
- include libraries/dos_lib.i
- include libraries/dos.i
-
- section CheckPrinter,code
- sub.l a1,a1
- CALLEXEC FindTask
- lea _Reply(pc),a1
- move.l d0,MP_SIGTASK(a1)
- lea _ParIO(pc),a0
- move.l a1,MN_REPLYPORT(a0)
- CALLEXEC AddPort
-
- lea _ParName(pc),a0
- lea _ParIO(pc),a1
- moveq #0,d0
- moveq #0,d1
- CALLEXEC OpenDevice
- tst.l d0
- bne.s RMSG
- lea _ParIO(pc),a1
- move.w #PDCMD_QUERY,IO_COMMAND(a1)
- CALLEXEC DoIO
- ;IO-Struktur mit Parallel-Port-STATUS füllen
-
- CDEV:
- lea _ParIO(pc),a1
- CALLEXEC CloseDevice
- RMSG:
- lea _Reply(pc),a1
- CALLEXEC RemPort
-
- lea _ParIO(pc),a1
- move.b IO_PARSTATUS(a1),d0
-
- ; D0 enthält jetzt das Status-Byte des Parallel-Ports .
- ; Siehe devices/parallel.i für weitere Informationen :
- ; Bit 0 : 1-OffLine
- ; : 0-OnLine
- ; Bit 1 : 1-OK
- ; : 0-PAPER_OUT
- ; Bit 2 : 1-PRINTER_READY
- ; : 0-PRINTER_BUSY
- ; Bit 3 : 1-Direction WRITE
- ; : 0-Direction READ
-
- move.b d0,d7 ;für später retten
-
- lea _DosName(pc),a1
- moveq #0,d0
- CALLEXEC OpenLibrary
- lea _DOSBase(pc),a0
- move.l d0,(a0)
- beq.s Error
- CALLDOS Output
- move.l d0,d1
- btst #0,d7
- beq.s ONLINE
- move.l #_OfflineTXT,d2
- move.l #_OffLineLng,d3
- PrintIt:
- CALLDOS Write
- Error: moveq #0,d0
- rts
- ONLINE:
- move.l #_OnlineTXT,d2
- move.l #_OnLineLng,d3
- bra.s PrintIt
-
- ; Daten für die eigentliche Routine (PAR-Status)
-
- _ParName: PARALLELNAME
- _ParIO: ds.l 20
- _Reply: ds.l 8
-
- ; Daten für Textausgabe
-
- _DOSBase: ds.l 1
- _OnlineTXT: dc.b "Printer is ONLINE",$a
- _OnLineLng =*-_OnlineTXT
- _OfflineTXT dc.b "Printer is OFFLINE/Not connected",$a
- _OffLineLng =*-_OfflineTXT
- _DosName: DOSNAME
-