home *** CD-ROM | disk | FTP | other *** search
- the assembly language program must not modify any registers except the
- scratch registers:
-
- 386: EAX,ECX,EDX
- 68K: D0-D2,A0-A1,FP0-FP2
-
- Parameters are passed on the stack, with the leftmost parameter first.
- The compiler uses an unusual parameter passing sequence; for assembly
- language work it is useful to use a base pointer to index them.
-
- On the 68K:
-
- A0 will be pre-loaded with the address of the parameter list.
- if you call a C function you must preload A0 with a pointer to
- the parameter list. This means a parameter list
- allocated by an assembly function need not be located on
- the stack; however the C compiler always allocates
- parameter lists on the stack. return values are passed in D0
- or in FP0 if the function returns floating point. In genenral
- the compiler will move the a0 value to a6 (after pushig a6)
- if it needs to access arguments.
-
- On the 386:
-
- The parameters must always be on the stack. The compiler
- indexes off ESP to get at them; however for assembly language
- work it is convenient to load ebp with the stack pointer
- (taking care to push ebp first) and then index off ebp. The
- first parameter will normally be located at [ebp+8] if the
- loading is done first thing. Return values are passed in EAX
- or on top of the FP stack.