str (hello wrold program is really simple now!)

This commit is contained in:
pommicket 2021-11-13 13:56:26 -05:00
parent 3fe11fa0cb
commit 147fb9ccca
3 changed files with 45 additions and 13 deletions

View file

@ -37,3 +37,4 @@ x3c
;;;;;;;;;;;;;;;;;;;;;;;/+ ;;;;;;;;;;;;;;;;;;;;;;;/+
:funciton :funciton
call A call A
str Here is some text which will be put in the executable!

43
03/in02
View file

@ -78,6 +78,12 @@ im
##a. ascii '\n' ##a. ascii '\n'
jn jn
:-rL keep looping :-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 // we now have a full line from the file in ::LI
// the pointer to the end of the line is in rbp // the pointer to the end of the line is in rbp
// look at the first character // look at the first character
@ -213,6 +219,20 @@ im
##1. ##1.
je je
:-sy :-sy
im
--ST "str"
IA
im
--LI
JA
im
--s=
cl
BA
im
##1.
je
:-st
jm jm
:-ex :-ex
// handle += instruction // handle += instruction
@ -1796,6 +1816,24 @@ jm
:-rl jump back to read next line :-rl jump back to read next line
::Cl ::Cl
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>" // handle "syscall <number>"
::sy ::sy
im im
@ -2126,6 +2164,11 @@ jm
'l 'l
'l 'l
20 20
::ST "str" text
's
't
'r
20
::IF input file name ::IF input file name
'i 'i
'n 'n

14
03/in03
View file

@ -7,18 +7,6 @@ J=d42
syscall x3c syscall x3c
:hello_world :hello_world
'H str Hello, world!
'e
'l
'l
'o
',
x20
'w
'o
'r
'l
'd
'!
xa xa
:hello_world_end :hello_world_end