From 6de7ebfc3fa320b639a292a174f213005d5ce2c2 Mon Sep 17 00:00:00 2001 From: Alex AUVOLAT Date: Fri, 10 Jan 2014 15:07:34 +0100 Subject: Unsigned multiplication works (uses as many cycles as necessary) ; unit tests. --- cpu/os.asm | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) (limited to 'cpu/os.asm') diff --git a/cpu/os.asm b/cpu/os.asm index c7abde3..6c5d162 100644 --- a/cpu/os.asm +++ b/cpu/os.asm @@ -141,7 +141,7 @@ t3fail: pop RA jr RA -unit_test_0: +unit_test_0: # Addition / substraction li B 1 li C 12 @@ -150,16 +150,46 @@ unit_test_0: sei A C 56 and B B A - li C -7 + li C 7 + sub C Z C li D 7 add C C D se A C Z and B B A + li C 32767 + li D 32767 + add C C D + li D 2 + sub D Z D + se A C D + and B B A + jr RA -unit_test_1: + +unit_test_1: # Unsigned multiplication li B 1 + + li C 12 + li D 44 + mulu C C D + move D E + sei A C 528 + and B B A + se A D Z + and B B A + + li C 744 + li D 1244 + mulu C C D + move D E + sei A C 8032 + and B B A + sei A D 14 + and B B A + jr RA + unit_test_2: li B 1 jr RA -- cgit v1.2.3