shithub: rgbds

Download patch

ref: 3623638be70502863816d40f9acb2f020d4c9c61
parent: 8ea3669a6475d995de43dceb9dfd50d8dbfa134f
author: Antonio Niño Díaz <antonio_nd@outlook.com>
date: Thu Feb 22 16:23:25 EST 2018

Fix HIGH() and LOW() for constants

HIGH() and LOW() only worked with labels and register pairs.

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>

--- a/src/asm/asmy.y
+++ b/src/asm/asmy.y
@@ -1234,6 +1234,8 @@
 
 const		: T_ID					{ $$ = sym_GetConstantValue($1); }
 		| T_NUMBER				{ $$ = $1; }
+		| T_OP_HIGH '(' const ')'		{ $$ = ($3 >> 8) & 0xFF; }
+		| T_OP_LOW '(' const ')'		{ $$ = $3 & 0xFF; }
 		| string				{ $$ = str2int($1); }
 		| T_OP_LOGICNOT const %prec NEG		{ $$ = !$2; }
 		| const T_OP_LOGICOR const		{ $$ = $1 || $3; }