From a7635cb1ea985b77628df284a3d8424ccf97d4f0 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Tue, 30 Apr 2019 16:24:45 -0400 Subject: [PATCH] zasm: allow blank lines in asm source code --- apps/zasm/main.asm | 1 + apps/zasm/tests/test1.asm | 6 ++++-- apps/zasm/tok.asm | 12 ++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/apps/zasm/main.asm b/apps/zasm/main.asm index 5166d91..8e4641e 100644 --- a/apps/zasm/main.asm +++ b/apps/zasm/main.asm @@ -24,6 +24,7 @@ main: ; to where we should write the next upcode. parseLine: push bc + call gotoNextNotBlankLine call tokenize jr nz, .error call parseTokens diff --git a/apps/zasm/tests/test1.asm b/apps/zasm/tests/test1.asm index 55823c4..c2b0fbc 100644 --- a/apps/zasm/tests/test1.asm +++ b/apps/zasm/tests/test1.asm @@ -1,2 +1,4 @@ - add a, b - inc a + ; comment + add a, b ; comment + inc a ; comment + ; comment diff --git a/apps/zasm/tok.asm b/apps/zasm/tok.asm index cedac41..43646fb 100644 --- a/apps/zasm/tok.asm +++ b/apps/zasm/tok.asm @@ -144,6 +144,18 @@ gotoNextLine: call JUMP_UNSETZ ret +; Repeatedly calls gotoNextLine until the line in (HL) points to a line that +; isn't blank or 100% comment. Sets Z if we reach a line, Unset Z if we reach +; EOF +gotoNextNotBlankLine: + call toWord + ret z ; Z set? we have a not-blank line + ; Z not set? (HL) is at the end of the line or at the beginning of + ; comments. + call gotoNextLine + ret nz + jr gotoNextNotBlankLine + ; *** Variables *** tokInstr: