3 * Copyright (C) 2006 Exophase <exophase@gmail.com>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of
8 * the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25 DMA_START_IMMEDIATELY,
71 dma_repeat_type repeat_type;
72 dma_ds_type direct_sound_channel;
73 dma_increment_type source_direction;
74 dma_increment_type dest_direction;
75 dma_length_type length_type;
76 dma_start_type start_type;
141 FLASH_DEVICE_MACRONIX_64KB = 0x1C,
142 FLASH_DEVICE_AMTEL_64KB = 0x3D,
143 FLASH_DEVICE_SST_64K = 0xD4,
144 FLASH_DEVICE_PANASONIC_64KB = 0x1B,
145 FLASH_DEVICE_MACRONIX_128KB = 0x09
146 } flash_device_id_type;
150 FLASH_MANUFACTURER_MACRONIX = 0xC2,
151 FLASH_MANUFACTURER_AMTEL = 0x1F,
152 FLASH_MANUFACTURER_PANASONIC = 0x32,
153 FLASH_MANUFACTURER_SST = 0xBF
154 } flash_manufacturer_id_type;
156 u8 function_cc read_memory8(u32 address);
157 u32 function_cc read_memory16(u32 address);
158 u16 function_cc read_memory16_signed(u32 address);
159 u32 function_cc read_memory32(u32 address);
160 cpu_alert_type function_cc write_memory8(u32 address, u8 value);
161 cpu_alert_type function_cc write_memory16(u32 address, u16 value);
162 cpu_alert_type function_cc write_memory32(u32 address, u32 value);
164 extern u8 *memory_regions[16];
165 extern u32 memory_limits[16];
167 /* EDIT: Shouldn't this be extern ?! */
168 extern u32 waitstate_cycles_sequential[16][3];
170 extern u32 gamepak_size;
171 extern char gamepak_title[13];
172 extern char gamepak_code[5];
173 extern char gamepak_maker[3];
174 extern char gamepak_filename[512];
176 cpu_alert_type dma_transfer(dma_transfer_type *dma);
177 u8 *memory_region(u32 address, u32 *memory_limit);
178 u32 load_gamepak(char *name);
179 u32 load_backup(char *name);
180 s32 load_bios(char *name);
181 void update_backup();
182 void update_backup_force();
184 void init_gamepak_buffer();
185 void bios_region_read_allow();
186 void bios_region_read_protect();
187 u8 *load_gamepak_page(u32 physical_index);
188 void memory_write_mem_savestate(file_tag_type savestate_file);
189 void memory_read_savestate(file_tag_type savestate_file);
190 void load_state(char *savestate_filename);
191 void save_state(char *savestate_filename, u16 *screen_capture);
193 extern u8 *gamepak_rom;
194 extern u32 gamepak_ram_buffer_size;
195 extern u32 oam_update;
196 extern u32 gbc_sound_update;
197 extern u32 gbc_sound_wave_update;
198 extern dma_transfer_type dma[4];
200 extern u8 *write_mem_ptr;
202 extern u16 palette_ram[512];
203 extern u16 oam_ram[512];
204 extern u16 palette_ram_converted[512];
205 extern u16 io_registers[1024 * 16];
206 extern u8 ewram[1024 * 256 * 2];
207 extern u8 iwram[1024 * 32 * 2];
208 extern u8 vram[1024 * 96 * 2];
210 extern u8 bios_rom[1024 * 32];
211 extern u32 bios_read_protect;
213 extern u8 *memory_map_read[8 * 1024];
215 extern u8 *memory_map_write[8 * 1024];
217 extern flash_device_id_type flash_device_id;