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
  • I need help with a code in assembly language MASM (x86)

    write an assembly language (x86) program to input in a string 10 multi-digit integers and displays them in ascending order. Modify the code below to comply with the requirement..model small.stack 100h.datastrg1 DB 'Insert numbers: $'strg2 DB 'Sorted numbers: $'Arr Db 10 dup(?)v dw ?.codemain procmov ax,@datamov ds,axmov ah,9lea dx,strg1int 21hmov dl,0ahmov ah,2int 21h;inputsmov di,0mov cx,10Input_loop:mov ah,1int 21hmov arr[di],almov dl,0ahmov ah,2int 21hinc diloop Input_loopmov v,0sort:mov di,0mov cx,10sub cx,vB:mov al,Arr[di]cmp al,Arr[di+1]jng Cmov al,Arr[di]xchg al,Arr[di+1]mov Arr[di],alc:inc diloop Binc vcmp v,10jne sort;Outputmov ah,9lea dx,strg2int...

  • 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...

  • X86 Assembly Language Help to implement the CipherChar Procedure at the end of the given code...

    X86 Assembly Language Help to implement the CipherChar Procedure at the end of the given code INCLUDE Irvine32.inc         .data       KeyPrompt BYTE "Enter the passphrase: ",0       TextPrompt BYTE "Enter the plaintest: ",0           str1 BYTE "The passphrase has length:",0           str2 BYTE "The plaintest has length:",0       KeyIs BYTE "The passphrase: ",0       PlainTextIs BYTE "The plaintext: ",0       CipherTextIs BYTE "The ciphertext: ",0       KMAX = 64                        ; passphrase buffer maximum size       BMAX = 128                       ; test...

  • Assembly Language Programming Assignment program must be in: MASM assembly language / x86 architecture / irvine...

    Assembly Language Programming Assignment program must be in: MASM assembly language / x86 architecture / irvine library procedures Objectives: 1. using register indirect addressing 2. passing parameters 3. generating “random” numbers 4. working with arrays Description: Write and test a MASM program to perform the following tasks: 1. Introduce the program. 2. Generate ARRAYSIZE random integers in the range [LO = 10 .. HI = 29], storing them in consecutive elements of an array. ARRAYSIZE should be set to 200....

  • Assembly language 64 bit please ! An example file for set up ==========+ ;| Data Segment...

    Assembly language 64 bit please ! An example file for set up ==========+ ;| Data Segment BEGINS Here | ;+======================================================================+ segment .data ;Code this expression: sum = num1+num2 num1 dq 0 ;left operand of the addition operation num2 dq 0 ;right operand of the addition operation sum dq 0 ;will hold the computed Sum value RetVal dq 0 ;Integer value RETURNED by function calls ;can be ignored or used as determined by the programmer ;Message string prompting for the keyboard...

  • C language huffman This exercise will familiarize you with linked lists, which you will need for...

    C language huffman This exercise will familiarize you with linked lists, which you will need for a subsequent programming Getting Started assignment Overview Requirements Getting Started Submit Start by getting the files. Type 264get hw13 and then cd hw13 from bash. Pre-tester You will get the following files: Q&A Updates 1. huffman.h: An empty header file, you have to define your own functions in this homework. 2. huffman.c: An empty c file, you have to define your own functions in...

  • 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...

  • 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...

  • 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 =...

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
ADVERTISEMENT