diff options
author | Sean Bartell <wingedtachikoma@gmail.com> | 2011-06-25 21:32:25 -0400 |
---|---|---|
committer | Nils Wallménius <nils@rockbox.org> | 2012-04-25 22:13:20 +0200 |
commit | f40bfc9267b13b54e6379dfe7539447662879d24 (patch) | |
tree | 9b20069d5e62809ff434061ad730096836f916f2 /lib/rbcodec/codecs/libgme/ay_cpu.c | |
parent | a0009907de7a0107d49040d8a180f140e2eff299 (diff) | |
download | rockbox-f40bfc9267b13b54e6379dfe7539447662879d24.tar.gz rockbox-f40bfc9267b13b54e6379dfe7539447662879d24.zip |
Add codecs to librbcodec.
Change-Id: Id7f4717d51ed02d67cb9f9cb3c0ada4a81843f97
Reviewed-on: http://gerrit.rockbox.org/137
Reviewed-by: Nils Wallménius <nils@rockbox.org>
Tested-by: Nils Wallménius <nils@rockbox.org>
Diffstat (limited to 'lib/rbcodec/codecs/libgme/ay_cpu.c')
-rw-r--r-- | lib/rbcodec/codecs/libgme/ay_cpu.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/lib/rbcodec/codecs/libgme/ay_cpu.c b/lib/rbcodec/codecs/libgme/ay_cpu.c new file mode 100644 index 0000000000..5fbfe7c1ea --- /dev/null +++ b/lib/rbcodec/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 | } | ||