;
; include file for netprint.device
;
; Timo Rossi, 1995
;
		include	'exec/types.i'
		include	'exec/initializers.i'
		include	'exec/resident.i'
		include	'exec/devices.i'
		include	'exec/io.i'
		include	'exec/memory.i'
		include	'exec/errors.i'
		include	'dos/dos.i'
		include	'dos/dosextens.i'
		include	'dos/dostags.i'

		include	'offsets.i'

CR		equ	13
LF		equ	10

libcall		macro
		ifeq	NARG-1
		jsr	_LVO\1(a6)
		endc
		ifeq	NARG-2
		move.l	\1,a6
		libcall	\2
		endc
		endm


		STRUCTURE DevBase,DD_SIZE
		  LONG	 dv_SegList
		  APTR	 dv_SysBase
		  APTR	 dv_UtilityBase
		  APTR	 dv_DosBase
		  APTR	 dv_Process
		  APTR	 dv_MsgPort
		  STRUCT dv_InitMsg,MN_SIZE
		LABEL DevBase_SIZE

		STRUCTURE DevUnit,UNIT_SIZE
		  LONG	 du_FileHandle
		  STRUCT du_LprCmd,16
		  STRUCT du_FileName,32
		  ULONG	 du_BytesWritten
		LABEL DevUnit_SIZE

		STRUCTURE DosCmd,MN_SIZE
		  LONG	 dcmd_Command
		  STRUCT dcmd_Args,3*4
		  LONG	 dcmd_Res
		  STRUCT dcmd_ReplyPort,MP_SIZE
		LABEL DosCmd_SIZE

DOSCMD_QUITPROC	equ	0
DOSCMD_OPEN	equ	1
DOSCMD_CLOSE	equ	2
DOSCMD_WRITE	equ	3
DOSCMD_EXECUTE	equ	4
DOSCMD_DELETE	equ	5
DOSCMD_LAST	equ	DOSCMD_DELETE


DEVNAME		macro
		dc.b	'netprint.device',0
		endm

EVEN		macro
		ds.w	0
		endm

		ifd	DEBUG

; 
; Debug message (Printf-style, parameters in D0-D7)
; This version does not trash any registers
;
DMSG		macro
		movem.l	d0/d1/a0/a1,-(sp)
		lea	DMSG_S\@(pc),a0
		bsr	DPrintf
		bra.s	DMSG_E\@
DMSG_S\@	dc.b	\1
		dc.b	0
		ds.w	0
DMSG_E\@	movem.l	(sp)+,d0/d1/a0/a1
		endm

		endc	;DEBUG
