From acb0917556fc33681c1df5a530cf754193e67705 Mon Sep 17 00:00:00 2001 From: Andree Buschmann Date: Sun, 7 Aug 2011 20:01:04 +0000 Subject: 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 --- apps/codecs/libgme/hes_cpu_io.h | 72 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 apps/codecs/libgme/hes_cpu_io.h (limited to 'apps/codecs/libgme/hes_cpu_io.h') diff --git a/apps/codecs/libgme/hes_cpu_io.h b/apps/codecs/libgme/hes_cpu_io.h new file mode 100644 index 0000000000..6b49c69e22 --- /dev/null +++ b/apps/codecs/libgme/hes_cpu_io.h @@ -0,0 +1,72 @@ + +#include "hes_emu.h" + +#include "blargg_source.h" + +int Cpu_read( struct Hes_Emu* this, hes_addr_t addr ) +{ + check( addr <= 0xFFFF ); + int result = *Cpu_get_code( &this->cpu, addr ); + if ( this->cpu.mmr [addr >> page_shift] == 0xFF ) + result = Emu_cpu_read( this, addr ); + return result; +} + +void Cpu_write( struct Hes_Emu* this, hes_addr_t addr, int data ) +{ + check( addr <= 0xFFFF ); + byte* out = this->write_pages [addr >> page_shift]; + addr &= page_size - 1; + if ( out ) + out [addr] = data; + else if ( this->cpu.mmr [addr >> page_shift] == 0xFF ) + Emu_cpu_write( this, addr, data ); +} + +#define CPU_READ_FAST( emu, addr, time, out ) \ + CPU_READ_FAST_( emu, addr, time, out ) + +#define CPU_READ_FAST_( emu, addr, time, out ) \ +{\ + out = READ_PROG( addr );\ + if ( emu->cpu.mmr [addr >> page_shift] == 0xFF )\ + {\ + FLUSH_TIME();\ + out = Emu_cpu_read( emu, addr );\ + CACHE_TIME();\ + }\ +} + +#define CPU_WRITE_FAST( emu, addr, data, time ) \ + CPU_WRITE_FAST_( emu, addr, data, time ) + +#define CPU_WRITE_FAST_( emu, addr, data, time ) \ +{\ + byte* out = emu->write_pages [addr >> page_shift];\ + addr &= page_size - 1;\ + if ( out )\ + {\ + out [addr] = data;\ + }\ + else if ( emu->cpu.mmr [addr >> page_shift] == 0xFF )\ + {\ + FLUSH_TIME();\ + Emu_cpu_write( emu, addr, data );\ + CACHE_TIME();\ + }\ +} + +#define CPU_READ( emu, addr, time ) \ + Cpu_read( emu, addr ) + +#define CPU_WRITE( emu, addr, data, time ) \ + Cpu_write( emu, addr, data ) + +#define CPU_WRITE_VDP( emu, addr, data, time ) \ + Cpu_write_vdp( emu, addr, data ) + +#define CPU_SET_MMR( emu, page, bank ) \ + Emu_cpu_set_mmr( emu, page, bank ) + +#define CPU_DONE( emu, time, result_out ) \ + result_out = Cpu_done( emu ) -- cgit v1.2.3