summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/m6809/m6809make.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/m6809/m6809make.py')
-rw-r--r--src/devices/cpu/m6809/m6809make.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/devices/cpu/m6809/m6809make.py b/src/devices/cpu/m6809/m6809make.py
index 8838b960191..b7e243a2066 100644
--- a/src/devices/cpu/m6809/m6809make.py
+++ b/src/devices/cpu/m6809/m6809make.py
@@ -2,21 +2,22 @@
# license:BSD-3-Clause
# copyright-holders:Olivier Galibert
-import sys
+import io
import re
+import sys
# Initial state
-state = 1
text = ""
-dispatch_to_states = { "MAIN" : 0 }
-states_to_dispatch = { 0 : "MAIN" }
+dispatch_to_states = { "MAIN" : 0, "INTERRUPT_VECTOR" : 1 }
+states_to_dispatch = { 0 : "MAIN", 1 : "INTERRUPT_VECTOR" }
+state = len(states_to_dispatch)
def load_file(fname, lines):
path = fname.rpartition('/')[0]
if path != "":
path += '/'
try:
- f = open(fname, "rU")
+ f = io.open(fname, "r")
except Exception:
err = sys.exc_info()[1]
sys.stderr.write("Cannot read opcodes file %s [%s]\n" % (fname, err))
@@ -50,9 +51,9 @@ while count < len(lines):
next_line_is_return = (count + 1 == len(lines)) or lines[count+1].strip() == "return;"
# Check to see if the next line is a dispatch followed by return
- next_line_is_dispatch_and_return = (count + 1 < len(lines)) and re.match('([A-Za-z0-9\t ]+\:)*\s*\%', lines[count+1]) and lines[count+2].strip() == "return;"
+ next_line_is_dispatch_and_return = (count + 1 < len(lines)) and re.match('([A-Za-z0-9\t ]+\\:)*\\s*\\%', lines[count+1]) and lines[count+2].strip() == "return;"
- if re.match('([A-Za-z0-9\t ]+\:)*\s*\%', line):
+ if re.match('([A-Za-z0-9\t ]+\\:)*\\s*\\%', line):
# This is a dispatch - find the '%'
percent_pos = line.find("%")
dispatch = line[percent_pos+1:].strip("\t\n; ")