|
Writing ProceduresThe most common blocks of code you will be writing will be procedures. The basic layout of a procedure looks as follows: comment block, procedure name, near or far, code, and finally ENDP. Your procedures will all be NEAR calls for the first project. I will cover the difference between near and far in class.
;=======================================================================
; strOut will write a string to the specified handle.
;=======================================================================
; PreCond -- The stack must be set up as follows:
; Handle (dest), Offset then Segment to string (src)
; PostCond -- The string will be written to the specified handle
; Remarks -- All registers are returned to their original states.
;=======================================================================
strOut PROC NEAR
; put your code here
strOut ENDP
To call a procedure in your code, simply add a line like
call strOut
I will cover argument passing in class, but the two basic methods of doing this are passing by register and passing using the stack. Your book covers this in some depth. I would recommend looking at passing parameters using the stack. Last Modified: January 26, 1999 - Barry E. Mapen |