Answer the question
In order to leave comments, you need to log in
How to rewrite a program?
Greetings.
I need to rewrite my program using the 3Fh and 40h functions, and copy the characters from the stack via PUSH and POP.
The program allows you to enter a string of 10 characters and output the first three.
sstack SEGMENT para stack "stack"
DB 100 dup (?)
sstack ENDS
sdata SEGMENT para "data"
Message DB "Enter the string:",10,13, "$"
MaxLength DB 11
CurrentLehgth DB ?
s1 DB 11 DUP(?)
s2 DB 4 DUP(?)
new_line DB 10,13,"Output :","$"
sdata ENDS
scode SEGMENT para "code"
ASSUME CS:scode, DS:sdata
start:
mov AX, sdata
mov DS, AX
mov AH, 9
mov DX, offset Message
int 21h
mov AH, 0Ah
mov DX, offset MaxLength
int 21h
mov AH, 9
mov DX, offset new_line
int 21h
mov AL, s1
mov s2, AL
mov BL, CurrentLehgth
mov BH, 0
mov AL, s1[0]
mov s2,al
mov AL, s1[1]
mov s2+1,al
mov AL, s1[2]
mov s2+2,al
mov s2+3, "$"
mov s1[BX], "$"
mov ah, 9
mov dx, offset s1
int 21h
mov ah, 9
mov DX, offset new_line
int 21h
mov ah, 9
mov dx, offset s2
int 21h
mov ah, 04ch
int 21h
scode ENDS
END start
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question