Fix formatting of .org and end.

This commit is contained in:
Jeff Tranter 2015-06-20 21:59:07 -04:00
parent 27bded0255
commit cb42cc9b36
3 changed files with 10 additions and 8 deletions

View File

@ -8,7 +8,7 @@
# AddressWidth = 16 # 16-bit addresses
# Maximum length of an instruction (for formatting purposes)
maxLength = 5;
maxLength = 5
# Leadin bytes for multbyte instructions
leadInBytes = [0x18, 0x1a, 0xcd]
@ -318,7 +318,7 @@ opcodeTable = {
0xdf : [ 2, "stx", "direct" ],
0xff : [ 3, "stx", "extended" ],
0xef : [ 2, "stx", "indexedx" ],
0x18ef : [ 3, "stx", "indexedy" ],
0xcdef : [ 3, "stx", "indexedy" ],
0x18df : [ 3, "sty", "direct" ],
0x18ff : [ 4, "sty", "extended" ],
0x1aef : [ 3, "sty", "indexedx" ],

View File

@ -23,7 +23,7 @@ CPU Status
6809 planned
6811 planned
6811 done
8008 planned

10
udis.py
View File

@ -89,7 +89,8 @@ except FileNotFoundError:
# Print initial origin address
if args.nolist is False:
print("{0:04X} .org ${1:04X}".format(address, address))
s = " "
print("{0:04X}{1:s}.org ${2:04X}".format(address, s[0:maxLength*3+3], address))
else:
print(" .org ${0:04X}".format(address))
@ -99,7 +100,8 @@ while True:
if len(b) == 0: # handle EOF
if args.nolist is False:
print("{0:04X} end".format(address))
s = " "
print("{0:04X}{1:s}end".format(address, s[0:maxLength*3+3]))
break
# Get op code
@ -158,7 +160,7 @@ while True:
line += " "
# Handle relative addresses. Indicated by the flag pcr being set.
# TODO: Needs changes if more flags are added.
# Note: Needs changes if more flags are added.
if flags == pcr:
if op[1] < 128:
op[1] = address + op[1] + 2
@ -198,7 +200,7 @@ while True:
if operand == "":
line += " {0:s}".format(mnemonic)
else:
line += " {0:4s} {1:s}".format(mnemonic, operand)
line += " {0:5s} {1:s}".format(mnemonic, operand)
# Print line of output
print(line)