Im having a problem with a final part of my assignment. We get in a stream of bits, etc etc, in the stream is an integer with the number of 1’s in the text portion. I get that integer and its 24 which is correct, now i loop through the text data i get and i try to count all the 1’s in there. But my proc is always returning zero.
I was able to make sure it was looping properly and it is.
The text = Hello which is 16 1’s, here is my proc for looping through that text to count the number of ones in it.
sub AX,AX sub SI,SI mov bx,[bp+6] ;get message offset @@mainLoop: mov cx,8 mov dh,80h cmp byte ptr [bx + si],0 je @@endChecker @@innerLoop: test byte ptr [bx + si],dh jz @@zeroFound inc AX @@zeroFound: shr bh,1 loop @@innerLoop @@continue: inc si jmp @@mainLoop
the rest of the proc is just push/pops. What im wanting this to actually do is use TEST to compare 100000000 to a byte, if its a 1 inc AX else shift right the mask by 1 and loop a whole byte, than inc to next byte and do again.
‘shr bh,1’ should probably be ‘shr dh,1’, no?