From dc4fdc1f2fdc4f044b4ea40d74cfedd0d25eddfa Mon Sep 17 00:00:00 2001 From: Bernd Boeckmann Date: Mon, 17 Apr 2023 16:27:35 +0200 Subject: [PATCH] implement .echo --- asm6502.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/asm6502.c b/asm6502.c index 5cd5569..d447309 100644 --- a/asm6502.c +++ b/asm6502.c @@ -1336,7 +1336,41 @@ static void directive_endif(char **p, int pass) static void directive_echo(char **p, int pass) { + value v; + int next; + if (pass == 1) { + skip_to_eol(p); + return; + } + + do { + next = 0; + skip_white(p); + + if ( **p == '"') { + string_lit(p, filename_buf, STR_LEN); + printf("%s", filename_buf); + } + else { + v = expr(p); + if (DEFINED(v)) { + printf("%u", (unsigned)v.v); + } + else { + printf("?"); + } + } + + skip_white(p); + if (**p == ',') { + skip_curr_and_white(p); + next = 1; + } + } + while (next); + + puts(""); } static int directive(char **p, int pass)