;
; IFormat v1.0
; written by Mauro Panigada
;
; $VER: IFormat.a v1.0 by Mauro Panigada
;
; Started: 1996-04-17 (year/month/day)
; Finished: 1996-**-** (idem)
;
; FREEWARE
;
; A intuitionized version of DFormat v1.0, but less rough: it performs
; device's inhibition automatically.
; Note: it does not seem to be very intelligent: it only pass your
;   choices to dos function (for quick format, that only works). So
;   you can do operations that you never can do... As quickly formatting
;   a OSF as FFS, that it is impossible.
;
; To do: sort of list; to use LockDosList and NextDosList to find
;   all the device we need. Now it goes and steals them directly from
;   dos structure...; iconify (it is useful when it is visitor on
;   a public screen); !! >> commodities << !!; true format (and not
;   only quick format!)
;

		incdir	"dh0:progr/assem/include/"
		include	"exec/types.i"
		include	"exec/libraries.i"
		include	"exec/exec_lib.i"
		include	"exec/memory.i"
		include	"dos/dos.i"
		include	"dos/dos_lib.i"
		include	"dos/dostags.i"
		include	"dos/var.i"
		include	"dos/dosextens.i"
		include	"intuition/intuition.i"
		include	"intuition/intuition_lib.i"
		include	"libraries/gadtools.i"
		include	"libraries/gadtools_lib.i"


NEWGAD		MACRO
		dc.w	\1,\2,\3,\4
		dc.l	\5,0
		dc.w	0
		dc.l	\6,0,\7
		ENDM

DEBUG		EQU	0

	STRUCTURE	mstores,0
		LABEL	_intbase
		LONG	tag0
		LABEL	_gadtoolsbase
		LONG	newp
		LABEL	_publock
		LONG	tag1
		LABEL	_visualinfo
		LONG	fsl
		LABEL	_sfont
		LONG	tag2
		LABEL	_window
		LONG	pname
		LONG	_dosbase
		LONG	_userport
		LONG	_rastport
		LONG	_class
		WORD	_code
		WORD	_qualifier
		LONG	_iaddress
		LONG	_glist
		STRUCT	_mlh,MLH_SIZE
		WORD	_barheight
		LONG	_cbuffer0
		STRUCT	_cbuffer1,32
		STRUCT	_cbuffer2,32
		WORD	_devcount
		LABEL	mstores_SIZE


*+--------------+
*| STARTUP CODE | Initialization and creatiion of new process
*+--------------+

		SECTION	IFormatCODE,CODE

pseg		

* It can start from wb, now...
		include	"misc/easystart.i"

		lea	stores,a5
		IFEQ	DEBUG-1
		move.l	4.w,a6
		lea	dosname(pc),a1
		moveq	#36,d0
		jsr	_LVOOpenLibrary(a6)
		move.l	d0,_dosbase(a5)
		beq.s	dbret
		jmp	main
dbret		rts
		ENDC
		bra.s	start

		dc.b	"$VER: IFormat v1.0 (1996-04-17) written by"
		dc.b	" Mauro Panigada",0
		even

start		move.l	#(mstores_SIZE/4)-1,d0
		moveq	#0,d1
		move.l	a5,a4	; to make sure that we'll have a clear
clrloop		move.l	d1,(a4)+	; area.
		dbf	d0,clrloop
		move.l	4.w,a6
		lea	dosname(pc),a1
		moveq	#36,d0
		jsr	_LVOOpenLibrary(a6)
		move.l	d0,_dosbase(a5)
		beq.s	fexit
		lea	pseg(pc),a4
		move.l	-4(a4),d7	; next segment
		move.l	d7,newp(a5)	; now next = first of new one
		clr.l	-4(a4)
		jsr	_LVOForbid(a6)	; rough thing
		lea	pnamen,a1		; (unuseful): when
		jsr	_LVOFindTask(a6)	; you run more than
		tst.l	d0		; one iformat, he changes his
		beq.s	notal		; task name...
		move.l	d0,a0
		addi.b	#1,TC_Userdata(a0)
		move.b	TC_Userdata(a0),d0
		add.b	d0,pndiff
