Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .data
- string db 80 dup(" ") ; Hold up to 80 characters
- str_length dw -1 ; Must start on -1 as return key is a character
- char db ?
- proc readString
- push ax bx
- clc
- mov bx, OFFSET string
- next_char:
- call readChar
- jc done
- mov al, char
- mov [bx],al
- inc bx
- jmp next_char
- done:
- pop bx ax
- ret
- endp readString
- proc readChar
- push ax
- mov ah,1
- INT 21H
- mov char,al
- cmp char, 13 ; IS IT RETURN CHARACTER??
- jnz done2
- stc ; Set the Carry Flag
- done2:
- inc str_length ; Keep track of how many characters are entered
- pop ax
- ret
- endp readChar
Add Comment
Please, Sign In to add comment