get rid of unused lablen
This commit is contained in:
parent
6e0d124efd
commit
b7eed7d44e
|
@ -338,13 +338,18 @@ class Line:
|
||||||
self.ins = ins
|
self.ins = ins
|
||||||
self.args = args
|
self.args = args
|
||||||
|
|
||||||
def check_line(self, lablen, reglen):
|
def check_line(self, reglen, datlen):
|
||||||
for a in self.args:
|
for a in self.args:
|
||||||
if a.at == ArgType.REG:
|
if a.at == ArgType.REG:
|
||||||
if a.val < 0 or a.val >= reglen:
|
if a.val < 0 or a.val >= reglen:
|
||||||
raise RangeCheckException(a.at,
|
raise RangeCheckException(a.at,
|
||||||
a.val,
|
a.val,
|
||||||
reglen)
|
reglen)
|
||||||
|
elif a.at == ArgType.DAT:
|
||||||
|
if a.val < 0 or a.val >= datlen:
|
||||||
|
raise RangeCheckException(a.at,
|
||||||
|
a.val,
|
||||||
|
reglen)
|
||||||
def __call__(self):
|
def __call__(self):
|
||||||
return self.ins.render(self.args)
|
return self.ins.render(self.args)
|
||||||
|
|
||||||
|
@ -366,7 +371,7 @@ def _term_sep(s):
|
||||||
class Program:
|
class Program:
|
||||||
def _asm_push_line(self, ins, args):
|
def _asm_push_line(self, ins, args):
|
||||||
l = Line(ins, args)
|
l = Line(ins, args)
|
||||||
l.check_line(self.lablen, self.reglen)
|
l.check_line(self.reglen, self.datlen)
|
||||||
self.asm.append(l)
|
self.asm.append(l)
|
||||||
|
|
||||||
def parse_asm_line(self, line):
|
def parse_asm_line(self, line):
|
||||||
|
@ -454,8 +459,8 @@ class Program:
|
||||||
assert len(b) < encoding_types[lablen][0]
|
assert len(b) < encoding_types[lablen][0]
|
||||||
return b
|
return b
|
||||||
|
|
||||||
def __init__(self, lablen=16, reglen=16):
|
def __init__(self, reglen=16, datlen=16):
|
||||||
self.asm = []
|
self.asm = []
|
||||||
self.lablen = lablen
|
|
||||||
self.reglen = reglen
|
self.reglen = reglen
|
||||||
|
self.datlen = datlen
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue