Question

In: Computer Science

In YASM Assembly language, how would you convert a hex byte into it's ascii representation?

In YASM Assembly language, how would you convert a hex byte into it's ascii representation?

Solutions

Expert Solution

Solution: The above-given problem has been coded using the assembly programming language, please find attached the same down below:

Code:

2000   LDA 2050H This loads the hexadecimal data
2003   MOV B, A It moves the content of accumulator to register B
2004   ANI OFH   It is used to mask the upper nibble
2006   CALL SUB1 It fetches the ASCII code for upper nibble
2009   STA 2051H  
2012   MOV A, B It moves the content of register B to the accumulator
2013   ANI F0H It masks the lower nibble
2015   RLC  
2016   RLC  
2017   RLC  
2018   RLC  
2019   CALL SUB1   It is used to fetch the ASCII code for the lower nibble
2022   STA 2052H  
2025   HLT  
SUB1   CPI 0AH  
JC SKIP  
ADI 07H  
SKIP   ADI 30H  
RET  

Here's the solution to your question, please provide it a 100% rating. Thanks for asking and happy learning!!


Related Solutions

Write a program in MIPS assembly language to convert an ASCII number string containing positive and...
Write a program in MIPS assembly language to convert an ASCII number string containing positive and negative integer decimal strings, to an integer. Your program should expect register $a0 to hold the address of a nullterminated string containing some combination of the digits 0 through 9. Your program should compute the integer value equivalent to this string of digits, then place the number in register $v0. If a non-digit character appears anywhere in the string, your program should stop with...
How to convert binary to hex?
How to convert binary to hex?
Write a parity checker for the ASCII system in MARIE. MARIE is an assembly language. The...
Write a parity checker for the ASCII system in MARIE. MARIE is an assembly language. The parity checker should repeatedly execute a loop that performs the following tasks: 1. Ask the user for an input X, which can be any printable ASCII character from Table 1; 2. Output the decimal code of X; 3. Output the total number of 1’s that appears in the binary code of X; 4. Output the parity bit which, when added to the binary code...
Write a program in "RISC-V" assembly to convert an ASCII string containing a positive or negative...
Write a program in "RISC-V" assembly to convert an ASCII string containing a positive or negative integer decimal string to an integer. ‘+’ and ‘-’ will appear optionally. And once they appear, they will only appear once in the first byte. If a non-digit character appears in the string, your program should stop and return -1.
Convert the following statement into the 8-bit unsigned binary ASCII representation: Bob’s laptop receives the frame...
Convert the following statement into the 8-bit unsigned binary ASCII representation: Bob’s laptop receives the frame containing the ARP reply message. First, convert each character into it's ASCII equivalents. Then, convert to a Binary number. For example: Bob's -> 066 111 098 039 115 -> 01000010 01101111 01100010 00100111 01110011 Remember, each Binary number has to be 8-bits.
Convert this C++ program exactly as you see it into x86 assembly language: // Use the...
Convert this C++ program exactly as you see it into x86 assembly language: // Use the Irvine library for the print function #include <iostream> // The string that needs to be printed char word[] = "Golf\0"; // Pointer to a specific character in the string char * character = word; //NOTE: This main() function is not portable outside of Visual Studio void main() { // Set up a LOOP - See the while loop's conditional expression below int ecx =...
1. Convert the machine language instructions into assembly language instructions: 7976C1 06
1. Convert the machine language instructions into assembly language instructions: 7976C1 06
Provide the instruction type, assembly language instruction, and binary representation of the instruction described by the...
Provide the instruction type, assembly language instruction, and binary representation of the instruction described by the following LEGv8 fields: op = 0x458, Rm = 14, Rn = 16, Rd = 18, shamt = 0
write a assembly language program to convert GRAY to BCD code in 8051
write a assembly language program to convert GRAY to BCD code in 8051
Assembly Language Exercises - 1. Play with .byte, print characters 2. Use .space along with li...
Assembly Language Exercises - 1. Play with .byte, print characters 2. Use .space along with li $v0, 8 to test how .space reacts with certain string lengths when printed. Describe what happens when experimenting for both and use comments.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT