Answer to Question #295682 in Assembler for majid lakho

Question #295682

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.


1
Expert's answer
2022-02-09T10:40:41-0500
; 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

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS