summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--03/ex038
-rw-r--r--03/in02140
-rw-r--r--03/in036
3 files changed, 145 insertions, 9 deletions
diff --git a/03/ex03 b/03/ex03
index 2301b33..5b24fdd 100644
--- a/03/ex03
+++ b/03/ex03
@@ -31,10 +31,10 @@ B-=J
A=:label
x3c
return
-;;;;;;;;;;;;;;;;;;;;;;;*-
-;;;;;;;;;;;;;;;;;;;;;;;/-
-;;;;;;;;;;;;;;;;;;;;;;;*+
-;;;;;;;;;;;;;;;;;;;;;;;/+
+imul
+idiv
+mul
+div
:funciton
call A
str Here is some text which will be put in the executable!
diff --git a/03/in02 b/03/in02
index 0eb608b..a1a4b32 100644
--- a/03/in02
+++ b/03/in02
@@ -278,8 +278,64 @@ im
##1.
je
:-al
+im
+--U* "mul"
+IA
+im
+--LI
+JA
+im
+--s=
+cl
+BA
+im
+##1.
+je
+:-u*
+im
+--S* "imul"
+IA
+im
+--LI
+JA
+im
+--s=
+cl
+BA
+im
+##1.
+je
+:-s*
+im
+--U/ "div"
+IA
+im
+--LI
+JA
+im
+--s=
+cl
+BA
+im
+##1.
+je
+:-u/
+im
+--S/ "idiv"
+IA
+im
+--LI
+JA
+im
+--s=
+cl
+BA
+im
+##1.
+je
+:-s/
jm
-:-ex
+:-!i
// handle += instruction
::+=
im
@@ -2165,6 +2221,66 @@ jm
:-rl next line
::Rt
re
+// deal with "mul"
+::u*
+im
+--+*
+IA
+im
+##3.
+DA
+im
+--wr
+cl
+jm
+:-rl next line
+// deal with "imul"
+::s*
+im
+---*
+IA
+im
+##3.
+DA
+im
+--wr
+cl
+jm
+:-rl next line
+// deal with "div"
+::u/
+im
+--+/
+IA
+im
+##3.
+DA
+im
+--wr
+cl
+jm
+:-rl next line
+// deal with "idiv"
+::s/
+im
+---/
+IA
+im
+##3.
+DA
+im
+--wr
+cl
+jm
+:-rl next line
+::+*
++*
+::-*
+-*
+::+/
++/
+::-/
+-/
// bad instruction
::!i
im
@@ -2311,6 +2427,28 @@ jm
'g
'n
\n
+::U* "mul" text
+'m
+'u
+'l
+\n
+::S* "imul" text
+'i
+'m
+'u
+'l
+\n
+::U/ "div" text
+'d
+'i
+'v
+\n
+::S/ "idiv" text
+'i
+'d
+'i
+'v
+\n
::IF input file name
'i
'n
diff --git a/03/in03 b/03/in03
index 3be190d..dcbf395 100644
--- a/03/in03
+++ b/03/in03
@@ -1,10 +1,8 @@
-return
-str Hi
-align
-return
+; write to stdout
J=d1
I=:hello_world
D=:hello_world_end
+; calculate length by subtracting end from start
D-=I
syscall d1
J=d42