summaryrefslogtreecommitdiff
path: root/lib/rbcodec/codecs/libgme/ay_cpu.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rbcodec/codecs/libgme/ay_cpu.c')
-rw-r--r--lib/rbcodec/codecs/libgme/ay_cpu.c59
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
9can redistribute it and/or modify it under the terms of the GNU Lesser
10General Public License as published by the Free Software Foundation; either
11version 2.1 of the License, or (at your option) any later version. This
12module is distributed in the hope that it will be useful, but WITHOUT ANY
13WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
15details. You should have received a copy of the GNU Lesser General Public
16License along with this module; if not, write to the Free Software Foundation,
17Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
18
19#include "blargg_source.h"
20
21void 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 \
50bool 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}