negative offset

This commit is contained in:
julianb0 2019-05-30 11:41:00 +02:00
parent a4544a2b57
commit a20f4a248e
No known key found for this signature in database
GPG Key ID: DDF8325C95299A62
1 changed files with 12 additions and 3 deletions

View File

@ -421,13 +421,22 @@ def gentext():
lastimm = 4
elif word == "%imm64":
lastimm = 8
elif word[2:] == "off" and word[0] == '%':
if word[2:] == "off" and word[0] == '%':
lastimm = 2
b_text.write(special_syms[word].to_bytes(2, byteorder='little', signed=False))
isSigned = True
else:
isSigned = False
b_text.write(special_syms[word].to_bytes(2, byteorder='little', signed=isSigned))
continue
if is_number(word):
b_text.write(int(word, base=0).to_bytes(lastimm, byteorder='little', signed=False))
if word[0] == '-':
isSigned = True
else:
isSigned = False
b_text.write(int(word, base=0).to_bytes(lastimm, byteorder='little', signed=isSigned))
continue
print("Assembly error, unknown token '{}' in line: {}".format(word, line))