Working and commented.

This commit is contained in:
Elf M. Sternberg 2018-04-25 08:41:35 -07:00
parent 4a7fa5a427
commit f1328af5d6
2 changed files with 6 additions and 6 deletions

View File

@ -3,7 +3,7 @@
;; Link with: ld -m elf_i386 -o hello hello.o ;; Link with: ld -m elf_i386 -o hello hello.o
;; Run with: ./hello ;; Run with: ./hello
;; sys/syscall.h ;; sys/unistd_32.h
%define SYS_write 4 %define SYS_write 4
%define SYS_exit 1 %define SYS_exit 1
@ -17,11 +17,11 @@ section .text
global _start global _start
_start: _start:
mov edx, 26d ; Length of the message mov edx, 26d ; Length of the message. The 'd' means 'decimal'
mov ecx, msg ; Address of the message mov ecx, msg ; Address of the message (not the content)
mov ebx, STDOUT ; using STDOUT (see definition above) mov ebx, STDOUT ; using STDOUT (see definition above)
mov eax, SYS_write ; Using WRITE in 32-bit mode? mov eax, SYS_write ; Using WRITE in 32-bit mode?
int 80h int 80h ; Interrupt target. The 'h' means 'hexidecimal'
mov ebx, 0 mov ebx, 0
mov eax, SYS_exit mov eax, SYS_exit

View File

@ -3,7 +3,7 @@
;; Link with: ld -m elf_i386 -o hello hello.o ;; Link with: ld -m elf_i386 -o hello hello.o
;; Run with: ./hello ;; Run with: ./hello
;; sys/syscall.h ;; sys/unistd_64.h
%define SYS_write 1 %define SYS_write 1
%define SYS_exit 60 %define SYS_exit 60