notal		move.l	a5,d1
		move.l	_dosbase(a5),a6
		move.l	#-1,fsl(a5)
		move.l	#pnamen,pname(a5)	; init tags values
		move.l	#NP_Seglist,tag0(a5)
		move.l	#NP_FreeSeglist,tag1(a5)
		move.l	#NP_Name,tag2(a5)
		jsr	_LVOCreateNewProc(a6)	; go!
		tst.l	d0
		bne.s	wevenp
		move.l	d7,-4(a4)	; if it fails, dos will free
wevenp		move.l	4.w,a6		; this segment
		jsr	_LVOPermit(a6)
fexit		rts

dosname		dc.b	"dos.library",0
		even


*+-----------+
*| MAIN CODE | The segments which really are important
*+-----------+

		SECTION	IFormatNewCODE,CODE

		bra.s	main

pnamen		dc.b	"IFormat-Task_"
pndiff		dc.b	"0",0
		even

main		lea	stores,a5
		move.l	4.w,a6
		lea	intname(pc),a1
		moveq	#36,d0
		jsr	_LVOOpenLibrary(a6)
		move.l	d0,_intbase(a5)
		beq	exit
		lea	gadtoolsname(pc),a1
		moveq	#39,d0
		jsr	_LVOOpenLibrary(a6)
		move.l	d0,_gadtoolsbase(a5)
		beq	exit

		bsr	createdevlist
		tst.l	d0
		bne	exit
		bsr	sortdevlist

		lea	g2_tag(pc),a0
		lea	_mlh(a5),a1
		move.l	a1,4(a0)

		move.l	_dosbase(a5),a6
		move.l	#vname,d1
		lea	_cbuffer2(a5),a0
		move.l	a0,d2
		moveq	#32,d3
		move.l	#GVF_GLOBAL_ONLY,d4
		jsr	_LVOGetVar(a6)
		tst.l	d0
		bmi.s	m_novar
		lea	_cbuffer2(a5),a0
		bsr	s_lockpubscr
		tst.l	d0
		beq.s	m_novar
		move.l	d0,a0
		move.l	_intbase(a5),a6
		jsr	_LVOScreenToFront(a6)
		bra.s	m_yepvar

m_novar		bsr	lockpubscr
m_yepvar	bsr	getvisual
		bsr	creategadgets
		tst.l	d0
		bne	exit
		bsr	openwindow
		tst.l	d0
		bne	exit

		move.l	_gadtoolsbase(a5),a6
		move.l	_rastport(a5),a0
		lea	box_tag(pc),a1
		move.l	_visualinfo(a5),4(a1)
		lea	b1_coord(pc),a2
		move.w	(a2)+,d0
		move.w	(a2)+,d1
		add.w	_barheight(a5),d1
		move.w	(a2)+,d2
		move.w	(a2)+,d3
		jsr	_LVODrawBevelBoxA(a6)

waitmessages	move.l	4.w,a6
		move.l	_userport(a5),a0
		jsr	_LVOWaitPort(a6)
		move.l	_userport(a5),a0
		move.l	_gadtoolsbase(a5),a6
		jsr	_LVOGT_GetIMsg(a6)
		move.l	d0,a1
		move.l	im_Class(a1),_class(a5)
		move.w	im_Code(a1),_code(a5)
		move.w	im_Qualifier(a1),_qualifier(a5)
		move.l	im_IAddress(a1),_iaddress(a5)
		jsr	_LVOGT_ReplyIMsg(a6)

		move.l	_class(a5),d0
		cmp.l	#IDCMP_DISKINSERTED,d0
		beq	updatedisk
		cmp.l	#IDCMP_DISKREMOVED,d0
		beq	updatedisk
		cmp.l	#BUTTONIDCMP,d0
		beq	buttonpressed
		cmp.l	#IDCMP_CLOSEWINDOW,d0
		bne	waitmessages

exit		bsr	closewindow
		bsr	freegadgets
		bsr	freevisual
		bsr	unlockpubscr
		bsr	freedevlist
		move.l	4.w,a6
		move.l	_intbase(a5),a1
		jsr	_LVOCloseLibrary(a6)
		move.l	_gadtoolsbase(a5),a1
		jsr	_LVOCloseLibrary(a6)
		move.l	_dosbase(a5),a1
		jmp	_LVOCloseLibrary(a6)

*=================================================================

buttonpressed	; 0: disabled. FORMAT is not implemented yet
		; 1,2: they are not interesting now
		; 3: QUICK FORMAT (dformat function)
		; 4: ABORT will be enabled when FORMAT will
		; 5: OPTIONS select format options (unuseful)

		move.l	_iaddress(a5),a0
		move.w	gg_GadgetID(a0),d0
		cmp.w	#3,d0
		beq	f_quickformat
		cmp.w	#5,d0
		beq	f_options
		bra	waitmessages

f_quickformat	move.l	_gadtoolsbase(a5),a6
		lea	str_gad(pc),a0
		move.l	12(a0),a0
		move.l	_window(a5),a1
		sub.l	a2,a2
		lea	str_tag(pc),a3
		lea	_cbuffer0(a5),a4	; _cbuffer0=new volume name
		move.l	a4,4(a3)
		jsr	_LVOGT_GetGadgetAttrsA(a6)
		lea	lv_gad(pc),a0
		move.l	12(a0),a0
		move.l	_window(a5),a1
		sub.l	a2,a2
		lea	lv_tag(pc),a3
		lea	4(a3),a4
		clr.l	(a4)
		jsr	_LVOGT_GetGadgetAttrsA(a6)
		move.l	(a4),d0
		lea	_mlh(a5),a0
qf_loop		move.l	(a0),a0
		dbf	d0,qf_loop
		move.l	LN_NAME(a0),a0		; d7 = device name
		lea	_cbuffer1(a5),a1
qf_loop0	move.b	(a0)+,(a1)+
		tst.b	-1(a0)
		bne.s	qf_loop0
		move.b	#":",-1(a1)
		clr.b	(a1)
		lea	lv_gad0(pc),a0
		move.l	12(a0),a0
		move.l	_window(a5),a1
		sub.l	a2,a2
		lea	lv_tag(pc),a3
		lea	4(a3),a4
		jsr	_LVOGT_GetGadgetAttrsA(a6)
		move.l	(a4),d0
		lea	dostypes(pc),a0
		lsl.w	#2,d0
		move.l	(a0,d0.w),d6		; d6 = dostype
		move.l	_dosbase(a5),a6
		lea	_cbuffer1(a5),a4
		move.l	a4,d1
		moveq	#DOSTRUE,d2
		jsr	_LVOInhibit(a6)
		tst.l	d0
		beq	fqf_inh_error
		move.l	a4,d1
		move.l	_cbuffer0(a5),d2
		move.l	d6,d3
		jsr	_LVOFormat(a6)
		moveq	#25,d1		; wait 1/2 sec.
		jsr	_LVODelay(a6)
		move.l	a4,d1
		moveq	#DOSFALSE,d2
		jsr	_LVOInhibit(a6)
		bra	waitmessages

f_options	lea	easyreq(pc),a1
		move.l	#text1,es_TextFormat(a1)
		bra.s	fqf_era

fqf_inh_error	lea	easyreq(pc),a1
		move.l	#text0,es_TextFormat(a1)
fqf_era		move.l	#title0,es_Title(a1)
		move.l	#reqgad0,es_GadgetFormat(a1)
		move.l	_window(a5),a0
		sub.l	a2,a2
		sub.l	a3,a3
		move.l	_intbase(a5),a6
		jsr	_LVOEasyRequestArgs(a6)
		bra	waitmessages

*=================================================================

