From 0e4bff58eab6a24d07168e24b092e1b83aadb38a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 21 Dec 2025 11:12:11 +0000 Subject: [PATCH 1/8] Initial plan From b59845b3337d2cf3c11b5dba3d9f8f776465d6cd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 21 Dec 2025 11:17:26 +0000 Subject: [PATCH 2/8] Initial investigation complete - planning conditional preprocessing fix Co-authored-by: duhow <1145001+duhow@users.noreply.github.com> --- test_ifdef.asm | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 test_ifdef.asm diff --git a/test_ifdef.asm b/test_ifdef.asm new file mode 100644 index 0000000..c2e2ae1 --- /dev/null +++ b/test_ifdef.asm @@ -0,0 +1,47 @@ +.BIOS +.BIOSVARS + +.FILENAME "TESTIFD.ROM" + +;-------------------------------------------------------------------- +LABELEXIST: + +;Case 1: The Label does not exist. The ELSE must be processed. +IFDEF THISLABELNOTEXIST + CONSTANT1: EQU $01 + CONSTANT2: EQU $02 +ELSE +CONSTANT1 EQU $01 +CONSTANT2 EQU $02 +ENDIF + +;Case 2: The Label exist. The ELSE does not have to be processed. +IFDEF LABELEXIST +CONSTANT3 EQU $03 +CONSTANT4 EQU $04 +ELSE + CONSTANT3: EQU $03 + CONSTANT4: EQU $04 +ENDIF +;-------------------------------------------------------------------- + +.PAGE 1 +.ROM + +MAIN: + DI + LD SP,[HIMEM] ;($FC4A) Stack at the top of memory + EI + +LOOP: + halt + + ld A,7 + call SNSMAT + sub A,11111011B ;ESC + JR Z,EXIT_HELP + + jp LOOP + +EXIT_HELP: + call 0 From caa08b95efb4a309a1d30f2ed352c62c3ddcb1b6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 21 Dec 2025 11:26:29 +0000 Subject: [PATCH 3/8] Implement parser5 for IFDEF preprocessing - fixes conditional compilation Co-authored-by: duhow <1145001+duhow@users.noreply.github.com> --- Makefile | 3 +- src/dura.y | 4 +- src/parser5.l | 318 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 323 insertions(+), 2 deletions(-) create mode 100644 src/parser5.l diff --git a/Makefile b/Makefile index eb1267b..40c9439 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,8 @@ BUILD_FILES = src/dura.tab.c \ src/lex.parser1.c \ src/lex.parser2.c \ src/lex.parser3.c \ - src/lex.parser4.c + src/lex.parser4.c \ + src/lex.parser5.c C_FILES := src/asmsx.c src/labels.c diff --git a/src/dura.y b/src/dura.y index 1bf504b..c834b9e 100644 --- a/src/dura.y +++ b/src/dura.y @@ -32,6 +32,7 @@ int preprocessor1(char *); /* defined in parser1.l */ int preprocessor2(); /* defined in parser2.l */ int preprocessor3(int); /* defined in parser3.l */ int preprocessor4(); /* defined in parser4.l */ +int preprocessor5(); /* defined in parser5.l */ /* forward function declarations to address GCC -Wimplicit-function-declaration warnings */ void yyerror(char *); @@ -4690,11 +4691,12 @@ int main(int argc, char *argv[]) { preprocessor3(zilog); // Zilog preprocessor4(); //Macros snprintf(fname_p2, PATH_MAX - 1, "~tmppre.%i", preprocessor2()); // REPT + preprocessor5(); // Conditional compilation (IFDEF/ELSE/ENDIF) printf("Assembling source file %s\n", fname_asm); conditional[0] = 1; - f = fopen(fname_p2, "r"); + f = fopen("~tmppre.3", "r"); yyin = f; yyparse(); diff --git a/src/parser5.l b/src/parser5.l new file mode 100644 index 0000000..4ce9d9c --- /dev/null +++ b/src/parser5.l @@ -0,0 +1,318 @@ +/* + PARSER-5 + (c) 2025 asMSX team + + Functions: + 1.- Process IFDEF/ELSE/ENDIF conditional compilation directives + 2.- Strip out code in false conditional blocks + 3.- Track label definitions for IFDEF support + 4.- Pass through IF/ELSE/ENDIF directives to main parser (expressions evaluated there) +*/ + +%{ +#include "asmsx.h" + +#define MAX_CONDITIONALS 16 +#define MAX_SYMBOLS 8192 + +// Type of conditional +#define COND_IF 1 +#define COND_IFDEF 2 + +static FILE *p5_output; +static char *p5_name; +static int p5_lines; + +// Conditional compilation state +typedef struct { + int type; // COND_IF or COND_IFDEF + int enabled; // Is this block enabled? +} conditional_state; + +static conditional_state conditional_stack[MAX_CONDITIONALS]; +static int conditional_level = 0; + +// Symbol tracking for IFDEF +static char *defined_symbols[MAX_SYMBOLS]; +static int num_symbols = 0; + +int prompt_error5(int, char*, int); +int is_symbol_defined(char* name); +void define_symbol(char* name); + +static inline int is_output_enabled() { + if (conditional_level == 0) return 1; + return conditional_stack[conditional_level].enabled; +} +%} + +%option noinput nounput noyywrap + +%% + +"#"file[ \t]*\"[a-z_][a-z0-9_]*"."[a-z_][a-z0-9_]*\"\n { + // Always output file markers + fprintf(p5_output, "%s", yytext); + + // Save filename + char *dup = strdup(yytext); + char *p5_tmpstr = strtok(dup, "\""); + p5_tmpstr = strtok(NULL, "\""); + if (p5_tmpstr) { + p5_name[0] = '\0'; + safe_strcat(p5_name, p5_tmpstr, PATH_MAX, p5_name, p5_lines); + } + free(dup); +} + +"#"line[ \t]*[0-9]+\n { + // Always output line markers + fprintf(p5_output, "%s", yytext); + p5_lines = atoi(&yytext[5]); +} + +"."?ifdef[ \t]+[a-z_][a-z0-9_]*[ \t]*\n { + // Extract symbol name + char *line_copy = strdup(yytext); + char *name_start = line_copy; + if (name_start[0] == '.') name_start++; + name_start += 5; // skip "ifdef" + while (*name_start == ' ' || *name_start == '\t') name_start++; + + // Remove trailing whitespace and newline + char *end = name_start + strlen(name_start) - 1; + while (end > name_start && (*end == ' ' || *end == '\t' || *end == '\n')) { + *end = '\0'; + end--; + } + + if (conditional_level >= MAX_CONDITIONALS - 1) { + free(line_copy); + prompt_error5(1, p5_name, p5_lines); + } + + conditional_level++; + conditional_stack[conditional_level].type = COND_IFDEF; + int parent_enabled = (conditional_level == 1) ? 1 : conditional_stack[conditional_level - 1].enabled; + + if (parent_enabled && is_symbol_defined(name_start)) { + conditional_stack[conditional_level].enabled = 1; + } else { + conditional_stack[conditional_level].enabled = 0; + } + + free(line_copy); + // Don't output the IFDEF directive itself +} + +"."?if[ \t]+ { + // For IF with expression, pass through to main parser + // But track it so we know to pass through corresponding ELSE/ENDIF + if (conditional_level >= MAX_CONDITIONALS - 1) { + prompt_error5(1, p5_name, p5_lines); + } + + conditional_level++; + conditional_stack[conditional_level].type = COND_IF; + int parent_enabled = (conditional_level == 1) ? 1 : conditional_stack[conditional_level - 1].enabled; + conditional_stack[conditional_level].enabled = parent_enabled; + + // Pass through to main parser if parent is enabled + if (is_output_enabled()) { + fprintf(p5_output, "%s", yytext); + } +} + +"."?else[ \t]*\n { + if (conditional_level == 0) { + prompt_error5(2, p5_name, p5_lines); + } + + if (conditional_stack[conditional_level].type == COND_IFDEF) { + // Handle ELSE for IFDEF + int parent_enabled = (conditional_level == 1) ? 1 : conditional_stack[conditional_level - 1].enabled; + int was_enabled = conditional_stack[conditional_level].enabled; + conditional_stack[conditional_level].enabled = parent_enabled && !was_enabled; + // Don't output the ELSE directive itself + } else { + // Pass through ELSE for IF + if (is_output_enabled()) { + fprintf(p5_output, "%s", yytext); + } + } +} + +"."?endif[ \t]*\n { + if (conditional_level == 0) { + prompt_error5(3, p5_name, p5_lines); + } + + if (conditional_stack[conditional_level].type == COND_IFDEF) { + // Handle ENDIF for IFDEF + conditional_level--; + // Don't output the ENDIF directive itself + } else { + // Pass through ENDIF for IF + if (is_output_enabled()) { + fprintf(p5_output, "%s", yytext); + } + conditional_level--; + } +} + +[a-z_][a-z0-9_]*:[ \t]*\n { + // Label definition - track it + char *label = strdup(yytext); + char *colon = strchr(label, ':'); + if (colon) *colon = '\0'; + + define_symbol(label); + free(label); + + if (is_output_enabled()) { + fprintf(p5_output, "%s", yytext); + } +} + +[a-z_][a-z0-9_]*[ \t]+equ[ \t]+ { + // EQU definition - track the symbol name + char *label = strdup(yytext); + char *space = label; + while (*space && *space != ' ' && *space != '\t') space++; + *space = '\0'; + + define_symbol(label); + free(label); + + if (is_output_enabled()) { + fprintf(p5_output, "%s", yytext); + } +} + +[a-z_][a-z0-9_]*[ \t]+"="[ \t]+ { + // Assignment definition - track the symbol name + char *label = strdup(yytext); + char *space = label; + while (*space && *space != ' ' && *space != '\t') space++; + *space = '\0'; + + define_symbol(label); + free(label); + + if (is_output_enabled()) { + fprintf(p5_output, "%s", yytext); + } +} + +\n { + if (is_output_enabled()) { + fprintf(p5_output, "%s", yytext); + } +} + +. { + if (is_output_enabled()) { + fprintf(p5_output, "%s", yytext); + } +} + +%% + +int prompt_error5(int c, char* filename, int line) { + fprintf(stderr, "%s, line %d: ", filename, line); + switch (c) { + case 1: + fprintf(stderr, "Too many nested conditional levels\n"); + break; + case 2: + fprintf(stderr, "ELSE without IF/IFDEF\n"); + break; + case 3: + fprintf(stderr, "ENDIF without IF/IFDEF\n"); + break; + default: + fprintf(stderr, "Unknown error in prompt_error5()\n"); + } + exit(c); + return c; +} + +int is_symbol_defined(char* name) { + for (int i = 0; i < num_symbols; i++) { + if (strcmp(defined_symbols[i], name) == 0) { + return 1; + } + } + return 0; +} + +void define_symbol(char* name) { + if (num_symbols >= MAX_SYMBOLS) { + return; // Silently ignore overflow + } + + // Check if already defined + if (is_symbol_defined(name)) { + return; + } + + defined_symbols[num_symbols] = strdup(name); + num_symbols++; +} + +int preprocessor5() { + const char* input_file = "~tmppre.2"; + FILE *input; + + // Initialize + conditional_level = 0; + num_symbols = 0; + + // Add ASMSX as a predefined symbol + define_symbol("ASMSX"); + + p5_name = malloc(PATH_MAX); + if (!p5_name) { + fprintf(stderr, "Fatal: cannot allocate memory for p5_name\n"); + exit(1); + } + p5_name[0] = 0; + p5_lines = 0; + + if ((input = fopen(input_file, "r")) == NULL) { + fprintf(stderr, "Fatal: cannot process file %s\n", input_file); + exit(1); + } + + yyin = input; + p5_output = fopen("~tmppre.3", "w"); + + if (p5_output == NULL) { + fprintf(stderr, "ERROR: cannot create file ~tmppre.3 in %s\n", __func__); + exit(1); + } + + yylex(); + + // Check for unmatched IFDEF conditionals (IF conditionals checked by main parser) + if (conditional_level != 0) { + for (int i = 1; i <= conditional_level; i++) { + if (conditional_stack[i].type == COND_IFDEF) { + fprintf(stderr, "ERROR: Unmatched IFDEF directive\n"); + exit(45); + } + } + } + + fclose(input); + fclose(p5_output); + + free(p5_name); + + // Free symbol memory + for (int i = 0; i < num_symbols; i++) { + free(defined_symbols[i]); + } + + return 0; +} From d9d68b35f29cf10d6170f3dfaf1fee264718011b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 21 Dec 2025 11:34:18 +0000 Subject: [PATCH 4/8] Fix parser5 to handle assignments without spaces and correct file numbering Co-authored-by: duhow <1145001+duhow@users.noreply.github.com> --- src/dura.y | 6 +++--- src/parser5.l | 38 +++++++++++++++++++++++++++----------- 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/src/dura.y b/src/dura.y index c834b9e..5d11ecf 100644 --- a/src/dura.y +++ b/src/dura.y @@ -32,7 +32,7 @@ int preprocessor1(char *); /* defined in parser1.l */ int preprocessor2(); /* defined in parser2.l */ int preprocessor3(int); /* defined in parser3.l */ int preprocessor4(); /* defined in parser4.l */ -int preprocessor5(); /* defined in parser5.l */ +int preprocessor5(const char*); /* defined in parser5.l */ /* forward function declarations to address GCC -Wimplicit-function-declaration warnings */ void yyerror(char *); @@ -4691,12 +4691,12 @@ int main(int argc, char *argv[]) { preprocessor3(zilog); // Zilog preprocessor4(); //Macros snprintf(fname_p2, PATH_MAX - 1, "~tmppre.%i", preprocessor2()); // REPT - preprocessor5(); // Conditional compilation (IFDEF/ELSE/ENDIF) + snprintf(fname_p2, PATH_MAX - 1, "~tmppre.%i", preprocessor5(fname_p2)); // Conditional compilation (IFDEF/ELSE/ENDIF) printf("Assembling source file %s\n", fname_asm); conditional[0] = 1; - f = fopen("~tmppre.3", "r"); + f = fopen(fname_p2, "r"); yyin = f; yyparse(); diff --git a/src/parser5.l b/src/parser5.l index 4ce9d9c..1aba6c8 100644 --- a/src/parser5.l +++ b/src/parser5.l @@ -189,12 +189,18 @@ static inline int is_output_enabled() { } } -[a-z_][a-z0-9_]*[ \t]+"="[ \t]+ { +[a-z_][a-z0-9_]*[ \t]*"="[ \t]* { // Assignment definition - track the symbol name + // Handles both "VAR = value" and "VAR=value" char *label = strdup(yytext); - char *space = label; - while (*space && *space != ' ' && *space != '\t') space++; - *space = '\0'; + char *eq = strchr(label, '='); + if (eq) *eq = '\0'; + // Trim trailing spaces + char *end = label + strlen(label) - 1; + while (end > label && (*end == ' ' || *end == '\t')) { + *end = '\0'; + end--; + } define_symbol(label); free(label); @@ -260,8 +266,7 @@ void define_symbol(char* name) { num_symbols++; } -int preprocessor5() { - const char* input_file = "~tmppre.2"; +int preprocessor5(const char* input_filename) { FILE *input; // Initialize @@ -279,16 +284,27 @@ int preprocessor5() { p5_name[0] = 0; p5_lines = 0; - if ((input = fopen(input_file, "r")) == NULL) { - fprintf(stderr, "Fatal: cannot process file %s\n", input_file); + if ((input = fopen(input_filename, "r")) == NULL) { + fprintf(stderr, "Fatal: cannot process file %s\n", input_filename); exit(1); } yyin = input; - p5_output = fopen("~tmppre.3", "w"); + + // Determine output filename by incrementing the input number + char output_filename[PATH_MAX]; + int file_num; + if (sscanf(input_filename, "~tmppre.%d", &file_num) == 1) { + snprintf(output_filename, PATH_MAX, "~tmppre.%d", file_num + 1); + } else { + // Fallback + snprintf(output_filename, PATH_MAX, "~tmppre.3"); + } + + p5_output = fopen(output_filename, "w"); if (p5_output == NULL) { - fprintf(stderr, "ERROR: cannot create file ~tmppre.3 in %s\n", __func__); + fprintf(stderr, "ERROR: cannot create file %s in %s\n", output_filename, __func__); exit(1); } @@ -314,5 +330,5 @@ int preprocessor5() { free(defined_symbols[i]); } - return 0; + return file_num + 1; } From 1e0d5608ca4eedf66bef5ff8f8427722d20eb091 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 21 Dec 2025 11:35:04 +0000 Subject: [PATCH 5/8] Add test case for IFDEF with invalid syntax in false block Co-authored-by: duhow <1145001+duhow@users.noreply.github.com> --- test/features/bugs.feature | 44 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/test/features/bugs.feature b/test/features/bugs.feature index 0a066b6..796228b 100644 --- a/test/features/bugs.feature +++ b/test/features/bugs.feature @@ -160,6 +160,50 @@ Feature: Fixing issues And sym does not contain If it's a label, it may not be defined. And build has no warnings + Scenario: IFDEF with invalid syntax in false block should not cause error + Given I write the code to test.asm + """ + .BIOS + .BIOSVARS + .FILENAME "TESTIFD.ROM" + + LABELEXIST: + + ; Case 1: The Label does not exist. The ELSE must be processed. + IFDEF THISLABELNOTEXIST + CONSTANT1: EQU $01 + CONSTANT2: EQU $02 + ELSE + CONSTANT1 EQU $01 + CONSTANT2 EQU $02 + ENDIF + + ; Case 2: The Label exist. The ELSE does not have to be processed. + IFDEF LABELEXIST + CONSTANT3 EQU $03 + CONSTANT4 EQU $04 + ELSE + CONSTANT3: EQU $03 + CONSTANT4: EQU $04 + ENDIF + + .PAGE 1 + .ROM + + MAIN: + DI + EI + ret + """ + When I build test.asm + Then file TESTIFD.ROM.rom exists + And sym contains CONSTANT1 + And sym contains CONSTANT2 + And sym contains CONSTANT3 + And sym contains CONSTANT4 + And sym contains LABELEXIST + And build has no warnings + @wip Scenario: Issue #88 Local label semantics Given I write the code to test.asm From db8ae7361bfefb144902c1ae83d04bf22bd07294 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 21 Dec 2025 11:37:19 +0000 Subject: [PATCH 6/8] Fix case-sensitivity and add warning for symbol table overflow Co-authored-by: duhow <1145001+duhow@users.noreply.github.com> --- src/parser5.l | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/parser5.l b/src/parser5.l index 1aba6c8..9a696dd 100644 --- a/src/parser5.l +++ b/src/parser5.l @@ -50,7 +50,7 @@ static inline int is_output_enabled() { %% -"#"file[ \t]*\"[a-z_][a-z0-9_]*"."[a-z_][a-z0-9_]*\"\n { +"#"file[ \t]*\"[a-zA-Z_][a-zA-Z0-9_]*"."[a-zA-Z_][a-zA-Z0-9_]*\"\n { // Always output file markers fprintf(p5_output, "%s", yytext); @@ -71,7 +71,7 @@ static inline int is_output_enabled() { p5_lines = atoi(&yytext[5]); } -"."?ifdef[ \t]+[a-z_][a-z0-9_]*[ \t]*\n { +"."?ifdef[ \t]+[a-zA-Z_][a-zA-Z0-9_]*[ \t]*\n { // Extract symbol name char *line_copy = strdup(yytext); char *name_start = line_copy; @@ -160,7 +160,7 @@ static inline int is_output_enabled() { } } -[a-z_][a-z0-9_]*:[ \t]*\n { +[a-zA-Z_][a-zA-Z0-9_]*:[ \t]*\n { // Label definition - track it char *label = strdup(yytext); char *colon = strchr(label, ':'); @@ -174,7 +174,7 @@ static inline int is_output_enabled() { } } -[a-z_][a-z0-9_]*[ \t]+equ[ \t]+ { +[a-zA-Z_][a-zA-Z0-9_]*[ \t]+equ[ \t]+ { // EQU definition - track the symbol name char *label = strdup(yytext); char *space = label; @@ -189,7 +189,7 @@ static inline int is_output_enabled() { } } -[a-z_][a-z0-9_]*[ \t]*"="[ \t]* { +[a-zA-Z_][a-zA-Z0-9_]*[ \t]*"="[ \t]* { // Assignment definition - track the symbol name // Handles both "VAR = value" and "VAR=value" char *label = strdup(yytext); @@ -254,7 +254,8 @@ int is_symbol_defined(char* name) { void define_symbol(char* name) { if (num_symbols >= MAX_SYMBOLS) { - return; // Silently ignore overflow + fprintf(stderr, "WARNING: Symbol table overflow in preprocessor5, symbol '%s' not tracked for IFDEF\n", name); + return; } // Check if already defined From 05aa1cf4a95f331691003c2690817307778f250c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 21 Dec 2025 11:49:41 +0000 Subject: [PATCH 7/8] Changes before error encountered Co-authored-by: duhow <1145001+duhow@users.noreply.github.com> --- src/parser5.l | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/parser5.l b/src/parser5.l index 9a696dd..4b3d047 100644 --- a/src/parser5.l +++ b/src/parser5.l @@ -71,7 +71,7 @@ static inline int is_output_enabled() { p5_lines = atoi(&yytext[5]); } -"."?ifdef[ \t]+[a-zA-Z_][a-zA-Z0-9_]*[ \t]*\n { +"."?[iI][fF][dD][eE][fF][ \t]+[a-zA-Z_][a-zA-Z0-9_]*[ \t]*\n { // Extract symbol name char *line_copy = strdup(yytext); char *name_start = line_copy; @@ -105,7 +105,7 @@ static inline int is_output_enabled() { // Don't output the IFDEF directive itself } -"."?if[ \t]+ { +"."?[iI][fF][ \t]+ { // For IF with expression, pass through to main parser // But track it so we know to pass through corresponding ELSE/ENDIF if (conditional_level >= MAX_CONDITIONALS - 1) { @@ -123,7 +123,7 @@ static inline int is_output_enabled() { } } -"."?else[ \t]*\n { +"."?[eE][lL][sS][eE][ \t]*\n { if (conditional_level == 0) { prompt_error5(2, p5_name, p5_lines); } @@ -142,7 +142,7 @@ static inline int is_output_enabled() { } } -"."?endif[ \t]*\n { +"."?[eE][nN][dD][iI][fF][ \t]*\n { if (conditional_level == 0) { prompt_error5(3, p5_name, p5_lines); } @@ -174,7 +174,7 @@ static inline int is_output_enabled() { } } -[a-zA-Z_][a-zA-Z0-9_]*[ \t]+equ[ \t]+ { +[a-zA-Z_][a-zA-Z0-9_]*[ \t]+[eE][qQ][uU][ \t]+ { // EQU definition - track the symbol name char *label = strdup(yytext); char *space = label; @@ -316,7 +316,7 @@ int preprocessor5(const char* input_filename) { for (int i = 1; i <= conditional_level; i++) { if (conditional_stack[i].type == COND_IFDEF) { fprintf(stderr, "ERROR: Unmatched IFDEF directive\n"); - exit(45); + exit(45); // Error code 45: Unmatched IF/IFDEF directive } } } From 7b7a52d98629c6935fdaaf6c853d95620c219916 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Gir=C3=B3n?= Date: Tue, 23 Dec 2025 09:28:48 +0100 Subject: [PATCH 8/8] Delete test_ifdef.asm --- test_ifdef.asm | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 test_ifdef.asm diff --git a/test_ifdef.asm b/test_ifdef.asm deleted file mode 100644 index c2e2ae1..0000000 --- a/test_ifdef.asm +++ /dev/null @@ -1,47 +0,0 @@ -.BIOS -.BIOSVARS - -.FILENAME "TESTIFD.ROM" - -;-------------------------------------------------------------------- -LABELEXIST: - -;Case 1: The Label does not exist. The ELSE must be processed. -IFDEF THISLABELNOTEXIST - CONSTANT1: EQU $01 - CONSTANT2: EQU $02 -ELSE -CONSTANT1 EQU $01 -CONSTANT2 EQU $02 -ENDIF - -;Case 2: The Label exist. The ELSE does not have to be processed. -IFDEF LABELEXIST -CONSTANT3 EQU $03 -CONSTANT4 EQU $04 -ELSE - CONSTANT3: EQU $03 - CONSTANT4: EQU $04 -ENDIF -;-------------------------------------------------------------------- - -.PAGE 1 -.ROM - -MAIN: - DI - LD SP,[HIMEM] ;($FC4A) Stack at the top of memory - EI - -LOOP: - halt - - ld A,7 - call SNSMAT - sub A,11111011B ;ESC - JR Z,EXIT_HELP - - jp LOOP - -EXIT_HELP: - call 0