Homework 3
(40 points, 10 points each)
Problem 1
Write assembly language code for printing the larger of two numbers specified by the user.
Problem 2
Translate the below code for counting the 1 bits in r0 into assembly code.
r3 = 1;
r1 = 0;
while (r3 != 0) {
if ((r0 & r3) != 0) {
r1 = r1 + 1;
}
r3 = r3 + r3;
}
Problem 3
Suppose t0 contains an integer value a, and t1 contains an integer value b that is more than 0.
Write an assembly language fragment that leaves in t2 the value of a
b — that is, t0 raised to the
positive power found in t1. You may change the values in t0 and t1, but the value for t2 should
be computed reflecting the initial t0 and t1 values.
Problem 4
Write assembly language program to detect if a phrase or characters entered by the user is a
palindrome.
版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。