updatedisk	move.l	lv_gad+12(pc),a0
		move.l	_window(a5),a1
		sub.l	a2,a2
		lea	lv_gad_tag(pc),a3
		move.l	#-1,4(a3)
		move.l	_gadtoolsbase(a5),a6
		jsr	_LVOGT_SetGadgetAttrsA(a6)
		bsr	freedevlist
		lea	_mlh(a5),a0
		moveq	#0,d0
		move.l	d0,(a0)+
		move.l	d0,(a0)+
		move.l	d0,(a0)+
		bsr	createdevlist
		tst.l	d0
		beq	exit		; error creating new list...
		bsr	sortdevlist	; roughly it exits!
		lea	lv_gad_tag(pc),a3
		lea	_mlh(a5),a1
		move.l	a1,4(a3)
		move.l	_window(a5),a1
		sub.l	a2,a2
		move.l	lv_gad+12(pc),a0
		move.l	_gadtoolsbase(a5),a6
		jsr	_LVOGT_SetGadgetAttrsA(a6)
		move.l	_window(a5),a0
		sub.l	a1,a1
		jsr	_LVOGT_RefreshWindow(a6)
		bra	waitmessages

*=================================================================
* Subroutines to make gadgets (by M.P.)
*=================================================================

lockpubscr	suba.l	a0,a0
s_lockpubscr	move.l	_intbase(a5),a6
		jsr	_LVOLockPubScreen(a6)
		move.l	d0,_publock(a5)
		rts

getvisual	move.l	_publock(a5),a0
		sub.l	a1,a1
		move.l	_gadtoolsbase(a5),a6
		jsr	_LVOGetVisualInfoA(a6)
		move.l	d0,_visualinfo(a5)
		rts

creategadgets	move.l	_publock(a5),a0
		moveq	#0,d6
		move.b	sc_BarHeight(a0),d6
		ext.w	d6
		move.w	d6,_barheight(a5)
		move.l	_gadtoolsbase(a5),a6
		lea	_glist(a5),a0
		jsr	_LVOCreateContext(a6)
		lea	glist(pc),a4
		move.l	#sfont,_sfont(a5)
		moveq	#0,d7		; gadgetID
cgad_loop	tst.l	d0
		beq	cgad_error
		move.l	d0,a0
		move.l	(a4),d0		; KIND
		bmi.s	cgad_end
		move.l	4(a4),a1	; NEWGAD
		move.l	_visualinfo(a5),gng_VisualInfo(a1)
		move.l	_sfont(a5),gng_TextAttr(a1)
		add.w	d6,gng_TopEdge(a1)
		move.w	d7,gng_GadgetID(a1)
		addq.w	#1,d7
		move.l	8(a4),a2	; TAGLIST
		jsr	_LVOCreateGadgetA(a6)
		move.l	d0,12(a4)
		add.l	#(4*4),a4
		bra.s	cgad_loop
cgad_end	moveq	#0,d0
		rts
cgad_error	moveq	#-1,d0
		rts

freegadgets	move.l	_glist(a5),d0
		beq.s	fg_end
		move.l	d0,a0
		move.l	_gadtoolsbase(a5),a6
		jsr	_LVOFreeGadgets(a6)
fg_end		rts

freevisual	move.l	_gadtoolsbase(a5),a6
		move.l	_visualinfo(a5),d0
		beq.s	fv_end
		move.l	d0,a0
		jsr	_LVOFreeVisualInfo(a6)
fv_end		rts

unlockpubscr	move.l	_intbase(a5),a6
		move.l	_publock(a5),d0
		beq.s	ulps_end
		move.l	d0,a1
		sub.l	a0,a0
		jsr	_LVOUnlockPubScreen(a6)
ulps_end	rts

*=================================================================
* Other subroutines...
*=================================================================

