lang-bootstrap/02/in02

49 lines
455 B
Text
Raw Normal View History

2021-11-09 20:27:03 -05:00
jm
2021-11-09 20:53:55 -05:00
:-co jump to code
2021-11-10 12:55:41 -05:00
::hw start of hello world
2021-11-09 20:53:55 -05:00
'H
'e
'l
'l
'o
',
'
'w
'o
'r
'l
'd
'!
\n
::he end of hello world
2021-11-10 12:55:41 -05:00
2021-11-09 20:53:55 -05:00
::co start of code
2021-11-10 12:55:41 -05:00
// calculate the length of the hello world string
2021-11-09 20:53:55 -05:00
// by subtracting hw from he.
im
--he
BA
im
--hw
nA
+B
DA put length in rdx
2021-11-10 12:55:41 -05:00
// okay now write it
2021-11-09 20:53:55 -05:00
im
##1.
JA set rdi to 1 (stdout)
im
--hw
IA set rsi to a pointer to "Hello, world!\n"
im
##1. write
sy
im
##0. exit code 0
JA
im
##3c. exit = syscall 0x3c
sy