Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
15
Task/String-length/8086-Assembly/string-length.8086
Normal file
15
Task/String-length/8086-Assembly/string-length.8086
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
;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
|
||||
Loading…
Add table
Add a link
Reference in a new issue