1 // -*- C++ -*- 2 // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. 3 // Copyright (C) 1999-2003 Forgotten 4 // Copyright (C) 2004 Forgotten and the VBA development team 5 6 // This program is free software; you can redistribute it and/or modify 7 // it under the terms of the GNU General Public License as published by 8 // the Free Software Foundation; either version 2, or(at your option) 9 // any later version. 10 // 11 // This program is distributed in the hope that it will be useful, 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 // GNU General Public License for more details. 15 // 16 // You should have received a copy of the GNU General Public License 17 // along with this program; if not, write to the Free Software Foundation, 18 // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 20 #ifndef VBA_GBA_H 21 #define VBA_GBA_H 22 23 #include "System.h" 24 25 #define SAVE_GAME_VERSION_1 1 26 #define SAVE_GAME_VERSION_2 2 27 #define SAVE_GAME_VERSION_3 3 28 #define SAVE_GAME_VERSION_4 4 29 #define SAVE_GAME_VERSION_5 5 30 #define SAVE_GAME_VERSION_6 6 31 #define SAVE_GAME_VERSION_7 7 32 #define SAVE_GAME_VERSION_8 8 33 #define SAVE_GAME_VERSION SAVE_GAME_VERSION_8 34 35 typedef struct { 36 u8 *address; 37 u32 mask; 38 } memoryMap; 39 40 typedef union { 41 struct { 42 #ifdef WORDS_BIGENDIAN 43 u8 B3; 44 u8 B2; 45 u8 B1; 46 u8 B0; 47 #else 48 u8 B0; 49 u8 B1; 50 u8 B2; 51 u8 B3; 52 #endif 53 } B; 54 struct { 55 #ifdef WORDS_BIGENDIAN 56 u16 W1; 57 u16 W0; 58 #else 59 u16 W0; 60 u16 W1; 61 #endif 62 } W; 63 #ifdef WORDS_BIGENDIAN 64 volatile u32 I; 65 #else 66 u32 I; 67 #endif 68 } reg_pair; 69 70 #ifndef NO_GBA_MAP 71 extern memoryMap map[256]; 72 #endif 73 74 extern reg_pair reg[45]; 75 extern u8 biosProtected[4]; 76 77 extern bool N_FLAG; 78 extern bool Z_FLAG; 79 extern bool C_FLAG; 80 extern bool V_FLAG; 81 extern bool armIrqEnable; 82 extern bool armState; 83 extern int armMode; 84 extern void (*cpuSaveGameFunc)(u32,u8); 85 86 extern bool freezeWorkRAM[0x40000]; 87 extern bool freezeInternalRAM[0x8000]; 88 extern bool CPUReadGSASnapshot(const char *); 89 extern bool CPUWriteGSASnapshot(const char *, const char *, const char *, const char *); 90 extern bool CPUWriteBatteryFile(const char *); 91 extern bool CPUReadBatteryFile(const char *); 92 extern bool CPUExportEepromFile(const char *); 93 extern bool CPUImportEepromFile(const char *); 94 extern bool CPUWritePNGFile(const char *); 95 extern bool CPUWriteBMPFile(const char *); 96 extern void CPUCleanUp(); 97 extern void CPUUpdateRender(); 98 extern bool CPUReadMemState(char *, int); 99 extern bool CPUReadState(const char *); 100 extern bool CPUWriteMemState(char *, int); 101 extern bool CPUWriteState(const char *); 102 extern int CPULoadRom(const char *); 103 extern void CPUUpdateRegister(u32, u16); 104 extern void CPUWriteHalfWord(u32, u16); 105 extern void CPUWriteByte(u32, u8); 106 extern void CPUInit(const char *,bool); 107 extern void CPUReset(); 108 extern void CPULoop(int); 109 extern void CPUCheckDMA(int,int); 110 extern bool CPUIsGBAImage(const char *); 111 extern bool CPUIsZipFile(const char *); 112 #ifdef PROFILING 113 extern void cpuProfil(char *buffer, int, u32, int); 114 extern void cpuEnableProfiling(int hz); 115 #endif 116 117 extern struct EmulatedSystem GBASystem; 118 119 #define R13_IRQ 18 120 #define R14_IRQ 19 121 #define SPSR_IRQ 20 122 #define R13_USR 26 123 #define R14_USR 27 124 #define R13_SVC 28 125 #define R14_SVC 29 126 #define SPSR_SVC 30 127 #define R13_ABT 31 128 #define R14_ABT 32 129 #define SPSR_ABT 33 130 #define R13_UND 34 131 #define R14_UND 35 132 #define SPSR_UND 36 133 #define R8_FIQ 37 134 #define R9_FIQ 38 135 #define R10_FIQ 39 136 #define R11_FIQ 40 137 #define R12_FIQ 41 138 #define R13_FIQ 42 139 #define R14_FIQ 43 140 #define SPSR_FIQ 44 141 142 #include "Cheats.h" 143 #include "Globals.h" 144 #include "EEprom.h" 145 #include "Flash.h" 146 147 #endif //VBA_GBA_H 148