From 730bc7858d6f4df65f0bd1aea20c29717fdacd98 Mon Sep 17 00:00:00 2001 From: xamidev <121681048+xamidev@users.noreply.github.com> Date: Fri, 18 Oct 2024 21:23:10 +0200 Subject: [PATCH] comments? --- cpu.c | 8 ++++++-- program.asm | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cpu.c b/cpu.c index bf4040c..09c7fd0 100644 --- a/cpu.c +++ b/cpu.c @@ -127,8 +127,12 @@ void assemble(const char* filename) { char instruction[10]; int reg1, reg2, addr; - - if (sscanf(line, "%s %d %d", instruction, ®1, ®2) == 3) + if (strncmp(line, ";", 1) == 0) + { + // comment, ignore + continue; + } + else if (sscanf(line, "%s %d %d", instruction, ®1, ®2) == 3) { if (strncmp(instruction, "MOV", 3) == 0) { diff --git a/program.asm b/program.asm index 019e078..5cf239c 100644 --- a/program.asm +++ b/program.asm @@ -1,3 +1,3 @@ - +;this is a comment MOV 1 2 HLT