Category : Utilities for DOS and Windows Machines
Archive   : POP-CAL.ZIP
Filename : POP-CAL.ASM

 
Output of file : POP-CAL.ASM contained in archive : POP-CAL.ZIP
; POP-CAL: A memory-resident pop-up calendar for 1583 - 9999 AD
;
; Alt-C Pops up and terminates the calendar
; Left/Right Cursor Keys Change months
; Up/Down Cursor Keys Change years
;
cseg segment
assume cs:cseg
;
ppfdata struc
rom16h dw ?,?
savss dw ?
savsp dw ?
video_seg dw ?
mnth db ?
year dw ?
weekday db ?
left dw ?
hilite db ?
busy db ?
crt_mode db ?
crt_cols dw ?
status_port dw ?
ppfdata ends
org 100h-status_port
v ppfdata <>
;
org 100h
begin: jmp Install
db "Copyright 1986 Ziff-Davis Publishing Co.",1Ah
days db 'SunMonTueWedThrFriSat'
months db 'JanFebMarAprMayJunJulAugSepOctNovDec'
numdays db 31,28,31,30,31,30,31,31,30,31,30,31
bios dw 40h
scan_code dw 2e00h
;
int16h: sti
cmp ah,0
je come_back
skip_us:jmp dword ptr v.rom16h
come_back:
cmp v.busy,0
jne skip_us
getkey: pushf
call dword ptr v.rom16h
cmp ax,scan_code
je now_busy
iret
now_busy:
mov v.busy,1
mov v.savss,ss
mov v.savsp,sp
mov sp,cs
cli
mov ss,sp
mov sp,offset v.rom16h
sti
push ax
push bx
push cx
push dx
push bp
push si
push di
push ds
push es
call begin_calendars
pop es
pop ds
pop di
pop si
pop bp
pop dx
pop cx
pop bx
pop ax
cli
mov ss,v.savss
mov sp,v.savsp
sti
mov ah,0
mov v.busy,0
jmp getkey
;
begin_calendars:
push cs
push cs
pop ds
pop es
cld
assume ds:cseg
call wndo
jmp showcal
nxtcal: mov v.mnth,dh
mov v.year,cx
showcal:call fill
input: mov ah,0
int 16h
cmp ax,scan_code
jne getdate
exit: call wndo
ret
getdate:mov dh,v.mnth
mov cx,v.year
trylft: cmp ah,75
jne tryrgt
dec dh
jns nxtcal
mov dh,11
dec cx
jmp chkloyr
tryrgt: cmp ah,77
jne tryup
inc dh
cmp dh,11
jng nxtcal
mov dh,0
inc cx
jmp chkhiyr
tryup: cmp ah,72
jne trydwn
inc cx
chkhiyr:cmp cx,10000
jge input
jmp nxtcal
trydwn: cmp ah,80
jne input
dec cx
chkloyr:cmp cx,1582
jle input
jmp nxtcal
;
fill: call firstday
mov es,v.video_seg
mov al,v.mnth
cbw
mov cx,3
mul cl
mov si,offset months
add si,ax
mov di,v.crt_cols
add di,v.left
add di,22
movname:lodsb
call writebyte
loop movname
add di,2
mov ax,v.year
mov bl,100
div bl
mov bh,1
call unpack
mov al,ah
call unpack
setdi: mov ax,v.crt_cols
mov bl,4
mul bl
add ax,4
mov di,v.left
add di,ax
mov dl,v.weekday
mov cl,dl
mov dh,6
jcxz start_current_month
blnkrwl:call blank2
loop blnkrwl
start_current_month:
mov cl,7
sub cl,dl
mov bl,v.mnth
xor bh,bh
mov dl,numdays[bx]
mov al,1
showdays:
call unpack
inc al
add di,4
dec dl
jz blnkrst
loop showdays
call nxtweek
jmp showdays
blnkrw4:call blank2
blnkrst:loop blnkrw4
call nxtweek
jnz blnkrw4
push cs
pop es
ret
;
nxtweek:add di,v.left
add di,4
mov cl,7
dec dh
ret
;
firstday:
mov si,v.year
mov numdays[1],28
test si,3
jnz getday
feb29: mov numdays[1],29
getday: mov bx,6
mov ax,si
sub ax,1583
add bx,ax
add ax,2
mov cx,4
cwd
div cx
add bx,ax
cmp si,1700
jl cnvrt
mov ax,si
sub ax,1600
mov cl,100
cwd
div cx
cmp dx,0
jne deduct
test ax,3
jz decax
mov numdays[1],28
decax: dec ax
deduct: sub bx,ax
cwd
mov cl,4
div cx
add bx,ax
cnvrt: mov si,offset numdays
xor ah,ah
mov cl,v.mnth
jcxz final
addmnth:lodsb
add bx,ax
loop addmnth
final: mov ax,bx
cwd
mov cl,7
div cx
mov v.weekday,dl
ret
;
unpack: push ax
push bx
aam
add ax,3030h
cmp ah,30h
jne putnum
cmp bh,1
je putnum
mov ah,20h
putnum: mov bl,al
mov al,ah
call writebyte
mov al,bl
call writebyte
pop bx
pop ax
ret
;
blank2: mov al,20h
call writebyte
call writebyte
add di,4
ret
;
writebyte:
push dx
mov dx,v.status_port
mov ah,al
onl: in al,dx
test al,1
jnz onl
cli
on2: in al,dx
test al,1
jz on2
mov al,ah
stosb
sti
inc di
pop dx
ret
;
wndo: call getprms
mov dx,v.status_port
sub dx,2
mov es,bios
mov bh,es:[65h]
mov al,bh
and al,0f7h
out dx,al
mov si,offset data_strt
mov di,v.left
mov es,v.video_seg
mov bl,11
nxtlin: mov cx,30
getchr: mov ax,es:[di]
movsw
mov [si-2],ax
loop getchr
add di,v.left
dec bl
jnz nxtlin
mov al,bh
out dx,al
push cs
pop es
ret
;
getprms:push es
mov es,bios
mov ax,es:[4ah]
shl ax,1
mov v.crt_cols,ax
sub al,30*2
mov v.left,ax
mov ax,es:[63h]
add ax,6
mov v.status_port,ax
mov v.hilite,70h
mov bl,es:[49h]
cmp bl,7
mov ax,0B000h
je setseg
mov ax,0B800h
test bl,1
jz setseg
mov v.hilite,1fh
setseg: mov v.video_seg,ax
pop es
ret
;
Install:call getprms
mov di,offset data_strt
mov ah,v.hilite
mov al,20h
mov cx,11*30
rep stosw
push di
mov si,offset days
mov bl,7
mov di,offset data_strt
add di,3*30*2+4
movday: mov cx,3
movchr: movsb
inc di
loop movchr
inc di
inc di
dec bl
jnz movday
mov ah,2ah
int 21h
dec dh
mov v.mnth,dh
mov v.year,cx
go_resident:
xor ax,ax
mov es,ax
mov ax,es:[16h*4]
mov v.rom16h,ax
mov ax,es:[16h*4+2]
mov v.rom16h+2,ax
mov ax,offset int16h
cli
mov es:[16h*4],ax
mov es:[16h*4+2],cs
sti
pop dx
int 27h
;
data_strt equ this word
cseg ends
end begin


  3 Responses to “Category : Utilities for DOS and Windows Machines
Archive   : POP-CAL.ZIP
Filename : POP-CAL.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/