Skip to main content
\(\newcommand{\doubler}[1]{2#1} \newcommand{\binary}{\mathtt} \newcommand{\hex}{\mathtt} \newcommand{\octal}{\mathtt} \newcommand{\prog}{\mathtt} \newcommand{\lt}{<} \newcommand{\gt}{>} \newcommand{\amp}{&} \)

Section14.4Programming Exercises


Show that the main function in Listing 14.3.1 works with the assembly language hexToInt function in Listing 14.3.5


Does the program in in Exercise 14.4.1 work correctly for both lowercase and uppercase alphabetic hex characters? Why or why not?

Hint Answer

Write an assembly language version of the main function in Listing 14.3.1. Use the assembly language versions of hexToInt, writeStr, and readLn in your program. You may use printf from the C Standard Library to display your result.

Hint Solution

Write a program in assembly language that asks the user to enter two hexadecimal numbers, each up to 32 bits, and displays their sum.

Hint Solution