Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Mips programming below is the mystery code: .text main: li $a0, 0 jal putDec li $a0, ' ' li $v0, 11 syscall li $a0, 1

Mips programming

image text in transcribedimage text in transcribed

below is the mystery code:

.text

main: li $a0, 0 jal putDec li $a0, ' ' li $v0, 11 syscall li $a0, 1 jal putDec li $a0, ' ' li $v0, 11 syscall li $a0, 196 jal putDec li $a0, ' ' li $v0, 11 syscall li $a0, -1 jal putDec li $a0, ' ' li $v0, 11 syscall li $a0, -452 jal putDec li $a0, ' ' li $v0, 11 syscall li $a0, 2 jal mystery move $a0, $v0 jal putDec li $a0, ' ' li $v0, 11 syscall

li $a0, 3 jal mystery move $a0, $v0 jal putDec li $a0, ' ' li $v0, 11 syscall

li $v0, 10 # terminate program syscall

putDec: ## FILL IN ## jr $ra # returnv

mystery: bne $0, $a0, recur # li $v0, 0 # jr $ra # recur: sub $sp, $sp, 8 # sw $ra, 4($sp) # sub $a0, $a0, 1 # jal mystery # sw $v0, 0($sp) # jal mystery # lw $t0, 0($sp) # addu $v0, $v0, $t0 # addu $v0, $v0, 1 # add $a0, $a0, 1 # lw $ra, 4($sp) # add $sp, $sp, 8 # jr $ra #

(Exercise) Fill-in PutDec Using mystery.s given in the assignment page, work on putDec function which will take the argument given in $a0 and interprets it as a 2's complement number. Your task is to go figure out character by character of what is the appropriate character to print out. We will be using syscall to accomplish this task For example, if we want to print out character zero we would use: li Sa 0, '0' li 0, 11 syscall $v0 is telling the OS what function to do whereas $ao is supplying the actual character to print out. If we want to print out that is contained in $to then the code would look like li Sa 0, '0' add $a0 0, Sto added 0-9 in Sto to make char li svo, 11 syscall

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 Proceedings Part 1 Lncs 13426

Authors: Christine Strauss ,Alfredo Cuzzocrea ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

3031124227, 978-3031124228

More Books

Students also viewed these Databases questions

Question

Determine the synthetic pathway for the following:

Answered: 1 week ago

Question

Evaluate employees readiness for training. page 275

Answered: 1 week ago

Question

=+ How would you advise those problems be resolved?

Answered: 1 week ago