mirror of
https://github.com/pkivolowitz/asm_book.git
synced 2026-06-23 07:28:04 +08:00
more source code for the chapter
This commit is contained in:
parent
e8a4c79ae2
commit
1e325fa7d8
1 changed files with 28 additions and 0 deletions
28
section_1/float/frintp.s
Normal file
28
section_1/float/frintp.s
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
.text
|
||||||
|
.global main
|
||||||
|
.align 2
|
||||||
|
|
||||||
|
main: str x30, [sp, -16]!
|
||||||
|
|
||||||
|
ldr x0, =d
|
||||||
|
ldr d0, [x0]
|
||||||
|
frintp d0, d0
|
||||||
|
ldr x0, =fmt1
|
||||||
|
bl printf
|
||||||
|
|
||||||
|
ldr x0, =h
|
||||||
|
ldr d0, [x0]
|
||||||
|
frintp d0, d0
|
||||||
|
ldr x0, =fmt2
|
||||||
|
bl printf
|
||||||
|
|
||||||
|
ldr x30, [sp], 16
|
||||||
|
mov w0, wzr
|
||||||
|
ret
|
||||||
|
|
||||||
|
.data
|
||||||
|
fmt1: .asciz "with fraction: %f\n"
|
||||||
|
fmt2: .asciz "without fraction: %f\n"
|
||||||
|
d: .double 5.00000001
|
||||||
|
h: .double 5.0
|
||||||
|
.end
|
||||||
Loading…
Reference in a new issue