How would i do the loop for this in SPARC ASSEMBLY .section \".data\" /*Variable
ID: 3650714 • Letter: H
Question
How would i do the loop for this in SPARC ASSEMBLY.section ".data"
/*Variables data section*/
pstatep: .asciz " This program prints the Fibonacci sequence." !Program purpose statemt
userprompt: .asciz " Enter a limit on the largest number to be displayed:" !Prompt user to enter a number
constop: .asciz " Do you want to print a different sequence (Y/N):" !Continue or stop statement
number: .asciz "%d" !number to be entered
letter: .asciz "%s" !letter to be entered
nl: .asciz " "
uinput: .word 0 !location for the input number to be stored*/
condition: .byte 0
/*Code starts here*/
.align 8
.global main
.section ".text"
/*Macro*/
define(f_1, l0)
define(f_2, l1)
define(count, l2)
main:
save %sp, -96, %sp
start:
set pstatep, %o0 !Welcome message prompt
call printf
nop
set userprompt, %o0 !Prompt for number entry
call printf
nop
set number, %o0 !interger input only
set uinput, %o1 !input storage
set nl, %o2
call scanf
nop
ld [%o1], %o0
mov %o0, %count
mov 1, %f_1
mov 1, %f_2
mov 1, %o0
call printf
nop
mov 1, %o0
call printf
nop
loop:
add %f_1, %f_2, %o0
call printf
mov %f_1, %f_2
mov %o0, %f_1
cmp %f_1, %count
ble loop
nop
set constop, %o0 !Continue or stop(yes or no)
call printf
nop
set letter, %o0
set condition, %o1
set nl, %o2
call scanf
nop
set condition, %l0
ldub[%l0], %o0
cmp %o0, 'y'
be start
nop
ret
restore
Explanation / Answer
void myFibo(int lastNum, int num) { printf("%d, ", lastNum); if(num < 400) /*Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.