		name	date
;
;
; subroutine date: assembly language routine to allow the acquisition
; of the current date
;
; fortran call is : call date(month,day,year) 
;
; where: month = munber of month(1-12), day = number of day(1-31)
;	   year = current year(1980-2099)
;
;
;	interface to IBM professional fortran 1.0

stack_size	equ	6	; number of bytes needed on stack

data		segment
		db	'date    '
sp_save	dw	?
		dd	date
		dd	0
data		ends



;
code		segment	'code'
		assume	cs:code,ds:data,es:nothing,ss:nothing
		public	date
date		proc		far


;----------execute Profort standard entry linkage--------------------

		push	ds
		sub	bp,stack_size+6
		mov	ax,data
		mov	ds,ax
		mov	sp_save,sp
		mov	sp,bp
;---------------------------------------------------------------------

		mov	ah,2ah
		int	21h			; get date

;	es:[bx] =	&month
;	es:4[bx] =	&day
;	es:8[bx] =  &year

;	format returned by dos is dh(month),dl(day),cx(year)

		lds	si,es:8[bx]
		mov	[si],cx		; store year
		lds	si,es:[bx]
		mov	al,dh
		xor	ah,ah
		mov	[si],ax		; store month
		mov	al,dl
		lds	si,es:4[bx]
		mov	[si],ax		; store day

;-------------perform exit linkage------------------------------------

		add	sp,stack_size+2
		ret
;---------------------------------------------------------------------

date		endp
code		ends
		end

stack		segment word stack 'stack'
		db	stack_size dup(?)
stack		ends
		end
-------------------------------------

cls 		endp
code		ends
		end

stack		segment wo