summaryrefslogtreecommitdiff
path: root/cpu/os.asm
diff options
context:
space:
mode:
authorAlex AUVOLAT <alex.auvolat@ens.fr>2014-01-10 15:07:34 +0100
committerAlex AUVOLAT <alex.auvolat@ens.fr>2014-01-10 15:07:34 +0100
commit6de7ebfc3fa320b639a292a174f213005d5ce2c2 (patch)
treedd290bad14f5326b49a2dffefe82c1fdd01af961 /cpu/os.asm
parent25e1beee38cba662f62f2de85855091a4e718064 (diff)
downloadSystDigit-Projet-6de7ebfc3fa320b639a292a174f213005d5ce2c2.tar.gz
SystDigit-Projet-6de7ebfc3fa320b639a292a174f213005d5ce2c2.zip
Unsigned multiplication works (uses as many cycles as necessary) ; unit tests.
Diffstat (limited to 'cpu/os.asm')
-rw-r--r--cpu/os.asm36
1 files changed, 33 insertions, 3 deletions
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