
*	WriteArb.asm (of PCQ Pascal runtime library)
*	Copyright (c) 1989 Patrick Quaid

*	This just writes some type to a file of that type

	SECTION	ONE

	XREF	_p%DOSBase
	XREF	_LVOWrite
	XREF	outbuffer

	XDEF	_p%writearb
_p%writearb

	cmp.l	#4,d3
	ble.s	1$		; if <= 4 then go around
	move.l	d0,d2
	bra.s	5$		; go to write stuff

1$	cmp.l	#3,d3		; if its three, do the same
	bne.s	2$
	move.l	d0,d2
	bra.s	5$

2$	move.l	#outbuffer,d2	; all these will write into buffer
	cmp.l	#1,d3
	bne.s	3$		; if not 1 then go around
	move.b	d0,outbuffer	; move it into outbuffer
	bra.s	5$		; go write

3$	cmp.l	#2,d3		; is it two?
	bne.s	4$		; go around
	move.w	d0,outbuffer	; store it
	bra.s	5$

4$	move.l	d0,outbuffer	; store it if it's 4

5$	move.l	4(sp),d1
	move.l	_p%DOSBase,a6
	jsr	_LVOWrite(a6)
	rts

	END