openwindow	move.l	_intbase(a5),a6
		suba.l	a0,a0
		lea	newwindowtags(pc),a1
		move.l	_glist(a5),nwt_gadgets(a1)
		move.l	_publock(a5),nwt_pubscreen(a1)
		jsr	_LVOOpenWindowTagList(a6)
		move.l	d0,_window(a5)
		beq.s	ow_error
		move.l	d0,a1
		move.l	wd_UserPort(a1),_userport(a5)
		move.l	wd_RPort(a1),_rastport(a5)
		move.l	a1,a3
		move.l	_glist(a5),a0
		sub.l	a2,a2
		moveq	#-1,d0
		jsr	_LVORefreshGList(a6)
		move.l	_gadtoolsbase(a5),a6
		move.l	a3,a0
		sub.l	a1,a1
		jsr	_LVOGT_RefreshWindow(a6)
		moveq	#0,d0
		rts
ow_error	moveq	#-1,d0
		rts

closewindow	move.l	_intbase(a5),a6
		move.l	_window(a5),d0
		beq.s	cw_end
		move.l	d0,a0
		jsr	_LVOCloseWindow(a6)
cw_end		rts


*
* Here a hard code: we'll search for all device we can need!
* In my previous program "DBCruncher v2.0", where I designed the whole
* interface (but it and the program are unfinished!), I needed this
* routine; but it was so hard that actually it does not work. I hope
* here I'll do better.
* (In fact) Now it works well...
*

CREATENODE	MACRO
		move.l	#LN_SIZE,d0
		move.l	#MEMF_PUBLIC|MEMF_CLEAR,d1
		jsr	_LVOAllocVec(a6)
		ENDM

ALLOCNAME	MACRO
		moveq	#0,d0
		move.b	(a0),d0
		add.b	#4,d0
		move.l	#MEMF_PUBLIC|MEMF_CLEAR,d1
		jsr	_LVOAllocVec(a6)
		ENDM

createdevlist	clr.w	_devcount(a5)
		move.l	_dosbase(a5),a0
		move.l	4.w,a6
		move.l	dl_Root(a0),a0
		move.l	rn_Info(a0),a0
		adda.l	a0,a0
		adda.l	a0,a0
		move.l	di_DevInfo(a0),a3
		adda.l	a3,a3
		adda.l	a3,a3		; a3 = it! (iddu)
		lea	_mlh(a5),a4	; a4 = struct mlh
		NEWLIST	a4
cdl_loop	cmp.l	#DLT_DEVICE,dol_Type(a3)
		bne	cdl_skip
		tst.l	dol_Lock(a3)
		bne	cdl_skip
		move.l	dol_Name(a3),a0
		add.l	a0,a0
		add.l	a0,a0
		lea	devname(pc),a1
		addq.w	#1,a0
		moveq	#0,d1
		moveq	#2,d2		; 3+1 that must be 0
		moveq	#5,d0
cdl_loopi	or.b	(a0)+,d1	; get first 4 byte of name
		lsl.l	#8,d1		; (a1 can be odd and 68000 is not
		dbf	d2,cdl_loopi	; 68020!)
cdl_skloop	cmp.l	(a1)+,d1
		beq	cdl_skip
		dbf	d0,cdl_skloop
		CREATENODE
		tst.l	d0
		beq	cdl_fatalerr
		add.w	#1,_devcount(a5)
		move.l	d0,a1
		move.l	d0,a2		; a2 = node
		move.l	a4,a0
		ADDTAIL
		move.l	dol_Name(a3),d5
		lsl.l	#2,d5
		move.l	d5,a0		; d5 = *name (bstr)
		ALLOCNAME
		tst.l	d0
		beq	cdl_fatalerr
		move.l	d0,LN_NAME(a2)
		move.l	d0,a1
		move.l	d5,a0
		moveq	#0,d0
		move.b	(a0)+,d0
		;subq.w	#1,d0
cdl_lpstr	move.b	(a0)+,(a1)+
		dbf	d0,cdl_lpstr
		clr.b	-1(a1)
cdl_skip	move.l	dol_Next(a3),d0
		beq.s	cdl_end
		lsl.l	#2,d0
		move.l	d0,a3
		bra	cdl_loop
cdl_end		moveq	#0,d0
		rts
				; if there's this error, it means you
