From cb42cc9b36a830054b86416d667108a13360c567 Mon Sep 17 00:00:00 2001 From: Jeff Tranter Date: Sat, 20 Jun 2015 21:59:07 -0400 Subject: [PATCH] Fix formatting of .org and end. --- 6811.py | 4 ++-- README.md | 2 +- udis.py | 12 +++++++----- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/6811.py b/6811.py index c1fa1d7..f175f30 100755 --- a/6811.py +++ b/6811.py @@ -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" ], diff --git a/README.md b/README.md index 88cb935..202c21e 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ CPU Status 6809 planned -6811 planned +6811 done 8008 planned diff --git a/udis.py b/udis.py index 64fee48..c05af45 100755 --- a/udis.py +++ b/udis.py @@ -89,9 +89,10 @@ 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)) + print(" .org ${0:04X}".format(address)) while True: try: @@ -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)