简体   繁体   English

linux nasm程序集隔离字符串中的字符

[英]linux nasm assembly isolating characters in a string

If I had a string declared like this: 如果我有这样声明的字符串:

message db "ABCDEFGHIJ",0

how could I create a pointer that would allow me to point to a specific character in this string, such as the 'A' character. 如何创建一个指针,使我可以指向该字符串中的特定字符,例如'A'字符。 And also, how could I create a loop that would allow me to increment the pointer and as a result, cycle through the entire string? 而且,如何创建一个循环,使我可以增加指针,从而循环遍历整个字符串?

    mov ecx, message ; Masm would use "offset"
top:
    mov al, [ecx] ; get a character
    inc ecx  ; get ready for next one
    cmp al, 0  ; end of string?
    jz done
; do something intelligent with al
    jmp top
done:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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