Here’s a simple 8086 assembly language program to count the characters in the string "i know assembly programming":
<code class="language-assembly">section .datas1 db 'i know assembly programming', 0 ; String with null terminator count db 0 ; To store the character count
section .text global _start
_start: mov si, s1 ; Load address of the string into SI xor cx, cx ; Clear CX for counting characters
count_loop: cmp byte [si], 0 ; Check for null terminator je done ; If found, jump to done inc cx ; Increment character count inc si ; Move to the next character jmp count_loop ; Repeat the loop
done: mov count, cl ; Store the count in 'count' ; Further code to exit or display the count can go here
</code>
This program initializes a string and counts the characters until it encounters the null terminator, storing the final count in a variable.
Copyright © 2026 eLLeNow.com All Rights Reserved.