home *** CD-ROM | disk | FTP | other *** search
/ Programmer Power Tools / Programmer Power Tools.iso / progjrn / pj_6_6.arc / LAHEY386.ARC / GETTIM.LST < prev    next >
Encoding:
File List  |  1988-08-28  |  5.6 KB  |  203 lines

  1. Microsoft (R) Macro Assembler Version 5.10                  8/28/88 02:13:55
  2.                                                              Page     1-1
  3.  
  4.  
  5.                 ;
  6.                 ; GETTIM.ASM
  7.                 ;
  8.                 ; Author:    M. Steven Baker
  9.                 ; Date:        August 27, 1988
  10.                 ;
  11.                 ; a GETTIM subroutine for LAHEY F77/32 bit
  12.                 ; must assemble with MASM 5.x or higher
  13.                 ; based on SAMPLE.ASM code from LAHEY supplemen
  14.                 tal disk
  15.                 ; FORTRAN calling convention with INTEGER*4 arg
  16.                 uments
  17.                 ;    CALL GETTIM(ihr,imin,isec,i100)
  18.                 ;    CALL GETDAT(iyear,imonth,iday)
  19.                 
  20.                 .386    ; required to generate 32-bit code/data
  21.                 
  22.                 ; It is very important when linking to F77L-EM/
  23.                 32 program units that any data
  24.                 ; segments your assembly code uses have their c
  25.                 lass name as 'DATA' in order
  26.                 ; to link correctly.  In addition, you must als
  27.                 o use the GROUP directive 
  28.                 ; to include the data in group DGROUP.  DS and 
  29.                 ES are set to DGROUP by the 
  30.                 ; FORTRAN code, and must be set that way on ret
  31.                 urn.  Your code segment must
  32.                 ; also be included in the group CGROUP, and inc
  33.                 lude the directive:
  34.                 ; ASSUME DS:DGROUP, CS:CGROUP
  35.                 
  36.  0000                data    segment    dword public 'DATA'
  37.                 dgroup    group    data
  38.                 
  39.  0000                data    ends
  40.                 ;
  41.                 ; Any code segments should have a class name of
  42.                  'CODE'.
  43.                 ;
  44.  0000                excode    segment    dword public 'CODE'
  45.                 cgroup    group    excode
  46.                 assume    cs:cgroup, ds:dgroup
  47.                 ;
  48.                 ; The procedure names must be declared public t
  49.                 o be addressable by
  50.                 ; other modules.
  51.                 ;
  52.                 public    GETTIM, GETDAT
  53.                 
  54.  0000                GETTIM    proc    near
  55.                 ;
  56.                 ; Upon entry to any subroutine, F77L-EM/32 has 
  57.                 pushed addresses of
  58.                 ; each argument onto the stack.  In the calling
  59. Microsoft (R) Macro Assembler Version 5.10                  8/28/88 02:13:55
  60.                                                              Page     1-2
  61.  
  62.  
  63.                  program,
  64.                 ; 'gettim' was defined as a simple subroutine; 
  65.                 ; When all arguments have been dealt with, 
  66.                 ; F77L-EM/32 issues a near call to the named ro
  67.                 utine.
  68.                 ;
  69.                 ; log4 = example( int2, int4, int2a, int2a(3), 
  70.                 dp, cmpx )
  71.                 ;          arg1  arg2  arg3     arg4   a
  72.                 rg5 arg6
  73.                 ;
  74.                 ;    push    ebp        ; always do thi
  75.                 s... if EBP/ESP are used
  76.                 ;    mov    ebp, esp    ; and this (ebp
  77.                  must be preserved)
  78.                 ;
  79.                 ; The arguments are pushed right to left; thus,
  80.                  the first argument
  81.                 ; is closest to ebp.  At this point, the stack 
  82.                 contains:
  83.                 ;
  84.                 ;    offset of argn
  85.                 ;         ...
  86.                 ;    offset of arg1 = IHR
  87.                 ;    return code offset  (EIP) }-- four byte
  88.                  address from near call
  89.                 ;    saved ebp    <-- ebp, esp
  90.                 ;
  91.                 ; The first argument address is now 8 bytes fro
  92.                 m ebp, referenced at [ebp+8].
  93.                 ; Note that the minimum argument displacement i
  94.                 s 8 for subroutines and 12
  95.                 ; for functions.
  96.                 ;
  97.                 ;    CALL GETTIM(ihr,imin,isec,i100)
  98.                 ;
  99.  0000  B4 2C                mov    ah,2ch        ;DOS Get Time f
  100.                 unction
  101.  0002  CD 21                int    21h        ;returns CH=hou
  102.                 r,   CL=minute
  103.                                 ;        DH =se
  104.                 cond DL=hundredths
  105.  0004  8B 4424 04            mov    eax,ss:[esp+4]
  106.  0008  C7 00 00000000            mov    dword ptr [eax],0    ;zero v
  107.                 alue
  108.  000E  88 28                mov    [eax],ch        ;set mi
  109.                 nutes
  110.                 ;
  111.  0010  8B 4424 08            mov    eax,ss:[esp+8]
  112.  0014  C7 00 00000000            mov    dword ptr [eax],0    ;zero v
  113.                 alue
  114.  001A  88 08                mov    [eax],cl        ;set mi
  115.                 nutes
  116.                 ;
  117. Microsoft (R) Macro Assembler Version 5.10                  8/28/88 02:13:55
  118.                                                              Page     1-3
  119.  
  120.  
  121.  001C  8B 4424 0C            mov    eax,ss:[esp+0ch]
  122.  0020  C7 00 00000000            mov    dword ptr [eax],0    ;zero v
  123.                 alue
  124.  0026  88 30                mov    [eax],dh        ;set se
  125.                 conds
  126.                 ;
  127.  0028  8B 4424 10            mov    eax,ss:[esp+10h]
  128.  002C  C7 00 00000000            mov    dword ptr [eax],0    ;zero v
  129.                 alue
  130.  0032  88 10                mov    [eax],dl        ;set 1/
  131.                 100 seconds
  132.                 ;
  133.  0034  C3                ret
  134.  0035                GETTIM    endp
  135.                 
  136.  0035                GETDAT    proc    near
  137.                 ;
  138.                 ;    CALL GETDAT(iyear,imonth,iday)
  139.  0035  B4 2A                mov    ah,2ah        ;DOS Get Date f
  140.                 unction
  141.  0037  CD 21                int    21h        ;returns CX=yea
  142.                 r
  143.                                 ;        DH =mo
  144.                 nth  DL=day
  145.  0039  8B 4424 04            mov    eax,ss:[esp+4]
  146.  003D  C7 00 00000000            mov    dword ptr [eax],0    ;zero v
  147.                 alue
  148.  0043  66| 89 08            mov    [eax],cx        ;set ye
  149.                 ar
  150.                 ;
  151.  0046  8B 4424 08            mov    eax,ss:[esp+8]
  152.  004A  C7 00 00000000            mov    dword ptr [eax],0    ;zero v
  153.                 alue
  154.  0050  88 30                mov    [eax],dh        ;set mo
  155.                 nth
  156.                 ;
  157.  0052  8B 4424 0C            mov    eax,ss:[esp+0ch]
  158.  0056  C7 00 00000000            mov    dword ptr [eax],0    ;zero v
  159.                 alue
  160.  005C  88 30                mov    [eax],dh        ;set da
  161.                 y
  162.                 ;
  163.  005E  C3                ret
  164.  005F                GETDAT    endp
  165.                 
  166.                 
  167.  005F                excode    ends
  168.                 
  169.                     end
  170. Microsoft (R) Macro Assembler Version 5.10                  8/28/88 02:13:55
  171.                                                              Symbols-1
  172.  
  173.  
  174. Segments and Groups:
  175.  
  176.                 N a m e             Size    Length     Align    Combine Class
  177.  
  178. CGROUP . . . . . . . . . . . . .      GROUP
  179.   EXCODE . . . . . . . . . . . .      32 Bit    005F    DWORD    PUBLIC    'CODE'
  180. DGROUP . . . . . . . . . . . . .      GROUP
  181.   DATA . . . . . . . . . . . . .      32 Bit    0000    DWORD    PUBLIC    'DATA'
  182.  
  183. Symbols:            
  184.  
  185.                 N a m e             Type     Value     Attr
  186.  
  187. GETDAT . . . . . . . . . . . . .      N PROC    0035    EXCODE    Global    Length = 002A
  188. GETTIM . . . . . . . . . . . . .      N PROC    0000    EXCODE    Global    Length = 0035
  189.  
  190. @CPU . . . . . . . . . . . . . .      TEXT  3343        
  191. @FILENAME  . . . . . . . . . . .      TEXT  gettim        
  192. @VERSION . . . . . . . . . . . .      TEXT  510        
  193.  
  194.  
  195.     115 Source  Lines
  196.     115 Total   Lines
  197.      12 Symbols
  198.  
  199.   47168 Bytes symbol space free
  200.  
  201.       0 Warning Errors
  202.       0 Severe  Errors
  203.