There is a program for counting odd elements. How to write a count of elements not equal to zero?
Turbo assembler
mov ax, data mov ds, ax lea bx, mas ;берём в bx адрес первого элемента mov cx, len ;счетчик цикла xor ax, ax ;обнуляем регистр cikl: mov al, [bx] ;прибавляем к al байт, адрес которого хранится в bx test ax,1 ;проверяем на четность jnz next inc numb; увеличиваем, если четно next: inc bx ;переходим к следующему элементу loop cikl
mov al, [bx]not an "append", it is an assignment.test ax, 1is not a parity check, it is a test for equality to one. - yeputonstest ax, 1is the low bit test for equality to one. It so happens that even numbers have a low bit of 0, and odd numbers have a 1 bit. So, this is quite a parity check. - insoloror ax,axand perkhod on the presence / absence of the flag Z - Mikecmp. - yeputons