Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

DONT COPY OTHER CHEGG ANSWER PLEASE . Make reverse code output correctly as shown in the screenshot. Base - Plus - Index Read then Write

DONT COPY OTHER CHEGG ANSWER PLEASE . Make reverse code output correctly as shown in the screenshot. Base-Plus-Index Read then Write Exercise: displaying a string of characters to the monitor
This program will display a message of your choice by reading the input line then print it to the monitor.
a.
2. Assemble the following code at the default location (just enter "a 100")
a. Note only the offsets are shown as the line numbers below (don't type the offsets or comments after the semicolon)
MOV AX,2000; ;et data segment
MOV DS,AX
MOV SI,1000 ;point to storage location
MOV AH,1 ;read command /108 WAITFORLF TOP
INT 21 ; read one char into AL (this is 21Hex in debug)
CMP AL,0D ;test for line feed
JE 115 ;if line feed exit loop
MOV [SI],AL ;save character to array
INC SI ;increment byte array pointer to save next char
JMP 108 ;JMP TO WAITFORLF TOP
MOV BX,1000 ;set base of stored array data
SUB SI,1000 ;find number of entries
MOV CX,SI
MOV AH,02 ;write command /0120 WRITELOOPTOP
MOV DL,Bx; get byte for write command
INT 21 ;write to monitor
INC BX ;increment byte array pointer
DEC CX ;down count loop counter (when 0 exit)
JNZ ,011E,; JUMP TO WRITELOOPTOP
INT 3
3. Save the program either mark and copy the program in windows then paste to notepad,
4. Run the code by typing "g" for go
The message may repeat on the same line and overwrite itself
If it does add the following code before displaying the message back to cause it to display on the next line
MOV AH,2 ;write monitor command
MOV DL,0A,; carriage return
INT 21 ;write to monitor
Reverse the pattern that was input to the monitor so is prints out backwards in debug first then translate the code into the MASM51 template of part 2
For full credit, fix the code by using the SI register for the down count loop counter instead of CX, then use Bx+SI to point to the data (this will save having two down count registers in your code)
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions