Problem 2. Write the main program and subroutine that takes a set of 8-bit binar
ID: 1716630 • Letter: P
Question
Problem 2. Write the main program and subroutine that takes a set of 8-bit binary number, and converts them to their respective 2-character ASCII representation. Binary Hexadecimal ASCII Codes Examples: 1010 0101- A5 A' 41, 5'-35 1111000 i = F1 --> ‘F'= 46, 1-31 0000 00 10 = 02-> "O'= 30,'5'-32 0'-30, 5-32 41 35 46 31 30 32 A5 F1 02 sume that three parameters are passed to the subroutine. First, the starting address of the memory location where the se: of numbers are stored is passed in register X, second the starting address for the memory location where the ASCI codes will be stored is passed in register Y, and the length of the original data set is passed in register EB. a) Assume that threc parameters are passed to the subroutine. First, the sExplanation / Answer
data segment save db 10 dup(' ') , '$' ; the ASCII will save here data ends stack segment dw 128 dup(0) stack ends code segment assume cs:code , ds:data , ss:stack main proc far mov ax, data mov ds, ax mov es, ax mov di,offset save add di , 9 mov ax,0ffffh mov dx,0001h mov cx,10 ; dx ax will divide by cx convert: div cx add dl,'0' mov [di],dl dec di mov dx,0 cmp ax,cx jge convert add al,'0' mov [di] , al ;show the number mov ah,09h mov dx,offset save int 21h ; wait for any key.... mov ah, 1 int 21h mov ax, 4c00h ; exit to operating system. int 21h main endp code ends end main
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.