-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.s
26 lines (23 loc) · 891 Bytes
/
main.s
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
# PowerPC 32-bit assembly for Linux (Big-Endian)
# System calls for PPC Linux:
# 4 for write
# 1 for exit
.section ".text"
.align 2
.global _start
_start:
# Write system call
li 0,4 # System call number for write
li 3,1 # File descriptor 1 is stdout
lis 4,message@ha # Load high adjusted part of address
la 4,message@l(4) # Load address relative to high part
li 5,14 # Message length
sc # Make system call
# Exit system call
li 0,1 # System call number for exit
li 3,0 # Return code 0
sc # Make system call
.section ".rodata"
.align 2 # 4-byte alignment for 32-bit
message:
.ascii "Hello, World!\n"