联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp

您当前位置:首页 >> Java编程Java编程

日期:2018-11-24 10:54

Functionality The functionality of your program will be as follows:

1.Read two program arguments: signed decimal numbers [-64, 63].

2.Print the user inputs.

3.Convert the ASCII strings into two sign-extended integer values.

a.Convert the first program argument to a 32-bit two’s complement number, stored

in register $s1.

b.Convert the second program argument to a 32-bit two’s complement number, stored

in register $s2.

4.Add the two integer values, store the sum in $s0.

5.Print the sum as a decimal to the console.

6.Print the sum as 32-bit two’s complement binary number to the console.

7.Print the sum as a decimal number expressed in Morse code.

a.Use a period (ASCII code 0x2E) for “dots” and a hyphen (ASCII code 0x2D)for

“dashes”.

b.Insert a space (ASCII code 0x20) between characters.

c.Don’t forget to print the Morse code for a minus sign if the number is negative!

Output

An example of the expected output is given below. Your code’s output format should

match this output format exactly. New line characters are printed after each

number representation. If you skip the extra credit, the last line printed will be

the new line character after the binary value.

-----------------------------------

You entered the decimal numbers:

45 -54

The sum in decimal is:

-9

The sum in two’s complement binary is:

11111111111111111111111111110111

The sum in Morse code is:

-....- ----.

-- program is finished running –

Register Usage Registers $s1 and $s2 shall contain the two 32-bit two’s complement integers entered by

the user. Register $s0 shall be used to store the 32-bit two’s complement sum. You should try to use as

few registers as possible. Try to only use $zero, $v0, $a0,$s0-$s2, and the temporary registers, $t0-$t9. If

you run out of registers, you may use $s3-$s8.After the header comment and pseudocode, but before

your program, include a comment about register usage. Some registers might be reused in several parts

of your code, this is ok.

Syscalls

When printing the integer values, you may use syscall system services 4 (print

string) and 11 (print character). You may not use syscall system service 1 (print

integer), syscall system service 35 (print integer as binary), or syscall system

service 36 (print integer as unsigned).

Input

In this lab you will obtain two user inputs, not using a syscall, but by using

program arguments. The user will enter two integer values between -64 and 63.

These numbers will be sign-extended to 32 bits and stored in $s1 and $s2.


版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp