-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhellostd.s
More file actions
40 lines (34 loc) · 764 Bytes
/
Copy pathhellostd.s
File metadata and controls
40 lines (34 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
################################################################################
#
# hello.s
# By: Denver Coneybeare
# July 07, 2011
#
# The "Hello World" of Linux x86 assembly, using the standard library's printf.
#
# Build Instructions:
# $ gcc hellostd.s main.c
#
# Example Run:
# $ ./a.out
# Hello World
#
################################################################################
.data
template:
.ascii "%s\n\0"
message:
.ascii "Hello World\0"
.text
.global go
go:
enter $8, $0
# push the template and the message onto the stack (in reverse order) then
# call printf
pushl $message
pushl $template
call printf
# return a value of 0 (zero) in register eax
mov $0, %eax
leave
ret