I noticed at my ASM book that author uses that LENGTHOF str
for finding the size of byte it is searching. Code:
.data
alpha BYTE "ABCDEFGH",0
.code
mov edi,OFFSET alpha ; EDI points to the string
mov al,'F' ; search for the letter F
mov ecx,LENGTHOF alpha ; set the search count
cld ; direction = forward
repne scasb ; repeat while not equal
jnz quit ; quit if letter not found
dec edi ; found: back up EDI
Is there a way to replace the LENGTHOF alpha
part? I am aware that len equ $-alpha
exists but for the sake of learning i search for more under the hood and "primitive" practices. So that I can understand better how that really works.