Question: I need help with this Assembly Language code This is what I have so far (I'm asking the user for the length of an array).

I need help with this Assembly Language code

This is what I have so far (I'm asking the user for the length of an array). What I need help with is:

- making sure the user's input falls within a range of 1 and 20

- if it doesn't (eg. 21 or 50), print out a message saying "Error" and let them try inputting another number again.

Feel free to edit my code underneath. Thanks

practice.asm

.data array: .space 4 # a space that advances the location counter by 4 bytes size: .word 12 # size of "array" message: .asciiz "Enter a number for the length of the array: "

# -------- Code section --------- # .text la $a0,message # display the message li $v0,4 # load in v0 syscall li $v0,5 # read 1st integer into array size syscall move $t5, $v0 # moves the value from the user input into variable t5 la $t0, array # load the address of the array

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!