diff --git a/main.s b/main.s index e4b4259..6f31575 100644 --- a/main.s +++ b/main.s @@ -2,16 +2,17 @@ .text _start: - movl $4, %eax # 4 (code for "write" syscall) -> EAX register - movl $1, %ebx # 1 (file descriptor for stdout) -> EBX (1st argument to syscall) - movl $msg, %ecx # 32-bit address of msg string -> ECX (2nd argument) - movl $len, %edx # length of msg string -> EDX (3rd arg) - int $0x80 # interrupt with location 0x80 (128), which invokes the kernel's system call procedure + mov $1, %rax + mov $1, %rdi + mov $msg, %rsi + mov $len, %rdx + syscall + + mov $60, %rax + mov $0, %rdi + syscall - movl $1, %eax # 1 ("exit") -> EAX - movl $0, %ebx # 0 (with success) -> EBX - int $0x80 # see previous .data msg: - .ascii "Hello, world!\n" # inline ascii string - len = . - msg # assign (current address - address of msg start) to symbol "len" + .ascii "Hello, world!\n" + len = . - msg