DATAW1 DW 97F4H COUNT2 DB ? ; ... SUB AL,AL ;clear AL to keep the number of 1s in BCD MOV DL,16 ;rotate total of 16 times MOV BX,DATAW1 ;move the operand to BX GAIN: ROL BX,1 ;rotate it once JNC NEXT ;check for 1. If CF=0 then jump ADD AL,1 ;if CF=1 then add one to count DAA ;adjust the count for BCD EXT: DEC DL ;go through this 16 times JNZ AGAIN ;if not finished go back MOV COUNT2,AL ;save the number of 1s in COUNT2