In this blog post, we’ll explore how to count the number of ‘0’s and ‘1’s in a binary string using an 8086 assembly language program. The following code snippet demonstrates this process:
DATA SEGMENT STR1 DB "00011100" NZ DW ? NO DW ? DATA ENDS CODE SEGMENT ASSUME CS:CODE, DS:DATA START: MOV AX, DATA MOV DS, AX LEA SI, STR1 MOV BX, 00H MOV DX, 00H MOV CX, 08H UP: MOV AX, [SI] ROR AX, 1 JNC ZE INC BX JMP DN ZE: INC DX DN: INC SI DEC CX JNZ UP MOV NZ, DX MOV NO, BX INT 3 CODE ENDS END STARTContinue reading 8086 Assembly Program to Count Number of 0’s and 1’s from a String