Friday, July 14, 2017

8086 Programming

How to get sentence as input and display each word in new line?

TITLE MULTILINE
.MODEL SMALL
.STACK 32
.DATA
MAXCHR DB 50H
ACTCHR DB ?
STR1 DB 50 DUP(?)
.CODE
MAIN PROC FAR
MOV AX,@DATA
MOV DS,AX

MOV AH,0AH
MOV DX,OFFSET MAXCHR
INT 21H

MOV AH,02H
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H

MOV CL,ACTCHR
MOV CH,00H
MOV BX,OFFSET STR1
 
L1:CMP BYTE PTR [BX],20H
JNZ L2
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H
INC BX
L2:MOV DL,[BX]
INT 21H
INC BX
LOOP L1

MOV AX,4C00H
INT 21H
MAIN ENDP

END MAIN

0 comments:

Post a Comment