Line 1... |
Line 1... |
#!/usr/bin/python2.7
|
#!/usr/bin/python2.7
|
|
|
################################################################################
|
################################################################################
|
#
|
#
|
# Copyright 2012, Sinclair R.F., Inc.
|
# Copyright 2012-2015, Sinclair R.F., Inc.
|
#
|
#
|
# Assembler for SSBCC 9x8 processor
|
# Assembler for SSBCC 9x8 processor
|
#
|
#
|
################################################################################
|
################################################################################
|
|
|
Line 59... |
Line 59... |
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');
|
argListParser.add_argument('-s', metavar='STACK_NAME=length', action='append', help='Stack length');
|
argListParser.add_argument('-s', metavar='STACK_NAME=length', action='append', help='Stack length');
|
argListParser.add_argument('filename', metavar='filename', nargs='+', type=validateFile, help='required list of files');
|
argListParser.add_argument('filename', metavar='filename', nargs='+', type=validateFile, help='required list of files');
|
argList = argListParser.parse_args();
|
argList = argListParser.parse_args();
|
|
|
|
# Determine whether or not interrupts are enabled
|
|
interruptsEnabled = True if argList.i else False;
|
|
|
# Construct the keyword parser
|
# Construct the keyword parser
|
from asmDef_9x8 import asmDef_9x8
|
from asmDef_9x8 import asmDef_9x8
|
ad = asmDef_9x8();
|
ad = asmDef_9x8(interruptsEnabled);
|
|
|
# Record the constants in the program symbol table.
|
# Record the constants in the program symbol table.
|
if argList.C:
|
if argList.C:
|
for constant in argList.C:
|
for constant in argList.C:
|
a=re.findall(r'^(C_\w+)=(-?[1-9]\d*|\w+)$',constant);
|
a=re.findall(r'^(C_\w+)=(-?[1-9]\d*|\w+)$',constant);
|
Line 82... |
Line 85... |
|
|
# Record the defines.
|
# Record the defines.
|
if argList.D:
|
if argList.D:
|
for name in argList.D:
|
for name in argList.D:
|
if not re.match('D_',name):
|
if not re.match('D_',name):
|
raise SSBCCException('Bad define name "%s" should start with "D_"' % name);
|
raise asmDef.AsmException('Argument "%s" to "%s" should start with "D_"' % (name,sys.argv[0],));
|
ad.AddSymbol(name, 'define');
|
ad.AddSymbol(name, 'define');
|
|
|
# Record the input names and values in the appropriate record type
|
# Record the input names and values in the appropriate record type
|
if argList.G:
|
if argList.G:
|
for parameter in argList.G:
|
for parameter in argList.G:
|