summaryrefslogtreecommitdiff
path: root/apps/codecs/libasap/asap_internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/libasap/asap_internal.h')
-rw-r--r--apps/codecs/libasap/asap_internal.h93
1 files changed, 93 insertions, 0 deletions
diff --git a/apps/codecs/libasap/asap_internal.h b/apps/codecs/libasap/asap_internal.h
new file mode 100644
index 0000000000..1385215f37
--- /dev/null
+++ b/apps/codecs/libasap/asap_internal.h
@@ -0,0 +1,93 @@
1/*
2 * asap_internal.h - private interface of the ASAP engine
3 *
4 * Copyright (C) 2005-2008 Piotr Fusik
5 *
6 * This file is part of ASAP (Another Slight Atari Player),
7 * see http://asap.sourceforge.net
8 *
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.
13 *
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.
18 *
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
22 */
23
24#ifndef _ASAP_INTERNAL_H_
25#define _ASAP_INTERNAL_H_
26
27#if !defined(JAVA) && !defined(CSHARP)
28
29#include "asap.h"
30
31#define CONST_LOOKUP(type, name) \
32 static const type name[]
33#define FILE_FUNC static
34#define ASAP_FUNC
35#define PTR *
36#define ADDRESSOF &
37#define ARRAY *
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) \
46 type name[size]
47#define INIT_ARRAY(array) memset(array, 0, sizeof(array))
48
49#define AST ast->
50#define PST pst->
51#define MODULE_INFO module_info->
52#define ASAP_OBX const byte *
53#define GET_OBX(name) name##_obx
54
55int ASAP_GetByte(ASAP_State *ast, int addr);
56void ASAP_PutByte(ASAP_State *ast, int addr, int data);
57
58void Cpu_RunScanlines(ASAP_State *ast, int scanlines);
59
60void PokeySound_Initialize(ASAP_State *ast);
61void PokeySound_StartFrame(ASAP_State *ast);
62void PokeySound_PutByte(ASAP_State *ast, int addr, int data);
63int PokeySound_GetRandom(ASAP_State *ast, int addr);
64void PokeySound_EndFrame(ASAP_State *ast, int cycle_limit);
65int PokeySound_Generate(ASAP_State *ast, byte buffer[], int buffer_offset, int blocks, ASAP_SampleFormat format);
66abool PokeySound_IsSilent(const PokeyState *pst);
67void PokeySound_Mute(const ASAP_State *ast, PokeyState *pst, int mask);
68
69#ifdef ASAPSCAN
70abool call_6502_player(ASAP_State *ast);
71extern abool cpu_trace;
72void print_cpu_state(const ASAP_State *ast, int pc, int a, int x, int y, int s, int nz, int vdi, int c);
73#endif
74
75#endif /* !defined(JAVA) && !defined(CSHARP) */
76
77#define ASAP_MAIN_CLOCK 1773447
78
79#define V_FLAG 0x40
80#define D_FLAG 0x08
81#define I_FLAG 0x04
82#define Z_FLAG 0x02
83
84#define NEVER 0x800000
85
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)
92
93#endif /* _ASAP_INTERNAL_H_ */