summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2021-11-13 13:56:26 -0500
committerpommicket <pommicket@gmail.com>2021-11-13 13:56:26 -0500
commit147fb9ccca4593209349b7c6c41ddeca17678464 (patch)
tree119d81214d1f48bd8a2617dcf30ce2ed1427897b
parent3fe11fa0cb21a5b78b401e86ca9ca382332e8a6f (diff)
str (hello wrold program is really simple now!)
-rw-r--r--03/ex031
-rw-r--r--03/in0243
-rw-r--r--03/in0314
3 files changed, 45 insertions, 13 deletions
diff --git a/03/ex03 b/03/ex03
index e78c187..90ab070 100644
--- a/03/ex03
+++ b/03/ex03
@@ -37,3 +37,4 @@ x3c
;;;;;;;;;;;;;;;;;;;;;;;/+
:funciton
call A
+str Here is some text which will be put in the executable!
diff --git a/03/in02 b/03/in02
index fa30868..7a55324 100644
--- a/03/in02
+++ b/03/in02
@@ -78,6 +78,12 @@ im
##a. ascii '\n'
jn
:-rL keep looping
+// subtract 1 from rbp because we don't care about the newline
+im
+##ffffffffffffffff. -1
+BR
++B
+RA
// we now have a full line from the file in ::LI
// the pointer to the end of the line is in rbp
// look at the first character
@@ -213,6 +219,20 @@ im
##1.
je
:-sy
+im
+--ST "str"
+IA
+im
+--LI
+JA
+im
+--s=
+cl
+BA
+im
+##1.
+je
+:-st
jm
:-ex
// handle += instruction
@@ -1796,6 +1816,24 @@ jm
:-rl jump back to read next line
::Cl
cl
+// handle "str <string>"
+::st
+im
+##4.
+BA
+im
+--LI
++B
+IA pointer to string
+nA
+BR
++B
+DA length of string
+im
+--wr write
+cl
+jm
+:-rl next line
// handle "syscall <number>"
::sy
im
@@ -2126,6 +2164,11 @@ jm
'l
'l
20
+::ST "str" text
+'s
+'t
+'r
+20
::IF input file name
'i
'n
diff --git a/03/in03 b/03/in03
index 88843a6..5a797c1 100644
--- a/03/in03
+++ b/03/in03
@@ -7,18 +7,6 @@ J=d42
syscall x3c
:hello_world
-'H
-'e
-'l
-'l
-'o
-',
-x20
-'w
-'o
-'r
-'l
-'d
-'!
+str Hello, world!
xa
:hello_world_end