Reputation: 123
Assuming you've read some ascii text into a character buffer of length say, 255 . How can you retrieve the length of the ascii text stored in the buffer into a CX register? (EDITED)
Thanks
Upvotes: 1
Views: 6657
Reputation: 490118
Search for the '$' using rep scasb
, then subtract to get the distance from the beginning of the string.
; warning: untested code.
mov di, offset buffer
mov al, '$'
mov cx, 255
repnz scasb
sub di, offset buffer
mov cx, di
Upvotes: 2