From b9c432a9b4237762d537e2d17c5005bd2c2fbeb8 Mon Sep 17 00:00:00 2001 From: Maurizio Porrato Date: Sat, 13 Feb 2021 15:40:29 +0000 Subject: [PATCH] Assembler: remove restrictions on some operands --- asm.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/asm.py b/asm.py index 1867b80..5b42d63 100755 --- a/asm.py +++ b/asm.py @@ -87,10 +87,7 @@ class ASM(SimpleNamespace): else: return (0x1a, arg.disp) else: - if (sp, is_a) not in (('inc', True), ('dec', False)): - raise SyntaxError() - else: - return (0x18, None) + return (0x18, None) elif arg.reg in ('PC', 'EX'): raise SyntaxError() else: @@ -270,8 +267,8 @@ def exprlist_expr(p): def arg_a_arg(p): return p[0] -@pg.production("arg_a : POP") -def arg_a_pop(p): +@pg.production("arg : POP") +def arg_pop(p): return Indirect(reg='SP', disp=0, sp='inc') @pg.production("arg_a : SBO REG ADD ADD SBC") @@ -284,12 +281,12 @@ def arg_a_pop_explicit(p): def arg_b_arg(p): return p[0] -@pg.production("arg_b : PUSH") -def arg_b_push(p): +@pg.production("arg : PUSH") +def arg_push(p): return Indirect(reg='SP', disp=0, sp='dec') -@pg.production("arg_b : SBO SUBTRACT SUBTRACT REG SBC") -def arg_b_push_explicit(p): +@pg.production("arg : SBO SUBTRACT SUBTRACT REG SBC") +def arg_push_explicit(p): if p[3].getstr().upper() != 'SP': raise SyntaxError() return Indirect(reg='SP', disp=0, sp='dec')