/*
 * $Date: $
 * $Source: $
 * $Revision: $
 * $State: $
 *
 * $Log: $
 */

#ifndef _EMU_XMS_H
#define _EMU_XMS_H

#include "emu_defs.h"

#define INT2F_XMS_MAGIC		0x0043	/* AH for all int 2f XMS calls */
#define XMS_VERSION    		0x0300	/* version 3.00 */
#define XMS_DRIVER_VERSION	0x0003	/* my driver version 0.03 */

#define NUM_HANDLES     64
#define FIRST_HANDLE    1

#define PARAGRAPH       16	/* bytes in a paragraph */

/* the NEWXMS API duplicates some functions for > 64 MB range (32-bit) */
#define OLDXMS          1
#define NEWXMS          2

/* non-version XMS call been made yet? */
EXTERN int xms_grab_int15 INIT(0);

struct EMM {
  Bit32u   Length;
  Bit16u   SourceHandle;
  Bit32u   SourceOffset;
  Bit16u   DestHandle;
  Bit32u   DestOffset;
};

struct Handle {
  Bit16u   num;
  Bit8u   *addr;
  Bit32u   size;
  Boolean  valid;
  int lockcount;
};

struct UMB {
  Bit16u   segment, size;
  Boolean  used;
};

extern void xms_control(void);
extern void xms_int15(void);
extern void xms_init(void);
extern void xms_reset(void);

#endif /* _EMU_XMS_H */
