shithub: rgbds

Download patch

ref: 001b95d12a9d89d4f084ce1155c0685b76089b8a
parent: 3b2c862320f5001746282186b6c0565ff4716dfa
author: ISSOtm <[email protected]>
date: Tue Feb 11 06:25:22 EST 2020

Add SHIFT with numeric argument

Fixes #442.

--- a/src/asm/asmy.y
+++ b/src/asm/asmy.y
@@ -777,6 +777,12 @@
 ;
 
 shift		: T_POP_SHIFT		{ sym_ShiftCurrentMacroArgs(); }
+		| T_POP_SHIFT uconst
+		{
+			int32_t i = $2;
+			while (i--)
+				sym_ShiftCurrentMacroArgs();
+		}
 ;
 
 load		: T_POP_LOAD string comma sectiontype sectorg sectattrs
--- /dev/null
+++ b/test/asm/arg-shift.asm
@@ -1,0 +1,21 @@
+print_all: MACRO
+    REPT _NARG
+    	PRINTT " \1"
+    	SHIFT
+    ENDR
+    PRINTT "\n"
+ENDM
+
+print_some: MACRO
+    PRINTT "\1"
+    SHIFT 5
+    PRINTT "\2\6\9"
+    SHIFT 17
+    SHIFT
+    PRINTT "\3\9"
+ENDM
+
+
+	print_all This test, probably, passes\,, but who knows, ?
+
+	print_some R,e,d,n,e,x,G,a,m,e,B,o,y,D,e,v,e,l,o,p,e,m,e,n,t,S,y,s,t,e,m,\n
--- /dev/null
+++ b/test/asm/arg-shift.out
@@ -1,0 +1,2 @@
+ This test probably passes, but who knows ?
+RGBDS