hai.,. I'm struggling now to solve this problem., I could not able to save the string inputed by the user., the emulator responces error:

INT 21h, AH=09h - 
address: 07140
byte 24h not found after 2000 bytes.
; correct example of INT 21h/9h:
mov dx, offset msg
mov ah, 9
int 21h
ret
msg db "Hello$

I only have 1 hr left to solver this., I really need help.,
Assembly is realy different from Java and vb which i also used..but now in string manipulation just takes me overnight and still does'nt work

; You may customize this and other start-up templates; 
; The location of this template is c:\emu8086\inc\0_com_template.txt

name "Lab_exercise"

org 100h

; add your code here

.model small

;filename  db 30,?, 30 dup(' ')

name db $,<' '> 

.stack 200

.data
    msg1 db " Enter your name: " , "$"
    msg2 db " Enter your address: ","$"
    msg3 db " Enter your school: " ,"$"
    
    thename db 20 DUP <' '>
    para_list LABEL BYTE

.code
          
Main PROC

HouseKeeping:     
     mov ax,@data
     mov ds,ax
        
Prompt:
        
     ;prompt the user to input name
     lea dx,msg1
     mov ah,9
     int 21h
     
     mov ah, 06h
     mov al,00h
     int 10h
    
GetWord:        
     ;user input text  
     mov ah,0ah
     lea dx,para_list
     int 21h
     
     mov thename,al
     ;set cursor position for input address
     ;mov dh,1
     ;mov dl,0
    ; mov ah,02
     ;int 10h
             
 
    ; lea dx,msg1
     ;mov ah,9
     ;int 21h
     
        ;user input text  
     ;mov ah,0ah
     ;int 21h
     
     
     
     lea dx,thename
     mov ah,9
     int 21h 
     
     ;mov ah,00h
     ;int 16h
     
     ;mov ah, 0eh
     ;int 10h
     
     ;wait for any key
     mov ah,0
     int 16h
end

ret

Edited 6 Years Ago by peter_budo: Keep it Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)

mov ah,0ah
lea dx,para_list  ; DS:DX should point to buffer with
                          ; first byte containing length
int 21h
 
mov thename,al ;On return from 21/0A AL=last char read
                          ; usually the carriage return 0D

A correct buffer used as a
parameter to function 21/0A would have the following form:
Byte +0 - Length
Byte +1 - Num of characters actually read
Byte +2 - Start of actual buffer

Here is an example that reads in 16 bytes:

buf db 10h,0
      db 10h dup (?)
start:
mov ah, 0ah
lea dx, buf
int 21h

hi i am renuka please go through the following pro for lenght calculation

print macro mes
mov ah, 09h
lea dx, mes
int 21h
endm
.model small
.data
ms1 db 10,13,"enter the string: $"
ms2 db 10,13, "$"
buff db 80
.code
start: mov ax,@data ;initialize data segment
mov ds,ax
print ms1 ; call macro print to display ms1 on screen
mov ah,0ah ; input the string
lea dx,buff
int 21h
print ms2 ; call macro print to display ms2 on screen
mov cl,buff+1 ; cl=character count
;mov bx,0000h ; bx=00

end start

why to write buff+1 to get length,its giving diff ans for buff+2,+0

Hi Guys, i am recently studying Assemble. I know this post if old. In the Univ. with use DEBUG in DOS to write the code... (which is ugly for me). How I can translate this example to use it on DEBUG? Thanks.

This article has been dead for over six months. Start a new discussion instead.