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

The goal of this lab is to familiarize you with assembly language programs. You

ID: 3813879 • Letter: T

Question

The goal of this lab is to familiarize you with assembly language programs. You need to work in teams of 2 to complete this lab. You need to modify the class example "Copying a String" at the end of the Assembly Language II lecture. You need to modify the example program so it copies from the end of the source string and stores the copied values starting at the beginning of the target (destination) string. The target string should be the reversed version of the source string. For example, the program should take a source string of "RCGC CSC203" and create a target string "302CSC CGCR". You cannot use the stack push and pop operations for this assignment. The purpose of this assignment is to learn how to use a loop and arrays. Requirements: Display source string on the screen. Use a LOOP instruction to build a loop used to copy a character at a time from the source to the destination. Finally, display the target (destination) string on the screen. Place a comment at the beginning of your program with your names and date completed. (Need x86 processor program) or (Irvine 32 library based).

Explanation / Answer

.MODEL SMALL
.DATA
        STR1    DB      5   DUP(' '),'$'
        STR2    DB      5   DUP(' '),'$'
        NL      DB      0DH,0AH,'$'
.CODE

MAIN    PROC

        MOV AX,@DATA
        MOV DS,AX

        LEA SI,STR1
        LEA DI,STR2

        MOV AH,01H

AGAIN:
        INT 21H

        CMP AL,0DH
        JE BAK
        MOV [SI],AL
        INC SI
        JMP AGAIN
     
BAK:
        MOV AL,'$'
        MOV [SI],AL

        MOV AH,09H

        LEA DX,NL
        INT 21H
        LEA SI,STR1
        MOV CX,LENGTH STR1
        ADD CX,1
DOTHIS:
       
        MOV AL,[SI]
        MOV [DI],AL

        INC DI
        INC SI
        LOOP DOTHIS

        MOV AL,'$'
        MOV [DI],AL

        MOV AH,09H
        LEA DX,NL
        INT 21H

        LEA DX,STR2
        INT 21H

        MOV AH,4CH
        INT 21H

MAIN    ENDP
END   MAIN

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