;------------------------------------------------------------------------------ ; EQUATES ;------------------------------------------------------------------------------ beep equ 07h ; console BEEP lf equ 0Ah ; linefeed cr equ 0Dh ; carriage return eof equ 1Ah ; End Of File marker ;------------------------------------------------------------------------------ ; START OF CODE ;------------------------------------------------------------------------------ code segment assume cs:code, ds:code, es:code org 100h start: jmp getparms banner db 'WhatDateTIME v1.0 of 05/22/88. By Jan R. Terpstra ->Militantly Public Domain!<-',cr,lf,'$',eof help db 'Helpfile WDATIME.HLP not found - Usage: WDATIME c',cr,lf,beep,'$' file db 'WDATIME.HLP',00h buffer db 64 dup(?) getparms: lea dx,banner ; point to string mov ah,09h ; print it int 21h ; via DOS mov si,80H ; Address of PSP commandline mov ah,[si] ; Get input length cmp ah,0 ; Any parms? je no_parms ; No - show help add si,2 ; Point to first parm cmp byte ptr [si],'t' ; Check time? je get_time ; yup mov ah,2Ah ; get the current time int 21h ; via DOS cmp byte ptr [si],'d' ; Check date? jne weekday ; yup mov al,dl ; day in AL jmp exit weekday: cmp byte ptr [si],'w' ; Check weekday? jne get_month ; yup inc al ; weekday (1 = sun, 7 = sat) in AL jmp exit get_month: cmp byte ptr [si],'m' ; Check month? jne no_parms ; something wrong here.... mov al,dh ; month in AL jmp exit get_time: mov ah,2ch ; get the current time int 21h ; via int21 mov al,ch ; move hours in AL cbw ; convert to word mov bl,10 ; setup for multiply mul bl ; multiply by 10 mov dl,al ; store in DL mov al,cl ; minutes in AL mov bl,06h ; setup for divide cbw ; convert to word div bl ; divide by 10 add al,dl ; set errorlevel jmp exit ; and ready no_parms: lea dx,file ; point to filename mov ax,3D00h ; open file, compatability mode int 21h ; via DOS jc no_help ; if not here, complain mov bx,ax ; filehandle in BX read_file: lea dx,buffer ; point to buffer mov ah,3Fh mov cx,64 ; read 64 bytes int 21h ; via DOS push ax ; save count lea si,buffer ; point to buffer mov cx,ax ; # of chars to print prt_loop: mov dl,[si] ; get a char cmp dl,eof ; end of file? je looper ; don't print mov ah,02h ; print it int 21h ; via DOS looper: inc si ; point to next char loop prt_loop ; more? pop cx ; get count back cmp cx,64 ; 64 chars read? je read_file ; yup, possibly more mov ah,3Eh ; close file int 21h ; via DOS jmp done no_help: lea dx,help ; point to string mov ah,09h ; print it int 21h ; via DOS done: mov al,0FFh ; errorlevel = 255 exit: mov ah,4Ch ; exit with errorlevel set int 21h ; end code ends end start