home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c081_11 / 9.ddi / CHAPXMPL.ZIP / DOTOTAL.ASM < prev    next >
Encoding:
Assembly Source File  |  1991-02-13  |  1.4 KB  |  34 lines

  1. ; Turbo Assembler    Copyright (c) 1988, 1991 By Borland International, Inc.
  2.  
  3. ; DOTOTAL.ASM - Example for interfacing C++ and Turbo Assembler
  4.  
  5. ; From the Turbo Assembler User's Guide - Interfacing Turbo Assembler
  6. ;                                          with Borland C++
  7.  
  8.        DOSSEG                       ;select Intel-convention
  9.                                     ;segment ordering
  10.        .MODEL  SMALL                ;select small model 
  11.                                     ;(nearcode and data)
  12.        .DATA                        ;TC-compatible initialized
  13.                                     ;data segment
  14.        EXTRN   _Repetitions:WORD    ;externally defined
  15.        PUBLIC  _StartingValue       ;available to other modules
  16. _StartingValue  DW  0
  17.        .DATA?                       ;TC-compatible uninitialized
  18.                                     ;data segment
  19. RunningTotal    DW  ?
  20.        .CODE                        ;TC-compatible code segment
  21.        PUBLIC  _DoTotal
  22. _DoTotal        PROC                ;function (near-callable in
  23.                                     ;small model)
  24.        mov     cx,[_Repetitions]    ;# of counts to do
  25.        mov     ax,[_StartingValue]
  26.        mov     [RunningTotal],ax    ;set initial value
  27. TotalLoop:
  28.        inc     [RunningTotal]       ;RunningTotal++
  29.        loop    TotalLoop
  30.        mov     ax,[RunningTotal]    ;return final total
  31.        ret
  32. _DoTotal        ENDP
  33.        END
  34.