home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 181.img / TASM-101.ZIP / CHAPXMPL.ARC / DOTOTAL.ASM < prev    next >
Assembly Source File  |  1989-05-02  |  1KB  |  27 lines

  1.        DOSSEG                       ;select Intel-convention
  2.                                     ;segment ordering
  3.        .MODEL  SMALL                ;select small model 
  4.                                     ;(nearcode and data)
  5.        .DATA                        ;TC-compatible initialized
  6.                                     ;data segment
  7.        EXTRN   _Repetitions:WORD    ;externally defined
  8.        PUBLIC  _StartingValue       ;available to other modules
  9. _StartingValue  DW  0
  10.        .DATA?                       ;TC-compatible uninitialized
  11.                                     ;data segment
  12. RunningTotal    DW  ?
  13.        .CODE                        ;TC-compatible code segment
  14.        PUBLIC  _DoTotal
  15. _DoTotal        PROC                ;function (near-callable in
  16.                                     ;small model)
  17.        mov     cx,[_Repetitions]    ;# of counts to do
  18.        mov     ax,[_StartingValue]
  19.        mov     [RunningTotal],ax    ;set initial value
  20. TotalLoop:
  21.        inc     [RunningTotal]       ;RunningTotal++
  22.        loop    TotalLoop
  23.        mov     ax,[RunningTotal]    ;return final total
  24.        ret
  25. _DoTotal        ENDP
  26.        END
  27.