/*
 * general constants/functions for memory, addresses, etc.
 *    for Linux DOS emulator, Robert Sanders, gt8134b@prism.gatech.edu
 *
 * $Date: $
 * $Source: $
 * $Revision: $
 * $State: $
 *
 * $Log: $
 */

#ifndef _EMU_MEM_H
#define _EMU_MEM_H

/* Memory adresses for all common video adapters */

#define VBIOS_START	   (config.vbios_seg << 4)
#define VBIOS_SIZE	   (config.vbios_size)

#define EMM_BASE_ADDRESS   (config.ems_frame << 4)
#define EMM_SEGMENT        (config.ems_frame)

#define BIOS_DATA_SEG      (0x400)	/* for absolute adressing */
#define BIOS_DATA_PTR(off) ((void *) (BIOS_DATA_SEG + off))

#define KBD_START BIOS_DATA_PTR(0x80)
#define KBD_END   BIOS_DATA_PTR(0x82)
#define KBD_HEAD  BIOS_DATA_PTR(0x1A)
#define KBD_TAIL  BIOS_DATA_PTR(0x1C)

#define KBDFLAG_ADDR (unsigned short *)BIOS_DATA_PTR(0x17)
#define KEYFLAG_ADDR (unsigned short *)BIOS_DATA_PTR(0x96)

/* memcheck memory conflict finder definitions */
extern int  memcheck_addtype(int map_char, const char *name);
extern void memcheck_reserve(int map_char, int addr_start, int size);
extern void memcheck_init(void);
extern int  memcheck_isfree(int addr_start, int size);
extern int  memcheck_findhole(int *start_addr, int min_size, int max_size);
extern void memcheck_dump(void);

extern void a20_init(void);
extern void a20_reset(void);
extern void a20_enable(void);
extern void a20_disable(void);

#endif /* _EMU_MEM_H */
