From 4b7cd2408110814339f8b1616be4688d076ee783 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Fri, 20 Jun 2025 21:26:22 +0200 Subject: [PATCH] macros: Added mul16 and div16 macros --- src/macros.inc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/macros.inc b/src/macros.inc index f06eed2..fcc3fe3 100644 --- a/src/macros.inc +++ b/src/macros.inc @@ -67,6 +67,16 @@ srl $1 ; / 2 srl $1 ; / 4 srl $1 ; / 8 +#endmacro + + ; divides a regiser by 16 + ; inputs: + ; $1: the register +#macro div8 + srl $1 ; / 2 + srl $1 ; / 4 + srl $1 ; / 8 + srl $1 ; / 16 #endmacro ; multiplies a regiser with 8 @@ -78,6 +88,16 @@ sla $1 ; * 8 #endmacro + ; multiplies a regiser with 16 + ; inputs: + ; $1: the register +#macro mul16 + sla $1 ; * 2 + sla $1 ; * 4 + sla $1 ; * 8 + sla $1 ; * 16 +#endmacro + ; asserts. if $1 != $2 causes a ld b, b ; inputs: ; $1: comparison (z, nz, c, nz) -- 2.30.2