2 * asap_internal.h - private interface of the ASAP engine
4 * Copyright (C) 2005-2008 Piotr Fusik
6 * This file is part of ASAP (Another Slight Atari Player),
7 * see http://asap.sourceforge.net
9 * ASAP is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published
11 * by the Free Software Foundation; either version 2 of the License,
12 * or (at your option) any later version.
14 * ASAP is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty
16 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 * See the GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with ASAP; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 #ifndef _ASAP_INTERNAL_H_
25 #define _ASAP_INTERNAL_H_
27 #if !defined(JAVA) && !defined(CSHARP)
31 #define CONST_LOOKUP(type, name) \
32 static const type name[]
33 #define FILE_FUNC static
38 #define VOIDPTR void *
39 #define UBYTE(data) (data)
40 #define SBYTE(data) (signed char) (data)
41 #define STRING const char *
42 #define ZERO_ARRAY(array) memset(array, 0, sizeof(array))
43 #define COPY_ARRAY(dest, dest_offset, src, src_offset, len) \
44 memcpy(dest + dest_offset, src + src_offset, len)
45 #define NEW_ARRAY(type, name, size) \
47 #define INIT_ARRAY(array) memset(array, 0, sizeof(array))
51 #define MODULE_INFO module_info->
52 #define ASAP_OBX const byte *
53 #define GET_OBX(name) name##_obx
55 int ASAP_GetByte(ASAP_State
*ast
, int addr
);
56 void ASAP_PutByte(ASAP_State
*ast
, int addr
, int data
);
58 void Cpu_RunScanlines(ASAP_State
*ast
, int scanlines
);
60 void PokeySound_Initialize(ASAP_State
*ast
);
61 void PokeySound_StartFrame(ASAP_State
*ast
);
62 void PokeySound_PutByte(ASAP_State
*ast
, int addr
, int data
);
63 int PokeySound_GetRandom(ASAP_State
*ast
, int addr
);
64 void PokeySound_EndFrame(ASAP_State
*ast
, int cycle_limit
);
65 int PokeySound_Generate(ASAP_State
*ast
, byte buffer
[], int buffer_offset
, int blocks
, ASAP_SampleFormat format
);
66 abool
PokeySound_IsSilent(const PokeyState
*pst
);
67 void PokeySound_Mute(const ASAP_State
*ast
, PokeyState
*pst
, int mask
);
70 abool
call_6502_player(ASAP_State
*ast
);
71 extern abool cpu_trace
;
72 void print_cpu_state(const ASAP_State
*ast
, int pc
, int a
, int x
, int y
, int s
, int nz
, int vdi
, int c
);
75 #endif /* !defined(JAVA) && !defined(CSHARP) */
77 #define ASAP_MAIN_CLOCK 1773447
84 #define NEVER 0x800000
86 #define dGetByte(addr) UBYTE(AST memory[addr])
87 #define dPutByte(addr, data) AST memory[addr] = (byte) (data)
88 #define dGetWord(addr) (dGetByte(addr) + (dGetByte((addr) + 1) << 8))
89 #define GetByte(addr) (((addr) & 0xf900) == 0xd000 ? ASAP_GetByte(ast, addr) : dGetByte(addr))
90 #define PutByte(addr, data) do { if (((addr) & 0xf900) == 0xd000) ASAP_PutByte(ast, addr, data); else dPutByte(addr, data); } while (FALSE)
91 #define RMW_GetByte(dest, addr) do { if (((addr) >> 8) == 0xd2) { dest = ASAP_GetByte(ast, addr); AST cycle--; ASAP_PutByte(ast, addr, dest); AST cycle++; } else dest = dGetByte(addr); } while (FALSE)
93 #endif /* _ASAP_INTERNAL_H_ */