1 #ifdef __MAIN_DECLARATIONS__
2 #define axeEXTERN
3 #else
4 #define axeEXTERN extern
5 #endif
6 
7 #ifndef BYTE
8 #define BYTE unsigned char
9 #endif
10 #ifndef WORD
11 #define WORD unsigned short int
12 #endif
13 #ifndef DWORD
14 #define DWORD unsigned long int
15 #endif
16 #ifndef BOOL
17 #define BOOL int
18 #endif
19 #define TRUE 1
20 #define FALSE 0
21 
22 axeEXTERN bool	isStereo;
23 axeEXTERN int	sampleStep;
24 
25 extern void pokeyGenerateCheckIRQline(void);
26 extern void pokeyGenerateIRQ( BYTE irqMask );
27 
28 axeEXTERN BYTE	atariMem[ 0x10000 ];
29 axeEXTERN WORD	sndBuf[16384];
30 axeEXTERN int	sndBufPtr;
31 
32 axeEXTERN BYTE	ANTIC_VCOUNT_D40B;
33 
34 axeEXTERN WORD cpuReg_PC;
35 axeEXTERN BYTE cpuFlag_N,cpuFlag_Z,cpuFlag_C,cpuFlag_D,cpuFlag_B,cpuFlag_I,cpuFlag_V,cpuReg_A,cpuReg_X,cpuReg_Y,cpuReg_S;
36 // cpuFlag_N is valid only in last bit-7
37 // cpuFlag_Z is set if whole cpuFlag_Z is not zero
38 // cpuFlag_C is valid only in first bit-0
39 // cpuFlag_D is valid only in first bit-0
40 // cpuFlag_B is valid only in first bit-0
41 // cpuFlag_I is valid only in first bit-0
42 // cpuFlag_V is valid only in first bit-0
43 
44 
45 extern void cpuInit( void );
46 extern int cpuExecuteOneOpcode( void );
47 extern BYTE cpuGetFlags( void );
48 extern void cpuSetFlags( BYTE flags );
49 
50 extern void pokeyInit( void );
51 extern void pokeyReset( void );
52 extern BYTE pokeyReadByte( short unsigned int address );
53 extern void pokeyWriteByte0( short unsigned int address, BYTE value );
54 extern void pokeyWriteByte1( short unsigned int address, BYTE value );
55 extern void pokeyUpdateSound( int n );
56 extern void pokeyUpdateSoundCounters( void );
57 
58 inline BYTE freddieReadByte( WORD ad )
59 {
60 	if( (ad&0xF800)==0xD000 )
61 	{
62 		if( (ad&0xFF00)==0xD200 )
63 		{
64 			return pokeyReadByte( ad );
65 		}
66 		if( (ad&0xFF0F)==0xD40B )
67 			return ANTIC_VCOUNT_D40B;
68 	}
69 	return atariMem[ad];
70 }
71 inline BYTE freddieCPUReadByte( WORD ad )
72 {
73 	return atariMem[ad];
74 }
75 
76 inline void freddieWriteByte( WORD ad, BYTE val )
77 {
78 	if( (ad&0xFF00)==0xD200 )
79 	{
80 		if( ((ad&0x10)==0) || (isStereo==false) ) pokeyWriteByte0( ad, val );
81 		else pokeyWriteByte1( ad, val );
82 		return;
83 	}
84 	atariMem[ad] = val;
85 }
86 
87 typedef int (*opcodeFunc)(bool &holded);
88 
89 extern opcodeFunc opcodes_0x00_0xFF[256];
90