TITLE Simple Procedure Practice... (ford1.asm) ; Permutations and combinations INCLUDE Irvine32.inc .data sQueryStr BYTE "Enter the number of objects to choose from: ", 0 sChooseStr BYTE "Enter the number of objects to choose: ", 0 sInvalidInt BYTE "You have entered an invalid integer!" , 0 sError BYTE "Could not complete calculation!", 0 sResult BYTE "The result is: ", 0 .code main PROC mov edx, OFFSET sQueryStr call WriteString call ReadInt jnc okay1 badInt: mov edx, OFFSET sInvalidInt call WriteString call crlf jmp myExit okay1: push eax mov edx, OFFSET sChooseStr call WriteString call ReadInt jc badInt push eax call Calc jc ErrorInCalc mov edx, OFFSET sResult call WriteString call WriteInt call crlf jmp myExit ErrorInCalc: mov edx, OFFSET sError call WriteString call crlf myExit: exit main ENDP ; Calc should compute the number of combinations one can choose n objects from a set of m objects ; It should handle unexpected inputs and print a suitable error message on meaningless ; requests (like choosing 0 objects from 20, or 20 from 1). ; It should not change any of the registers except eax, which should contain the final value ; It should not mindlessly pushad :) at the beginning of the code ; If the calculation cannot be carried out, it should print a meaningful error message, set ; the carry flag and return a value of 0 in eax. If the calculation is successful it should ; clear the carry flag ; You should manage the stack *without* masm macros (like USES or forms like dataPTR: PTR WORD) ; You may, however, use LOCAL. Calc PROC ; Replace the following... enjoy. mov eax, 12345h ; Example code L2: ret Calc ENDP end Main