Write a procedure named PackedToAsc that converts a 4-byte packed decimal number
ID: 3801394 • Letter: W
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. Write a short test program that demonstrates several conversions and displays the converted numbers on the screen. Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers. Note: we will only test this procedure with non-negative integers. Descriptions of this algorithm are available on the web
Explanation / Answer
Incorporate Irvine32.inc
.information
numbers DWORD 87654321h, 45346894h, 193492h, 123h, 3h
support BYTE 8 DUP(1), 0 ; 8 digits in addition to invalid character
.code
main8stub PROC
; Prepare for LOOP
L1:
; Prepare the pointer to support and a stuffed decimal number
; Call _PackedToAsC to change over to ASCII digits
; Display series of digits
; ...
; Get next number
circle L1
main8stub ENDP
;- - - - -
_PackedToAsc PROC
;
; methodology that changes over a 4-byte stuffed decimal number
; to a string of ASCII decimal digits
; Receives: EAX, One pressed decimal number
; EDX, The pointer to a cushion with ASCII returned
; Returns: String of ASCII digits in cushion pointed by EDX
;- - - - - -
_PackedToAsc ENDP
END main8stub
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.