home *** CD-ROM | disk | FTP | other *** search
/ CD Shareware Magazine 1996 December / CD_shareware_12-96.iso / DOS / Programa / CCDL122.ZIP / DOC / ASMINTER.DOC < prev    next >
Encoding:
Text File  |  1996-08-08  |  1.3 KB  |  31 lines

  1. the assembly language program must not modify any registers except the
  2. scratch registers:
  3.  
  4. 386:    EAX,ECX,EDX
  5. 68K:    D0-D2,A0-A1,FP0-FP2
  6.  
  7. Parameters are passed on the stack, with the leftmost parameter first.
  8. The compiler uses an unusual parameter passing sequence; for assembly
  9. language work it is useful to use a base pointer to index them.
  10.  
  11. On the 68K:
  12.  
  13.     A0 will be pre-loaded with the address of the parameter list.  
  14.     if you call a C function you must preload A0 with a pointer to
  15.     the parameter list.  This means a parameter list 
  16.     allocated by an assembly function need not be located on 
  17.     the stack; however the C compiler always allocates 
  18.     parameter lists on the stack.  return values are passed in D0 
  19.     or in FP0 if the function returns floating point.  In genenral
  20.     the compiler will move the a0 value to a6 (after pushig a6)
  21.     if it needs to access arguments.
  22.  
  23. On the 386:
  24.  
  25.     The parameters must always be on the stack.  The compiler 
  26.     indexes off ESP to get at them; however for assembly language 
  27.     work it is convenient to load ebp with the stack pointer 
  28.     (taking care to push ebp first) and then index off ebp.  The 
  29.     first parameter will normally be located at [ebp+8] if the 
  30.     loading is done first thing.  Return values are passed in EAX 
  31.     or on top of the FP stack.