get rid of unused lablen

This commit is contained in:
Peter McGoron 2023-02-21 17:47:15 +00:00
parent 6e0d124efd
commit b7eed7d44e
1 changed files with 9 additions and 4 deletions

View File

@ -338,13 +338,18 @@ class Line:
self.ins = ins
self.args = args
def check_line(self, lablen, reglen):
def check_line(self, reglen, datlen):
for a in self.args:
if a.at == ArgType.REG:
if a.val < 0 or a.val >= reglen:
raise RangeCheckException(a.at,
a.val,
reglen)
elif a.at == ArgType.DAT:
if a.val < 0 or a.val >= datlen:
raise RangeCheckException(a.at,
a.val,
reglen)
def __call__(self):
return self.ins.render(self.args)
@ -366,7 +371,7 @@ def _term_sep(s):
class Program:
def _asm_push_line(self, ins, args):
l = Line(ins, args)
l.check_line(self.lablen, self.reglen)
l.check_line(self.reglen, self.datlen)
self.asm.append(l)
def parse_asm_line(self, line):
@ -454,8 +459,8 @@ class Program:
assert len(b) < encoding_types[lablen][0]
return b
def __init__(self, lablen=16, reglen=16):
def __init__(self, reglen=16, datlen=16):
self.asm = []
self.lablen = lablen
self.reglen = reglen
self.datlen = datlen