home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 13 / 13.iso / s / s001 / 1.ddi / TS / ASM / SWAKE.ASM < prev    next >
Encoding:
Assembly Source File  |  1987-08-09  |  1.2 KB  |  47 lines

  1. ;                *************
  2. ;                * SWAKE.asm *
  3. ;               *******************************************
  4. ;               * Copyright TimeSlice, Inc. 1985, 86, 87. *
  5. ;               *******************************************
  6. include ts.inc
  7. ;
  8. ;
  9. start_data
  10. end_data
  11. ;
  12. extrn    __jmpint:far
  13. extrn    __gus:far
  14. ;
  15. start_code
  16. ;
  17. ;*******
  18. ;* SWAKE()
  19. ;* This function is invoked to wake up the slicer. It decrements the
  20. ;* sleeping level of the slicer, and if it reaches zero, really
  21. ;* wakes up the slicer by modifying its first instruction so that
  22. ;* instead of jumping to original timer interrupt service routine,
  23. ;* it jumps to the next instruction.
  24. ;*******
  25. routine    swake
  26.     pushf            ;save flags
  27.     push    es        ;save es
  28.     cli            ;no interrupts, please
  29.     dec    _sslev        ;decrement level of slicer sleep
  30.     jnz    sw1        ;if still asleep, return
  31.     mov    cx,offset __gus    ;have jmpint point to the next instruction
  32.     mov    dx,seg __gus
  33.     mov    es,dx
  34.     mov    bx,offset __jmpint
  35.     mov    es:[bx].off,cx    ;which is the begining of the slicer awake
  36.     mov    es:[bx].sgt,dx
  37. sw1:    jg    sw2        ;if _sslev reaches below zero, reset to zero
  38.     xor    ax,ax
  39.     mov    _sslev,ax
  40. sw2:    pop    es        ;restore es
  41.     popf            ;restore flags
  42. return    swake
  43. ;
  44. end_code
  45.  
  46.  
  47.