summaryrefslogtreecommitdiff
path: root/src/os9x_65c816_def.h
blob: 8763ecd80febc4ef623c675dbdaecdb01e0c6f0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//#define __PALMOS__

//#define __TESTING__

#define MAP_LAST  12

#define regA      R11   //format : 0xhhll0000 or 0xll000000
#define rstatus      R4      //format : 0xff800000
#define regDBank  R4 //format : 0x000000ll
#define regX      R5 //format : 0xhhll0000 or 0xll000000
#define regY      R6 //format : 0xhhll0000 or 0xll000000

#define rpc    R7 //32bits address
#define regD      R8 //format : 0xhhll0000
#define regPBank  R8 //format : 0x000000ll
#define regCycles R9 //32bits counter
#define regS      R10   //format : 0x0000hhll

#define rscratch  R0 //format : 0xhhll0000 if data and calculation or return of S9XREADBYTE  or WORD
#define regopcode R0 //format : 0x000000ll
#define rscratch2 R1 //format : 0xhhll for calculation and value
#define rscratch3 R2 //
#define rscratch4 R3 //??????


#define rscratch5 R5 //??????
#define rscratch6 R6 //??????
#define rscratch7 R8 //??????
#define rscratch8 R9 //??????
#define rscratch9 R10   //??????

#define regpcbase R12   //32bits address

#define regCPUvar       R14



//not used
//R13 //Pointer 32 bit on a struct.

//R15 = pc (sic!)


/*#define Carry       1
#define Zero        2
#define IRQ         4
#define Decimal     8
#define IndexFlag  16
#define MemoryFlag 32
#define Overflow   64
#define Negative  128
#define Emulation 256*/

#define STATUS_SHIFTER     24
#define MASK_EMUL    (1<<(STATUS_SHIFTER-1))
#define MASK_SHIFTER_CARRY (STATUS_SHIFTER+1)
#define  MASK_CARRY     (1<<(STATUS_SHIFTER))  //0
#define  MASK_ZERO      (2<<(STATUS_SHIFTER))  //1
#define MASK_IRQ     (4<<(STATUS_SHIFTER))  //2
#define MASK_DECIMAL    (8<<(STATUS_SHIFTER))  //3
#define  MASK_INDEX     (16<<(STATUS_SHIFTER)) //4  //1
#define  MASK_MEM    (32<<(STATUS_SHIFTER)) //5  //2
#define  MASK_OVERFLOW     (64<<(STATUS_SHIFTER)) //6  //4
#define  MASK_NEG    (128<<(STATUS_SHIFTER))//7  //8

#define ONE_CYCLE 6
#define SLOW_ONE_CYCLE 8

#define  NMI_FLAG     (1 << 7)
#define IRQ_PENDING_FLAG    (1 << 11)
#define SCAN_KEYS_FLAG      (1 << 4)


#define MEMMAP_BLOCK_SIZE (0x1000)
#define MEMMAP_SHIFT 12
#define MEMMAP_MASK (0xFFF)