Category : Batch File Utilities - mostly for DOS
Archive   : DELAY.ZIP
Filename : T.ASM

 
Output of file : T.ASM contained in archive : DELAY.ZIP
;
; timer program; causes pause of seconds as dictated by the
; command line
;
text segment

org 100h
assume cs:text
assume ds:text
assume es:text
assume ss:text

t: mov si,80h ; point to command tail
cld ; clear direction
xor ax,ax ; clear count
t1: lodsb ; get byte
cmp al,0Dh ; cr?
je t3 ; if so, stop
cmp al,'0' ; digit?
jb t1 ; if not, try next character
cmp al,'9' ; else try upper limit
ja t1 ; if not, try next character
;
; we have found a digit!
;
sub al,'0' ; initialize timer
mov timer,ax ; from 1st digit
mov string,si ; set string address in memory
dec string ;
t2: lodsb ; get byte from tail
cmp al,'0' ; digit?
jb t4 ; if not, end of digit string
cmp al,'9' ; try high end
ja t4 ; if not, end of digit string
sub al,'0' ; convert to raw binary
mov bx,timer ; multiply by 10
shl bx,1 ;
shl bx,1 ;
add bx,timer ;
shl bx,1 ;
add bx,ax ;
mov timer,bx ;
jmp t2 ; get next digit
;
; stop here
;
t3: mov ax,4C00h ; return no error
int 21h ;
;
; print what we're doing
;
t4: mov [si-1],ah ; clear string end
mov si,offset str1 ; print "Pausing "
call print ;
mov si,string ; print number of seconds
call print ;
mov si,offset str2 ; print " second"
call print ;
cmp timer,1 ; singular?
je t5 ;
mov al,'s' ; if plural, add 's'
call outch ;
t5: mov si,offset str3 ; print newline
call print ;
mov ax,timer ; zero timer
or ax,ax ;
jz t3 ;
mov ah,2Ch ; get current time
int 21h ;
mov hunds,dl ; set hundredths
;
; wait for hundredths to move off of here
;
t6: mov ah,2Ch ;
int 21h ; next time
cmp hunds,dl ;
je t6 ;
;
; wait for hundredths to exceed recorded
;
t7: mov ah,2Ch ; read time
int 21h ;
or dl,dl ; if zero, make it 101
jnz t8 ;
mov dl,101 ;
t8: cmp hunds,dl ;
jb t7 ;
;
; then wait for hundredths to equal or fall below recorded
;
t9: mov ah,2Ch ; read time
int 21h ;
cmp hunds,dl ;
jae t9 ;
;
; output 'tick'
;
mov al,'.' ; output '.'
call outch ;
dec timer ; decrement clock
mov ax,timer ; done?
or ax,ax ;
jne t6 ; if not, go again
jmp t3 ; else exit
;
; print nul-terminated string
;
print proc near

cld ; clear direction
p1: lodsb ; get byte
or al,al ; nul?
jz p2 ;
call outch ; output it
jmp p1 ; next...
p2: ret ; return

print endp
;
; output character
;
outch proc near

mov dl,al ; output to console
mov ah,2 ;
int 21h ;
ret ; return

outch endp

str1 db "Pausing ",0
str2 db " second",0
str3 db 13,10,0
timer dw ?
hunds db ?
string dw ?


text ends
end t


  3 Responses to “Category : Batch File Utilities - mostly for DOS
Archive   : DELAY.ZIP
Filename : T.ASM

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/