; FSTAMP.A - Routine callable by DeSmet C returning file time/date stamp ; Copyright (c) 1986, T.A. Daneliuk ; Last Modified: 09/20/86 ; ; ; usage: fstamp(fp,date,time); ; where, fp is pointer to an open file ; date is a pointer to a character array to hold date (mm-dd-yy) ; time is a pointer to a character array to hold time (hh:mm:ss) ; ; If system call fails, the arrays are returned with zeros ; ; ; Passed Parameters ; fp equ [bp+4] date equ [bp+6] time equ [bp+8] ; ; dseg ; ; idat db '00-00-8000:00:00' fdate dw 0 ftime dw 0 ; ; cseg public fstamp_ ; ; fstamp_: push bp ; Procedure prologue mov bp,sp push si ; Need a couple pointers push di mov si,time mov di,date mov bx,offset idat mov cx,8 init: mov al,[bx] mov ds:[di],al mov al,[bx+8] mov ds:[si],al inc si inc di inc bx loop init mov byte ds:[di],0 ; Put Null terminators in mov byte ds:[si],0 pop di pop si mov ax,5700h mov bx,fp int 21h jc alldone ; Had and error, so quit now mov fdate,dx ; Save binary images mov ftime,cx mov bx,date ; Do date digits first inc bx ; Month field first mov ax,dx mov cl,5 shr ax,cl and ax,000fh call addasc add bx,3 ; Day field next mov ax,fdate and ax,001fh call addasc add bx,3 ; Year field last mov ax,fdate mov cl,9 shr ax,cl and ax,007fh call addasc mov bx,time ; Now do time digits inc bx ; Hours field first mov ax,cx mov cl,11 shr ax,cl and ax,001fh call addasc add bx,3 ; Minutes field next mov ax,ftime mov cl,5 shr ax,cl and ax,003fh call addasc add bx,3 ; Seconds field last mov ax,ftime and ax,001fh shl ax,1 ; Multiply by 2 call addasc alldone: pop bp ret ; ; ; Do An ASCII Addition: Add Binary Contents In AL To ASCII String At BX ; ; addasc: top: dec al cmp al,-1 jz done mov ah,[bx] cmp ah,'9' jz digit2 inc byte [bx] jmp top digit2: mov ah,'0' mov [bx],ah mov ah,[bx-1] cmp ah,'9' jz digit3 inc byte [bx-1] jmp top digit3: mov ah,'0' mov [bx-1],ah jmp top done: ret end