add 4502 option to Ophis command line.

This commit is contained in:
gardners 2014-02-06 22:23:28 +10:30
parent ccef1b663f
commit c4be540f49
2 changed files with 10 additions and 1 deletions

View File

@ -26,7 +26,7 @@ listfile = None
def parse_args(raw_args):
"Populate the module's globals based on the command-line options given."
global enable_collapse, enable_branch_extend
global enable_undoc_ops, enable_65c02_exts
global enable_undoc_ops, enable_65c02_exts, enable_4502_exts
global warn_on_branch_extend
global print_summary, print_loaded_files
global print_pass, print_ir, print_labels
@ -46,6 +46,8 @@ def parse_args(raw_args):
help="Enable 6502 undocumented opcodes")
ingrp.add_option("-c", "--65c02", action="store_true", default=False,
dest="c02", help="Enable 65c02 extended instruction set")
ingrp.add_option("-4", "--4502", action="store_true", default=False,
dest="csg4502", help="Enable 4502 extended instruction set")
outgrp = optparse.OptionGroup(parser, "Console output options")
outgrp.add_option("-v", "--verbose", action="store_const", const=2,
@ -72,6 +74,10 @@ def parse_args(raw_args):
parser.error("No input files specified")
if options.c02 and options.undoc:
parser.error("--undoc and --65c02 are mutually exclusive")
if options.c02 and options.csg4502:
parser.error("--undoc and --65c02 are mutually exclusive")
if options.csg4502 and options.undoc:
parser.error("--undoc and --65c02 are mutually exclusive")
infiles = args
outfile = options.outfile
@ -79,6 +85,7 @@ def parse_args(raw_args):
enable_branch_extend = options.enable_branch_extend
enable_undoc_ops = options.undoc
enable_65c02_exts = options.c02
enable_4502_exts = options.csg4502
warn_on_branch_extend = options.warn
print_summary = options.verbose > 0 # no options set
print_loaded_files = options.verbose > 1 # v

View File

@ -104,6 +104,8 @@ def run_ophis(args):
Ophis.Opcodes.opcodes.update(Ophis.Opcodes.undocops)
elif Ophis.CmdLine.enable_65c02_exts:
Ophis.Opcodes.opcodes.update(Ophis.Opcodes.c02extensions)
elif Ophis.CmdLine.enable_65c02_exts:
Ophis.Opcodes.opcodes.update(Ophis.Opcodes.csg4502extensions)
Ophis.CorePragmas.reset()
return run_all()