Either submit the
source code file (.asm) on Ecampus under the "Submit Homework" menu option, or demo
the programs to the instructor during lab.
Using x86 assembly language, write a program that converts an
integer to binary and hexadecimal using bitwise operators. Do not use
external functions. You may use the algorithm below.
Algorithm to convert Value to binary:
(1) set Count to 0
(2) AND Value with 128 (binary 10000000) and store into Temp
(3) if result is zero, output "0"
(4) if result is not zero, output "1"
(5) shift Temp left
(6) increment Count
(7) if Count <= 8, jump to step (2)
Algorithm to convert Value to hexadecimal:
(1) shift Value right 4 digits and store into Temp
(2) if Temp <=9, print Temp
(3) if Temp >=10, add 55 to Temp and print the ASCII character
(4) AND Value with 240 (binary 00001111) and store into Temp
(5) if Temp <=9, print Value
(6) if Temp >=10, add 55 to Temp and print the ASCII character
This x86 assembly program converts an integer to binary and hex.
Enter an integer from 0 - 255: 73