mirror of
https://github.com/pkivolowitz/asm_book.git
synced 2026-06-23 07:28:04 +08:00
added Hello World to Hello World
This commit is contained in:
parent
5fb10be549
commit
7444d2842a
1 changed files with 25 additions and 0 deletions
|
|
@ -520,3 +520,28 @@ if a_register has value 0
|
||||||
```
|
```
|
||||||
|
|
||||||
Answer: True
|
Answer: True
|
||||||
|
|
||||||
|
### 5
|
||||||
|
|
||||||
|
While this chapter is entitled "Hello World," the example used isn't actually "Hello World." Here is a "Hello World" for you to complete:
|
||||||
|
|
||||||
|
```text
|
||||||
|
.global main
|
||||||
|
main:
|
||||||
|
str x30, [sp, -16]! // Preserve x30
|
||||||
|
ldr x0, =HW // Load address of string for puts
|
||||||
|
WHAT GOES HERE? // puts(HW)
|
||||||
|
ldr x30, [sp], 16 // Restore x30
|
||||||
|
mov x0, xzr // return 0
|
||||||
|
ret
|
||||||
|
|
||||||
|
.data
|
||||||
|
HW: .asciz "Hello, World"
|
||||||
|
.end
|
||||||
|
```
|
||||||
|
|
||||||
|
Answer:
|
||||||
|
|
||||||
|
```text
|
||||||
|
bl puts
|
||||||
|
```
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue