home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frostbyte's 1980s DOS Shareware Collection
/
floppyshareware.zip
/
floppyshareware
/
DOOG
/
CTASK.ZIP
/
TSKBIOS.ASM
< prev
next >
Wrap
Assembly Source File
|
1989-12-20
|
5KB
|
280 lines
;
; --- Version 2.0 89-12-13 17:56 ---
;
; CTask - BIOS INT 15 interrupt handler (IBM AT specific)
;
; Public Domain Software written by
; Thomas Wagner
; Patschkauer Weg 31
; D-1000 Berlin 33
; West Germany
;
; NOTE: Support for printer output busy has been dropped in
; version 1.2. Depending on the speed of the driving
; program, the old algorithm (which used a timed delay)
; could cause the printer to slow down to an unbearable
; crawl, and there is little chance for a clean solution
; here, since there is not enough info on the printer
; passed to INT 15.
; Instead, an INT 17 replacement that schedules while
; waiting on the printer has been added (module tskint17.asm).
;
name tskbios
.model large,c
;
public tsk_install_bios
public tsk_remove_bios
;
include tsk.mac
;
extrn clear_flag_wait_set: far
extrn set_flag: far
extrn create_flag: far
extrn delete_flag: far
extrn t_delay: far
;
extrn tsk_dgroup: word
;
intseg segment at 0
;
org 15h*4
pintofs dw ? ; interrupt entry
pintseg dw ?
intseg ends
;
;
.tsk_data
;
extrn tsk_glob_rec: word ; global_rec
;
floppy flag <>
fdisk flag <>
kbd flag <>
;
flag_tab label word
dw offset fdisk
dw offset floppy
dw offset kbd
;
IF TSK_NAMEPAR
fflname db "WFLEXDSK",0
ffdname db "WHARDDSK",0
fkbname db "WKBDPOST",0
ENDIF
;
.tsk_edata
.tsk_code
;
extrn tsk_switch_stack: near
;
post_save label dword ; in CSEG to allow addressing
psofs dw ?
psseg dw ?
;
;----------------------------------------------------------------------
;
; interrupt handler
;
bios_int proc far
pushf
sti
cmp ah,90h ; WAIT
jb bios_pass
cmp ah,91h ; POST
ja bios_pass
cmp al,2 ; fdisk/floppy/keyboard
jbe process_bios
cmp al,0fdh ; floppy motor
je process_bios
;
bios_pass:
popf
jmp cs:post_save
;
;
process_bios:
popf
call tsk_switch_stack
stc_saved ; Carry set on return
;
cmp al,2
jbe flag_ops
;
; Wait for diskette motor start (1 sec.)
;
wait_motor:
xor ax,ax
push ax
mov ax,tsk_glob_rec.ticks_per_sec
push ax
call t_delay
add sp,4
iret
;
; Floppy/Fdisk/Keyboard wait/post
;
flag_ops:
xor bh,bh
mov bl,al
add bx,bx
mov bx,flag_tab[bx] ; load appropriate flag
cmp ah,90h
je fl_wait ; jump if wait op
push ds
push bx
call set_flag ; set flag: complete
add sp,4
clc_saved ; carry clear on return
iret
;
fl_wait:
xor dx,dx
cmp al,2
je fl_dowait ; no timeout if AL=2 (Keyboard)
mov dx,tsk_glob_rec.ticks_per_sec
add dx,dx ; two seconds
cmp al,1
je fl_dowait ; 2 sec timeout if AL=1 (Diskette)
mov cx,dx
add dx,cx
add dx,cx ; 6 sec timeout for Harddisk
fl_dowait:
xor ax,ax
push ax
push dx
push ds
push bx
call clear_flag_wait_set ; Clear flag & wait for event
add sp,8
or ax,ax
jnz flw_ret ; keep carry set if timeout
clc_saved ; else return with carry clear
flw_ret:
iret
;
bios_int endp
;
;------------------------------------------------------------------------
;
; void far tsk_remove_bios (void)
;
; This routine un-installs the int handler.
;
tsk_remove_bios proc near uses ds
;
mov ds,cs:tsk_dgroup
;
push es
xor ax,ax
mov es,ax
assume es:intseg
cli
mov ax,cs:psofs ; restore vector
mov pintofs,ax
mov ax,cs:psseg
mov pintseg,ax
sti
assume es:nothing
pop es
;
mov ax,offset floppy
push ds
push ax
call delete_flag
add sp,4
;
mov ax,offset fdisk
push ds
push ax
call delete_flag
add sp,4
;
mov ax,offset kbd
push ds
push ax
call delete_flag
add sp,4
;
ret
;
tsk_remove_bios endp
;
;----------------------------------------------------------------------
;
; void far tsk_install_bios (void)
;
; This routine installs the int handler.
;
tsk_install_bios proc near uses ds
;
mov ds,cs:tsk_dgroup
;
IF TSK_NAMEPAR
mov ax,offset fflname
push ds
push ax
ENDIF
mov ax,offset floppy
push ds
push ax
call create_flag
IF TSK_NAMEPAR
add sp,8
ELSE
add sp,4
ENDIF
;
IF TSK_NAMEPAR
mov ax,offset ffdname
push ds
push ax
ENDIF
mov ax,offset fdisk
push ds
push ax
call create_flag
IF TSK_NAMEPAR
add sp,8
ELSE
add sp,4
ENDIF
;
IF TSK_NAMEPAR
mov ax,offset fkbname
push ds
push ax
ENDIF
mov ax,offset kbd
push ds
push ax
call create_flag
IF TSK_NAMEPAR
add sp,8
ELSE
add sp,4
ENDIF
;
push es
xor ax,ax
mov es,ax ; establish addressing for intseg
assume es:intseg
;
mov ax,pintofs ; save old timer int addr
mov psofs,ax
mov ax,pintseg
mov psseg,ax
cli
mov pintofs,offset bios_int ; set new timer int addr
mov pintseg,cs
sti
assume es:nothing
pop es
ret
;
tsk_install_bios endp
;
.tsk_ecode
end