home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 September
/
Simtel20_Sept92.cdr
/
msdos
/
progjorn
/
pj_6_6.arc
/
NDPF386.ARC
/
GETDAT.ASM
next >
Wrap
Assembly Source File
|
1988-08-28
|
3KB
|
117 lines
;
; GETTIM.ASM and GETDAT.asm
;
; Author: M. Steven Baker
; Date: August 27, 1988
;
; a GETTIM subroutine for NDP FORTRAN-386
; must assemble with Phar LAP 386asm
; FORTRAN calling convention with INTEGER*4 arguments
; 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 class name as 'DATA' in order
; to link correctly. In addition, you must also 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 return. Your code segment must
; also be included in the group CGROUP, and include the directive:
; ASSUME DS:DGROUP, CS:CGROUP
dataseg segment dword
dataseg ends
;
codeseg segment dword er public use32
assume cs:codeseg, ds:dataseg
;
; The procedure names must be declared public to be addressable by
; other modules.
;
public _gettim_, _getdat_
align 4
_gettim_ proc near
;
; Upon entry to any subroutine, NDP FORTRAN-386 has pushed addresses of
; each argument onto the stack. In the calling program,
; 'gettim' was defined as a simple subroutine;
; When all arguments have been dealt with,
; NDPF-386 issues a near call to the named routine.
;
; log4 = example( int2, int4, int2a, int2a(3), dp, cmpx )
; arg1 arg2 arg3 arg4 arg5 arg6
;
; push ebp ; always do this... 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 from ebp, referenced at [ebp+8].
; Note that the minimum argument displacement is 8 for subroutines and 12
; for functions.
;
; CALL GETTIM(ihr,imin,isec,i100)
;
mov ah,2ch ;DOS Get Time function
int 21h ;returns CH=hour, CL=minute
; DH =second DL=hundredths
mov eax,ss:[esp+4]
mov dword ptr [eax],0 ;zero value
mov [eax],ch ;set minutes
;
mov eax,ss:[esp+8]
mov dword ptr [eax],0 ;zero value
mov [eax],cl ;set minutes
;
mov eax,ss:[esp+0ch]
mov dword ptr [eax],0 ;zero value
mov [eax],dh ;set seconds
;
mov eax,ss:[esp+10h]
mov dword ptr [eax],0 ;zero value
mov [eax],dl ;set 1/100 seconds
;
ret
_gettim_ endp
_getdat_ proc near
;
; CALL GETDAT(iyear,imonth,iday)
;
mov ah,2ah ;DOS Get Date function
int 21h ;returns CX=year
; DH =month DL=day
mov eax,ss:[esp+4]
mov dword ptr [eax],0 ;zero value
mov [eax],cx ;set year
;
mov eax,ss:[esp+8]
mov dword ptr [eax],0 ;zero value
mov [eax],dh ;set month
;
mov eax,ss:[esp+0ch]
mov dword ptr [eax],0 ;zero value
mov [eax],dh ;set day
;
ret
_getdat_ endp
codeseg ends
end
;
; Do not put any label name or expression after the end statement! This
; defines a program entry point, which has already been defined by the
; Fortran MAIN module.