view src/gb/gbGlobals.h @ 396:c7a43f4ffd9d

fixed bug where A was always 0 when the self-modigying code was executed.
author Robert McIntyre <rlm@mit.edu>
date Fri, 13 Apr 2012 04:50:58 -0500
parents f9f4f1b99eed
children
line wrap: on
line source
1 #ifndef VBA_GB_GLOBALS_H
2 #define VBA_GB_GLOBALS_H
4 #if _MSC_VER > 1000
5 #pragma once
6 #endif // _MSC_VER > 1000
8 #include "../Port.h"
10 extern int32 gbRomSizeMask;
11 extern int32 gbRomSize;
12 extern int32 gbRamSize;
13 extern int32 gbRamSizeMask;
15 extern u8 * gbRom;
16 extern u8 * gbRam;
17 extern u8 * gbVram;
18 extern u8 * gbWram;
19 extern u8 * gbMemory;
20 extern u16 *gbLineBuffer;
22 extern u8 *gbMemoryMap[16];
24 inline u8 gbReadMemoryQuick(u16 address)
25 {
26 extern int32 gbEchoRAMFixOn;
27 if (gbEchoRAMFixOn)
28 {
29 if (address >= 0xe000 && address < 0xfe00)
30 {
31 address -= 0x2000;
32 }
33 }
34 return gbMemoryMap[address>>12][address&0xfff];
35 }
37 inline void gbWriteMemoryQuick(u16 address, u8 value)
38 {
39 extern int32 gbEchoRAMFixOn;
40 if (gbEchoRAMFixOn)
41 {
42 if (address >= 0xe000 && address < 0xfe00)
43 {
44 address -= 0x2000;
45 }
46 }
47 gbMemoryMap[address>>12][address&0xfff] = value;
48 }
50 inline u8 gbReadROMQuick(u32 address)
51 {
52 return gbRom[address];
53 }
55 extern int32 gbFrameSkip;
56 extern u16 gbColorFilter[32768];
57 extern int32 gbColorOption;
58 extern int32 gbPaletteOption;
59 extern int32 gbEmulatorType;
60 extern int32 gbBorderOn;
61 extern int32 gbBorderAutomatic;
62 extern int32 gbCgbMode;
63 extern int32 gbSgbMode;
64 extern int32 gbWindowLine;
65 extern int32 gbSpeed;
66 extern u8 gbBgp[4];
67 extern u8 gbObp0[4];
68 extern u8 gbObp1[4];
69 extern u16 gbPalette[128];
71 extern u8 register_LCDC;
72 extern u8 register_LY;
73 extern u8 register_SCY;
74 extern u8 register_SCX;
75 extern u8 register_WY;
76 extern u8 register_WX;
77 extern u8 register_VBK;
79 extern int emulating;
81 extern int32 gbBorderLineSkip;
82 extern int32 gbBorderRowSkip;
83 extern int32 gbBorderColumnSkip;
84 extern int32 gbDmaTicks;
86 extern bool8 useOldFrameTiming;
87 extern bool8 gbNullInputHackEnabled;
88 extern bool8 gbNullInputHackTempEnabled;
90 extern void gbRenderLine();
91 extern void gbDrawSprites();
93 extern u8 (*gbSerialFunction)(u8);
95 #endif // VBA_GB_GLOBALS_H