cdl_fatalerr	moveq	#-1,d0	; have got few few few memory!
		rts


freedevlist	move.l	4.w,a6
		lea	_mlh(a5),a3
		move.l	a3,a4
		addq.w	#4,a4
		SUCC	a3,d3
fdl_loop	cmp.l	a4,d3
		beq.s	fdl_end
		move.l	d3,a3
		move.l	LN_NAME(a3),d0
		beq.s	fdl_skname
		move.l	d0,a1
		jsr	_LVOFreeVec(a6)
fdl_skname	move.l	a3,a1
		SUCC	a3,d3
		jsr	_LVOFreeVec(a6)
		bra.s	fdl_loop
fdl_end		rts


; @@@@@@@@@@@@@@@@@@@
; @@   SORT....!   @@
; @@@@@@@@@@@@@@@@@@@
;

* more and more hard than coding createdevlist! *
* (the sort itself is simple, but implementation in this case...) *

sortdevlist	rts


*+-------------------+
*| MAIN PROGRAM DATA | All data that we need
*+-------------------+

*»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»» LIBRARIES
intname		dc.b	"intuition.library",0
		even
gadtoolsname	dc.b	"gadtools.library",0
		even

*»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»» FONT
sfont		dc.l	topazname
		dc.w	8
		dc.b	FS_NORMAL,FPF_ROMFONT
topazname	dc.b	"topaz.font",0
		even

*»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»» WINDOW
TRUE		EQU	-1
FALSE		EQU	0

DISKSIDCMP	EQU	IDCMP_DISKINSERTED|IDCMP_DISKREMOVED
WinIDCMP	EQU	BUTTONIDCMP|IDCMP_CLOSEWINDOW|LISTVIEWIDCMP|IDCMP_GADGETDOWN|DISKSIDCMP

newwindowtags	dc.l	WA_Left,40
		dc.l	WA_Top,25
		dc.l	WA_Width,306
		dc.l	WA_Height,122
		dc.l	WA_IDCMP,WinIDCMP
nwt_gadgets	EQU	(*-newwindowtags)+4
		dc.l	WA_Gadgets,0
nwt_pubscreen	EQU	(*-newwindowtags)+4
		dc.l	WA_PubScreen,0
		dc.l	WA_Title,wintitle
		dc.l	WA_SizeGadget,FALSE
		dc.l	WA_DragBar,TRUE
		dc.l	WA_CloseGadget,TRUE
		dc.l	WA_DepthGadget,TRUE
		dc.l	WA_RMBTrap,TRUE
		dc.l	WA_GimmeZeroZero,FALSE
		dc.l	WA_Activate,TRUE
		dc.l	WA_ScreenTitle,scrtitle
		dc.l	TAG_DONE

title0
wintitle	dc.b	"IFormat v1.0",0
		even
scrtitle	dc.b	"IFormat v1.0 (1996-04-17) by Mauro Panigada",0
		even

*»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»» GLIST

DEFGAD		MACRO
		IFEQ	NARG-1
		dc.l	-1
		ELSE
		dc.l	\1,\2,\3,0
		ENDC
		ENDM

glist		DEFGAD	BUTTON_KIND,gadget0,g0_tag	; 0
str_gad		DEFGAD	STRING_KIND,gadget1,g1_tag	; 1
lv_gad		DEFGAD	LISTVIEW_KIND,gadget2,g2_tag	; 2
		DEFGAD	BUTTON_KIND,gadget3,0		; 3
		DEFGAD	BUTTON_KIND,gadget4,g0_tag	; 4
		DEFGAD	BUTTON_KIND,gadget5,0		; 5
lv_gad0		DEFGAD	LISTVIEW_KIND,gadget6,g6_tag
		DEFGAD	END

g1_tag		dc.l	GA_Immediate,TRUE
		dc.l	GTST_MaxChars,32
str_tag		dc.l	GTST_String,emptyname
		dc.l	TAG_END

g0_tag		dc.l	GA_Disabled,TRUE
		dc.l	TAG_END

