summaryrefslogtreecommitdiff
path: root/lib/rbcodec/codecs/libasap/asap_internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rbcodec/codecs/libasap/asap_internal.h')
-rw-r--r--lib/rbcodec/codecs/libasap/asap_internal.h115
1 files changed, 115 insertions, 0 deletions
diff --git a/lib/rbcodec/codecs/libasap/asap_internal.h b/lib/rbcodec/codecs/libasap/asap_internal.h
new file mode 100644
index 0000000000..def444bc2f
--- /dev/null
+++ b/lib/rbcodec/codecs/libasap/asap_internal.h
@@ -0,0 +1,115 @@
1/*
2 * asap_internal.h - private interface of ASAP
3 *
4 * Copyright (C) 2005-2010 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#include "anylang.h"
28
29#ifndef C
30
31#define ASAP_SONGS_MAX 32
32#define ASAP_SAMPLE_RATE 44100
33
34#endif
35
36#ifdef JAVA
37
38#define ASAP_FORMAT_U8 8
39#define ASAP_FORMAT_S16_LE 16
40#define ASAP_FORMAT_S16_BE -16
41#define ASAP_SampleFormat int
42
43#elif defined(CSHARP) || defined(JAVASCRIPT)
44
45#define ASAP_FORMAT_U8 ASAP_SampleFormat.U8
46#define ASAP_FORMAT_S16_LE ASAP_SampleFormat.S16LE
47#define ASAP_FORMAT_S16_BE ASAP_SampleFormat.S16BE
48
49#elif defined(ACTIONSCRIPT)
50
51#define ASAP_SampleFormat int
52
53#else /* C */
54
55#include "asap.h"
56
57int ASAP_GetByte(ASAP_State *ast, int addr);
58void ASAP_PutByte(ASAP_State *ast, int addr, int data);
59
60void Cpu_RunScanlines(ASAP_State *ast, int scanlines);
61
62void PokeySound_Initialize(ASAP_State *ast);
63void PokeySound_StartFrame(ASAP_State *ast);
64void PokeySound_PutByte(ASAP_State *ast, int addr, int data);
65int PokeySound_GetRandom(ASAP_State *ast, int addr, int cycle);
66void PokeySound_EndFrame(ASAP_State *ast, int cycle_limit);
67int PokeySound_Generate(ASAP_State *ast, byte buffer[], int buffer_offset, int blocks, ASAP_SampleFormat format);
68abool PokeySound_IsSilent(const PokeyState *pst);
69void PokeySound_Mute(const ASAP_State *ast, PokeyState *pst, int mask);
70
71#ifdef ASAPSCAN
72abool call_6502_player(ASAP_State *ast);
73extern int cpu_trace;
74void trace_cpu(const ASAP_State *ast, int pc, int a, int x, int y, int s, int nz, int vdi, int c);
75#endif
76
77#endif /* C */
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 DELTA_SHIFT_POKEY 20
87#define DELTA_SHIFT_GTIA 20
88#define DELTA_SHIFT_COVOX 17
89
90/* 6502 player types */
91#define ASAP_TYPE_SAP_B 1
92#define ASAP_TYPE_SAP_C 2
93#define ASAP_TYPE_SAP_D 3
94#define ASAP_TYPE_SAP_S 4
95#define ASAP_TYPE_CMC 5
96#define ASAP_TYPE_CM3 6
97#define ASAP_TYPE_CMR 7
98#define ASAP_TYPE_CMS 8
99#define ASAP_TYPE_DLT 9
100#define ASAP_TYPE_MPT 10
101#define ASAP_TYPE_RMT 11
102#define ASAP_TYPE_TMC 12
103#define ASAP_TYPE_TM2 13
104
105#define dGetByte(addr) UBYTE(ast _ memory[addr])
106#define dPutByte(addr, data) ast _ memory[addr] = CAST(byte) (data)
107#define dGetWord(addr) (dGetByte(addr) + (dGetByte((addr) + 1) << 8))
108#define GetByte(addr) (((addr) & 0xf900) == 0xd000 ? ASAP_GetByte(ast, addr) : dGetByte(addr))
109#define PutByte(addr, data) do { if (((addr) & 0xf900) == 0xd000) ASAP_PutByte(ast, addr, data); else dPutByte(addr, data); } while (FALSE)
110#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)
111
112#define ASAP_MAIN_CLOCK(ast) ((ast) _ module_info->ntsc ? 1789772 : 1773447)
113#define CYCLE_TO_SAMPLE(cycle) TO_INT(((cycle) * ASAP_SAMPLE_RATE + ast _ sample_offset) / ASAP_MAIN_CLOCK(ast))
114
115#endif /* _ASAP_INTERNAL_H_ */