Copyright (C) 2000-2012 |
GNU Info (nasm.info)Section 4.9.14.9.1. `%arg' Directive ----------------------- The `%arg' directive is used to simplify the handling of parameters passed on the stack. Stack based parameter passing is used by many high level languages, including C, C++ and Pascal. While NASM comes with macros which attempt to duplicate this functionality (see *Note Section 7.4.5::), the syntax is not particularly convenient to use and is not TASM compatible. Here is an example which shows the use of `%arg' without any external macros: some_function: %push mycontext ; save the current context %stacksize large ; tell NASM to use bp %arg i:word, j_ptr:word mov ax,[i] mov bx,[j_ptr] add ax,[bx] ret %pop ; restore original context This is similar to the procedure defined in *Note Section 7.4.5:: and adds the value in i to the value pointed to by j_ptr and returns the sum in the ax register. See *Note Section 4.7.1:: for an explanation of `push' and `pop' and the use of context stacks. automatically generated by info2www version 1.2.2.9 |