From 8460c0ff475dd280e6b3059f654c1734965e66e6 Mon Sep 17 00:00:00 2001 From: ShatteredMINT Date: Sun, 30 Aug 2026 18:24:53 +0200 Subject: [PATCH] add integer multiply --- imath.asm | 16 ++++++++++++++++ stdlib.asm | 3 ++- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 imath.asm diff --git a/imath.asm b/imath.asm new file mode 100644 index 0000000..3262321 --- /dev/null +++ b/imath.asm @@ -0,0 +1,16 @@ +pub mul_low: + mov r3, 0 ; result + mov r4, 31 ; loop counter + + mull_loop: + asr r5, r2, 31 + and r5, r5, r1 + lsl r5, r5, r4 + add r3, r3, r5 + lsl r2, r2, 1 + sub r4, r4, 1 + cmp r4, 0 + jge mull_loop + mov r1, r3 + + jmp r13 \ No newline at end of file diff --git a/stdlib.asm b/stdlib.asm index a7a551d..6c340f0 100644 --- a/stdlib.asm +++ b/stdlib.asm @@ -27,4 +27,5 @@ ; ===== TYPES ===== -pub include bit \ No newline at end of file +pub include bit +pub include imath \ No newline at end of file