unix - Questions on mov command in assembly -


i have few issues using registers , storing data.

  1. before read in character want buffer of size 100 register esi points to. use this?

mov esi, 100 store buffer size 100, , then

mov esi, [al] inc esi 

to store current character entered esi , move next location store new character?

i can't find out how check if null terminated character entered. i've tried cmp al, 0xa check new line , cmp eax, -1 check eof.

note: have function called read_char read in character put al register

to define buffer in nasm can use buffer times 100 db 0

you address mov esi, buffer

to store character in al in it, , raise address write mov [esi], al inc esi

how check if null terminated character entered

the null byte following character. need compare word that. read character , following byte, compare:

mov ax, [esi] cmp ax, 0x000a 

this tests if linefeed last item in zero-terminated string.


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -