-
Notifications
You must be signed in to change notification settings - Fork 2
/
opcodes.h
122 lines (107 loc) · 3.68 KB
/
opcodes.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
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/*
¬°¤*,¸¸,*¤°¬¯¬°¤*,¸_¸,*¤°¬°¤*,¸,*¤°¬¯¬°¤*,¸_¸,*¤°¬°¤*,¸,*¤°¬¯¬°¤*,¸_¸,*¤°¬°¤*,¸
¸,*¤°¬¯¬°¤*,¸_¸,*¤°¬°¤*,¸,*¤°¬¯¬°¤*,¸_¸,*¤°¬°¤*,¸,*¤°¬¯¬°¤*,¸_¸,*¤°¬°¤*,¸,*¤°¬¯
__/¯\____ ___/\__ _/\__ _/\_ _/\__ _/\___ ___/\__ __/\_ _/\__
\_ ____/_> ____ \_/ _ \_ \ < /_ \_/ _>> ____ \_ > \_/ _ \_
_> ___/ ¯>__> <<__// __ _/ |> ></ _/> </ ¯ \\__> <<__// /\ // __ _/
_> \7 <__/:. \__/:. \> \_/ L/ _____/. 7> .\_/:. \__/ <_/ </:. \> \_
|:::::::::::::::::::::::/:::::::::::::>::::::::/::::::::::::::::::::::::/:::::|
|¯¯\::::/\:/¯\::::/¯¯¯¯<::::/\::/¯¯\:/¯¯¯¯¯¯\::\::/¯¯\::::/¯¯\::::/¯¯¯¯<::::/¯|
|__ |¯¯| T _ |¯¯¯| ___ |¯¯| |¯| _ T ______ |¯¯¯¯| _ |¯¯¯| _ |¯¯¯| ___ |¯¯| _|
\|__|/\|/ \|___|/ \|__|/\|_|/ \|/ \| |/ \|___|/ \|___|/dNo\|__|/
¬°¤*,¸¸,*¤°¬¯¬°¤*,¸_¸,*¤°¬°¤*,¸,*¤°¬¯¬°¤*,¸_¸,*¤°¬°¤*,¸,*¤°¬¯¬°¤*,¸_¸,*¤°¬°¤*,¸
¸,*¤°¬¯¬°¤*,¸_¸,*¤°¬°¤*,¸,*¤°¬¯¬°¤*,¸_¸,*¤°¬°¤*,¸,*¤°¬¯¬°¤*,¸_¸,*¤°¬°¤*,¸,*¤°¬¯
This file is part of Etripator,
copyright (c) 2009--2023 Vincent Cruz.
Etripator 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.
Etripator 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 Etripator. If not, see <http://www.gnu.org/licenses/>.
¬°¤*,¸¸,*¤°¬¯¬°¤*,¸_¸,*¤°¬°¤*,¸,*¤°¬¯¬°¤*,¸_¸,*¤°¬°¤*,¸,*¤°¬¯¬°¤*,¸_¸,*¤°¬°¤*,¸
¸,*¤°¬¯¬°¤*,¸_¸,*¤°¬°¤*,¸,*¤°¬¯¬°¤*,¸_¸,*¤°¬°¤*,¸,*¤°¬¯¬°¤*,¸_¸,*¤°¬°¤*,¸,*¤°¬¯
*/
#ifndef ETRIPATOR_OPCODES_H
#define ETRIPATOR_OPCODES_H
#include "config.h"
/**
* Opcode types:
* -# `OPC`
* -# `OPC A`
* -# `OPC #nn`
* -# `OPC #nn, ZZ`
* -# `OPC #nn, ZZ, X`
* -# `OPC #nn, hhll`
* -# `OPC #nn, hhll, X`
* -# `OPC ZZ`
* -# `OPC ZZ, X`
* -# `OPC ZZ, Y`
* -# `OPC (ZZ)`
* -# `OPC (ZZ, X)`
* -# `OPC (ZZ), Y`
* -# `OPC ZZ, hhll`
* -# `OPC hhll`
* -# `OPC (hhll)`
* -# `OPC hhll, X`
* -# `OPC hhll, Y`
* -# `OPC shsl,dhdl,hhll`
* -# `OPC l_hhll` (label)
* -# `OPC ZZ, l_hhll` (label)
* -# `OPC [hhll, X]`
* -# `.db OPC` (unsupported opcode output as raw binary data)
*/
enum PCE_ADDRESSING_MODE {
PCE_OP = 0,
PCE_OP_A,
PCE_OP_nn,
PCE_OP_nn_ZZ,
PCE_OP_nn_ZZ_X,
PCE_OP_nn_hhll,
PCE_OP_nn_hhll_X,
PCE_OP_ZZ,
PCE_OP_ZZ_X,
PCE_OP_ZZ_Y,
PCE_OP__ZZ__,
PCE_OP__ZZ_X__,
PCE_OP__ZZ__Y_,
PCE_OP_ZZ_hhll,
PCE_OP_hhll,
PCE_OP__hhll__,
PCE_OP_hhll_X,
PCE_OP_hhll_Y,
PCE_OP_shsl_dhdl_hhll,
PCE_OP__lbl__,
PCE_OP_ZZ_lbl,
PCE_OP__hhll_X__,
PCE_unknown
};
/**
* Opcode
*/
typedef struct {
char name[5]; /**< name. **/
uint8_t size; /**< size in bytes. **/
uint8_t type; /**< addressing type. **/
} opcode_t;
/**
* Get opcode description.
*/
const opcode_t* opcode_get(uint8_t op);
/**
*
*/
const char* opcode_format(const opcode_t *op, int i);
/**
* Is the instruction a local jump ?
*/
int opcode_is_local_jump(uint8_t op);
/**
* Is the instruction a "far" jump ?
*/
int opcode_is_far_jump(uint8_t op);
#endif // ETRIPATOR_OPCODES_H