annotate src/gba/GBAGlobals.h @ 336:25b7bb7da3b1

Fixed two major bugs related to restart events which were causing desync. The entire video now syncs properly.
author Robert McIntyre <rlm@mit.edu>
date Sat, 07 Apr 2012 07:31:59 -0500
parents f9f4f1b99eed
children
rev   line source
rlm@1 1 #ifndef VBA_GBA_GLOBALS_H
rlm@1 2 #define VBA_GBA_GLOBALS_H
rlm@1 3
rlm@1 4 #if _MSC_VER > 1000
rlm@1 5 #pragma once
rlm@1 6 #endif // _MSC_VER > 1000
rlm@1 7
rlm@1 8 #include "../Port.h"
rlm@1 9
rlm@1 10 #define VERBOSE_SWI 1
rlm@1 11 #define VERBOSE_UNALIGNED_MEMORY 2
rlm@1 12 #define VERBOSE_ILLEGAL_WRITE 4
rlm@1 13 #define VERBOSE_ILLEGAL_READ 8
rlm@1 14 #define VERBOSE_DMA0 16
rlm@1 15 #define VERBOSE_DMA1 32
rlm@1 16 #define VERBOSE_DMA2 64
rlm@1 17 #define VERBOSE_DMA3 128
rlm@1 18 #define VERBOSE_UNDEFINED 256
rlm@1 19 #define VERBOSE_AGBPRINT 512
rlm@1 20
rlm@1 21 // moved from armdis.cpp
rlm@1 22 #define debuggerReadMemory(addr) \
rlm@1 23 READ32LE(&map[(addr) >> 24].address[(addr) & map[(addr) >> 24].mask])
rlm@1 24
rlm@1 25 #define debuggerReadHalfWord(addr) \
rlm@1 26 READ16LE(&map[(addr) >> 24].address[(addr) & map[(addr) >> 24].mask])
rlm@1 27
rlm@1 28 #define debuggerReadByte(addr) \
rlm@1 29 READ8LE(&map[(addr) >> 24].address[(addr) & map[(addr) >> 24].mask])
rlm@1 30
rlm@1 31 #define debuggerWriteMemory(addr, value) \
rlm@1 32 WRITE32LE((&map[(addr)>>24].address[(addr) & map[(addr)>>24].mask]), (value))
rlm@1 33
rlm@1 34 #define debuggerWriteHalfWord(addr, value) \
rlm@1 35 WRITE16LE((&map[(addr)>>24].address[(addr) & map[(addr)>>24].mask]), (value))
rlm@1 36
rlm@1 37 #define debuggerWriteByte(addr, value) \
rlm@1 38 WRITE8LE((&map[(addr)>>24].address[(addr) & map[(addr)>>24].mask]), (value))
rlm@1 39
rlm@1 40 // moved from GBA.h
rlm@1 41 typedef struct
rlm@1 42 {
rlm@1 43 u8 *address;
rlm@1 44 u32 mask;
rlm@1 45 } memoryMap;
rlm@1 46
rlm@1 47 #ifndef NO_GBA_MAP
rlm@1 48 extern memoryMap map[256];
rlm@1 49 #endif
rlm@1 50
rlm@1 51 // moved from GBA.h
rlm@1 52 typedef union
rlm@1 53 {
rlm@1 54 struct
rlm@1 55 {
rlm@1 56 #ifdef WORDS_BIGENDIAN
rlm@1 57 u8 B3;
rlm@1 58 u8 B2;
rlm@1 59 u8 B1;
rlm@1 60 u8 B0;
rlm@1 61 #else
rlm@1 62 u8 B0;
rlm@1 63 u8 B1;
rlm@1 64 u8 B2;
rlm@1 65 u8 B3;
rlm@1 66 #endif
rlm@1 67 } B;
rlm@1 68 struct
rlm@1 69 {
rlm@1 70 #ifdef WORDS_BIGENDIAN
rlm@1 71 u16 W1;
rlm@1 72 u16 W0;
rlm@1 73 #else
rlm@1 74 u16 W0;
rlm@1 75 u16 W1;
rlm@1 76 #endif
rlm@1 77 } W;
rlm@1 78 #ifdef WORDS_BIGENDIAN
rlm@1 79 volatile u32 I;
rlm@1 80 #else
rlm@1 81 u32 I;
rlm@1 82 #endif
rlm@1 83 } reg_pair;
rlm@1 84
rlm@1 85 extern reg_pair reg[45];
rlm@1 86 extern u8 biosProtected[4];
rlm@1 87 extern bool8 ioReadable[0x400];
rlm@1 88 extern bool8 N_FLAG;
rlm@1 89 extern bool8 C_FLAG;
rlm@1 90 extern bool8 Z_FLAG;
rlm@1 91 extern bool8 V_FLAG;
rlm@1 92 extern bool8 armState;
rlm@1 93 extern bool8 armIrqEnable;
rlm@1 94 extern u32 armNextPC;
rlm@1 95 extern int32 armMode;
rlm@1 96 extern u32 stop;
rlm@1 97 extern int32 saveType;
rlm@1 98 extern bool8 useBios;
rlm@1 99 extern bool8 skipBios;
rlm@1 100 extern int32 frameSkip;
rlm@1 101 extern u32 extButtons;
rlm@1 102 extern bool8 capturePrevious;
rlm@1 103 extern int32 captureNumber;
rlm@1 104 extern bool8 speedup;
rlm@1 105 extern bool8 synchronize;
rlm@1 106 extern bool8 cpuDisableSfx;
rlm@1 107 extern bool8 cpuIsMultiBoot;
rlm@1 108 extern bool8 parseDebug;
rlm@1 109 extern int32 layerSettings;
rlm@1 110 extern int32 layerEnable;
rlm@1 111 extern bool8 speedHack;
rlm@1 112 extern bool8 memLagEnabled, memLagTempEnabled;
rlm@1 113 extern bool8 useOldFrameTiming;
rlm@1 114 extern int32 cpuSaveType;
rlm@1 115 extern bool8 cpuEnhancedDetection;
rlm@1 116 extern bool8 cheatsEnabled;
rlm@1 117
rlm@1 118 extern int emulating;
rlm@1 119
rlm@1 120 extern u8 *bios;
rlm@1 121 extern u8 *rom;
rlm@1 122 extern u8 *internalRAM;
rlm@1 123 extern u8 *workRAM;
rlm@1 124 extern u8 *paletteRAM;
rlm@1 125 extern u8 *vram;
rlm@1 126 extern u8 *pix;
rlm@1 127 extern u8 *oam;
rlm@1 128 extern u8 *ioMem;
rlm@1 129
rlm@1 130 extern u16 DISPCNT;
rlm@1 131 extern u16 DISPSTAT;
rlm@1 132 extern u16 VCOUNT;
rlm@1 133 extern u16 BG0CNT;
rlm@1 134 extern u16 BG1CNT;
rlm@1 135 extern u16 BG2CNT;
rlm@1 136 extern u16 BG3CNT;
rlm@1 137 extern u16 BG0HOFS;
rlm@1 138 extern u16 BG0VOFS;
rlm@1 139 extern u16 BG1HOFS;
rlm@1 140 extern u16 BG1VOFS;
rlm@1 141 extern u16 BG2HOFS;
rlm@1 142 extern u16 BG2VOFS;
rlm@1 143 extern u16 BG3HOFS;
rlm@1 144 extern u16 BG3VOFS;
rlm@1 145 extern u16 BG2PA;
rlm@1 146 extern u16 BG2PB;
rlm@1 147 extern u16 BG2PC;
rlm@1 148 extern u16 BG2PD;
rlm@1 149 extern u16 BG2X_L;
rlm@1 150 extern u16 BG2X_H;
rlm@1 151 extern u16 BG2Y_L;
rlm@1 152 extern u16 BG2Y_H;
rlm@1 153 extern u16 BG3PA;
rlm@1 154 extern u16 BG3PB;
rlm@1 155 extern u16 BG3PC;
rlm@1 156 extern u16 BG3PD;
rlm@1 157 extern u16 BG3X_L;
rlm@1 158 extern u16 BG3X_H;
rlm@1 159 extern u16 BG3Y_L;
rlm@1 160 extern u16 BG3Y_H;
rlm@1 161 extern u16 WIN0H;
rlm@1 162 extern u16 WIN1H;
rlm@1 163 extern u16 WIN0V;
rlm@1 164 extern u16 WIN1V;
rlm@1 165 extern u16 WININ;
rlm@1 166 extern u16 WINOUT;
rlm@1 167 extern u16 MOSAIC;
rlm@1 168 extern u16 BLDMOD;
rlm@1 169 extern u16 COLEV;
rlm@1 170 extern u16 COLY;
rlm@1 171 extern u16 DM0SAD_L;
rlm@1 172 extern u16 DM0SAD_H;
rlm@1 173 extern u16 DM0DAD_L;
rlm@1 174 extern u16 DM0DAD_H;
rlm@1 175 extern u16 DM0CNT_L;
rlm@1 176 extern u16 DM0CNT_H;
rlm@1 177 extern u16 DM1SAD_L;
rlm@1 178 extern u16 DM1SAD_H;
rlm@1 179 extern u16 DM1DAD_L;
rlm@1 180 extern u16 DM1DAD_H;
rlm@1 181 extern u16 DM1CNT_L;
rlm@1 182 extern u16 DM1CNT_H;
rlm@1 183 extern u16 DM2SAD_L;
rlm@1 184 extern u16 DM2SAD_H;
rlm@1 185 extern u16 DM2DAD_L;
rlm@1 186 extern u16 DM2DAD_H;
rlm@1 187 extern u16 DM2CNT_L;
rlm@1 188 extern u16 DM2CNT_H;
rlm@1 189 extern u16 DM3SAD_L;
rlm@1 190 extern u16 DM3SAD_H;
rlm@1 191 extern u16 DM3DAD_L;
rlm@1 192 extern u16 DM3DAD_H;
rlm@1 193 extern u16 DM3CNT_L;
rlm@1 194 extern u16 DM3CNT_H;
rlm@1 195 extern u16 TM0D;
rlm@1 196 extern u16 TM0CNT;
rlm@1 197 extern u16 TM1D;
rlm@1 198 extern u16 TM1CNT;
rlm@1 199 extern u16 TM2D;
rlm@1 200 extern u16 TM2CNT;
rlm@1 201 extern u16 TM3D;
rlm@1 202 extern u16 TM3CNT;
rlm@1 203 extern u16 P1;
rlm@1 204 extern u16 IE;
rlm@1 205 extern u16 IF;
rlm@1 206 extern u16 IME;
rlm@1 207
rlm@1 208 #endif // VBA_GBA_GLOBALS_H