Thursday, September 25, 2008

Write an assembly program to READ YOUR NAME AND DISPLAY IT IN NEWLINE

Write an assembly program to READ YOUR NAME AND DISPLAY IT IN NEWLINE

title read and display name

dosseg

.model small

.stack 100H

.code

main proc

                mov ax, @data ; initialize ds register

                mov ds, ax

 

                mov ah, 09h       ; display message1

                mov dx, offset msg1

                int 21h

               

                mov ah, 0ah       ; read string

                mov dx, offset string

                int 21h

               

                mov alt, 09h       ; your name is

                mov dx, offset msg2

                int 21h

 

                mov ah, 09h       ; string output

                mov dx, offset string

                int 21h

                mov ax, 4C00H ; return to DOS

                int 21H

main endp

end main

 

.data

                msg1 db "Enter your name $"

                msg2 db "OAH, ODH, your name is $"

                max db 20

                len db ?

                string db 20 DUP('$')


Please, test this program in an Assembler ie Macroassembler (MASM) or Turbo Assembler, NASM or emulators.

 

0 responses:

Post a Comment

Thanking you for your comment(s). Hope you will visit this blog again!

Subscribe to geeklog feed Bookmark and Share

Design by Free blogger template