home *** CD-ROM | disk | FTP | other *** search
- ; **************
- ; * SSLEEP.asm *
- ; *******************************************
- ; * Copyright TimeSlice, Inc. 1985, 86, 87. *
- ; *******************************************
- ;
- include ts.inc
- ;
- ;
- start_data
- end_data
- ;
- ;
- extrn __jaddr:far
- extrn __jmpint:far
- ;
- start_code
- ;
- ;
- ;*******
- ;* SSLEEP()
- ;* Ssleep() puts the slicer to sleep. This routine is invoked by a process
- ;* which does not want to be interrupted by the slicer. The slicer stays
- ;* asleep until SWAKE() is called as many times as SSLEEP() was invoked.
- ;* This level of slicer sleep nesting is kept in _SSLEV.
- ;* The method used to put the slicer to sleep involves modifying the slicer's
- ;* first instruction so that it causes a jump to the original timer service
- ;* routine.
- ;*******
- routine ssleep
- pushf ;save flags
- push es ;and ES
- cli ;No interrupts allowed
- mov ax,_sslev ;AX <-- current level of slicer sleep
- test ax,ax ;already asleep ???
- jnz ss1 ;yes, simply inc _sslev
- mov bx,offset __jaddr
- mov dx,seg __jaddr
- mov es,dx
- mov cx,es:[bx].off ;copy original inter routine...
- mov dx,es:[bx].sgt
- mov bx,offset __jmpint
- mov es:[bx].off,cx ;...at jmpint
- mov es:[bx].sgt,dx
- ss1: inc ax ;increment level of slicer sleep
- mov _sslev,ax
- pop es ;restore ES
- popf ;and flags
- return ssleep
- ;
- end_code
-