D
D
DartNyan2015-10-07 15:56:16
assembler
DartNyan, 2015-10-07 15:56:16

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.

spoiler
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


PS: I read Kalashnikov, but it doesn't help much. Recommend literature with lots of simple examples.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Martyanov, 2015-10-07
@vilgeforce

Zubkov's textbook is good.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question