diff options
author | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-08-31 19:19:49 +0000 |
---|---|---|
committer | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-08-31 19:19:49 +0000 |
commit | 13cbade08a07296d92e7a7d3e20475de0032cba1 (patch) | |
tree | 731a1a4a99d86632a719ae49e3b3d2a12e764a3a /apps/codecs/libgme/nes_cpu_io.h | |
parent | d089e104034fdf5562bea125d2cacf4ee486782a (diff) | |
download | rockbox-13cbade08a07296d92e7a7d3e20475de0032cba1.tar.gz rockbox-13cbade08a07296d92e7a7d3e20475de0032cba1.zip |
Update libgme to Blargg's Game_Music_Emu 0.6-pre.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30397 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libgme/nes_cpu_io.h')
-rw-r--r-- | apps/codecs/libgme/nes_cpu_io.h | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/apps/codecs/libgme/nes_cpu_io.h b/apps/codecs/libgme/nes_cpu_io.h deleted file mode 100644 index 4f9d416c2d..0000000000 --- a/apps/codecs/libgme/nes_cpu_io.h +++ /dev/null | |||
@@ -1,94 +0,0 @@ | |||
1 | |||
2 | #include "nsf_emu.h" | ||
3 | |||
4 | #ifndef NSF_EMU_APU_ONLY | ||
5 | #include "nes_namco_apu.h" | ||
6 | #include "nes_fds_apu.h" | ||
7 | #include "nes_mmc5_apu.h" | ||
8 | #endif | ||
9 | |||
10 | #include "blargg_source.h" | ||
11 | |||
12 | int Cpu_read( struct Nsf_Emu* this, nes_addr_t addr ) | ||
13 | { | ||
14 | int result = this->cpu.low_mem [addr & 0x7FF]; | ||
15 | if ( addr & 0xE000 ) | ||
16 | { | ||
17 | result = *Cpu_get_code( &this->cpu, addr ); | ||
18 | if ( addr < sram_addr ) | ||
19 | { | ||
20 | if ( addr == status_addr ) | ||
21 | result = Apu_read_status( &this->apu, Cpu_time( &this->cpu ) ); | ||
22 | else | ||
23 | { | ||
24 | #ifndef NSF_EMU_APU_ONLY | ||
25 | if ( namco_enabled( this ) && addr == namco_data_reg_addr ) | ||
26 | return Namco_read_data( &this->namco ); | ||
27 | |||
28 | if ( fds_enabled( this ) && (unsigned) (addr - fds_io_addr) < fds_io_size ) | ||
29 | return Fds_read( &this->fds, Cpu_time( &this->cpu ), addr ); | ||
30 | |||
31 | if ( mmc5_enabled( this ) ) { | ||
32 | int i = addr - 0x5C00; | ||
33 | if ( (unsigned) i < mmc5_exram_size ) | ||
34 | return this->mmc5.exram [i]; | ||
35 | |||
36 | int m = addr - 0x5205; | ||
37 | if ( (unsigned) m < 2 ) | ||
38 | return (this->mmc5_mul [0] * this->mmc5_mul [1]) >> (m * 8) & 0xFF; | ||
39 | } | ||
40 | #endif | ||
41 | result = addr >> 8; // simulate open bus | ||
42 | } | ||
43 | } | ||
44 | } | ||
45 | |||
46 | /* if ( addr != 0x2002 ) | ||
47 | debug_printf( "Read unmapped $%.4X\n", (unsigned) addr ); */ | ||
48 | |||
49 | return result; | ||
50 | } | ||
51 | |||
52 | void Cpu_write( struct Nsf_Emu* this, nes_addr_t addr, int data ) | ||
53 | { | ||
54 | int offset = addr - sram_addr; | ||
55 | if ( (unsigned) offset < sram_size ) | ||
56 | { | ||
57 | this->sram [offset] = data; | ||
58 | } | ||
59 | else | ||
60 | { | ||
61 | // after sram because cpu handles most low_ram accesses internally already | ||
62 | int temp = addr & (low_ram_size-1); // also handles wrap-around | ||
63 | if ( !(addr & 0xE000) ) | ||
64 | { | ||
65 | this->cpu.low_mem [temp] = data; | ||
66 | } | ||
67 | else | ||
68 | { | ||
69 | int bank = addr - banks_addr; | ||
70 | if ( (unsigned) bank < bank_count ) | ||
71 | { | ||
72 | Write_bank( this, bank, data ); | ||
73 | } | ||
74 | else if ( (unsigned) (addr - start_addr) <= end_addr - start_addr ) | ||
75 | { | ||
76 | Apu_write_register( &this->apu, Cpu_time( &this->cpu ), addr, data ); | ||
77 | } | ||
78 | else | ||
79 | { | ||
80 | #ifndef NSF_EMU_APU_ONLY | ||
81 | // 0x8000-0xDFFF is writable | ||
82 | int i = addr - 0x8000; | ||
83 | if ( fds_enabled( this ) && (unsigned) i < fdsram_size ) | ||
84 | fdsram( this ) [i] = data; | ||
85 | else | ||
86 | #endif | ||
87 | Cpu_write_misc( this, addr, data ); | ||
88 | } | ||
89 | } | ||
90 | } | ||
91 | } | ||
92 | |||
93 | #define CPU_READ( emu, addr, time ) Cpu_read( emu, addr ) | ||
94 | #define CPU_WRITE( emu, addr, data, time ) Cpu_write( emu, addr, data ) | ||