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

View File

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