/*
	defs.h - header file for 'main.c'.
	Suitable for precompiling, when possible.
*/

#include <stdlib.h>

#include <intuition/intuition.h>
#include <exec/memory.h>
#include <exec/tasks.h>
#include <exec/interrupts.h>
#include <dos/dos.h>
#include <dos/dostags.h>
#include <graphics/gfxbase.h>
#include <graphics/gfxmacros.h>
#include <graphics/copper.h>
#include <devices/audio.h>
#include <hardware/custom.h>
#include <hardware/intbits.h>
#include <utility/tagitem.h>

#include <clib/exec_protos.h>
#include <clib/intuition_protos.h>
#include <clib/dos_protos.h>
#include <clib/graphics_protos.h>

/*  We do _not_ want to include all the stuff that alib_protos.h
    drags in - particularly not the mathffp.h file. The following
    prototypes are defined in alib_protos.h:
*/
void BeginIO( struct IORequest *io );
struct Task *CreateTask( UBYTE *name, long pri, APTR initPC,
unsigned long stackSize );



/*  Custom chips base address, resolved by linking with amiga.lib:
*/
__far extern struct Custom custom;


/*  C stubs and other labels in asm.a:
*/
void dummy(void);
int rawKey(struct IntuiMessage *msg);
void softScr_Update(void);
void softScr_Recalc(void);
void softScr_Redraw(void);
void VBServer(void);
int z80task(void);
__far extern WORD warmStart;
__far extern WORD taskLoop;
void UsrMemHandler(void);
__far extern ULONG UsrMemH_ExNum;
__far extern UWORD UsrMemH_Addr;
__far extern UBYTE UsrMemH_Value;


/*  Labels in screen.a:
*/
void softScr_InitTable(void);
__far extern ULONG softScr_SpBitmap;
__far extern ULONG softScr_Bitplane0;
__far extern ULONG softScr_Bitplane1;
__far extern ULONG softScr_Bitplane2;
__far extern ULONG softScr_Bitplane3;
__far extern ULONG softScr_LineModulo;



/*  Emulation environment data structure:

    This struct must match the assembler version in 'envdata.i'!!
    It must be defined together with the macro constant Z80_ENVDATA
    before Z80.h is read, so the Z80_Control structure includes it.
*/
struct Z80_Envdata {
    UBYTE Kbd[8];	/* Keyboard rows 0-7 */
    BYTE *SndPtr;	/* Pointer to sound data in chip memory */
};

#define Z80_ENVDATA

#include "Z80.h"



/*  Sizes to allocate
*/
#define SOFTUPD_BUFSIZE (0x1B00 + 6144)

/*  Offsets from start of z80Mem
*/
#define Z80_0_OFFSET 0x8000
#define SP_SCREENOFFSET (Z80_0_OFFSET+0x4000) /* display memory */
#define SP_SCRCOPYOFFSET 0x10000  /* copy of display memory */

#define SP_ROMSIZE 0x4000
#define SP_ROMNAME "Spectrum.ROM"
#define SP_PREFSNAME "Speccylator.prefs"


/*  Screen constants
*/
#define SPSCR_WIDTH 256
#define SPSCR_HEIGHT 192
#define SPSCR_BWDEPTH 2
#define SPSCR_BPLSIZE (sp_height*(sp_width>>3))


void cleanExit(char *s, int exitStatus);


