I’m trying to write a procedure to read a byte string from input and store it in ASCIIZ format (string ends with 0). Below is the code I have up until now; after I read the string, I can’t figure out how to access the last byte in the string and set it to 0.
READ_ASCIIZ PROC
PUSH BP
MOV BP, SP
MOV AH, 0AH
MOV DX, 4H[BP]
INT 21H
POP BP
RET 2H
READ_ASCIIZ ENDP
You could do it in the following manner (in nasm syntax, untested):
(Note this isn’t the most optimized way to do it)