home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_144 / 5.ddi / TASMEXMP.ZIP / COUNTADD.ASM < prev    next >
Encoding:
Assembly Source File  |  1992-06-10  |  1001 b   |  33 lines

  1. ; Turbo Assembler    Copyright (c) 1988, 1991 By Borland International, Inc.
  2.  
  3. ; COUNTADD.ASM  - Example of getting around name mangling
  4.  
  5. ; From the Turbo Assembler Users Guide
  6.  
  7.      .MODEL small   ; Select small model (near code and data)
  8.      .CODE
  9.      PUBLIC _count_add_increment
  10. _count_add_increment  PROC
  11.      ARG count_offset:word      ; Address of the member variable
  12.      push bp                    ; Preserve caller's stack frame
  13.      mov  bp,sp                 ; Set our own stack frame
  14.      mov  bx,[count_offset]     ; Load pointer
  15.      inc  word ptr [bx]         ; Increment member variable
  16.      pop  bp                    ; Restore callers stack frame
  17.      ret
  18. _count_add_increment  ENDP
  19.  
  20.      PUBLIC _count_add_add
  21. _count_add_add  PROC
  22.      ARG count_offset:word,what_to_add:word
  23.      push bp
  24.      mov  bp,sp
  25.      mov  bx,[count_offset]     ; Load pointer
  26.      mov  ax,[what_to_add]
  27.      add  [bx],ax
  28.      pop  bp
  29.      ret
  30. _count_add_add  ENDP
  31.  
  32.      end
  33.