80x86 assembly language I need to code the subroutine gets. The subroutine gets
ID: 3785915 • Letter: 8
Question
80x86 assembly language
I need to code the subroutine gets.
The subroutine gets has the following C signature: void gets(char *p).
When gets is invoked it receives a pointer to a location in memory that is ready to receive a string. The subroutine gets invokes getche() in a loop receiving characters from the user and saving each character within the memory space pointed to by p. When user presses enter key gets stops. program adds '' character to the end of string including the enter key.
i wrote my getche
getche:
mov ah, 1
int 21h
ret 2
Explanation / Answer
.data
index DB p
.code
getche:
MOV AH,01
INT 21H
MOV index,AL
INC index
CMP AL,0DH
JNZ getche
mov dl, ‘‘ ; dl = ‘a‘
MOV index,dl;
Comments:
1. First is the data segment where we store the pointer "P" to a variable "index"
2. "getche:" loop starts
3. at the end '' is added to last address
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.