annotate src/gba/GBA.h @ 513:3dbb863eb801

accuracy of displayed image is much improved, but there the palettes are still messed up.
author Robert McIntyre <rlm@mit.edu>
date Fri, 22 Jun 2012 18:58:47 -0500
parents 1ff2c546f5ad
children
rev   line source
rlm@1 1 #ifndef VBA_GBA_H
rlm@1 2 #define VBA_GBA_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 "zlib.h"
rlm@1 9 #include "../Port.h"
rlm@1 10
rlm@1 11 #if (defined(WIN32) && !defined(SDL))
rlm@1 12 #include "../win32/stdafx.h" // for HANDLE
rlm@1 13 //#include <windows.h> // for HANDLE
rlm@1 14 // NOTE: if you get this error:
rlm@1 15 // #error WINDOWS.H already included. MFC apps must not #include <windows.h>
rlm@1 16 // it is probably because stdafx.h is getting included at the wrong place
rlm@1 17 // (i.e. after anything else) in a file, or your precompiled headers are otherwise wrong
rlm@1 18 #endif
rlm@1 19
rlm@1 20 #define SAVE_GAME_VERSION_1 1
rlm@1 21 #define SAVE_GAME_VERSION_2 2
rlm@1 22 #define SAVE_GAME_VERSION_3 3
rlm@1 23 #define SAVE_GAME_VERSION_4 4
rlm@1 24 #define SAVE_GAME_VERSION_5 5
rlm@1 25 #define SAVE_GAME_VERSION_6 6
rlm@1 26 #define SAVE_GAME_VERSION_7 7
rlm@1 27 #define SAVE_GAME_VERSION_8 8
rlm@1 28 #define SAVE_GAME_VERSION_9 9
rlm@1 29 #define SAVE_GAME_VERSION_10 10
rlm@1 30 #define SAVE_GAME_VERSION_11 11
rlm@1 31 #define SAVE_GAME_VERSION_12 12
rlm@1 32 #define SAVE_GAME_VERSION_13 13
rlm@1 33 #define SAVE_GAME_VERSION SAVE_GAME_VERSION_13
rlm@1 34
rlm@1 35 #if (defined(WIN32) && !defined(SDL))
rlm@1 36 extern HANDLE mapROM; // shared memory handles
rlm@1 37 extern HANDLE mapWORKRAM;
rlm@1 38 extern HANDLE mapBIOS;
rlm@1 39 extern HANDLE mapIRAM;
rlm@1 40 extern HANDLE mapPALETTERAM;
rlm@1 41 extern HANDLE mapVRAM;
rlm@1 42 extern HANDLE mapOAM;
rlm@1 43 extern HANDLE mapPIX;
rlm@1 44 extern HANDLE mapIOMEM;
rlm@1 45 #endif
rlm@1 46
rlm@1 47 /*
rlm@1 48 extern reg_pair reg[45];
rlm@1 49 extern u8 biosProtected[4];
rlm@1 50
rlm@1 51 extern bool8 N_FLAG;
rlm@1 52 extern bool8 Z_FLAG;
rlm@1 53 extern bool8 C_FLAG;
rlm@1 54 extern bool8 V_FLAG;
rlm@1 55 extern bool8 armIrqEnable;
rlm@1 56 extern bool8 armState;
rlm@1 57 extern int32 armMode;
rlm@1 58 */
rlm@1 59 extern void (*cpuSaveGameFunc)(u32, u8);
rlm@1 60
rlm@1 61 extern bool8 freezeWorkRAM[0x40000];
rlm@1 62 extern bool8 freezeInternalRAM[0x8000];
rlm@1 63 extern bool CPUReadGSASnapshot(const char *);
rlm@1 64 extern bool CPUWriteGSASnapshot(const char *, const char *, const char *, const char *);
rlm@1 65 extern bool CPUWriteBatteryFile(const char *);
rlm@1 66 extern bool CPUReadBatteryFile(const char *);
rlm@1 67 extern bool CPUWriteBatteryToStream(gzFile);
rlm@1 68 extern bool CPUReadBatteryFromStream(gzFile);
rlm@1 69 extern bool CPUExportEepromFile(const char *);
rlm@1 70 extern bool CPUImportEepromFile(const char *);
rlm@1 71 extern bool CPUWritePNGFile(const char *);
rlm@1 72 extern bool CPUWriteBMPFile(const char *);
rlm@1 73 extern void CPUCleanUp();
rlm@1 74 extern void CPUUpdateRender();
rlm@1 75 extern void CPUUpdateRenderBuffers(bool force);
rlm@1 76 extern bool CPUReadMemState(char *, int);
rlm@1 77 extern bool CPUReadState(const char *);
rlm@1 78 extern bool CPUWriteMemState(char *, int);
rlm@1 79 extern bool CPUWriteState(const char *);
rlm@1 80 extern bool CPUReadStateFromStream(gzFile);
rlm@1 81 extern bool CPUWriteStateToStream(gzFile);
rlm@1 82 extern int CPULoadRom(const char *);
rlm@1 83 extern void CPUUpdateRegister(u32, u16);
rlm@1 84 extern void CPUWriteHalfWord(u32, u16);
rlm@1 85 extern void CPUWriteByte(u32, u8);
rlm@1 86 extern bool CPULoadBios(const char *, bool);
rlm@1 87 extern void CPUInit();
rlm@1 88 extern void CPUReset(bool userReset = false);
rlm@92 89 extern int CPULoop(int);
rlm@1 90 extern void CPUCheckDMA(int, int);
rlm@1 91 #ifdef PROFILING
rlm@1 92 extern void cpuProfil(char *buffer, int, u32, int);
rlm@1 93 extern void cpuEnableProfiling(int hz);
rlm@1 94 #endif
rlm@1 95
rlm@1 96 extern struct EmulatedSystem GBASystem;
rlm@1 97 extern struct EmulatedSystemCounters &GBASystemCounters;
rlm@1 98
rlm@1 99 #define R13_IRQ 18
rlm@1 100 #define R14_IRQ 19
rlm@1 101 #define SPSR_IRQ 20
rlm@1 102 #define R13_USR 26
rlm@1 103 #define R14_USR 27
rlm@1 104 #define R13_SVC 28
rlm@1 105 #define R14_SVC 29
rlm@1 106 #define SPSR_SVC 30
rlm@1 107 #define R13_ABT 31
rlm@1 108 #define R14_ABT 32
rlm@1 109 #define SPSR_ABT 33
rlm@1 110 #define R13_UND 34
rlm@1 111 #define R14_UND 35
rlm@1 112 #define SPSR_UND 36
rlm@1 113 #define R8_FIQ 37
rlm@1 114 #define R9_FIQ 38
rlm@1 115 #define R10_FIQ 39
rlm@1 116 #define R11_FIQ 40
rlm@1 117 #define R12_FIQ 41
rlm@1 118 #define R13_FIQ 42
rlm@1 119 #define R14_FIQ 43
rlm@1 120 #define SPSR_FIQ 44
rlm@1 121
rlm@1 122 #endif // VBA_GBA_H