Creating a MASM Procedure
Normally you follow these steps in creating a MASM procedure:
- Set up the procedure, defining compatible segments and declaring the
procedure.
- Enter the procedure and set up an appropriate stack frame.
- Preserve register values by pushing any registers on the stack that
you modify later.
- Reserve space on the stack for any local data (optional).
- Access arguments in the main body of your procedure.
- Deallocate any local data by returning space from the stack.
- Restore register values by popping any preserved registers from the stack.
- If you called the procedure as a function, return a value (optional).
- Set up the caller routine by restoring the caller stack frame.
- Exit the procedure and return to the caller program.