;============================================================================== ;file :parity.asm ;author :Andre Long ;due :March 13, 2006 ;description :This subprocedure will count the number of bits set to "1" ;============================================================================== ;Procedures INCLUDE Pcmac.inc ;macros EXTRN inputParity:word EXTRN parityBits:word EXTRN PUTBIN:FAR EXTRN NEWLINE:FAR EXTRN PUTDEC$:FAR ;============================================================================== .MODEL SMALL .586 .STACK 100h ;============================================================================== .DATA count DW 0 ;============================================================================== .CODE parity proc push ax push bx push cx push dx mov parityBits, 0 mov count, 0 mov bx, inputParity start: mov ax, bx and ax, 1 add parityBits, ax shr bx, 1 add count, 1 cmp count, 11 jb start pop dx pop cx pop bx pop ax ret parity endp end