Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write an Assembly Language procedure that encodes an original string using the f

ID: 3771197 • Letter: W

Question

Write an Assembly Language procedure that encodes an original string using the following arrays
Code1 BYTE “SHO5FUP3IK8EZG9XC0NQLDB1WVY4TR7AM6J2”

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 Code1 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.


2. Write an Assembly Language procedure that converts all lower case letters of a string into upper case letters. The procedure should accept two parameters in registers ESI and ECX as follows:

Offset address of the string in ESI register.

Length of the original string in ECX register.


3. Write an assembly language program that allows the user to enter a string of characters from the keyboard. The program should convert all lower case letters in the original string into upper case letters, and call the Encoding procedure. The program should display the result on the screen using an appropriate message. An example of a dialogue with the user is as follows:


Enter a string (Max. 60 characters): Good Morning Oman
Your encoded string is: nccv 6c3sisn c65s


Notes: You need to use the ReadString and WriteString procedures to read a string from the keyboard, and to display a string on the screen.


.data OLDSTR BYTE 61 DUP(0); assume maximum string size of 60 NEWSTR BYTE 61 DUP(0) ;add any needed data definitions
.code main PROC ; write your main procedure here
main ENDP
; add the Other procedures here
END main

Explanation / Answer

2 Program:

NAME DISPLAY_OF_STRINGS
ASSUME CS:CODE,DS:DATA
DATA SEGMENT
ORG 1000H
CODE1 BYTE “SHO5FUP3IK8EZG9XC0NQLDB1WVY4TR7AM6J2”
CODE2 BYTE “abcdefghijklmnopqrstuvwxyz0123456789”
DATA ENDS

CODE SEGMENT
ORG 2000H
START: MOV AX,DATA
MOV DS,AX
MOV AH,09H
MOV DX,OFFSET CODE1
INT 21H
MOV AH,4CH
INT 27H
MOV AH,09H
MOV DX,OFFSET CODE2
INT 21H
MOV AH,4CH
INT 27H
CODE ENDS
END START

3 Program:.

NAME DISPLAY_OF_LOWERSTRING_UPPERSTRING
ASSUME CS:CODE,DS:DATA
DATA SEGMENT
ORG 1000H
MESSAGE DB 'good morning oman'
COUNT DW 17
DATA ENDS

CODE SEGMENT
ORG 2000H
START: MOV AX,DATA
MOV DS,AX
MOV ES,AX
   MOV SI,0
MOV CX,COUNT
AGAIN:   MOV AL,MESSAGE[SI]
SUB AL,20H
MOV MESSAGE[SI],AL
INC SI
LOOP AGAIN
MOV AH,4CH
INT 27H
CODE ENDS
END START

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote