home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_144 / 1.ddi / CLIBSRC1.ZIP / H_SPUSH.ASM < prev    next >
Encoding:
Assembly Source File  |  1992-06-10  |  2.0 KB  |  65 lines

  1. ;[]-----------------------------------------------------------------[]
  2. ;|      H_SPUSH.ASM -- struct argument routine                       |
  3. ;[]-----------------------------------------------------------------[]
  4.  
  5. ;
  6. ;       C/C++ Run Time Library - Version 5.0
  7. ;       Copyright (c) 1987, 1992 by Borland International
  8. ;       All Rights Reserved.
  9.  
  10.                 INCLUDE RULES.ASI
  11.  
  12. ; calls to this routine are generated by the compiler to copy
  13. ; a "struct" argument to the stack
  14. ;
  15. ; DX:AX = address of struct to copy to stack
  16. ; CX    = size of struct, in bytes
  17. ;
  18.  
  19. _TEXT           SEGMENT BYTE PUBLIC 'CODE'
  20.                 ASSUME  CS:_TEXT
  21.  
  22.                 PUBLIC  SPUSH@
  23.                 PUBLIC  F_SPUSH@
  24.                 PUBLIC  N_SPUSH@
  25.  
  26. N_SPUSH@:
  27.                 pop     bx              ;fetch return address off stack
  28.                 sub     sp,cx           ;make room on stack for struct
  29.                 push    cs              ;save return address back on stack
  30.                 jmp     short PUSHIT
  31. SPUSH@:
  32. F_SPUSH@:
  33.                 pop     bx              ;fetch return address off stack
  34.                 pop     es
  35.                 sub     sp,cx           ;make room on stack for struct
  36.                 push    es              ;save return address back on stack
  37. PUSHIT:
  38.                 push    bx
  39.  
  40.                 push    di              ;save regs
  41.                 push    ds
  42.  
  43.                 mov     di,sp           ;set up di for move
  44.                 add     di,8
  45.                 mov     bx,ss           ;es = ss for move
  46.                 mov     es,bx
  47.                 mov     ds,dx           ;set up ds for move
  48.                 xchg    ax,si           ;set up si for move (also saves si)
  49.  
  50.                 cld
  51.                 shr     cx,1
  52.                 rep     movsw
  53.                 adc     cx,cx
  54.                 rep     movsb
  55.  
  56.                 xchg    si,ax           ;restore si
  57.                 pop     ds
  58.                 pop     di
  59.                 retf
  60. _TEXT           ENDS
  61.                 END
  62.  
  63.