docs, scripts
[fceu.git] / ncpu.S
CommitLineData
af32b6c2 1/*************************************
2 Little John GP32
3 File : ncpu.S
4 Authors : FCA author
5 modified and adapted by Yoyo.
6 adapted for fceu by notaz, 2007.
7**************************************/
8
9#include "ncpu.h"
10
11@@@
12@@@ Offets from REG_OP_TABLE
13@@@
14#define OTOFFS_NES_RAM (nes_internal_ram - cpu_exec_table)
15#define OTOFFS_NES_STACK (nes_stack - cpu_exec_table)
16#define OTOFFS_NES_REGS (nes_registers - cpu_exec_table)
17#define OTOFFS_PC_BASE (pc_base - cpu_exec_table)
92e249b1 18#define OTOFFS_IRQ_HOOK (MapIRQHook - cpu_exec_table)
19#define OTOFFS_X (X - cpu_exec_table)
af32b6c2 20
21@ fceu
22#define FCEU_IQNMI 0x08
23#define FCEU_IQTEMP 0x80
24
25
26@@@@@@@@@@@@@@@@@@@@@@@@@@
27
28
29@ SECTION_FAST
30 SECTION_TEXT
31 ALIGN
32
33
34
35@@@
36@@@ r0 = Address (unbased)
37@@@ uses REG_OP_TABLE; sets REG_PC; trashes r1,r2; keeps r0
38@@@
39.macro REBASE_PC
40 @ FIXME: do something with mem not in Page[].
41 cmp r0, #0x2000
42 ldrge r1, =Page
43 movge r2, r0, lsr #11
44 ldrge r2, [r1, r2, lsl #2]
45 andlt r2, r0, #0xf800
46 addlt r1, REG_OP_TABLE, #OTOFFS_NES_RAM
47 sublt r2, r1, r2
48 str r2, [REG_OP_TABLE, #OTOFFS_PC_BASE]
49 add REG_PC, r2, r0
50.endm
51
52
af32b6c2 53
54@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
55@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
56@@@
57@@@ CYCLE_NEXT
58@@@
59