;
; DSpace v1.2
;
; Copyright 1993-1995 by Stefano Reksten of 3AM - The Three Amigos!!!
;
; Tells you how many bytes are available on a volume. Freeware.
;
; For comments, postcards, greetings, and so on e-mail me at:
; rekststef@unisi.it
;
; or write me at this address:
; Stefano Reksten c/o Naimi
; v.le Cavour, 40
; 53100 Siena
; ITALY
;

	incdir include:
	include dos/dos.i
	include LVO3.0/exec_lib.i
	include LVO3.0/dos_lib.i

	move.l	$4,a6
	lea	DOSName,a1
	move.l	#37,d0
	jsr	_LVOOpenLibrary(a6)
	tst.l	d0
	beq.w	.nodos

	move.l	d0,a6
	move.l	#Template,d1
	move.l	#ArgArray,d2
	moveq	#0,d3
	jsr	_LVOReadArgs(a6)
	tst	d0
	beq.b	.noargs
	move.l	d0,RDArgs

	move.l	ArgArray,d1
	tst.l	d1
	beq.b	.noargs

	move.l	#ACCESS_READ,d2
	jsr	_LVOLock(a6)
	tst.l	d0
	beq.b	.nolock
	move.l	d0,Lock

	move.l	Lock,d1
	move.l	#DInfoData,d2
	jsr	_LVOInfo(a6)
	tst	d0
	beq.b	.noinfo

	lea	DInfoData,a0
	move.l	id_NumBlocks(a0),d0
	sub.l	id_NumBlocksUsed(a0),d0
	mulu.l	id_BytesPerBlock(a0),d0
	move.l	d0,ArgArray

	jsr	_LVOOutput(a6)
	move.l	d0,d1
	move.l	#Fmt,d2
	move.l	#ArgArray,d3
	jsr	_LVOVFPrintf(a6)

.noinfo
	move.l	Lock,d1
	jsr	_LVOUnLock(a6)
.nolock
	move.l	RDArgs,d1
	jsr	_LVOFreeArgs(a6)
.noargs
	move.l	a6,a1
	move.l	$4,a6
	jsr	_LVOCloseLibrary(a6)
.nodos
	rts

	cnop	0,4
DInfoData
	dc.l	0,0,0,0,0,0,0,0
Lock
	dc.l	0
ArgArray
	dc.l	0
RDArgs
	dc.l	0
DOSName
	dc.b	"dos.library",0
Template
	dc.b	"VolumeName/A",0
Fmt
	dc.b	"Free disk space: %ld bytes.",$A,0
	dc.b	"$VER: DSpace v1.2 (8-1-95)",0
