/*static char *SCCSID = "@(#)glb.c	6.4 91/10/29";*/
/***	GLB.C - Definitions of global variables.
 *
 *	Format
 *	Michael Walma
 *	Copyright March 1988, Microsoft Corp.
 *	March 28 1988
 *
 *	Modification History:
 *	G.A. Jones	09/29/88	Adapted from DEFGLOB.H.
 * @d01 73790    93SEP03 GY <Support V4FORMAT extensions.  GHASSAN@AUSVM1>
 *      74485    93OCT27 Nizinski added fmt_not_bad_param_flag to suppress
 *                       message sys1276 when exiting from format (when
 *                       reason for exit is not due to bad parameter on
 *                       the command line.
 *      80714    94MAR14 F.Miro' - Fast Format
 *      82508    94APR20 F.Miro' - Re-Delta Fast Format
 */

#include <setjmp.h>
#include "ldefs.h"
#include "ltypes.h"

USHORT fmt_label_flag = FALSE;	/* true when volume label is known */
USHORT fmt_format_flag = TRUE;	/* true when disk should be formatted */
USHORT fmt_format_track_flag = FALSE;	/* false ==> do not write 0xF6's to disk */
                                       /* true ==> write 0xF6's to disk */
                                       // @80714
USHORT fmt_update_config_flag = TRUE;  /* update config.sys when TRUE */
USHORT fmt_usepipe = FALSE;		/* true if pipe handle specified   */
USHORT fmt_not_bad_param_flag = FALSE; /* 74485 assume bad parameter */
#ifdef PMFRONTEND
USHORT fmt_pmfrontend = FALSE;	//PCR PM FRONT END
#endif

#ifdef FILE_VER
ULONG fmt_volsize=0L;		/* number of sectors in "disk" */
#endif

UCHAR fmt_volume_label [VOL_LABEL_SIZE+2];
UCHAR fmt_inbuf [80];

struct format_packet fmt_form_packet;	/* struct used by formatting IOCTL */

#ifdef TWO_MAPS
struct bad_list *fmt_bad=NULL, *fmt_bad2=NULL;
ULONG *fmt_free_ind [2] = { NULL, NULL };
#else
struct bad_list *fmt_bad=NULL;
ULONG *fmt_free_ind [1] = { NULL };
#endif

#ifdef TIMESTAMPS
UCHAR fmt_version_str [] = "Pinball FORMAT Boot_OEM 1.03\n";
#endif

/*
 * Array of error message codes, indexed by xxx_ERROR code definitions.
 */

USHORT fmt_error_message [] = {
  0,				/* no final error message for bad cmd line */
  FMT_OPEN_ERROR_STR,
  FMT_HPFS_NOT_LOADED_STR,
  FMT_INSTALL_ERROR_STR,
  FMT_INFO_ERROR_STR,
  FMT_INSUFF_MEM_STR,
  FMT_OS_ERROR_STR,
  FMT_FLOPPY_ERROR_STR,
  FMT_DRIVE_REQD_STR,
  FMT_TWO_DRIVES_STR,
  FMT_WRONG_LABEL_STR,
  FMT_TOO_MANY_MOUNTS_STR
};

struct FNODE fmt_root_fnode;

struct DIRBLK fmt_root_dir;

USHORT fmt_num_free_maps;
USHORT fmt_num_bad_blocks;

USHORT fmt_cblocks_bii;			 /* BIGDISK */

USHORT fmt_current_head;
USHORT fmt_current_cyl;

ULONG fmt_tracks_left;

//@80714
ULONG fmt_tracks_start_volume;
ULONG fmt_start_track_mid_volume;
ULONG fmt_number_mid_volume_tracks;

jmp_buf fmt_error;	/* setjmp environment used by exit_error */

USHORT hfileFmtPipe;

#ifdef  V4FORMAT        /* @d01 */
BYTE    fmt_cf;         /* MultiMedia's Contiguity Factor */
#endif
