Line 45... |
Line 45... |
argListParser = argparse.ArgumentParser(description='SSBCC 9x8 assembler');
|
argListParser = argparse.ArgumentParser(description='SSBCC 9x8 assembler');
|
argListParser.add_argument('-C', metavar='CONSTANT=value', action='append', help='Constant definition');
|
argListParser.add_argument('-C', metavar='CONSTANT=value', action='append', help='Constant definition');
|
argListParser.add_argument('-G', metavar='parametername', action='append', help='parameter names');
|
argListParser.add_argument('-G', metavar='parametername', action='append', help='parameter names');
|
argListParser.add_argument('-I', metavar='PORT=index', action='append', help='Input port names');
|
argListParser.add_argument('-I', metavar='PORT=index', action='append', help='Input port names');
|
argListParser.add_argument('-L', metavar='librarypath', action='append', help='Library search path');
|
argListParser.add_argument('-L', metavar='librarypath', action='append', help='Library search path');
|
|
argListParser.add_argument('-M', metavar='macropath', action='append', help='Macro search path');
|
argListParser.add_argument('-O', metavar='PORT=index', action='append', help='Output port names');
|
argListParser.add_argument('-O', metavar='PORT=index', action='append', help='Output port names');
|
argListParser.add_argument('-R', metavar='PORT=index', action='append', help='Strobe-only output port names');
|
argListParser.add_argument('-R', metavar='PORT=index', action='append', help='Strobe-only output port names');
|
argListParser.add_argument('-S', metavar='MEMORY=length', action='append', help='Memory length');
|
argListParser.add_argument('-S', metavar='MEMORY=length', action='append', help='Memory length');
|
argListParser.add_argument('-i', action='store_true', help='enable/require interrupt');
|
argListParser.add_argument('-i', action='store_true', help='enable/require interrupt');
|
argListParser.add_argument('-o', metavar='outfile', type=argparse.FileType('w'), required =True, help='output metafile');
|
argListParser.add_argument('-o', metavar='outfile', type=argparse.FileType('w'), required =True, help='output metafile');
|
Line 138... |
Line 139... |
a = a[0];
|
a = a[0];
|
ad.RegisterStackLength(a[0],int(a[1]));
|
ad.RegisterStackLength(a[0],int(a[1]));
|
|
|
# Construct the iterator that loops through the code bodies.
|
# Construct the iterator that loops through the code bodies.
|
fbi = asmDef.FileBodyIterator(argList.filename,ad);
|
fbi = asmDef.FileBodyIterator(argList.filename,ad);
|
|
|
|
# Add paths for the ".include" directive.
|
if argList.L:
|
if argList.L:
|
for path in argList.L:
|
for path in argList.L:
|
fbi.AddSearchPath(path);
|
fbi.AddSearchPath(path);
|
|
|
|
# Add paths for the ".macro" directive.
|
|
if argList.M:
|
|
for path in argList.M:
|
|
ad.AddMacroSearchPath(path);
|
|
|
################################################################################
|
################################################################################
|
#
|
#
|
# Stage 1: Parse the files.
|
# Stage 1: Parse the files.
|
#
|
#
|
# Read the entire file, doing the following while reading the file:
|
# Read the entire file, doing the following while reading the file:
|