home *** CD-ROM | disk | FTP | other *** search
- ;----------------------------------------------------------------
- ; This function will set the Environment variable ENVDATE
- ; to be the current date. This is useful for entering the
- ; date of comilation into a program, which could then be done
- ; with a command line define and a small .BAT file.
- ;----------------------------------------------------------------
-
- cseg segment
-
- org 0100h
-
- assume cs:cseg,ds:nothing
-
- main proc far
- jmp begin
-
- db 5 dup ('STACK ')
- stack label word
-
- stkseg dw ?
- stkptr dw ?
-
- outlen db len_out_str
-
- out_str db 'SET CURDATE='
- month db 'mm'
- db '/'
- day db 'dd'
- db '/'
- year db 'yy'
- db 0dh
- len_out_str equ $-out_str
-
- begin:
- mov sp,offset stack
-
- mov ax,cs
- mov ds,ax ; get addressability
-
- mov bx,offset end_of_code ; how much code and data?
- mov cl,4 ; it's in paragraps
- shr bx,cl
- inc bx ; throw one more in for good measure
- mov ah,04ah ; reallocate memory
- int 21h ; and do it
-
- mov ah,02ah ; get date
- int 21h ; and do it
-
- mov ax,cx ; get year
- mov cl,100 ; we just want the sub-hundreds
- div cl
- mov al,ah ; get fractional centuries
- mov si,offset year ; get where we want it
- call form_dec_num ; put AL into decimal format
-
- mov al,dh ; get month
- mov si,offset month ; where it goes
- call form_dec_num
-
- mov al,dl ; get day
- mov si,offset day ; where it goes
- call form_dec_num
-
- mov stkseg,ss ; save stk info
- mov stkptr,sp
-
- mov si,offset outlen ; get addr of command
- int 2eh ; do the undocumented interrupt
-
- mov ss,stkseg ; recover our stack
- mov sp,stkseg
-
- mov ax,04c00h ; exit to DOS
- int 21h
- main endp
-
- form_dec_num proc near
- push ax
-
- xor ah,ah
- aam
- add ax,03030h ; make both of them ASCII
- xchg ah,al ; reverse for storage
- mov [si],ax
-
- pop ax
- ret
- form_dec_num endp
-
- end_of_code label byte
-
- cseg ends
-
- end main