forked from haileys/6502
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathaddressing_modes.h
51 lines (44 loc) · 2.02 KB
/
addressing_modes.h
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
// addressing_modes.h -- addressing_modes.c public declarations and defines.
// Copyright (C) 2012 Chris J. Baird <[email protected]>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>
// derived from unlicenced/BSD-2clause code by Charlie Somerville
// https://github.com/charliesome/6502
#ifndef ADDRESSING_MODES_H
#define ADDRESSING_MODES_H
#include "cpu.h"
typedef unsigned short(*addrmode_t)(cpu_t*);
#define ADDRMODE(mode) unsigned short addrmode_##mode(cpu_t* cpu)
ADDRMODE(implied); /* Accumulator, etc */
ADDRMODE(imm8); /* Immediate */
ADDRMODE(imm16); /* #$xxxx (jmp) */
ADDRMODE(relative); /* branches */
ADDRMODE(abs); /* Absolute (jsr) .. how is this different from imm16? */
ADDRMODE(abs_deref); /* Absolute (value from) */
ADDRMODE(absx); /* Absoulte,x WRITE */
ADDRMODE(absx_deref); /* Absolute,x READ */
ADDRMODE(absy); /* Absolute,y WRITE */
ADDRMODE(absy_deref); /* Absolute,y READ ONLY */
ADDRMODE(zp); /* Zero Page WRITE */
ADDRMODE(zp_deref); /* Zero Page READ ONLY */
ADDRMODE(zpx); /* Zero Page,x WRITED */
ADDRMODE(zpx_deref); /* Zero Page,x READ ONLY */
ADDRMODE(zpy); /* Zero Page,y WRITED */
ADDRMODE(zpy_deref); /* Zero Page,y READ ONLY */
ADDRMODE(indirect); /* jmp Indirect */
ADDRMODE(indy); /* (Indirect),y WRITE */
ADDRMODE(indy_deref); /* (Indirect),y READONLY */
ADDRMODE(indx); /* (Indirect,x) WRITE */
ADDRMODE(indx_deref); /* (Indirect,x) READONLY */
#endif /* ADDRESSING_MODES_H */