forked from pkivolowitz/asm_book
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrodata.s
33 lines (25 loc) · 901 Bytes
/
rodata.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
27
28
29
30
31
32
33
.global main
.align 2
.section .rodata
rotypo: .asciz "Rypo" // Meant this to be "Typo"
fmt: .asciz "%s\n" // Used to print the strings
.data
rwtypo: .asciz "Rypo" // Meant this to be "Typo"
.text
main: str x30, [sp, -16]!
// Try to fix rwtypo --- this will work
ldr x1, =rwtypo
mov w2, 'T'
strb w2, [x1]
ldr x0, =fmt // Notice I already loaded rwtypo
bl printf
// Try to fix rotypo --- this will end in tears
ldr x1, =rotypo
mov w2, 'T'
strb w2, [x1]
ldr x0, =fmt // Notice I already loaded rwtypo
bl printf
ldr x30, [sp], 16
mov w0, wzr
ret
.end