Question: Write a ASM program to: Read a 16-bit unsigned integer input by the user Calculate the 2s compliment of the number Display the input and
Write a ASM program to:
Read a 16-bit unsigned integer input by the user
Calculate the 2s compliment of the number
Display the input and the 2s compliment output to the MIPS display in binary, decimal, & hexadecimal
.data int: .word 0
prompt: .asciiz "Please enter an 16- bit integer: " msgDec: .asciiz " Your number in decimal is: " msgBin: .asciiz " Your Number in binary code is: " msgHex: .asciiz " your number in Hexadecimal is: " twoComp: .asciiz " Your number in decimal with 2's comp is: " twoCompBin: .asciiz " Your Number in binary code with 2's comp is: " twoCompHex: .asciiz " your number in Hexadecimal with 2's comp is: " .text
.globl main
main: # entry point # 1 - Prompt the user for a number # 2 - Read the number from User # 3 - display the decimal result msg # 4 - display the number in decimal # 5 - display the binary result msg # 6 - display the number in binary # 7 - display the hex result msg # 8 - display the integer in hex
# 2's compliment # 1 - calculate the 2's compliment # 2 - display the decimal 2's comp result msg # 3 - display the decimal 2's comp result # 4 - display the binary 2's comp result msg # 5 - display the binary 2's comp result # 6 - display the Hexadecimal 2's comp result msg # 7 - display the Hexadecimal 2's comp result li $v0, 10 syscall
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
