home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / math / ultra101 / ultra_c.asm < prev    next >
Encoding:
Assembly Source File  |  1992-03-26  |  2.5 KB  |  117 lines

  1. ; Program:      ULTRA.ASM (Turbo C version)
  2. ;
  3. ; Description:  The greatest random number generator that ever was
  4. ;               or ever will be.  Way beyond Super-Duper.
  5. ;               (Just kidding, but we think its a good one.)
  6. ; Authors:      Arif Zaman (arif@stat.fsu.edu) and
  7. ;               George Marsaglia (geo@stat.fsu.edu).
  8. ; Date:         26 March 1992
  9. ; Version:      1.01
  10. ; Copyright:    To obtain permission to incorporate this program into
  11. ;               any commercial product, please contact the authors at
  12. ;               the e-mail address given above or at
  13. ;
  14. ;               Department of Statistics and
  15. ;               Supercomputer Computations Research Institute
  16. ;               Florida State University
  17. ;               Tallahassee, FL 32306.
  18. ;
  19. ; See Also:     The file ULTRA.DOC contains detailed comments
  20. ;
  21.    DOSSEG
  22.    .MODEL m,c
  23.  
  24. ;===== B: GLOBAL FUNCTIONS, SUBROUTINES and VARIABLES =================
  25. ;
  26.     public  i31bit, i15bit, i7bit,  i1bit,  uni,    duni,
  27.     public  i32bit, i16bit, i8bit,  rinit,  vni,    dvni
  28.     public  swbfill,swbx,   swbn
  29.  
  30. ;===== D. MACRO DEFINITIONS ===========================================
  31. ;
  32. ; RinitProcStart should take two 32-bit arguments conx and shrx
  33. ;   and place them in the data segment in congx and shrgx.
  34. ;   es and ds should both point to the data segment.
  35. ;   conx must be odd (so we or with 1 just to make sure).
  36. ; FillProc
  37. ;   DS is already the data segment. ES should also be made the same.
  38.  
  39. EnterProcedure   macro
  40.     if @DataSize eq 2
  41.       mov  dx,seg x
  42.       push ds
  43.       mov  ds,dx
  44.     endif
  45. endm
  46.  
  47. ExitProcedure    macro
  48.     if @DataSize eq 2
  49.       pop ds
  50.     endif
  51.     ret
  52. endm
  53.  
  54. RinitProcStart   macro
  55.   rinit   proc conx:dword, shrx:dword
  56.   EnterProcedure
  57.     push si
  58.     push di
  59.     mov ax,ds
  60.     mov es,ax
  61.     mov ax,word ptr conx
  62.     or  al,1
  63.     mov conglo,ax
  64.     mov ax,word ptr conx+2
  65.     mov conghi,ax
  66.     mov ax,word ptr shrx
  67.     mov shrglo,ax
  68.     mov ax,word ptr shrx+2
  69.     mov shrghi,ax
  70. endm
  71.  
  72. RinitProcEnd     macro
  73.     pop di
  74.     pop si
  75.   ExitProcedure
  76.   rinit endp
  77. endm
  78.  
  79. FillProcStart    macro
  80.   fillswb proc near
  81.     mov ax,ds
  82.     mov es,ax
  83.     push si
  84.     push di
  85. endm
  86.  
  87. FillProcEnd      macro
  88.     pop di
  89.     pop si
  90.     ret
  91.   fillswb endp
  92. endm
  93.  
  94. DwordFn macro
  95. endm
  96.  
  97. WordFn  macro
  98. endm
  99.  
  100. ByteFn  macro
  101. endm
  102.  
  103. RealFn  macro
  104. endm
  105.  
  106. DoubleFn macro
  107. endm
  108.  
  109. .DATA
  110.   INCLUDE ULTRADAT.INC
  111.  
  112. .STACK 10h
  113.  
  114. .CODE
  115.   INCLUDE ULTRACOD.INC
  116.  
  117. END