Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using assembly language Note: the four exercises must be included in ONE project using ONE assembly file. Just separate in the file the exercises using
Using assembly language
Note: the four exercises must be included in ONE project using ONE assembly file. Just separate in the file the exercises using clear comments. Programming Exercise I (6 points): The objective of this exercise is to write a program that converts a value v of a decimal digit d into the 9. Therefore, AL will ASCII code of the digit d. We assume that the register AL contains a value between 0 and contain the value of a decimal digit "0' to .9. You do not have to test AL for the range. Your program 1) must store in the register DL the ASCll code of the character, and 2) must display the character using the function WriteChar Example. If AL will contain the value 4. Your Program l) must store in DL the ASCII code of 4, ie. DL34h, and 2) must display the character 4 using the built-in function W To test our program, you must initialize AL to various values varying from 0 to 9 (e.g. MOV AL, 06h just before your instructions of the program you wrote. Programming Exercise 2 (24 points): (Implementing WriteHexByte) The objective of this exercise is to write a program that implements the function WriteHexByte to display hexadecimal on the console the byte contained in the register AL. We assume that AL contains a hexadecim number that uses only decimal digits (i.e. 0 to 9). Therefore, AL will contain a value such that both nibbles tal only the values from 0 to 9. For example, if AL 94h (1001 0100)2, then this content is valid because t most significant nibble (1001)2 and the least significant nibble (O100)2 are in the range [O-9]. The value 5Ah invalid because the least significant nibble ((1010)2 - Ah) is not in the range [0-9]. Given a valid value in A your program must I) store in the register DH the ASCIl code of the most significant nibble. 2) store in the register DL the ASClIl code of the least significant nibble. 3) Display (using WriteChar) on the console the character stored in DH (recall that Writechar AL for the character to display). 4) Display (using WriteChar) on the console the character stored in DL. 5) Display 'h' to indicate that the number is a hexadecimal number 6) "Display' the line feed' character (ASCll code is 0Ah) to go to the next line. 7) Display' the 'carriage' character (ASClI code is 0Dh) to go to the next line Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started