From 890daab687b2625a59ef0295924fc711bf47bf29 Mon Sep 17 00:00:00 2001 From: Olaf Seibert Date: Sun, 8 Mar 2020 16:50:51 +0100 Subject: [PATCH] Add .PAGE as no-op, and give errors for misplaced .ENDR .ENDM. --- assemble.c | 13 ++++++++++--- tests/test-endm.lst.ok | 9 ++++++++- tests/test-endm.mac | 4 ++++ tests/test-rept.lst.ok | 1 + 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/assemble.c b/assemble.c index 0b6ed52..25545b2 100644 --- a/assemble.c +++ b/assemble.c @@ -274,10 +274,9 @@ static int assemble( switch (op->section->type) { case SECTION_PSEUDO: switch (op->value) { - case P_ENDR: - case P_ENDM: - case P_SBTTL: + case P_PAGE: case P_PRINT: + case P_SBTTL: return 1; /* Accepted, ignored. (An obvious need: get assembly listing controls working fully. ) */ @@ -956,6 +955,14 @@ static int assemble( pop_cond(last_cond - 1); return 1; + case P_ENDM: + report(stack->top, "No macro definition block active\n"); + return 0; + + case P_ENDR: + report(stack->top, "No repeat block active\n"); + return 0; + case P_EVEN: cp = skipwhite(cp); if (!EOL(*cp)) { diff --git a/tests/test-endm.lst.ok b/tests/test-endm.lst.ok index b255ab0..5498d15 100644 --- a/tests/test-endm.lst.ok +++ b/tests/test-endm.lst.ok @@ -53,7 +53,14 @@ test-endm.mac:37->M5:3: ***ERROR .ENDM 'NOTM5' does not match .MACRO 'M5' 40 .macro M6 test-endm.mac:41: ***ERROR .ENDM 'NOTM6' does not match .MACRO 'M6' 41 .endm notM6 ; wrong - 41 + 42 +test-endm.mac:43: ***ERROR No macro definition block active + 43 .endm ; end without macro +test-endm.mac:44: ***ERROR No repeat block active + 44 .endr ; end without repetition +test-endm.mac:45: ***ERROR No conditional block active + 45 .endc ; end without condition + 45 Symbol table diff --git a/tests/test-endm.mac b/tests/test-endm.mac index 2abfbed..a5228d9 100644 --- a/tests/test-endm.mac +++ b/tests/test-endm.mac @@ -39,3 +39,7 @@ .macro M6 .endm notM6 ; wrong + + .endm ; end without macro + .endr ; end without repetition + .endc ; end without condition diff --git a/tests/test-rept.lst.ok b/tests/test-rept.lst.ok index b5705f5..66112c5 100644 --- a/tests/test-rept.lst.ok +++ b/tests/test-rept.lst.ok @@ -23,6 +23,7 @@ test-rept.mac:20: ***ERROR .REPT value must be constant 20 .rept undefd 21 000014 005200 inc r0 +test-rept.mac:22: ***ERROR No repeat block active 22 .endr 22