diff options
author | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-08-07 20:01:04 +0000 |
---|---|---|
committer | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-08-07 20:01:04 +0000 |
commit | acb0917556fc33681c1df5a530cf754193e67705 (patch) | |
tree | 052a47097009a210e4aed9c207bd6aa4828cc000 /apps/codecs/libgme/ay_cpu.c | |
parent | 93c6f1329a5691a8be158cefe15641bd1daf9ef8 (diff) | |
download | rockbox-acb0917556fc33681c1df5a530cf754193e67705.tar.gz rockbox-acb0917556fc33681c1df5a530cf754193e67705.zip |
Submit initial patch from FS#12176. Adds support for several new game music formats (AY, GBS, HES, KSS, SGC, VGM and VGZ) and replaces the current NSF and NSFE with a new implementation based on a port of the Game Music Emu library 'GME'. This first submit does not cover the full functionality provided by the author's original patch: Coleco-SGV is not supported, some GME-specific m3u-support has been removed and IRAM is not used yet. Further changes are very likely to follow this submit. Thanks to Mauricio Garrido.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30264 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libgme/ay_cpu.c')
-rw-r--r-- | apps/codecs/libgme/ay_cpu.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/apps/codecs/libgme/ay_cpu.c b/apps/codecs/libgme/ay_cpu.c new file mode 100644 index 0000000000..5fbfe7c1ea --- /dev/null +++ b/apps/codecs/libgme/ay_cpu.c | |||
@@ -0,0 +1,59 @@ | |||
1 | // Game_Music_Emu 0.6-pre. http://www.slack.net/~ant/ | ||
2 | |||
3 | #include "ay_emu.h" | ||
4 | |||
5 | #include "blargg_endian.h" | ||
6 | //#include "z80_cpu_log.h" | ||
7 | |||
8 | /* Copyright (C) 2006-2008 Shay Green. This module is free software; you | ||
9 | can redistribute it and/or modify it under the terms of the GNU Lesser | ||
10 | General Public License as published by the Free Software Foundation; either | ||
11 | version 2.1 of the License, or (at your option) any later version. This | ||
12 | module is distributed in the hope that it will be useful, but WITHOUT ANY | ||
13 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
14 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more | ||
15 | details. You should have received a copy of the GNU Lesser General Public | ||
16 | License along with this module; if not, write to the Free Software Foundation, | ||
17 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ | ||
18 | |||
19 | #include "blargg_source.h" | ||
20 | |||
21 | void cpu_out( struct Ay_Emu* this, cpu_time_t time, addr_t addr, int data ) | ||
22 | { | ||
23 | if ( (addr & 0xFF) == 0xFE ) | ||
24 | { | ||
25 | check( !cpc_mode ); | ||
26 | this->spectrum_mode = !this->cpc_mode; | ||
27 | |||
28 | // beeper_mask and last_beeper are 0 if (cpc_mode || !beeper_output) | ||
29 | if ( (data &= this->beeper_mask) != this->last_beeper ) | ||
30 | { | ||
31 | this->last_beeper = data; | ||
32 | int delta = -this->beeper_delta; | ||
33 | this->beeper_delta = delta; | ||
34 | struct Blip_Buffer* bb = this->beeper_output; | ||
35 | Blip_set_modified( bb ); | ||
36 | Synth_offset( &this->apu.synth_, time, delta, bb ); | ||
37 | } | ||
38 | } | ||
39 | else | ||
40 | { | ||
41 | cpu_out_( this, time, addr, data ); | ||
42 | } | ||
43 | } | ||
44 | |||
45 | #define OUT_PORT( addr, data ) cpu_out( this, TIME(), addr, data ) | ||
46 | #define IN_PORT( addr ) 0xFF // cpu in | ||
47 | #define FLAT_MEM mem | ||
48 | |||
49 | #define CPU_BEGIN \ | ||
50 | bool run_cpu( struct Ay_Emu* this, cpu_time_t end_time ) \ | ||
51 | {\ | ||
52 | struct Z80_Cpu* cpu = &this->cpu; \ | ||
53 | Z80_set_end_time( cpu, end_time ); \ | ||
54 | byte* const mem = this->mem.ram; // cache | ||
55 | |||
56 | #include "z80_cpu_run.h" | ||
57 | |||
58 | return warning; | ||
59 | } | ||