/*
 * bios.S entry points
 *
 * $Date: $
 * $Source: $
 * $Revision: $
 * $State: $
 *
 * $Log: $
 */

#ifndef _BIOS_ENTRY_H
#define _BIOS_ENTRY_H

#ifdef __cplusplus
#define asmlinkage extern "C"
#else
#define asmlinkage
#endif

#ifdef __ELF__
#ifdef __STDC__
#define CISH_INLINE(x) #x
#define CISH(x) x
#else
#define CISH_INLINE(x) "x"
#define CISH(x) x
#endif
#else
#ifdef __STDC__
#define CISH_INLINE(x) "_"#x
#define CISH(x) _##x
#else
#define CISH_INLINE(x) "_x"
#define CISH(x) _/**/x
#endif
#endif

#ifndef BIOSSEG
#define BIOSSEG		0xf000
#endif

/*
 * The following are the data addresses
 */
#define ROM_Mouse_Handler   0xd000   /* For internal mouse driver */
#define ROM_Int10_Handler   0xd004   /* For our int 10 handler */
#define LASTSCAN_OFF	    0xd008   /* For our int09 handler */

#define LASTSCAN_ADD	    (u_short *)((BIOSSEG << 4) + LASTSCAN_OFF)

/*
 * The following are the non-standard "dosemu bios" addresses
 */
#define ROM_Mouse_OFF       0xe2d0   /* internal mouse driver */
#define ROM_Mouse_ROUTINE_OFF 0xe2e0 /* ??? internal mouse driver */
#define ROM_XMSControl_OFF  0xe2f0   
#define ROM_IPX             0xe310   /* IPX code */
#define ROM_FCB_Handler     0xe350   /* int e7 FCB handler */
#define ROM_INT10_Watcher   0xe360   /* int 10 mouse helper */
#define ROM_DPMI_Offset     0xf100   /* currently located on it's own */
                                     /* reserved through 0xf500 */

#define ROM_PIC_HLT         0xcfff   /* Offset of 1 byte hlt -- last byte */
                                     /* in HLT handler block */

/*
 * The following are (to the best of my knowledge) the standard BIOS
 * entry points and table addresses
 */
#define ROM_BIOS_SELFTEST   0xe05b   /* power on self test addr */
#define ROM_BIOS_IRQ_HI     0xe2b0   /* irq 8-15 handler */
#define ROM_BIOS_NMI        0xe2c3   /* nmi handler */
#define ROM_BIOS_INT13HARD  0xe3fe   /* int 13 hard drive handler */
#define ROM_BIOS_HARDPARM   0xe401   /* hard drive param. table */
#define ROM_BIOS_HARDPARM2  0xe6b1   /* ??? hard drive param. table */
#define ROM_BIOS_INT19      0xe6f2   /* boot-load entry point */
#define ROM_BIOS_SYSPARM    0xe6f5   /* configuration data table */
#define ROM_BIOS_BAUDRATE   0xe729   /* baud rate generator table */
#define ROM_BIOS_INT14      0xe739   /* int 14 serial handler */
#define ROM_BIOS_INT16      0xe82e   /* int 16 keyboard handler */
#define ROM_BIOS_INT09      0xe987   /* int 09 keyboard interrupt */
#define ROM_BIOS_INT13FLOP  0xec59   /* int 13 floppy handler */
#define ROM_BIOS_INT13      0xec59   /* int 13 entry has to be somewhere... */
#define ROM_BIOS_INT0E      0xef57   /* int 0e floppy driver (irq6) */
#define ROM_BIOS_IRQ02      0xef60   /* irq2 default handler */
#define ROM_BIOS_IRQ03      0xef68   /* irq3 default handler */
#define ROM_BIOS_IRQ04      0xef70   /* irq4 default handler */
#define ROM_BIOS_IRQ05      0xef78   /* irq5 default handler */
#define ROM_BIOS_IRQ07      0xef80   /* irq7 default handler */
#define ROM_BIOS_IRQ09      0xefa0   /* irq9 cascade handler */
#define ROM_BIOS_FLOPPARM   0xefc7   /* diskette controller parms */
#define ROM_BIOS_INT17      0xefd2   /* int 17 printer handler */
#define ROM_BIOS_INT10LO    0xf045   /* int 10 0x00-0x0f handler */
#define ROM_BIOS_INT10      0xf065   /* int 10 handler */
#define ROM_BIOS_VIDEOPARM  0xf0a4   /* CGA/MDA video param table (int 1d) */
#define ROM_BIOS_INT12      0xf841   /* int 12 mem. size handler */
#define ROM_BIOS_INT11      0xf84d   /* int 11 equip. list handler */
#define ROM_BIOS_INT15      0xf859   /* int 15 system services */
#define ROM_BIOS_8x8FONT    0xfa6e   /* 8x8 font */
#define ROM_BIOS_INT1A      0xfe6e   /* int 0x1a time of day handler */
#define ROM_BIOS_INT08      0xfea5   /* int 0x08 timer tick handler */
#define ROM_BIOS_INITINTS   0xfef3   /* initial interrupt vector table */
#define ROM_BIOS_IRQ15      0xff43   /* irq15 code */
#define ROM_BIOS_IRET       0xff53   /* dummy iret instr. */
#define ROM_BIOS_INT05      0xff54   /* int 05 print screen handler */
#define ROM_BIOS_POWERON    0xfff0   /* power-on entry point */
#define ROM_BIOS_DATE       0xfff5   /* ascii rom date mm/dd/yy */
#define ROM_BIOS_MODELID    0xfffe   /* system model id */

#define GFX_CHARS	0xffa6e
#define GFXCHAR_SIZE	1024

#define Mouse_SEG          ((Bit32u)BIOSSEG)
#define Mouse_OFF          ((Bit32u)ROM_Mouse_OFF)
#define Mouse_ROUTINE_OFF  ((Bit32u)ROM_Mouse_ROUTINE_OFF)
#define Mouse_ADD          ((Mouse_SEG << 4)+Mouse_OFF)
#define Mouse_ROUTINE      ((Mouse_SEG << 4)+Mouse_ROUTINE_OFF)
#define PIC_SEG            ((Bit32u)BIOSSEG)
#define PIC_OFF            ((Bit32u)ROM_PIC_HLT)
#define PIC_ADD            ((PIC_SEG << 4) + PIC_OFF)
#define XMSControl_SEG     ((Bit32u)BIOSSEG)
#define XMSControl_OFF     ((Bit32u)ROM_XMSControl_OFF)
#define XMSControl_ADD     ((XMSControl_SEG << 4)+XMSControl_OFF)
#define XMSTrap_ADD        ((XMSControl_SEG << 4)+XMSControl_OFF+5)
#define ROM_CONFIG_SEG     BIOSSEG
#define ROM_CONFIG_OFF     ROM_BIOS_SYSPARM
#define ROM_CONFIG_ADD	   ((ROM_CONFIG_SEG << 4) + ROM_CONFIG_OFF)
#define DPMI_SEG	   BIOSSEG
#define DPMI_OFF	   ROM_DPMI_Offset
#define DPMI_ADD           ((DPMI_SEG << 4) + DPMI_OFF)
#define INT09_SEG	   BIOSSEG
#define INT09_OFF	   ROM_BIOS_INT09
#define INT09_ADD          ((INT09_SEG << 4) + INT09_OFF)
#define MFS_INT2F_SEG	   BIOSSEG
#define MFS_INT2F_OFF	   ROM_FCB_Handler

#endif /* _EMU_MEM_H */