g2_tag		dc.l	GTLV_Labels,0
		dc.l	GTLV_Selected,0
		dc.l	GTLV_ShowSelected,0
		dc.l	TAG_END

g6_tag		dc.l	GTLV_Labels,g6list
		dc.l	GTLV_ShowSelected,0
lv_tag		dc.l	GTLV_Selected,0
		dc.l	TAG_END

lv_gad_tag	dc.l	GTLV_Labels,-1
		dc.l	TAG_END

box_tag		dc.l	GT_VisualInfo,0
		dc.l	GTBB_Recessed,TRUE
		dc.l	TAG_END

b1_coord	dc.w	12,80,281,28

gadget0		NEWGAD	14,81,139,13,g0_text,PLACETEXT_IN,0
gadget1		NEWGAD	52,63,291-50,14,g1_text,PLACETEXT_LEFT,0
gadget2		NEWGAD	12,16,141,48,g2_text,PLACETEXT_ABOVE,0
gadget3		NEWGAD	153,81,138,13,g3_text,PLACETEXT_IN,0
gadget4		NEWGAD	14,94,139,13,g4_text,PLACETEXT_IN,0
gadget5		NEWGAD	153,94,138,13,g5_text,PLACETEXT_IN,0
gadget6		NEWGAD	153,16,140,48,g6_text,PLACETEXT_ABOVE,0

emptyname	dc.b	"Empty",0
g0_text		dc.b	"Format",0
g2_text		dc.b	"Drives",0
g6_text		dc.b	"DosType",0
g1_text		dc.b	"Name",0
g3_text		dc.b	"Quick Format",0
g4_text		dc.b	"Abort",0
g5_text		dc.b	"Options",0
		even

g6list		dc.l	node1
g6list0		dc.l	0
		dc.l	node7

DEFNODE		MACRO
		dc.l	\1,\2
		dc.b	0,0
		dc.l	\3
		ENDM

node1		DEFNODE	node2,g6list0,node1name
node2		DEFNODE	node3,node1,node2name
node3		DEFNODE	node4,node2,node3name
node4		DEFNODE	node5,node3,node4name
node5		DEFNODE	node6,node4,node5name
node6		DEFNODE	node7,node5,node6name
node7		DEFNODE	g6list0,node6,node7name

node1name	dc.b	"DOS",0		; add: ID_\1_DISK
node2name	dc.b	"FASTDIR_DOS",0
node3name	dc.b	"FASTDIR_FFS",0
node4name	dc.b	"FFS",0
node5name	dc.b	"INTER_DOS",0
node6name	dc.b	"INTER_FFS",0
node7name	dc.b	"MSDOS",0
		even

dostypes	dc.l	ID_DOS_DISK
		dc.l	ID_FASTDIR_DOS_DISK
		dc.l	ID_FASTDIR_FFS_DISK
		dc.l	ID_FFS_DISK
		dc.l	ID_INTER_DOS_DISK
		dc.l	ID_INTER_FFS_DISK
		dc.l	ID_MSDOS_DISK

; Device to be skipped: format can not operate on them
;
devname		dc.b	"PRT",0
		dc.b	"PAR",0
		dc.b	"SER",0
		dc.b	"RAW",0
		dc.b	"CON",0
		dc.b	"RAM",0

easyreq		dc.l	EasyStruct_SIZEOF
		dc.l	0
		dc.l	-1,-1,-1	; TITLE,TEXT,GADGET

text0		dc.b	"Error while inhibiting specified device.",0
		even
reqgad0		dc.b	"Resume",0
		even
text1		dc.b	"There are not options.",0
		even
vname		dc.b	"IFormat.pubscreen",0
		even


*+--------------------+
*| MAIN CODE BSS DATA | Un-initialized data area.
*+--------------------+

		SECTION	IFormatSTORES,BSS

stores		ds.b	mstores_SIZE

*+-------------+
*| SOURCE END! | Another master-piece by Mauro Panigada (!)
*+-------------+

		END