Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .model small
- .stack 100h
- .data
- ; First byte of buffer is number of characters to read (including Carriage Return)
- ; Second byte will be the number of bytes read (not including the Carriage Return).
- buffer db 9, 0, 9 dup("$")
- .code
- main proc
- mov ax,@data
- mov ds,ax
- LEA dx,buffer ; Read input. see: http://www.ctyme.com/intr/rb-2563.htm
- mov ah,0Ah
- int 21h
- ; Set BX to index of the Carriage Return in the buffer
- mov bh, 0 ; Upper part of BX set to 0
- mov bl,[buffer+1] ; [buffer+1] contains the nu,ber of chars read excluding Carriage Return
- mov [buffer+bx+2], '$' ; Replace the Carriage Return by a $ (end of string)
- LEA dx,buffer+2 ; Print out the string entered
- mov ah,09h
- int 21h
- LEA dx,buffer+2 ; Print out the string entered
- mov ah,09h
- int 21h
- mov ah,4ch
- int 21h
- main endp
- end main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement