home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 June
/
SIMTEL_0692.cdr
/
msdos
/
turbopas
/
stay42.arc
/
STAYI16.410
< prev
next >
Wrap
Text File
|
1986-06-13
|
7KB
|
99 lines
Inline(
{;****************************************************************************;}
{; P R O C E S S I N T E R R U P T 1 6 ;}
{; ;}
{;****************************************************************************;}
{; Function:}
{; Provide a Keyboard trap to allow concurrent processes to}
{; run in the background while a Turbo Read is active.}
{;}
{; Copyright (C) 1985,1986}
{; Lane Ferris}
{; - The Hunter's Helper -}
{; Distributed to the Public Domain for use without profit.}
{; Original Version 5.15.85}
{;}
{; ; On entry the Stack will already contain: ;}
{; ; 1) Sp for Dos ;}
{; ; 2) Bp for Dos ;}
{; ; 3) Ip for Dos ;}
{; ; 4) Cs for Dos ;}
{; ; 5) Flags for Dos ;}
$5D { Pop Bp}
/$5D { Pop Bp ; Restore Original Bp}
/$80/$FC/$00 { Cmp Ah,00 ; If Char request,}
/$74/$2A { Je Func00 ; loop for character}
/$80/$FC/$01 { Cmp Ah,01 ; If character availability test}
/$74/$05 { Je Func01 ; go check for char}
{GoBios16:}
/$2E { CS: ; Go to Bios Interrupt 16}
/$FF/$2E/>BIOS_INT16 { Jmp Far [>BIOS_Int16]}
{Func01:}
/$E8/$3F/$00 { Call KeyStat ; Look at Key buffer}
/$9C { PushF}
/$74/$16 { Jz Fret01 ; Return if no key}
/$2E { CS: ; Test for HOT KEY}
/$3A/$26/>OUR_HOTKEY { Cmp Ah,[<Our_HotKey]}
/$75/$0F { Jne Fret01}
/$B4/$00 { Mov Ah,0 ; Remove the HotKey}
/$2E { CS: ; flags are removed by BIOS return}
/$FF/$1E/>BIOS_INT16 { Call Dword [>BIOS_INT16]}
/$2E { CS: ; Say we saw the HOT Key}
/$80/$0E/>STATUS/<HOTKEY_ON { Or by [<Status],<HotKey_ON}
/$EB/$E4 { Jmp Func01 ;}
{Fret01:}
/$9D { POPF}
/$CA/$02/$00 { RETF 2 ; Return to user}
{Func00:}
/$E8/$1F/$00 { Call KeyStat ; Wait until character available}
/$74/$FB { Jz Func00}
/$B4/$00 { Mov Ah,0 ; Get the next User Key}
/$9C { PUSHF ;}
/$2E { CS:}
/$FF/$1E/>BIOS_INT16 { Call Dword [>BIOS_INT16]}
/$9C { PushF ; Save Return Flags}
/$2E { CS:}
/$3A/$26/>OUR_HOTKEY { Cmp Ah,[<Our_HotKey]; Our HotKey ?}
/$74/$04 { Je GotHotKey ; yes..enter Staysave code}
/$9D { POPF ; else Restore INT 16 flags}
/$CA/$02/$00 { RetF 2 ; Return W/Key discard original INT 16 flags}
{ ; ".. give it to Mikey..he'll eat anything"}
{GotHotKey:}
/$9D { POPF ; Discard INT16 return flags}
/$2E { CS: ; Say we saw the HOT Key}
/$80/$0E/>STATUS/<HOTKEY_ON { Or by [<Status],<HotKey_ON}
/$EB/$DE { Jmp Func00 ; Get another Key}
{;}
{; Call the Background task if no key is available}
{;}
{KeyStat:}
/$B4/$01 { Mov Ah,01 ; Look for available key}
/$9C { Pushf ; Call the keyboard function}
/$2E { CS:}
/$FF/$1E/>BIOS_INT16 { Call dw [<BIOS_INT16]}
/$74/$01 { Jz ChkDosCr ; No Character available from Keyboard}
/$C3 { RET ; else return with new flags and code}
{ChkDosCr:}
/$06 { Push ES ; Check if DOS Critical error in effect}
/$56 { Push Si}
/$2E { CS:}
/$C4/$36/>DOSSTAT2 { Les Si,[>DOSStat2]}
/$26 { ES: ; Zero says DOS is interruptable}
/$AC { Lodsb ; $FF says Dos is in a critical state}
/$2E { CS:}
/$C4/$36/>DOSSTAT1 { Les Si,[>DosStat1] ; If INDOS then INT $28 issued by DOS}
/$26 { ES: ; so we dont have to.}
/$0A/$04 { Or Al,[SI]}
/$2E { CS: ; Account for active interrupts}
/$0A/$06/>INTR_FLAGS { Or Al,[<Intr_Flags]; Any flags says we dont issue call}
/$5E { Pop Si ; to the background.}
/$07 { Pop Es}
/$3C/$01 { Cmp Al,01 ; Must be INDOS flag only}
/$7F/$02 { JG Skip28 ; DOS cannot take an interrupt yet}
/$CD/$28 { INT $28 ; Call Dos Idle function (background dispatch).}
{Skip28:}
/$31/$C0 { Xor Ax,Ax ; Show no keycode available}
/$C3 { RET}
{;---------------------------------------------------------------------------}
);