/* $Revision Header * Header built automatically - do not edit! *************
 *
 *	(C) Copyright 1990 by MXM
 *
 *	Name .....: PreInclude.c
 *	Created ..: Thursday 31-May-90 19:49
 *	Revision .: 1
 *
 *	Date            Author          Comment
 *	=========       ========        ====================
 *	24-Jul-90       Olsen           Added __NO_PRAGMAS and FormatterPort
 *	31-May-90       Olsen           Created this file!
 *
 ****************************************************************************
 *
 *	This file contains various includes/definitions used by Formatter.c
 *
 * $Revision Header ********************************************************/

	/* Note: I discovered that inline-library calls actually
	 *       slowed down the program and caused it to become
	 *       larger than necessary.
	 */

#define __NO_PRAGMAS 1

#include <intuition/intuitionbase.h>
#include <libraries/filehandler.h>
#include <libraries/dosextens.h>
#include <devices/trackdisk.h>
#include <libraries/arpbase.h>
#include <graphics/gfxbase.h>
#include <devices/timer.h>
#include <exec/devices.h>
#include <exec/memory.h>
#include <functions.h>

	/* This is the typical form of a disk bitmap (well, this
	 * is how it would look like in 'C').
	 */

struct DosBitmap
{
	ULONG	CheckSum;	/* Block checksum. */

	ULONG	BitmapData[55];	/* 55 × 32 Bits = 1760 blocks. */

	ULONG	WhoKnows0[72];	/* 72 unused bytes (to fit into 512 bytes). */
};

	/* This structure describes the root directory of a disk. */

struct DosDirectory
{
	ULONG			PrimaryType;		/* Primary type. */
	ULONG			HeaderKey;		/* Header key, always null. */

	ULONG			WhoKnows0;
	ULONG			HashTableSize;		/* Size of hash table (128 - 56 = 72). */
	ULONG			WhoKnows1;

	ULONG			CheckSum;		/* Block checksum. */

	ULONG			HashTable[72];		/* Hash table (filled in later). */

	ULONG			BitmapFlag;		/* DOSTRUE if bitmap is valid. */

	ULONG			BitmapPointers[25];	/* Pointers to bitmap blocks. */
	ULONG			BitmapExtension;	/* Pointer to bitmap extra information. */

	struct DateStamp	LastRootChange;		/* Time and date of last change in root directory. */

	char			DiskName[32];		/* Disk name as a BCPL string (max. 31 characters). */

	ULONG			WhoKnows2[2];

	struct DateStamp	LastDiskChange;		/* Time and date of last change on disk. */
	struct DateStamp	CreationDate;		/* Time and date of disk creation. */

	ULONG			NextHash;		/* Next entry in hash chain (userdir only). */
	ULONG			ParentDir;		/* Pointer to block with parent dir (userdir only). */

	ULONG			WhoKnows3;

	ULONG			SecondaryType;		/* Secondary type (huh?). */
};

	/* Global shared MsgPort. */

struct FormatterPort
{
	struct MsgPort	Port;			/* Standard exec link field. */

	BYTE		DriveInUse[4];		/* Occupied drives. */

	BYTE		NumPrgs;		/* Number of Formatters currently running. */
};

	/* Hard coded disk data. */

#define NUMCYLS		80			/* Number of cylinders. */
#define NUMHEADS	2			/* Number of heads. */
#define NUMTRACKS	(NUMCYLS * NUMHEADS)	/* Number of tracks. */

#define T_SHORT		2			/* Primary type. */
#define ST_ROOT		1			/* Secondary type. */

#define MILLION		1000000			/* Yes, this is a million. */
