Assembler: remove restrictions on some operands
This commit is contained in:
parent
c6b820cc8b
commit
b9c432a9b4
17
asm.py
17
asm.py
|
@ -87,10 +87,7 @@ class ASM(SimpleNamespace):
|
||||||
else:
|
else:
|
||||||
return (0x1a, arg.disp)
|
return (0x1a, arg.disp)
|
||||||
else:
|
else:
|
||||||
if (sp, is_a) not in (('inc', True), ('dec', False)):
|
return (0x18, None)
|
||||||
raise SyntaxError()
|
|
||||||
else:
|
|
||||||
return (0x18, None)
|
|
||||||
elif arg.reg in ('PC', 'EX'):
|
elif arg.reg in ('PC', 'EX'):
|
||||||
raise SyntaxError()
|
raise SyntaxError()
|
||||||
else:
|
else:
|
||||||
|
@ -270,8 +267,8 @@ def exprlist_expr(p):
|
||||||
def arg_a_arg(p):
|
def arg_a_arg(p):
|
||||||
return p[0]
|
return p[0]
|
||||||
|
|
||||||
@pg.production("arg_a : POP")
|
@pg.production("arg : POP")
|
||||||
def arg_a_pop(p):
|
def arg_pop(p):
|
||||||
return Indirect(reg='SP', disp=0, sp='inc')
|
return Indirect(reg='SP', disp=0, sp='inc')
|
||||||
|
|
||||||
@pg.production("arg_a : SBO REG ADD ADD SBC")
|
@pg.production("arg_a : SBO REG ADD ADD SBC")
|
||||||
|
@ -284,12 +281,12 @@ def arg_a_pop_explicit(p):
|
||||||
def arg_b_arg(p):
|
def arg_b_arg(p):
|
||||||
return p[0]
|
return p[0]
|
||||||
|
|
||||||
@pg.production("arg_b : PUSH")
|
@pg.production("arg : PUSH")
|
||||||
def arg_b_push(p):
|
def arg_push(p):
|
||||||
return Indirect(reg='SP', disp=0, sp='dec')
|
return Indirect(reg='SP', disp=0, sp='dec')
|
||||||
|
|
||||||
@pg.production("arg_b : SBO SUBTRACT SUBTRACT REG SBC")
|
@pg.production("arg : SBO SUBTRACT SUBTRACT REG SBC")
|
||||||
def arg_b_push_explicit(p):
|
def arg_push_explicit(p):
|
||||||
if p[3].getstr().upper() != 'SP':
|
if p[3].getstr().upper() != 'SP':
|
||||||
raise SyntaxError()
|
raise SyntaxError()
|
||||||
return Indirect(reg='SP', disp=0, sp='dec')
|
return Indirect(reg='SP', disp=0, sp='dec')
|
||||||
|
|
Loading…
Reference in New Issue