home *** CD-ROM | disk | FTP | other *** search
File List | 1988-08-28 | 5.6 KB | 203 lines |
- Microsoft (R) Macro Assembler Version 5.10 8/28/88 02:13:55
- Page 1-1
-
-
- ;
- ; GETTIM.ASM
- ;
- ; Author: M. Steven Baker
- ; Date: August 27, 1988
- ;
- ; a GETTIM subroutine for LAHEY F77/32 bit
- ; must assemble with MASM 5.x or higher
- ; based on SAMPLE.ASM code from LAHEY supplemen
- tal disk
- ; FORTRAN calling convention with INTEGER*4 arg
- uments
- ; CALL GETTIM(ihr,imin,isec,i100)
- ; CALL GETDAT(iyear,imonth,iday)
-
- .386 ; required to generate 32-bit code/data
-
- ; It is very important when linking to F77L-EM/
- 32 program units that any data
- ; segments your assembly code uses have their c
- lass name as 'DATA' in order
- ; to link correctly. In addition, you must als
- o use the GROUP directive
- ; to include the data in group DGROUP. DS and
- ES are set to DGROUP by the
- ; FORTRAN code, and must be set that way on ret
- urn. Your code segment must
- ; also be included in the group CGROUP, and inc
- lude the directive:
- ; ASSUME DS:DGROUP, CS:CGROUP
-
- 0000 data segment dword public 'DATA'
- dgroup group data
-
- 0000 data ends
- ;
- ; Any code segments should have a class name of
- 'CODE'.
- ;
- 0000 excode segment dword public 'CODE'
- cgroup group excode
- assume cs:cgroup, ds:dgroup
- ;
- ; The procedure names must be declared public t
- o be addressable by
- ; other modules.
- ;
- public GETTIM, GETDAT
-
- 0000 GETTIM proc near
- ;
- ; Upon entry to any subroutine, F77L-EM/32 has
- pushed addresses of
- ; each argument onto the stack. In the calling
- Microsoft (R) Macro Assembler Version 5.10 8/28/88 02:13:55
- Page 1-2
-
-
- program,
- ; 'gettim' was defined as a simple subroutine;
- ; When all arguments have been dealt with,
- ; F77L-EM/32 issues a near call to the named ro
- utine.
- ;
- ; log4 = example( int2, int4, int2a, int2a(3),
- dp, cmpx )
- ; arg1 arg2 arg3 arg4 a
- rg5 arg6
- ;
- ; push ebp ; always do thi
- s... if EBP/ESP are used
- ; mov ebp, esp ; and this (ebp
- must be preserved)
- ;
- ; The arguments are pushed right to left; thus,
- the first argument
- ; is closest to ebp. At this point, the stack
- contains:
- ;
- ; offset of argn
- ; ...
- ; offset of arg1 = IHR
- ; return code offset (EIP) }-- four byte
- address from near call
- ; saved ebp <-- ebp, esp
- ;
- ; The first argument address is now 8 bytes fro
- m ebp, referenced at [ebp+8].
- ; Note that the minimum argument displacement i
- s 8 for subroutines and 12
- ; for functions.
- ;
- ; CALL GETTIM(ihr,imin,isec,i100)
- ;
- 0000 B4 2C mov ah,2ch ;DOS Get Time f
- unction
- 0002 CD 21 int 21h ;returns CH=hou
- r, CL=minute
- ; DH =se
- cond DL=hundredths
- 0004 8B 4424 04 mov eax,ss:[esp+4]
- 0008 C7 00 00000000 mov dword ptr [eax],0 ;zero v
- alue
- 000E 88 28 mov [eax],ch ;set mi
- nutes
- ;
- 0010 8B 4424 08 mov eax,ss:[esp+8]
- 0014 C7 00 00000000 mov dword ptr [eax],0 ;zero v
- alue
- 001A 88 08 mov [eax],cl ;set mi
- nutes
- ;
- Microsoft (R) Macro Assembler Version 5.10 8/28/88 02:13:55
- Page 1-3
-
-
- 001C 8B 4424 0C mov eax,ss:[esp+0ch]
- 0020 C7 00 00000000 mov dword ptr [eax],0 ;zero v
- alue
- 0026 88 30 mov [eax],dh ;set se
- conds
- ;
- 0028 8B 4424 10 mov eax,ss:[esp+10h]
- 002C C7 00 00000000 mov dword ptr [eax],0 ;zero v
- alue
- 0032 88 10 mov [eax],dl ;set 1/
- 100 seconds
- ;
- 0034 C3 ret
- 0035 GETTIM endp
-
- 0035 GETDAT proc near
- ;
- ; CALL GETDAT(iyear,imonth,iday)
- 0035 B4 2A mov ah,2ah ;DOS Get Date f
- unction
- 0037 CD 21 int 21h ;returns CX=yea
- r
- ; DH =mo
- nth DL=day
- 0039 8B 4424 04 mov eax,ss:[esp+4]
- 003D C7 00 00000000 mov dword ptr [eax],0 ;zero v
- alue
- 0043 66| 89 08 mov [eax],cx ;set ye
- ar
- ;
- 0046 8B 4424 08 mov eax,ss:[esp+8]
- 004A C7 00 00000000 mov dword ptr [eax],0 ;zero v
- alue
- 0050 88 30 mov [eax],dh ;set mo
- nth
- ;
- 0052 8B 4424 0C mov eax,ss:[esp+0ch]
- 0056 C7 00 00000000 mov dword ptr [eax],0 ;zero v
- alue
- 005C 88 30 mov [eax],dh ;set da
- y
- ;
- 005E C3 ret
- 005F GETDAT endp
-
-
- 005F excode ends
-
- end
- Microsoft (R) Macro Assembler Version 5.10 8/28/88 02:13:55
- Symbols-1
-
-
- Segments and Groups:
-
- N a m e Size Length Align Combine Class
-
- CGROUP . . . . . . . . . . . . . GROUP
- EXCODE . . . . . . . . . . . . 32 Bit 005F DWORD PUBLIC 'CODE'
- DGROUP . . . . . . . . . . . . . GROUP
- DATA . . . . . . . . . . . . . 32 Bit 0000 DWORD PUBLIC 'DATA'
-
- Symbols:
-
- N a m e Type Value Attr
-
- GETDAT . . . . . . . . . . . . . N PROC 0035 EXCODE Global Length = 002A
- GETTIM . . . . . . . . . . . . . N PROC 0000 EXCODE Global Length = 0035
-
- @CPU . . . . . . . . . . . . . . TEXT 3343
- @FILENAME . . . . . . . . . . . TEXT gettim
- @VERSION . . . . . . . . . . . . TEXT 510
-
-
- 115 Source Lines
- 115 Total Lines
- 12 Symbols
-
- 47168 Bytes symbol space free
-
- 0 Warning Errors
- 0 Severe Errors
-