Write an Assembly Language procedure that encodes an original string using the f
ID: 3771890 • Letter: W
Question
Write an Assembly Language procedure that encodes an original string using the following arrays Code1 BYTE "SHO5FUP3IK8EZG9XC0NQLDBlWVY4TR7AM6J2" Code2 BYTE "abcdefghijklmnopqrstuvwxyz0123456789" The encoding works as follows: Each uppercase letter occurs somewhere in Code1. The procedure searches the array for the letter, notes the index of the array in which the letter occurs, and then uses this index in array Code2 to find the corresponding lowercase letter that encodes the uppercase one. For Example, suppose that the original string contains the letter R. Because R is stored at index 3 in Code1, R is encoded as d, because it is the character stored at index 3 in Code2. Characters in the original string that are not found in the array Codel are unchanged. Your procedure should accept three parameters in registers ESI, EDI and ECX as follows: Offset address of the original string in ESI register. Offset address of the encoded string in EDI register. Length of the original string in ECX register.Explanation / Answer
NAME DISPLAY_OF_THE _GIVEN _PROGRAM
ASSUME CS:CODE,DS:DATA
DATA SEGMENT
ORG 1000H
MESSAGE1 DB 'HIPROGRAMMERS'
MESSAGE2 DB 'welcometoalp'
COUNT DW 17
SEARCH DB 'R'
FOUND DB 'STRING FOUND$'
NOT FOUND DB 'STRING NOT FOUND$'
DATA ENDS
CODE SEGMENT
ORG 2000H
START: MOV AX,DATA
MOV DS,AX
MOV CX,COUNT
MOV DI,OFFSET MESSAGE1
MOV AL,SEARCH
REPNE SCASB
JZ YES
MOV DX,OFFSET NOT FOUND
MOV AH,09
INT 21H
JMP OVER
YES: MOV SI,DI
MOV SI,OFFSET MESSAGE2
MOV AL,SI
MOV DX,OFFSET FOUND
MOV AH,09
INT 21h
OVER: MOV AH,4CH
INT 21H
CODE ENDS
END START
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.