Armbaugruppe: Die gefundene Fibonacci -Nummer in Binärer. Wie kann man es menschlich lesbar machen? [Duplikat]Linux

Linux verstehen
Anonymous
 Armbaugruppe: Die gefundene Fibonacci -Nummer in Binärer. Wie kann man es menschlich lesbar machen? [Duplikat]

Post by Anonymous »

.global _start

.section .data
.align 4
n: .word 5 @n = 5
a: .word 0 @a = 0
b: .word 1 @b = 1

.section .text
_start:
init:
ldr r0, =n @loading address of 'n' to r0
ldr r1, [r0] @loading value of 'n' to r1
ldr r2, =a @loading address of 'a' to r2
ldr r3, [r2] @loading value of 'a' to r3
ldr r4, =b @loading address of 'b' to r4
ldr r5, [r4] @loading value of 'b' to r5
mov r6, #1 @r6 for iteration

loop:
cmp r6, r1
bgt end @go to end label if r6 > r1
add r7, r3, r5 @r7 = r3 + r5
mov r3, r5 @r3 = r5
mov r5, r7 @r5 = r7
add r6, r6, #1 @r6 = r6 + 1
B loop @branching to continue iteration

end:
mov r0, #1 @file descriptor - stdout
sub sp, sp, #4 @reserving required bytes in stack
str r7, [sp]
mov r1, sp @pass memory address to write
mov r2, #4 @number of bytes to write
mov r7, #4 @system call - write
svc 0
add sp, sp, #4 @clearing the stack reserved

@exit of the program
mov r0, #0 @exit status
mov r7, #1 @system call - exit
svc 0
< /code>
Ich bin neu in der Assembly -Programmierung und beginnt mit Arm ISA. Das Register R7 enthält die Fibonacci -Nummer im binären Format. Bitte helfen Sie mir, die Binärzahl in das menschliche lesbare Format umzuwandeln und die Ausgabe auszudrucken.

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post