# Write a procedure named PackedToAsc that converts a 4-byte packed d...

## Question

Write a procedure named PackedToAsc that converts a 4-byte packed decimal number to a string of ASCII decimal digits. Pass the packed number to the procedure in EAX, and pass a pointer to a buffer that will hold the ASCII digits. If EAX receives a packed BCD number like DWORD 87654321h, it should return a string of ASCII digits in a buffer like "87654321" to display. For this, an array is defined as numbers DWORD 87654321h, 45346894h, 193492h, 123h, 3h
The output of ASCII buffer will be
87654321
45346894
00193492
00000123
00000003

## Solution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

.code
main8stub PROC

; Prepare for LOOP
mov ecx, 5; set loop variable to 5
mov esi, OFFSET numbers ; store the start address of numbers in esi
mov edx, OFFSET buffer ; set edx to startaddres of buffer array
L1:
; Prepare pointer to buffer and packed decimal number
; Call _PackedToAsC to convert to ASCII digits
; Display string of digits
; ...
mov eax, [esi]; set eax to current element in numbers
Call _PackedToAsc ; call the function
mov edx, OFFSET buffer; prepare array for printing
Call WriteString; ; print the string
Call Crlf ; new line
; Get next number
add esi, 4; set esi to the next element in numbers

loop L1
Call ReadChar; stop the execution to see the result
Invoke ExitProcess, 0 ; exit

main8stub ENDP...

By purchasing this solution you'll be able to access the following files:
Solution.zip.

\$10.00
for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

### Find A Tutor

View available Assembly Language Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.