str (hello wrold program is really simple now!)
This commit is contained in:
parent
3fe11fa0cb
commit
147fb9ccca
3 changed files with 45 additions and 13 deletions
43
03/in02
43
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue