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
|
import json
address_mode_table = {
'Implied': 'AM_ACC',
'Immediate': 'AM_IMM',
'Zero Page': 'AM_ZP',
'Zero Page, X': 'AM_ZP_X',
'Zero Page, Y': 'AM_ZP_Y',
'Absolute': 'AM_ABS',
'Absolute, X': 'AM_ABS_X',
'Absolute, Y': 'AM_ABS_Y',
'Indirect': 'AM_IND',
'(Indirect)': 'AM_IND',
'(Indirect, X)': 'AM_IND_X',
'(Indirect), Y': 'AM_IND_Y',
}
# https://github.com/ericTheEchidna/65C02-JSON/
j = json.load(open('opcodes_65c02.json', 'r'))
#print(j)
for i in j:
#print(i)
instruction = str.lower(i["instruction"])
print('''
static void
''' + instruction + '''(uint8_t arg)
{
/* TODO: complete this */
}''')
|