;INPUT: DS:SI = BASE ADDR. OF STRING ;TYPICALLY, MS-DOS USES $ TO TERMINATE STRINGS. GetStringLength: xor cx,cx ;this takes fewer bytes to encode than "mov cx,0" cld ;makes string functions post-inc rather than post-dec. loop_GetStringLength: lodsb ;equivalent of "mov al,[ds:si],inc si" except this doesn't alter the flags. cmp '$' je done ;if equal, we're finished. inc cx ;add 1 to length counter. A null string will have a length of zero. jmp loop_GetStringLength done: ret