1 // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. 2 // Copyright (C) 1999-2003 Forgotten 3 // Copyright (C) 2004 Forgotten and the VBA development team 4 5 // This program is free software; you can redistribute it and/or modify 6 // it under the terms of the GNU General Public License as published by 7 // the Free Software Foundation; either version 2, or(at your option) 8 // any later version. 9 // 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 13 // GNU General Public License for more details. 14 // 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 Foundation, 17 // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 19 #include "GBA.h" 20 21 reg_pair reg[45]; 22 memoryMap map[256]; 23 bool ioReadable[0x400]; 24 25 uint32 N_FLAG = 0; 26 bool C_FLAG = 0; 27 bool Z_FLAG = 0; 28 bool V_FLAG = 0; 29 30 bool armState = true; 31 bool armIrqEnable = true; 32 uint32 armNextPC = 0x00000000; 33 int armMode = 0x1f; 34 uint32 stop = 0x08000568; 35 int saveType = 0; 36 bool useBios = false; 37 bool skipBios = false; 38 int frameSkip = 1; 39 bool speedup = false; 40 bool synchronize = true; 41 bool cpuDisableSfx = false; 42 bool cpuIsMultiBoot = false; 43 bool parseDebug = true; 44 int layerSettings = 0xff00; 45 int layerEnable = 0xff00; 46 47 uint8 *bios = NULL; 48 uint8 *rom = NULL; 49 uint8 *internalRAM = NULL; 50 uint8 *workRAM = NULL; 51 uint8 *paletteRAM = NULL; 52 uint8 *vram = NULL; 53 uint8 *pix = NULL; 54 uint8 *oam = NULL; 55 uint8 *ioMem = NULL; 56 57 uint16 DISPCNT = 0x0080; 58 uint16 DISPSTAT = 0x0000; 59 uint16 VCOUNT = 0x0000; 60 uint16 BG0CNT = 0x0000; 61 uint16 BG1CNT = 0x0000; 62 uint16 BG2CNT = 0x0000; 63 uint16 BG3CNT = 0x0000; 64 65 uint16 BGHOFS[4]; 66 uint16 BGVOFS[4]; 67 68 uint16 BG2PA = 0x0100; 69 uint16 BG2PB = 0x0000; 70 uint16 BG2PC = 0x0000; 71 uint16 BG2PD = 0x0100; 72 uint16 BG2X_L = 0x0000; 73 uint16 BG2X_H = 0x0000; 74 uint16 BG2Y_L = 0x0000; 75 uint16 BG2Y_H = 0x0000; 76 uint16 BG3PA = 0x0100; 77 uint16 BG3PB = 0x0000; 78 uint16 BG3PC = 0x0000; 79 uint16 BG3PD = 0x0100; 80 uint16 BG3X_L = 0x0000; 81 uint16 BG3X_H = 0x0000; 82 uint16 BG3Y_L = 0x0000; 83 uint16 BG3Y_H = 0x0000; 84 uint16 WIN0H = 0x0000; 85 uint16 WIN1H = 0x0000; 86 uint16 WIN0V = 0x0000; 87 uint16 WIN1V = 0x0000; 88 uint16 WININ = 0x0000; 89 uint16 WINOUT = 0x0000; 90 uint16 MOSAIC = 0x0000; 91 uint16 BLDMOD = 0x0000; 92 uint16 COLEV = 0x0000; 93 uint16 COLY = 0x0000; 94 95 uint16 DMSAD_L[4] = {0}; 96 uint16 DMSAD_H[4] = {0}; 97 uint16 DMDAD_L[4] = {0}; 98 uint16 DMDAD_H[4] = {0}; 99 uint16 DMCNT_L[4] = {0}; 100 uint16 DMCNT_H[4] = {0}; 101 102 uint16 P1 = 0xFFFF; 103 uint16 IE = 0x0000; 104 uint16 IF = 0x0000; 105 uint16 IME = 0x0000; 106