home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frostbyte's 1980s DOS Shareware Collection
/
floppyshareware.zip
/
floppyshareware
/
USCX
/
SETPGMS.ZIP
/
SETNOW.ASM
< prev
next >
Wrap
Assembly Source File
|
1987-01-15
|
5KB
|
231 lines
page 65,132
;Copyright 1986, Arnold B. Krueger
;All rights reserved. Contact "ARNY KRUEGER"
;at the EXEC-PC BBS (414-964-5160) for permission
;to use commercially.
;SETNOW places the current time and date into the
;environment variables DATE and TIME. Usage is:
;
;errorlevels are:
; 0 if all goes well
; 1 or 2 for env_set detected errors:
; 1 - not at DOS 2.0 or above
; 2 - error updating environment
; (an error message will be typed)
code_seg segment para public
assume cs:code_seg,ds:code_seg,ss:code_seg,es:code_seg
extrn env_set:near
org 80h
psp_parml db ? ;length of parms
psp_parm db ? ;actual parms
org 100h ; .COM file format
begin: jmp main ; Skip around data declarations
copyright db 'Copyright 1986, Arnold B. Krueger GPW, MI 48236'
byte_radix db 10
bin_to_ascii proc near ; Convert binary number to 2-digit ASCII
push ax
cbw ; Convert al to word for division
div byte_radix ; Divide al by radix
add al,48 ; Convert quotient in al to ASCII
stosb ; Store to location pointed to by di
add ah,48 ; Convert remainder in ah to ASCII
mov al,ah ; Move to al for store
stosb ; Store to location pointed to by di
pop ax
ret
bin_to_ascii endp
cr equ 13
lf equ 10
set_date db set_date_len-1,'DATE='
set_date_now db 'mm/dd/yy'
set_date_len equ $-set_date
set_time db set_time_len-1,'TIME='
set_time_now db 'hh:mm:ss'
set_time_len equ $-set_time
release_error db 1,'Need at least DOS 2.0 to run SETNOW',cr,lf,'$'
env_error db 2,'Error updating the DOS environment',cr,lf,'$'
main:
mov ah,30h ; get dos release number
int 21h
cmp al,1 ; above release 1.x
ja get_date ; if not, don't ask for current directry
mov si,offset release_error
jmp error_exit
get_date:
mov ah,02ah ;ask for date
int 21h ; dl=dd, dh=mm, cx=yy
mov di,offset set_date_now
mov al,dh
call bin_to_ascii
inc di
mov al,dl
call bin_to_ascii
inc di
sub cx,1900
mov al,cl
call bin_to_ascii
mov si,offset set_date
call env_set
jc set_error
mov ah,02ch ;ask for time
int 21h ; ch=hh, cl=mm, dh=ss dl=.ss (100ths)
mov di,offset set_time_now
mov al,ch
call bin_to_ascii
inc di
mov al,cl
call bin_to_ascii
inc di
mov al,dh
call bin_to_ascii
mov si,offset set_time
call env_set
jc set_error
xor al,al ;set al=0
exit:
mov ah,4ch ;terminate program, set errorlevel from al
int 21h
set_error:
mov si,offset env_error
error_exit:
lodsb ;reset al with errorlevel
push ax ;save it
mov dx,si ;get start of message
mov ah,9h ;type it out
int 21h
pop ax ;reset al with errorlevel
jmp exit
code_seg ends
end begin
(·l╠°
Θ<xyç3≤ⁿ ççççççç3 29çç3 213≤ⁿ ççççççç3 213≤ⁿ ççççççç?29çç end begin
ds
end begin
ends
end begin
end begin
BEGIN