aboutsummaryrefslogtreecommitdiff
path: root/devtools
diff options
context:
space:
mode:
Diffstat (limited to 'devtools')
-rw-r--r--devtools/tasmrecover/tasm/cpp.py10
-rw-r--r--devtools/tasmrecover/tasm/parser.py3
2 files changed, 9 insertions, 4 deletions
diff --git a/devtools/tasmrecover/tasm/cpp.py b/devtools/tasmrecover/tasm/cpp.py
index f5f7057211..831074976d 100644
--- a/devtools/tasmrecover/tasm/cpp.py
+++ b/devtools/tasmrecover/tasm/cpp.py
@@ -146,9 +146,11 @@ namespace %s {
m = re.match(r'(\w{2,2}):(.*)$', expr)
if m is not None:
- seg = m.group(1)
+ seg_prefix = m.group(1)
expr = m.group(2).strip()
- print "SEGMENT %s, remains: %s" %(seg, expr)
+ print "SEGMENT %s, remains: %s" %(seg_prefix, expr)
+ else:
+ seg_prefix = "ds"
m = re.match(r'(([abcd][xhl])|si|di|bp|sp)([\+-].*)?$', expr)
if m is not None:
@@ -174,9 +176,9 @@ namespace %s {
if indirection == 1:
if size == 1:
- expr = "context.ds.byte(%s)" %expr
+ expr = "context.%s.byte(%s)" %(seg_prefix, expr)
elif size == 2:
- expr = "context.ds.word(%s)" %expr
+ expr = "context.%s.word(%s)" %(seg_prefix, expr)
else:
expr = "@invalid size 0"
elif indirection == 0:
diff --git a/devtools/tasmrecover/tasm/parser.py b/devtools/tasmrecover/tasm/parser.py
index 2391aa442b..b1d7995597 100644
--- a/devtools/tasmrecover/tasm/parser.py
+++ b/devtools/tasmrecover/tasm/parser.py
@@ -101,6 +101,7 @@ class parser:
return text
def fix_dollar(self, v):
+ print("$ = %d" %len(self.binary_data))
return re.sub(r'\$', "%d" %len(self.binary_data), v)
def parse_int(self, v):
@@ -198,6 +199,7 @@ class parser:
if cmd0 == 'db' or cmd0 == 'dw' or cmd0 == 'dd':
arg = " ".join(cmd[1:])
+ print "%d: %s" %(len(self.binary_data), line) #fixme: COPYPASTE
binary_width = {'b': 1, 'w': 2, 'd': 4}[cmd0[1]]
self.binary_data += self.compact_data(binary_width, lex.parse_args(arg))
continue
@@ -221,6 +223,7 @@ class parser:
v = cmd[2]
self.set_global(cmd0, op.const(self.fix_dollar(v)))
elif cmd1 == 'db' or cmd1 == 'dw' or cmd1 == 'dd':
+ print "%d: %s" %(len(self.binary_data), line)
binary_width = {'b': 1, 'w': 2, 'd': 4}[cmd1[1]]
offset = len(self.binary_data)
self.binary_data += self.compact_data(binary_width, lex.parse_args(" ".join(cmd[2:])))