diff options
| -rw-r--r-- | converter.py | 39 | ||||
| -rw-r--r-- | converter_blank_funs.py | 31 |
2 files changed, 0 insertions, 70 deletions
diff --git a/converter.py b/converter.py deleted file mode 100644 index da9d8cd..0000000 --- a/converter.py +++ /dev/null | |||
| @@ -1,39 +0,0 @@ | |||
| 1 | import json | ||
| 2 | |||
| 3 | address_mode_table = { | ||
| 4 | 'Implied': 'AM_ACC', | ||
| 5 | 'Immediate': 'AM_IMM', | ||
| 6 | 'Zero Page': 'AM_ZP', | ||
| 7 | 'Zero Page, X': 'AM_ZP_X', | ||
| 8 | 'Zero Page, Y': 'AM_ZP_Y', | ||
| 9 | 'Absolute': 'AM_ABS', | ||
| 10 | 'Absolute, X': 'AM_ABS_X', | ||
| 11 | 'Absolute, Y': 'AM_ABS_Y', | ||
| 12 | 'Indirect': 'AM_IND', | ||
| 13 | '(Indirect)': 'AM_IND', | ||
| 14 | '(Indirect, X)': 'AM_IND_X', | ||
| 15 | '(Indirect), Y': 'AM_IND_Y', | ||
| 16 | } | ||
| 17 | |||
| 18 | # https://github.com/ericTheEchidna/65C02-JSON/ | ||
| 19 | j = json.load(open('opcodes_65c02.json', 'r')) | ||
| 20 | |||
| 21 | #print(j) | ||
| 22 | |||
| 23 | for i in j: | ||
| 24 | #print(i) | ||
| 25 | instruction = str.lower(i["instruction"]) | ||
| 26 | for op in i["opcodes"]: | ||
| 27 | address_mode = i["opcodes"][op]["address_mode"] | ||
| 28 | if "Bit " in address_mode: | ||
| 29 | am = 'AM_REL' | ||
| 30 | else: | ||
| 31 | am = address_mode_table[address_mode] | ||
| 32 | |||
| 33 | bytes = i["opcodes"][op]["bytes"] | ||
| 34 | cycles = i["opcodes"][op]["cycles"] | ||
| 35 | |||
| 36 | print(f'''case {op}: | ||
| 37 | {instruction}(opcode_arg({am})); | ||
| 38 | cycles += {cycles}; | ||
| 39 | break;''') | ||
diff --git a/converter_blank_funs.py b/converter_blank_funs.py deleted file mode 100644 index 9502ca8..0000000 --- a/converter_blank_funs.py +++ /dev/null | |||
| @@ -1,31 +0,0 @@ | |||
| 1 | import json | ||
| 2 | |||
| 3 | address_mode_table = { | ||
| 4 | 'Implied': 'AM_ACC', | ||
| 5 | 'Immediate': 'AM_IMM', | ||
| 6 | 'Zero Page': 'AM_ZP', | ||
| 7 | 'Zero Page, X': 'AM_ZP_X', | ||
| 8 | 'Zero Page, Y': 'AM_ZP_Y', | ||
| 9 | 'Absolute': 'AM_ABS', | ||
| 10 | 'Absolute, X': 'AM_ABS_X', | ||
| 11 | 'Absolute, Y': 'AM_ABS_Y', | ||
| 12 | 'Indirect': 'AM_IND', | ||
| 13 | '(Indirect)': 'AM_IND', | ||
| 14 | '(Indirect, X)': 'AM_IND_X', | ||
| 15 | '(Indirect), Y': 'AM_IND_Y', | ||
| 16 | } | ||
| 17 | |||
| 18 | # https://github.com/ericTheEchidna/65C02-JSON/ | ||
| 19 | j = json.load(open('opcodes_65c02.json', 'r')) | ||
| 20 | |||
| 21 | #print(j) | ||
| 22 | |||
| 23 | for i in j: | ||
| 24 | #print(i) | ||
| 25 | instruction = str.lower(i["instruction"]) | ||
| 26 | print(''' | ||
| 27 | static void | ||
| 28 | ''' + instruction + '''(uint8_t arg) | ||
| 29 | { | ||
| 30 | /* TODO: complete this */ | ||
| 31 | }''') | ||
