Develop an Assembly program that will follow the following flowchart for the six
ID: 3799238 • Letter: D
Question
Develop an Assembly program that will follow the following flowchart for the six quadrilaterals. Create a loop that will run six times. Inside the loop, use labels to ask the questions in the flowchart. You can have the user input 1 for true or 0 for false. Use structured jump instructions to go to different labels. These labels will have the different questions or answers and jump to print labels telling what type of quadrilateral the user has. Then jump back to the loop and continue for the six quadrilaterals. Document your program .mas source code with a 4 - 5 line paragraph explaining the program and with at least 5 lines of explanations throughout the program. Assemble and run your program with sim without the debugger once with each of the six sets of input data in order (i.e. square first, then rectangle, etc.). Copy and paste the results from the Console to a separate plain output .txt text file.
Submit your .mas Assembly source code and .txt output text file. Flowchart Source: The Centre for Innovation in Mathematics Teaching (CIMT) at The University of Plymouth, England.
START Does it No Khaue4 right angles a sther No pair of YES sides? Are a the sides No YES the same ength? Are there two pair NO YES of parallel sides YES Are a the sides NO the same length? YES Square Rectangle Rhombus Parallelogram Trapezium Quadrilateral with no special propertiesExplanation / Answer
#this is mips assembly
.data
string1: .asciiz "does it have 4 right angles "
string2: .asciiz "are all sides of same length "
string3: .asciiz "is there a pair of parallel sides"
string4: .asciiz "are there two pair of parallel sides "
string5: .asciiz "are all sides the same length "
string6: .asciiz "square "
string7: .asciiz "rectangle "
string8: .asciiz "paralleogram "
string9: .asciiz "trapezium "
string10: .asciiz "quadrilateral with no special properties "
string11: .asciiz "rhombus "
.text
loop:
bgt $t0,6,exit
#display string1
li $v0,4
la $a0,string1
syscall
#get answer
li $v0, 5
syscall
add $s0,$v0,$zero #s0 = number
bne $s0,1,displaystring3
#display string2
li $v0,4
la $a0,string2
syscall
#get answer
li $v0, 5
syscall
add $s0,$v0,$zero #s0 = number
bne $s0,1,displaystring7
#display string6
li $v0,4
la $a0,string6
syscall
#increment counter value
addi $t0,$t0,1
j loop
#end program
exit:li $v0,10
syscall
#display string3
displaystring3:
li $v0,4
la $a0,string3
syscall
#get answer
li $v0, 5
syscall
add $s0,$v0,$zero #s0 = number
bne $s0,1,diplaystring10
#display string4
li $v0,4
la $a0,string4
syscall
#get answer
li $v0, 5
syscall
add $s0,$v0,$zero #s0 = number
bne $s0,1,diplaystring9
#display string5
li $v0,4
la $a0,string5
syscall
#get number
li $v0, 5
syscall
add $s0,$v0,$zero #s0 = number
bne $s0,1,diplaystring8
#display string11
li $v0,4
la $a0,string11
syscall
#increment counter value
addi $t0,$t0,1
j loop
#display string10
diplaystring10:
li $v0,4
la $a0,string10
syscall
#increment counter value
addi $t0,$t0,1
j loop
#display string9
diplaystring9:
li $v0,4
la $a0,string9
syscall
#increment counter value
addi $t0,$t0,1
j loop
#display string8
diplaystring8:
li $v0,4
la $a0,string8
syscall
#increment counter value
addi $t0,$t0,1
j loop
#display string7
displaystring7:
li $v0,4
la $a0,string7
syscall
#increment counter value
addi $t0,$t0,1
j loop
-----------------------------
explaination:
the program asks exactly as in flow chart.
the counter limit for loop is set to 6.
bne instruction branches when user input is false and when its true ,the program continues sequentially exactly like in flowchart.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.