I am try to write a sparc assembly program to print Fibonacci sequence till the
ID: 3651989 • Letter: I
Question
I am try to write a sparc assembly program to print Fibonacci sequence till the number that user enter I got it to where the user can enter, but don't know where and how to do the loop. PLEASE help thank you..section ".data"
input: .word 0 !where the user input number will be read in
yesNo: .byte 0 !store a character representing yes or no
nl: .asciz " " !where we dump the trailing newline input
format: .asciz "%d%c" !specify a decimal number (word) and a character
format2: .asciz "%c%c" !specify two characters
prompt: .asciz " Please enter a number:"
prompt2: .asciz " Would you like to try again(Y/N):"
!!!!!!!!!!!!!!!!!!!!!!!! CODES !!!!!!!!!!!!!!!!!!!!!!
.align 4
.global main
.section ".text"
main:
save %sp, -96, %sp
repeat:
! prompt the user for an input
set prompt, %o0
call printf
nop
set format, %o0 !what kind of data we want to get
set input, %o1 !location for the input number to be stored
set nl, %o2 !location to dump the input newline
call scanf
nop !now, the user input must be in the data block
!specified by the lable input and nl
set prompt2, %o0 !reprompt
call printf
nop
set format2, %o0 !getting a character and a newline
set yesNo, %o1 !location for yes/no
set nl, %o2 !dummy newline
call scanf
nop
set yesNo, %l0 !get the address of yes/no memory
ldub [%l0], %o0 !get the yes/no response from memory
cmp %o0, 'y'
be repeat !yes, then try again
cmp %o0, 'Y' !yes, then try again
be repeat
nop
ret !get out
restore
Explanation / Answer
typo errors line 16 18 and 24
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.