Académique Documents
Professionnel Documents
Culture Documents
;
;
;
; copyright 1986 by dana nowell - all rights reserved
;
; history:
; version date name description
; 1.0 11/10/86 dn first cut
; 1.01 11/21/86 dn fixed memory allocation bug
; added installation message
;
;------------------------------------------------------------------------------
;
; macro section
;
;------------------------------------------------------------------------------
version_msg macro
jmp short copyright_end
copyright_msg db cr, lf
db 'tsr shell - version 1.01', cr, lf
db 'copyright 1986, dana nowell ', cr, lf, cr, lf
db 'may be distributed without license', cr, lf, '$'
copyright_end:
msg copyright_msg
endm
push dx
push ax
pop ax
pop dx
endm
;------------------------------------------------------------------------------
;
; note: the psp occurs at the beginning of the code segment
; for all programs. in com files the code seg = data seg
;
;------------------------------------------------------------------------------
org 0
dos_call db ? ; call
dd ? ; address of dos function handler
int_21h db ? ; int
db ? ; 21h
db ? ; retf ( return far )
reserved dw ? ; reserved by dos
fcb1_ext db 7 dup(?) ; fcb # 1 extension
fcb1 db 9 dup(?) ; fcb #1
fcb2_ext db 7 dup(?) ; fcb # 2 extension
fcb2 db 20 dup(?) ; fcb #2
;
; disk transfer area ( dta ) and parameter block occupy the same space
;
;
;dta db 128 dup(?) ; disk transfer area
;------------------------------------------------------------------------------
;
; note on standard fcb structure :
;
; the standard fcb is larger than the size reserved in the psp if you
; intend to use to fcb data from the psp move it to a different location.
;
;
; standard structure of a file control block
;
;
; extension :
; offset length description
; -7 1 extension active flag ( 0ffh = active )
; -6 5 normally unused should be zeros
; -1 1 file attribute when extension is active
; 1 . . . . . . . 1 read-only
; 2 . . . . . . 1 . hidden
; 4 . . . . . 1 . . system
; 8 . . . . 1 . . . volume label
; 16 . . . 1 . . . . subdirectory
; 32 . . 1 . . . . . archive
; 64 . 1 . . . . . . unused
; 128 1 . . . . . . . unused
;
; fcb :
; offset length description
; 0 1 special drive number ( 1 byte )
; 0 = default
; 1 = a:
; 2 = b: etc
; 1 8 filename or device name
; 9 3 filename extension
; 12 2 current block number
; 14 2 record size
; 16 4 file size in bytes ( dos dir entry at open )
; 20 2 file date ( bit coded as in dir )
; 22 10 dos work area
; 32 1 current record number ( 0 - 127 )
; 33 4 random record number
;
;------------------------------------------------------------------------------
start:
jmp install ; install the demon
;-------------------------------------------------------------------
;
; resident data structures go here
;
;-------------------------------------------------------------------
;-------------------------------------------------------------------
;
; new interrupt starts here
;
;-------------------------------------------------------------------
new_int:
pushf
;-------------------------------------------------------------------
;
; be well behaved and pass control to original int
;
;-------------------------------------------------------------------
popf
pushf
call dword ptr cs:old_int ; do old interrupt
;------------------------------------------------------------------------------
;
; installation data structures and code go here
;
; warning warning warning - this area does not exist after installation
;
;------------------------------------------------------------------------------
version_msg
cmp resident_flag, 0
je not_resident
msg already_installed_msg
not_resident:
mov dx, offset new_int ; offset of new timer interrupt
mov al, hook_int ; timer tick
mov ah, dos_set_int ; set int(al) vector from ds+dx
int dos_int ; do the int
install endp
;
; check resident procedure
; requires es register to contain the segment address of
; the current location for the interrupt being hooked.
; use the dos function 35h to obtain this information.
;
mov resident_flag, 1
not_res:
ret
check_resident endp
com ends
end start