Question

I would love help with the following exercise in Assembly language: The objective of this exercise...

I would love help with the following exercise in Assembly language:

The objective of this exercise is to write a procedure that will convert the ASCII code of a digit d into the value v of d, and store v in the register DL. The procedure uses the register AL as a parameter. AL contains the ASCII code of a hexadecimal digit d (‘0’ to ‘F’): 30h-39h and 41h-46h. You do not have to test AL for the range. The procedure must store in the register DL the value of the digit.

Examples:
1) If AL contains the ASCII code 34h (ASCII code of ‘4’), the procedure must store in DL the value of the digit ‘4’, i.e., the value 04h. Ultimately, DL = 04h.
2) If AL contains the ASCII code 44h (ASCII code of ‘D’), the procedure must store in DL the value of the digit ‘D’, i.e., the value 0Dh. Ultimately, DL = 0Dh.

Thank you!

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Please find the code below:::::


.model small
.stack 100h
.data

;prompt for input
printName db 'Mohammad Shahrukh $'

;it wil print message
print? db '? $'


printNextSeqLine db 'The following character in sequence is: $'   

.code
main proc

;to print counter
Mov bl,'0'

mov ax,@data ;move data address to ax
mov ds,ax ;move ax to data segment   
  
  
lea dx , printName ;if use lea no need to use offset
mov ah,9 ;ask to print array of string
int 21h


mov dx,10 ;print \n
mov ah,2
int 21h


mov dx,13 ;cursor at first position
mov ah,2
int 21h




lea dx , print? ;if use lea no need to use offset
mov ah,9 ;ask to print array of string
int 21h

mov ah,1 ;input character
int 21h
  
mov cl,al

mov dx,10 ;print \n
mov ah,2
int 21h


mov dx,13 ;cursor at first position
mov ah,2
int 21h
  
  
lea dx , printNextSeqLine ;if use lea no need to use offset
mov ah,9 ;print message
int 21h




add cl,1 ;add one to the input

mov dl,cl ;move data to dl
mov ah,2 ;print ah
int 21h

mov ah,4ch
int 21h  

main endp
end main

output:

set xt character of entered.exe_ ternal virtual devices virtual drive 6 help 65 step back single step run step delay ms: 0 F400:0204 F400:0294 255 RES IOS 2 2 75 INT 021h FF 255 RES CD 205 = 21 033! CF 207 IRET ADD CBX SI1. AL 160 ADD [BX + SI1. AL 00 000 NULL 00 000 NULL 00 000 NULL 00 000 NULL 00 000 NULL 00 000 NULL 00 000 NULL 00 000 NULL 00 000 NULL 00 000 NULL 00 000 NULL 00 000 NULL 00 000 NULL 00 000 NULL 00 000 NULL 00 000 NULL ADD CBX + SI]. AL ADD CBX + ADD LBXx +Sfh emulator screen (80x25 chars) ADD CBX + ADD CBX + ADD CBX + ADD CBX + Hohamad Shahrukh The following character in sequence is: B ADD CBX + ADD CBX + ADD CBX + ADD CBX + ADD CBX + ADD CBX + ADD CBX + ADD CBX + source reset aux vars debug use offset

Add a comment
Know the answer?
Add Answer to:
I would love help with the following exercise in Assembly language: The objective of this exercise...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Need help on Assembly language 1.Solve the following conditions: A. Suppose AL contains 11001011 and CF...

    Need help on Assembly language 1.Solve the following conditions: A. Suppose AL contains 11001011 and CF = 1.    Give the new contents of AL after each of the following instructions is executed.    Assume the above initial conditions for each part of this question. a. SHL AL,1 b. SHR AL,1 c. ROL AL,2 d. ROR AL,3 e. SAR AL,2 f. RCL AL,1 g. RCR AL,3 B. Suppose EAX contain ABCDH.    Show the contents of BX and CX after...

  • LC-3 Programming Help!! The Stack Protocol The following outline is the protocol for passing arguments to...

    LC-3 Programming Help!! The Stack Protocol The following outline is the protocol for passing arguments to a function and returning values. Everything is stored on the runtime stack so that space is used only when the function is executing. As a result the actual address of arguments and locals may change from call to call. However, the layout of the stack frame (activation record) is constant. Thus, the offests from the frame pointer (FP) to the parameters/locals are constant. All...

  • i need help with a mips program to to covert roman numerals to real numbers Lab 4: Roman Numeral Conversion Part A: Due...

    i need help with a mips program to to covert roman numerals to real numbers Lab 4: Roman Numeral Conversion Part A: Due Sunday, 19 May 2019, 11:59 PM Due Friday, 24 May 2019, 11:59 PM Part B: Minimum Submission Requirements Ensure that your Lab4 folder contains the following files (note the capitalization convention): o Diagram.pdf o Lab4. asm O README.txt Commit and push your repository Lab Objective In this lab, you will develop a more detailed understanding of how...

  • NEED HELP with HTML with Javascript embedding for form validation project below. I have my code...

    NEED HELP with HTML with Javascript embedding for form validation project below. I have my code below but I'm stuck with validation. If anyone can fix it, I'd really appreciate. ****************************************************************************** CODE: <!DOCTYPE html> <!-- To change this license header, choose License Headers in Project Properties. To change this template file, choose Tools | Templates and open the template in the editor. --> <html> <head> <title>Nice</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script> var textFromTextArea; function getWords(){ var text =...

  • I need help finding what is wrong with this code, it is for a CS course...

    I need help finding what is wrong with this code, it is for a CS course I am taking which codes in C (I am using XCode on Mac to code). This is the assignment: "Write a program that performs character processing on 10 characters read in from a file, and writes the results to output files. The program should read from “input.dat”. The program should write the ASCII values of the characters to “output_ascii.dat”. The program should print statistics...

  • Please use C programming to write the code to solve the following problem. Also, please use the i...

    Please use C programming to write the code to solve the following problem. Also, please use the instructions, functions, syntax and any other required part of the problem. Thanks in advance. Use these functions below especially: void inputStringFromUser(char *prompt, char *s, int arraySize); void songNameDuplicate(char *songName); void songNameFound(char *songName); void songNameNotFound(char *songName); void songNameDeleted(char *songName); void artistFound(char *artist); void artistNotFound(char *artist); void printMusicLibraryEmpty(void); void printMusicLibraryTitle(void); const int MAX_LENGTH = 1024; You will write a program that maintains information about your...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT