home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BBS 1
/
BBS#1.iso
/
maximus
/
bbslimit.arj
/
BBSLIMIT.ASM
next >
Wrap
Assembly Source File
|
1991-05-12
|
6KB
|
259 lines
.model tiny
.code
.startup
.286
check_file struc
req_name dw ? ; pointer on end of requested name
chg_name dw ? ; pointer on end of name to change
chg_size db ? ; size of chg_name
day db ? ; binary package for checked days
; all,mon,sun,sat,fri,the,wed,tue
time_from dw ? ; begin changing in BCD
time_to dw ? ; end changing in BCD
ends
jmp install
end_of_code dw 0 ;end of loaded code with data
ds_dx dd 0 ;pointer on filename
;struct_number dw 1 ;number of structures
end_of_name dw 0
month db 0,31,28,31,30,31,30,31,31,30,31,30 ;month table
full_year = 365
first_day = 1 ;1st January 1980 = Tuesday
get_weekday proc near
mov ah,4
int 1aH
xor ax,ax
push ax
popf
mov ax,1980H
das
sub cx,ax
mov ax,cx
call bcd2hex
push ax
push dx
mov bx,full_year
mul bx ;full days after 1980 w/o visokosnyi years in ax
xchg bx,ax
pop dx
pop ax
mov byte ptr month+2,28
test ax,11B ;is current year is vis?
jnz not_vis
mov byte ptr month+2,29
not_vis:
dec ax ;exclude current year
shr ax,2 ;number of vis year
add bx,ax ;bx == days w/o month and day
mov cl,dh ;mounth counter
xor ch,ch
mov si,offset month
xor ah,ah
cld
add_month:
lodsb
add bx,ax
loop add_month
xor ax,ax
mov al,dl ;current day
call bcd2hex ;al = current day in hex
add bx,ax ; bx == full day!!!
xchg ax,bx
xor dx,dx
mov bx,7
div bx ; ah = day of week, but...
mov al,dl
; inc al
ret
endp
bcd2hex proc near
shl ax,4
shr al,4
aad
xor ah,ah
ret
endp
check_time proc near
;input: bx pointer on check_file structure
mov ah,02H
int 1aH
test bx[time_from],8000H
jnz check_please
cmp cx,bx[time_from]
jb dont_check
cmp cx,bx[time_to]
ja dont_check
check_please:
clc
ret
dont_check:
stc
ret
endp
toupper proc near
cmp al,'A'
jb do_nothing
cmp al,'z'
ja do_nothing
and al,11011111B
do_nothing:
ret
endp
cmp_names proc near
;bx == pointer on structure
mov si,bx[req_name]
mov di,end_of_name
std
mov cl,bx[chg_size]
xor ch,ch
repe cmpsb
ret
endp
change_name proc near
;bx == pointer on structure
mov si,bx[chg_name]
mov di,end_of_name
std
mov cl,bx[chg_size]
xor ch,ch
rep movsb
mov word ptr ds_dx,80H
mov word ptr ds_dx+2,cs
ret
endp
move_name proc near
lds si,dword ptr cs:ds_dx
mov cx,128
mov di,80h
cld
mn1:
lodsb
call toupper
stosb
or al,al
je end_reached
loop mn1
stc
exit_mn:
push cs
pop ds
ret
end_reached:
dec di
dec di
mov cs:end_of_name,di
jmp exit_mn
endp
int21:
cmp ah,3dH
je check_it
db 0eaH
old_int21:
i21o dw 0
i21s dw 0
check_it:
pusha
push es
push ds
mov word ptr cs:ds_dx,dx
mov word ptr cs:ds_dx+2,ds
;main code of interrupt 21h
push cs
pop ds
push cs
pop es
mov bx,offset structures
call move_name
mov cx,struct_number
check_loop:
push cx
call cmp_names
jne dont_change
test bx[day],80H ;all days?
jne skip_check_day
push bx
call get_weekday
pop bx
mov cl,al
mov al,1
shl al,cl
test bx[day],al
je dont_change
skip_check_day:
call check_time
jc dont_change
call change_name
pop cx
jmp do_it
dont_change:
add bx,10 ;add size of structure
pop cx
loop check_loop
do_it:
pop ds
pop es
popa
push ds
push dx
mov ds,word ptr cs:ds_dx+2
mov dx,word ptr cs:ds_dx
cld
pushf
call dword ptr cs:old_int21
pop dx
pop ds
retf 2
install:
mov ah,9
mov dx,offset copyright
int 21H
mov ax,3d00H
mov dx,offset fname
int 21H
mov bx,ax
jnc i1
error:
mov ah,9
mov dx,offset error_read
int 21H
int 20H
i1:
mov dx,offset struct_number
mov ah,3fH
mov cx,0ffffH
int 21H
jc error
add ax,offset structures+4
mov end_of_code,ax
mov ah,3eH
int 21H
mov bx,offset structures
mov cx,struct_number
mov dx,offset structures
adjust:
add bx[req_name],dx
add bx[chg_name],dx
add bx,10
loop adjust
mov ax,3521H
int 21H
mov i21o,bx
mov i21s,es
mov dx,offset int21
mov ax,2521H
int 21H
mov dx,end_of_code
int 27H
fname db 'limits.use',0
struct_number dw 0
structures:
error_read db 'Read error!',10,13,24H
copyright db "Dynamical BBS's access. Copyright (C) AlexQ 1991",10,13
db ' Red Rat Club, Moscow,Russia.',10,13
db ' Free!',10,13,24H
ass2:
end