
#ifdef USE_ASM_R12
#define Flags @(20, r12)
#define BranchSkip @(3, r12)
#define NMIActive @(4, r12)
#define IRQActive @(5, r12)
#define WaitingForInterrupt @(6, r12)
#define InDMA @(7, r12)
#define WhichEvent @(8, r12)
#define PCS @(24, r12)
#define PCBase @(28, r12)
#define PCAtOpcodeStart @(32, r12)
#define WaitAddress @(36, r12)
#define WaitCounter @(40, r12)
#define Cycles @(44, r12)
#define NextEvent @(48, r12)
#define V_Counter @(52, r12)
#define MemSpeed @(56, r12)
#define MemSpeedx2 @(60, r12)
#define FastROMSpeed @(64, r12)
#define AutoSaveTimer @(68, r12)
#define SRAMModified @r12
#define NMITriggerPoint @(72, r12)
#define TriedInterleavedMode2 @(2, r12)
#define BRKTriggered @(1, r12)
#define NMICycleCount @(12, r12)
#define IRQCycleCount @(16, r12)
#else
#define Flags @(20+16, r11)
#define BranchSkip @(3, r11)
#define NMIActive @(4, r11)
#define IRQActive @(5, r11)
#define WaitingForInterrupt @(6, r11)
#define InDMA @(7, r11)
#define WhichEvent @(8, r11)
#define PCS @(24+16, r11)
#define PCBase @(28+16, r11)
#define PCAtOpcodeStart @(32+16, r11)
#define WaitAddress @(36+16, r11)
#define WaitCounter @(40+16, r11)
#define Cycles @(44+16, r11)
#define NextEvent @(48, r11)
#define V_Counter @(52, r11)
#define MemSpeed @(56+16, r11)
#define MemSpeedx2 @(60+16, r11)
#define FastROMSpeed @(64+16, r11)
#define AutoSaveTimer @(68+16, r11)
#define SRAMModified @r11
#define NMITriggerPoint @(72+16, r11)
#define TriedInterleavedMode2 @(2+16, r11)
#define BRKTriggered @(1, r11)
#define NMICycleCount @(12+16, r11)
#define IRQCycleCount @(16+16, r11)
#endif
#define PB @r11
#define PBMEM @r11
#define DB @(1, r11)
#define DBMEM @(1, r11)
#define PP @(2, r11)
#define PL @(2, r11)
#define PH @(3, r11)
#define AA @(4, r11)
#define AL @(4, r11)
#define AH @(5, r11)
#define DD @(6, r11)
#define DL @(6, r11)
#define DH @(7, r11)
#define SS @(8, r11)
#define SL @(8, r11)
#define SH @(9, r11)
#define XX @(10, r11)
#define XL @(10, r11)
#define XH @(11, r11)
#define YY @(12, r11)
#define YL @(12, r11)
#define YH @(13, r11)
#define PCR @(14, r11)
#define RAM _CMemory_RAM
#define VRAM _CMemory_VRAM
#define SRAM _CMemory_SRAM
#define BWRAM _CMemory_BWRAM
#define FillRAM _CMemory_FillRAM
#define ROM _CMemory_FillRAM + 0x200
#define C4RAM _CMemory_FillRAM + 0x8000 + 0x400000 + 0x10000
#define SRAMMask _CMemory_SRAMMask
#define Map _CMemory_Map
#define WriteMap _CMemory_WriteMap
#define MemorySpeed _CMemory_MemorySpeed
#define BlockIsRAM _CMemory_BlockIsRAM
#define APUPCS @(16, r1)
#define APURAM @(20, r1)
#define APUExecuting @(3, r1)
#define APUDirectPage @(24, r1)
#define APUBit @(4, r1)
#define APUAddress @(8, r1)
#define APUWaitAddress1 @(28, r1)
#define APUWaitAddress2 @(32, r1)
#define APUWaitCounter @(12, r1)
#define APUShadowRAM @(36, r1)
#define APUCachedSamples @(40, r1)
#define APU_Carry @r1
#define APU_Zero @(1, r1)
#define APU_Overflow @(2, r1)
#define APUTimerErrorCounter @(44, r1)
#define NextAPUTimerPos @(48, r1)
#define APUTimerCounter @(52, r1)
#define APUCycles @r1
#define APUShowROM @(4, r1)
#define APUFlags @(5, r1)
#define APUKeyedChannels @(6, r1)
#define APUOutPorts @(7, r1)
#define APUDSP @(11, r1)
#define APUExtraRAM 139
#define APUTimer 204
#define APUTimerTarget 210
#define APUTimerEnabled 216
#define TimerValueWritten 219
#define CPUSpeed @r1
#define CPUOpcodes @(4, r1)
#define _Carry @(8, r1)
#define _Zero @(9, r1)
#define _Negative @(10, r1)
#define _Overflow @(11, r1)
#define ShiftedDB @(20, r1)
#define ShiftedPB @(16, r1)
#define CPUExecuting @(12, r1)
#define Scanline @(28, r1)
#define Frame @(24, r1)
#define APUEnabled @r1
#define Shutdown @(1, r1)
#define H_Max @(20, r1)
#define HBlankStart @(24, r1)
#define CyclesPercentage @(28, r1)
#define DisableIRQ @(2, r1)
#define Paused @(3, r1)
#define PAL @(7, r1)
#define SA1Enabled @(82, r1)
#define SuperFXEnabled @(80, r1)
#define ApuP @r1
#define ApuYA @(2, r1)
#define ApuA @(2, r1)
#define ApuY @(3, r1)
#define ApuX @(4, r1)
#define ApuS @(5, r1)
#define ApuPC @(6, r1)
#define APUPCR @(6, r1)
#define BGMode @(18, r1)
#define BG3Priority @(19, r1)
#define Brightness @(14, r1)
#define GHight @(84, r1)
#define GInc @(85, r1)
#define GAddress @(86, r1)
#define GMask1 @(88, r1)
#define GFullGraphicCount @(90, r1)
#define GShift @(92, r1)
#define CGFLIP @(20, r1)
#define CGDATA @(184, r1)
#define FirstSprite @(11, r1)
#define LastSprite @(21, r1)
#define OBJ @(696, r1)
#define OAMPriorityRotation @(22, r1)
#define OAMAddr @r1
#define OAMFlip @(12, r1)
#define OAMTileAddress @(54, r1)
#define IRQVBeamPos @(16, r1)
#define IRQHBeamPos @(56, r1)
#define VBeamPosLatched @(58, r1)
#define HBeamPosLatched @(60, r1)
#define HBeamFlip @(24, r1)
#define VBeamFlip @(25, r1)
#define HVBeamCounterLatched @(13, r1)
#define MatrixA @(62, r1)
#define MatrixB @(64, r1)
#define MatrixC @(66, r1)
#define MatrixD @(68, r1)
#define CentreX @(70, r1)
#define CentreY @(72, r1)
#define Joypad1ButtonReadPos @(26, r1)
#define Joypad2ButtonReadPos @(27, r1)
#define CGADD @(28, r1)
#define FixedColourGreen @(30, r1)
#define FixedColourRed @(29, r1)
#define FixedColourBlue @(31, r1)
#define SavedOAMAddr @(2, r1)
#define ScreenHeight @(4, r1)
#define WRAM @(80, r1)
#define BG_Forced @(32, r1)
#define ForcedBlanking @(8, r1)
#define OBJThroughMain @(33, r1)
#define OBJThroughSub @(34, r1)
#define OBJSizeSelect @(35, r1)
#define OBJNameBase @(76, r1)
#define OAMReadFlip @(37, r1)
#define OAMData @(2232, r1)
#define VTimerEnabled @(9, r1)
#define HTimerEnabled @(10, r1)
#define HTimerPosition @(6, r1)
#define Mosaic @(38, r1)
#define BGMosaic @(142, r1)
#define Mode7HFlip @(39, r1)
#define Mode7VFlip @(40, r1)
#define Mode7Repeat @(41, r1)
#define Window1Left @(42, r1)
#define Window1Right @(43, r1)
#define Window2Left @(44, r1)
#define Window2Right @(50, r1)
#define ClipWindowOverlapLogic @(152, r1)
#define ClipWindow1Enable @(158, r1)
#define ClipWindow2Enable @(164, r1)
#define ClipWindow1Inside @(170, r1)
#define ClipWindow2Inside @(176, r1)
#define RecomputeClipWindows @(45, r1)
#define CGFLIPRead @(46, r1)
#define OBJNameSelect @(78, r1)
#define Need16x8Mulitply @(51, r1)
#define Joypad3ButtonReadPos @(52, r1)
#define MouseSpeed @(182, r1)
#define RangeTimeOver @(23, r1)
#define ColorsChanged @r1
#define HDMA @(1, r1)
#define HDMAStarted @(2, r1)
#define MaxBrightness @(3, r1)
#define LatchedBlanking @(4, r1)
#define OBJChanged @(5, r1)
#define RenderThisFrame @(6, r1)
#define SkippedFrames @(20, r1)
#define FrameSkip @(24, r1)
#define TileCache @(28, r1)
#define TileCached @(40, r1)
#define FirstVRAMRead @(52, r1)
#define Interlace @(54, r1)
#define DoubleWidthPixels @(56, r1)
#define RenderedScreenHeight @(60, r1)
#define RenderedScreenWidth @(64, r1)
#define Red @(68, r1)
#define Green @(1092, r1)
#define Blue @(2116, r1)
#define XB @(3140, r1)
#define ScreenColors @(3144, r1)
#define PreviousLine @(3656, r1)
#define CurrentLine @(3660, r1)
#define Joypads @(3668, r1)
#define SuperScope @(3688, r1)
#define Mouse @(3692, r1)
#define PrevMouseX @(3700, r1)
#define PrevMouseY @(3708, r1)
#define Clip @(3716, r1)
#define SA1Opcodes @(16, SA1REG)
#define SA1_Carry @SA1REG
#define SA1_Zero @(1, SA1REG)
#define SA1_Negative @(2, SA1REG)
#define SA1_Overflow @(3, SA1REG)
#define SA1CPUExecuting @(4, SA1REG)
#define SA1ShiftedPB @(20, SA1REG)
#define SA1ShiftedDB @(24, SA1REG)
#define SA1Flags @(28, SA1REG)
#define SA1Executing @(5, SA1REG)
#define SA1NMIActive @(6, SA1REG)
#define SA1IRQActive @(7, SA1REG)
#define SA1WaitingForInterrupt @(8, SA1REG)
#define SA1PCS @(36, SA1REG)
#define SA1PCBase @(40, SA1REG)
#define SA1PCAtOpcodeStart @(48, SA1REG)
#define SA1WaitAddress @(52, SA1REG)
#define SA1WaitCounter @(32, SA1REG)
#define SA1WaitByteAddress1 @(56, SA1REG)
#define SA1WaitByteAddress2 @(60, SA1REG)
#define SA1BWRAM @(44, SA1REG)
#define SA1Map @(64, SA1REG)
#define SA1WriteMap @(16448, SA1REG)
#define SA1op1 @(32832, SA1REG)
#define SA1op2 @(32834, SA1REG)
#define SA1arithmetic_op @(32836, SA1REG)
#define SA1sum @(32840, SA1REG)
#define SA1overflow @(10, SA1REG)
#define VirtualBitmapFormat @(11, SA1REG)
#define SA1_in_char_dma @(12, SA1REG)
#define SA1variable_bit_pos @(13, SA1REG)
#define SA1PB @r11
#define SA1DB @(1, r11)
#define SA1PP @(2, r11)
#define SA1PL @(2, r11)
#define SA1PH SA1PL + 1
#define SA1AA @(4, r11)
#define SA1AL @(4, r11)
#define SA1AH SA1AL + 1
#define SA1DD @(6, r11)
#define SA1DL @(6, r11)
#define SA1DH SA1DL + 1
#define SA1SS @(8, r11)
#define SA1SL @(8, r11)
#define SA1SH SA1SL + 1
#define SA1XX @(10, r11)
#define SA1XL @(10, r11)
#define SA1XH SA1XL + 1
#define SA1YY @(12, r11)
#define SA1YL @(12, r11)
#define SA1YH SA1YL + 1
#define SA1PCR @(14, r11)
#define S9xGetByte @(4, r14)
#define S9xSetByte @(8, r14)
#define S9xGetWord @(12, r14)
#define S9xSetWord @(16, r14)
#define S9xOpcode_IRQ @(20, r14)
#define S9xOpcode_NMI @(24, r14)
#define S9xSetPCBase @(28, r14)
#define ICPU @(32, r14)
#define IAPU @(36, r14)
#define APU @(40, r14)
#define SA1 @(44, r14)
#define APURegisters @(48, r14)
#define Settings @(52, r14)
#define IPPU @(56, r14)
#define PPU @(60, r14)
#define SA1Map_offs 64
#define SA1WriteMap_offs 16448
#ifdef USE_ASM_R12
#define NMITriggerPoint_offs 72
#else
#define NMITriggerPoint_offs 72+16
#endif
