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/hes_cpu_io.h | |
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/hes_cpu_io.h')
-rw-r--r-- | apps/codecs/libgme/hes_cpu_io.h | 72 |
1 files changed, 72 insertions, 0 deletions
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 @@ | |||
1 | |||
2 | #include "hes_emu.h" | ||
3 | |||
4 | #include "blargg_source.h" | ||
5 | |||
6 | int Cpu_read( struct Hes_Emu* this, hes_addr_t addr ) | ||
7 | { | ||
8 | check( addr <= 0xFFFF ); | ||
9 | int result = *Cpu_get_code( &this->cpu, addr ); | ||
10 | if ( this->cpu.mmr [addr >> page_shift] == 0xFF ) | ||
11 | result = Emu_cpu_read( this, addr ); | ||
12 | return result; | ||
13 | } | ||
14 | |||
15 | void Cpu_write( struct Hes_Emu* this, hes_addr_t addr, int data ) | ||
16 | { | ||
17 | check( addr <= 0xFFFF ); | ||
18 | byte* out = this->write_pages [addr >> page_shift]; | ||
19 | addr &= page_size - 1; | ||
20 | if ( out ) | ||
21 | out [addr] = data; | ||
22 | else if ( this->cpu.mmr [addr >> page_shift] == 0xFF ) | ||
23 | Emu_cpu_write( this, addr, data ); | ||
24 | } | ||
25 | |||
26 | #define CPU_READ_FAST( emu, addr, time, out ) \ | ||
27 | CPU_READ_FAST_( emu, addr, time, out ) | ||
28 | |||
29 | #define CPU_READ_FAST_( emu, addr, time, out ) \ | ||
30 | {\ | ||
31 | out = READ_PROG( addr );\ | ||
32 | if ( emu->cpu.mmr [addr >> page_shift] == 0xFF )\ | ||
33 | {\ | ||
34 | FLUSH_TIME();\ | ||
35 | out = Emu_cpu_read( emu, addr );\ | ||
36 | CACHE_TIME();\ | ||
37 | }\ | ||
38 | } | ||
39 | |||
40 | #define CPU_WRITE_FAST( emu, addr, data, time ) \ | ||
41 | CPU_WRITE_FAST_( emu, addr, data, time ) | ||
42 | |||
43 | #define CPU_WRITE_FAST_( emu, addr, data, time ) \ | ||
44 | {\ | ||
45 | byte* out = emu->write_pages [addr >> page_shift];\ | ||
46 | addr &= page_size - 1;\ | ||
47 | if ( out )\ | ||
48 | {\ | ||
49 | out [addr] = data;\ | ||
50 | }\ | ||
51 | else if ( emu->cpu.mmr [addr >> page_shift] == 0xFF )\ | ||
52 | {\ | ||
53 | FLUSH_TIME();\ | ||
54 | Emu_cpu_write( emu, addr, data );\ | ||
55 | CACHE_TIME();\ | ||
56 | }\ | ||
57 | } | ||
58 | |||
59 | #define CPU_READ( emu, addr, time ) \ | ||
60 | Cpu_read( emu, addr ) | ||
61 | |||
62 | #define CPU_WRITE( emu, addr, data, time ) \ | ||
63 | Cpu_write( emu, addr, data ) | ||
64 | |||
65 | #define CPU_WRITE_VDP( emu, addr, data, time ) \ | ||
66 | Cpu_write_vdp( emu, addr, data ) | ||
67 | |||
68 | #define CPU_SET_MMR( emu, page, bank ) \ | ||
69 | Emu_cpu_set_mmr( emu, page, bank ) | ||
70 | |||
71 | #define CPU_DONE( emu, time, result_out ) \ | ||
72 | result_out = Cpu_done( emu ) | ||