简体   繁体   中英

Parsing string byte by byte in nasm assembly for 32-bit architecture

我是汇编语言的新手,如果问题很明显,我很抱歉。我正在尝试解决一个汇编程序,我需要为此程序逐个字符地解析一个字符串并对该字符进行一些操作并将其存储在另一个字符串中。我的问题是如何在nasm汇编中逐字符解析字符串。

do something like this:

    mov si, <adress of the string in memory>
    mov cx, <whatever value tells you how long the string is>
    cld      ; make sure lodsb walks forward, not back (that'd be std then)
again: 
    lodsb    ; get next char to AL and increase SI
    ;
    ; <al contains each char of string here, one by one>
    ;
    dec cx
    jnz again   ; same as "loop", but not so small

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM