Write the code so that you can take input on the console and display each word in the next line. Run
this program and enter three subject/course names that you have studied this semester to test if it is
working properly or not.
; DosBox
DATA SEGMENT
MSG_ENTER DB "Enter three subject/course names: ",10,13,"$"
MSG_Line DB "$"
DATA ENDS
CODE SEGMENT
ASSUME DS:DATA,CS:CODE
START:
MOV AX,DATA
MOV DS,AX
LEA DX,MSG_ENTER ; "Enter ..."
MOV AH,9 ; Display string
INT 21H
mov cx,3 ; counter
begin:
MOV AH,1 ; Waiting for a key press
INT 21H
; AL = ASCII code of key pressed
cmp al,' '
jle nextLine
jmp begin
nextLine:
LEA DX,MSG_Line
MOV AH,9
INT 21H
loop begin
MOV AH,4CH
INT 21H
CODE ENDS
END START
Comments
Leave a comment