shithub: rgbds

Download patch

ref: f1f70d250ac9d065e53aa224509c81fd7f2dcbf0
parent: 98a221d6b68778bfd93c4d263d460cea19adae78
author: ISSOtm <[email protected]>
date: Thu Jan 9 01:10:28 EST 2020

Add test for `DEF(@)`

--- a/src/asm/symbol.c
+++ b/src/asm/symbol.c
@@ -314,7 +314,13 @@
 {
 	struct sSymbol *psym = sym_FindSymbol(s);
 
-	if (psym != NULL) {
+	if (psym == pPCSymbol) {
+		if (pCurrentSection->nOrg == -1)
+			yyerror("Expected constant PC but section is not fixed");
+		else
+			return pPCSymbol->nValue;
+
+	} else if (psym != NULL) {
 		if (psym->nType & SYMF_CONST)
 			return getvaluefield(psym);
 
--- /dev/null
+++ b/test/asm/pc-def.asm
@@ -1,0 +1,5 @@
+IF DEF(@)
+	PRINTT "defined\n"
+ELSE
+	PRINTT "not defined\n"
+ENDC
--- /dev/null
+++ b/test/asm/pc-def.err
@@ -1,0 +1,2 @@
+ERROR: pc-def.asm(1):
+    '@' is not allowed as argument to the DEF function