Develop a program using MIPS R3000 assembly instruction that

Develop a program (using MIPS R-3000 assembly instruction) that analyzes a given IP address for its domain class and displays the domain class the given IP address belongs to. Your program should prompt for an IP address and display its domain class (as shown below). Any invalid input should be detected as soon as a number is entered and your program should repeat a prompt until a valid number is entered. See the figure bellows 146 Once a valid number is entered, any such valid input should not be repeated (as shown below) After all the four numbers are correctly input, your program should determine its domain class and display it.

Solution

.data
hdr: .ascii \"Enter an IP address\ \"
first: .word 0
second .word 0
third .word 0
fourth .word 0

.text
.globl main
main:
lw $t0,first
lw $t1,second
lw $t2,third
lw $t3,fourth

blt $t0,255
li $v0 # the entered number is larger then 255

li $v0 # IP address you entered
li $v0,first
li $v0 # :
li $v0,second
li $v0 # :
li $v0,third
li $v0 # :
li $v0,fourth

bgez $t0,0
blt $t0,127
sw $a0,A

bgez $t1,127
blt $t1,191
sw $a0,B
bgez $t2,191
blt $t2,224
sw $a0,C
bgez $t3,224
blt $t3,239
sw $a0,D
li $v0 # Class
li $v0,a0
li $v0 # Address
li $v0 # program successfully completed
syscall
.end main

 Develop a program (using MIPS R-3000 assembly instruction) that analyzes a given IP address for its domain class and displays the domain class the given IP add

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site