Write a hexadecimal machine language program that will add and subtract the foll
ID: 3785303 • Letter: W
Question
Write a hexadecimal machine language program that will add and subtract the following numbers:
45(10) + 45(16) - 13(10) - 13(16) + b(16) + (-5)(10).
That is 45 in base 10 plus 45 in base 16 minus 13 in base 10 minus 13 in base 16 plus b in base 16 plus negative 5 in base 10.
Save each of the instructions in memory and after the instructions save each of the values in memory, including the results. Display the results in hexadecimal and decimal. Run your program and display the memory cells to make sure everything works.
Explanation / Answer
here is the code for hexadecimal machine language program that will add and subtract the following numbers:
45(10) + 45(16) - 13(10) - 13(16) + b(16) + (-5)(10).
Simulator Version 4.0
Machinecode file = lab.mac Size = 17 (hex) = 23 (dec)
Microcode file = none Size = 93 (hex) = 147 (dec)
Config file = none
Log file = lab.log
Answer file = none
Simulation mode = horizontal
Microlevel = disabled
Shifter = one-position
Cmd line addr = F3C (hex) = 3900 (dec)
Load point = 0 (hex) = 0 (dec)
---- [T7] 0: st /1 010/ g
0: st /1 010/ m[010]=002D/0000
1: add /2 011/ ac=0000/0045
2: sub /3 012/ ac=0045/0038
3: sub /3 013/ ac=0038/0025
4: add /2 014/ ac=0025/0030
5: add /2 015/ ac=0030/002B
6: st /1 016/ m[016]=0000/002B
7: hout /FFF9 / 002B
8: dout /FFFD / 43
9: halt /FFFF /
Machine inst count = A (hex) = 10 (dec)
---- [T7] d0
0: 1010 2011 3012 3013 2014 2015 1016 FFF9 ........
8: FFFD FFFF 0000 0000 0000 0000 0000 0000 ........
10: 0000 0045 000D 0013 000B FFFB 002B 0000 .E....+.
18: 0000 0000 0000 0000 0000 0000 0000 0000 ........
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.