summaryrefslogtreecommitdiff
path: root/apps/codecs/libasap/asap_internal.h
diff options
context:
space:
mode:
authorDominik Wenger <domonoky@googlemail.com>2010-02-04 17:31:10 +0000
committerDominik Wenger <domonoky@googlemail.com>2010-02-04 17:31:10 +0000
commit35472fe7f1c7133fa4291dad36ae457a460f021c (patch)
treec84a0118c7c992a30d0cb42d1778ec9918184b1f /apps/codecs/libasap/asap_internal.h
parentb1a6c9096dfde44249d0f4d8a929c63a89987623 (diff)
downloadrockbox-35472fe7f1c7133fa4291dad36ae457a460f021c.tar.gz
rockbox-35472fe7f1c7133fa4291dad36ae457a460f021c.zip
sync asap codec to ASAP 2.1
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24511 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libasap/asap_internal.h')
-rw-r--r--apps/codecs/libasap/asap_internal.h91
1 files changed, 57 insertions, 34 deletions
diff --git a/apps/codecs/libasap/asap_internal.h b/apps/codecs/libasap/asap_internal.h
index 1385215f37..1e38496344 100644
--- a/apps/codecs/libasap/asap_internal.h
+++ b/apps/codecs/libasap/asap_internal.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * asap_internal.h - private interface of the ASAP engine 2 * asap_internal.h - private interface of ASAP
3 * 3 *
4 * Copyright (C) 2005-2008 Piotr Fusik 4 * Copyright (C) 2005-2010 Piotr Fusik
5 * 5 *
6 * This file is part of ASAP (Another Slight Atari Player), 6 * This file is part of ASAP (Another Slight Atari Player),
7 * see http://asap.sourceforge.net 7 * see http://asap.sourceforge.net
@@ -24,33 +24,35 @@
24#ifndef _ASAP_INTERNAL_H_ 24#ifndef _ASAP_INTERNAL_H_
25#define _ASAP_INTERNAL_H_ 25#define _ASAP_INTERNAL_H_
26 26
27#if !defined(JAVA) && !defined(CSHARP) 27#include "anylang.h"
28 28
29#include "asap.h" 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
30 48
31#define CONST_LOOKUP(type, name) \ 49#elif defined(ACTIONSCRIPT)
32 static const type name[] 50
33#define FILE_FUNC static 51#define ASAP_SampleFormat int
34#define ASAP_FUNC 52
35#define PTR * 53#else /* C */
36#define ADDRESSOF & 54
37#define ARRAY * 55#include "asap.h"
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 56
55int ASAP_GetByte(ASAP_State *ast, int addr); 57int ASAP_GetByte(ASAP_State *ast, int addr);
56void ASAP_PutByte(ASAP_State *ast, int addr, int data); 58void ASAP_PutByte(ASAP_State *ast, int addr, int data);
@@ -60,7 +62,7 @@ void Cpu_RunScanlines(ASAP_State *ast, int scanlines);
60void PokeySound_Initialize(ASAP_State *ast); 62void PokeySound_Initialize(ASAP_State *ast);
61void PokeySound_StartFrame(ASAP_State *ast); 63void PokeySound_StartFrame(ASAP_State *ast);
62void PokeySound_PutByte(ASAP_State *ast, int addr, int data); 64void PokeySound_PutByte(ASAP_State *ast, int addr, int data);
63int PokeySound_GetRandom(ASAP_State *ast, int addr); 65int PokeySound_GetRandom(ASAP_State *ast, int addr, int cycle);
64void PokeySound_EndFrame(ASAP_State *ast, int cycle_limit); 66void PokeySound_EndFrame(ASAP_State *ast, int cycle_limit);
65int PokeySound_Generate(ASAP_State *ast, byte buffer[], int buffer_offset, int blocks, ASAP_SampleFormat format); 67int PokeySound_Generate(ASAP_State *ast, byte buffer[], int buffer_offset, int blocks, ASAP_SampleFormat format);
66abool PokeySound_IsSilent(const PokeyState *pst); 68abool PokeySound_IsSilent(const PokeyState *pst);
@@ -68,11 +70,11 @@ void PokeySound_Mute(const ASAP_State *ast, PokeyState *pst, int mask);
68 70
69#ifdef ASAPSCAN 71#ifdef ASAPSCAN
70abool call_6502_player(ASAP_State *ast); 72abool call_6502_player(ASAP_State *ast);
71extern abool cpu_trace; 73extern int 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); 74void trace_cpu(const ASAP_State *ast, int pc, int a, int x, int y, int s, int nz, int vdi, int c);
73#endif 75#endif
74 76
75#endif /* !defined(JAVA) && !defined(CSHARP) */ 77#endif /* C */
76 78
77#define ASAP_MAIN_CLOCK 1773447 79#define ASAP_MAIN_CLOCK 1773447
78 80
@@ -83,11 +85,32 @@ void print_cpu_state(const ASAP_State *ast, int pc, int a, int x, int y, int s,
83 85
84#define NEVER 0x800000 86#define NEVER 0x800000
85 87
86#define dGetByte(addr) UBYTE(AST memory[addr]) 88#define DELTA_SHIFT_POKEY 20
87#define dPutByte(addr, data) AST memory[addr] = (byte) (data) 89#define DELTA_SHIFT_GTIA 20
90#define DELTA_SHIFT_COVOX 17
91
92/* 6502 player types */
93#define ASAP_TYPE_SAP_B 1
94#define ASAP_TYPE_SAP_C 2
95#define ASAP_TYPE_SAP_D 3
96#define ASAP_TYPE_SAP_S 4
97#define ASAP_TYPE_CMC 5
98#define ASAP_TYPE_CM3 6
99#define ASAP_TYPE_CMR 7
100#define ASAP_TYPE_CMS 8
101#define ASAP_TYPE_DLT 9
102#define ASAP_TYPE_MPT 10
103#define ASAP_TYPE_RMT 11
104#define ASAP_TYPE_TMC 12
105#define ASAP_TYPE_TM2 13
106
107#define dGetByte(addr) UBYTE(ast _ memory[addr])
108#define dPutByte(addr, data) ast _ memory[addr] = CAST(byte) (data)
88#define dGetWord(addr) (dGetByte(addr) + (dGetByte((addr) + 1) << 8)) 109#define dGetWord(addr) (dGetByte(addr) + (dGetByte((addr) + 1) << 8))
89#define GetByte(addr) (((addr) & 0xf900) == 0xd000 ? ASAP_GetByte(ast, addr) : dGetByte(addr)) 110#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) 111#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) 112#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)
113
114#define CYCLE_TO_SAMPLE(cycle) TO_INT(((cycle) * ASAP_SAMPLE_RATE + ast _ sample_offset) / ASAP_MAIN_CLOCK)
92 115
93#endif /* _ASAP_INTERNAL_H_ */ 116#endif /* _ASAP_INTERNAL_H_ */