;============================================================================== ;file :mainParity.asm ;author :Andre Long ;due :March 13, 2006 ;description :This program will call a subprocedure called "parity" that will ; return the number of bits set to "1" for some input value ;============================================================================== ;Procedures To INCLUDE Pcmac.inc ;macros EXTRN NEWLINE:FAR ;display a new line EXTRN PUTBIN:FAR ;display number in binary EXTRN GETDEC$:FAR ;get 16-bit decimal unsigned EXTRN PUTDEC$:FAR ;display 16-bit decimal unsigned EXTRN PUTSTRNG:FAR ;display a string EXTRN parity:FAR ;count bits set to "1" ;============================================================================== .MODEL SMALL .586 .STACK 100h ;============================================================================== .DATA PUBLIC inputNumber PUBLIC parityBits getInput DB " Please enter a decimal number: ", '$' outPut1 DB " Number of bits set to 1 = ", '$' outPut2 DB " Binary format of entered number is: ", '$' inputNumber DW ? parityBits DW ? ;============================================================================== .CODE mainParity proc _Begin sPutStr getInput call GETDEC$ sPutStr outPut2 mov bl, 1 call PUTBIN mov inputNumber, ax call parity call NEWLINE sPutStr outPut1 mov ax, parityBits call PUTDEC$ _Exit mainParity endp end mainParity