//boot.h Copyright (C) 1989-2000 I.Pedley (CTPP) Mon 22-Jan-2001 at 21:05:51

//structures defined elsewhere, brought together here for use by
//bootstrap

//just like a DOS BPB, with jmp[] and oem[] tagging along at the beginning
struct BOOTSECTOR
{
    UC  jmp[3];
    CH  oem[8];
    UI  bytes_per_sector;
    UC  sectors_per_cluster;
    UI  sectors_reserved;
    UC  fats;
    UI  root_entries;
    UI  total_sectors;
    UC  mediabyte;
    UI  sectors_per_fat;
    UI  sectors_per_track;
    UI  heads;
    UL  hidden_sectors;
    UL  ext_totalsectors;
    UI  physicaldrivenumber;
    UC  extbootsignature;
    UL  serial;                     //valid if extbootsignature is 0x29
    CH  volume[11];                 //  "            "
    CH  fatscheme[8];               //  "            "
};

struct DOSDIRENTRY
{
    CH  name[8];
    CH  ext[3];
    UC  attr;
    UL  res1;
    UL  res2;
    UI  clusterhi;          //top 16 bits of the FAT32 cluster number
    UI  time;
    UI  date;
    UI  clusterlo;
    UL  size;
};

#define ftNORMAL    0x00
#define ftRDONLY    0x01
#define ftHIDDEN    0x02
#define ftSYSTEM    0x04
#define ftVOLUME    0x08
#define ftSUBDIR    0x10
#define ftARCHIVE   0x20



//#define RUNFILE              0x80000000
//#define MAPFILE              0x40000000
//#define DUMPFILE             0x20000000
//#define SORTSYMBOLS          0x10000000
//#define ABSOLUTE             0x08000000
//#define MEMORYFIXUPS         0x04000000
//#define EMBEDDEDSOURCE       0x02000000
//#define FASTRELOCS           0x01000000
//#define SYSTEMSYMBOLS        0x00000001
//#define IGNOREERRORS         0x00000002

//#define UNRESOLVEDEXTERNALS  0x00800000

#define STANDALONE           0x00400000


struct pdesc        //fword to load into GDTR and IDTR
{
   UI limit;
   UL linadd;
};
struct  DESC32
{
    UI  limit;
    UI  baseloword;
    UC  basemidbyte;
    UI  attribute;
    UC  basehibyte;
};
struct  SYSDESC32
{
    UI  offsetloword;
    UI  selector;
    UI  attribute;
    UI  offsethiword;
};

struct  RMIREGS
{
    UL  edi,esi,ebp,esp,ebx,edx,ecx,eax;
    UI  ip,cs,flags;
};
//structure for ChaOS real mode callbacks, matching industry DPMIREGS
struct DPMIREGS
{
    UL  edi;
    UL  esi;
    UL  ebp;
    UL  res;
    UL  ebx;
    UL  edx;
    UL  ecx;
    UL  eax;
    UI  flags;
    UI  es,ds,fs,gs;
    UI  ip,cs,sp,ss;
};

//17.3.02 defines for new boot map

#define bmPART  0x500   //partition table loaded just above BIOS data area
#define bmBOOT  0x700   //boot sector loaded just above that
#define bmROOT  0x900   //work area for boot sector to load root directory
#define bmLOAD  0xb00   //bootstrap loader just above that

#define rtPART  0x69b   //where to find run-time partition which booted
#define rtDRV   0x8fc   //where to find run-time bios drive identifier for
                        //boot device