home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / tsr / mixtsr / tsrasm.asm < prev    next >
Encoding:
Assembly Source File  |  1988-06-16  |  6.3 KB  |  312 lines

  1.  
  2.          global
  3.          include \powerc\source\libdef.asm
  4.          dref  myss
  5.          dref  stack
  6.          lref  suspending
  7.          dref  olddisk
  8.          dref  oldvideo
  9.          dref  diskflag
  10.          lref  videoflag
  11.          dref  dosbusy
  12.          fref  $$MAXS
  13.          lfref popup_tsr
  14.          dref  scancode
  15.          dref  keymask
  16.          dref  popflg
  17.          dref  oldkb
  18.          dref  oldtimer
  19.          dref  old28
  20.          dorg  $
  21.          ddef  running
  22. intss    DW    0
  23. intsp    DW    0
  24. running  DW    0
  25.          endglobal
  26.          org   $
  27.          idt   getsp
  28.          def   getsp
  29. getsp    equ   $
  30.          mov   ax,sp
  31.          retfar
  32.          idt   keyhit
  33.          def   keyhit
  34. keyhit   equ   $
  35.          mov   ah,1
  36.          int   >16
  37.          mov   ah,1
  38.          jnz   keyret
  39.          int   >28
  40.          mov   ax,0
  41. keyret   retfar
  42.          idt   dores
  43.          def   dores
  44. dores    equ   $
  45.          cmp   [suspending],0
  46.          jne   resret
  47.          mov   [running],1
  48.          cli
  49.          mov   [intss],ss
  50.          mov   [intsp],sp
  51.          mov   ss,[myss]
  52.          mov   sp,[stack]
  53.          sti
  54.          callfar popup_tsr
  55.          cli
  56.          mov   ss,[intss]
  57.          mov   sp,[intsp]
  58.          sti
  59.          mov   [running],0
  60. resret   retfar
  61.          idt newdisk
  62.          def newdisk
  63. newdisk  equ $
  64.          push ds
  65.          push bp
  66.          segcs
  67.          mov bp,[dgroup]
  68.          mov ds,bp
  69.          inc [diskflag]
  70.          pushf
  71.          segds
  72.          callseg [olddisk]
  73.          dec [diskflag]
  74.          pop bp
  75.          pop ds
  76.          retseg 2
  77.          idt newvideo
  78.          def newvideo
  79. newvideo push ds
  80.          push bp
  81.          segcs
  82.          mov bp,[dgroup]
  83.          mov ds,bp
  84.          inc [videoflag]
  85.          pop bp
  86.          pushf
  87.          segds
  88.          callseg [oldvideo]
  89.          dec [videoflag]
  90.          pop ds
  91.          iret
  92.          idt vpoke
  93.          def vpoke
  94. vpoke    equ $
  95.          push bp
  96.          mov bp,sp
  97.          push di
  98.          push es
  99.          mov cx,[bp][%PARM1]
  100.          mov es,cx
  101.          mov di,[bp][%PARM2]
  102.          cmp cx,45056
  103.          jz mono1
  104.          mov dx,986
  105. loop1    in al,dx
  106.          test al,1
  107.          jnz loop1
  108. loop2    in al,dx
  109.          test al,1
  110.          jz loop2
  111. mono1    mov ax,[bp][%PARM3]
  112.          stosw
  113.          pop es
  114.          pop di
  115.          pop bp
  116.          retfar
  117.          idt vpeek
  118.          def vpeek
  119. vpeek    equ $
  120.          push bp
  121.          mov bp,sp
  122.          push si
  123.          push ds
  124.          mov si,[bp][%PARM2]
  125.          mov cx,[bp][%PARM1]
  126.          mov ds,cx
  127.          cmp cx,45056
  128.          jz mono2
  129.          mov dx,986
  130. loop3    in al,dx
  131.          test al,1
  132.          jnz loop3
  133. loop4    in al,dx
  134.          test al,1
  135.          jz loop4
  136. mono2    lodsw
  137.          pop ds
  138.          pop si
  139.          pop bp
  140.          retfar
  141. dgroup   equ $+3
  142.          callfar $$MAXS
  143.          def newkb
  144. newkb    equ $
  145.          push ax
  146.          push bx
  147.          push cx
  148.          push ds
  149.          segcs
  150.          mov  cx,[dgroup]
  151.          mov  ds,cx
  152.          mov  bh,[keymask]
  153.          xor  ax,ax
  154.          mov  ds,ax
  155.          mov  ah,[>417]
  156.          mov  ds,cx
  157.          and  ah,bh
  158.          cmp  ah,bh
  159.          jnz  exold
  160.          mov  bl,[scancode]
  161.          cmp  bl,0
  162.          jz   exold
  163.          in   al,>60
  164.          cmp  al,bl
  165.          jnz  exold
  166.          cli
  167.          in   al,>61
  168.          mov  ah,al
  169.          or   al,>80
  170.          out  >61,al
  171.          mov  al,ah
  172.          out  >61,al
  173.          mov  al,>20
  174.          out  >20,al
  175.          sti
  176.          mov  ax,[running]
  177.          cmp  ax,0
  178.          jnz  skipex
  179.          mov  [popflg],1
  180.          jmp  skipex
  181. exold    pushf
  182.          segds
  183.          callseg [oldkb]
  184. skipex   pop  ds
  185.          pop  cx
  186.          pop  bx
  187.          pop  ax
  188.          iret
  189.          def newtimer
  190. newtimer equ $
  191.          push ax
  192.          push bx
  193.          push cx
  194.          push ds
  195.          push es
  196.          segcs
  197.          mov  cx,[dgroup]
  198.          mov  ds,cx
  199.          pushf
  200.          segds
  201.          callseg [oldtimer]
  202.          mov  bh,[scancode]    ; if !scancode
  203.          cmp  bh,0
  204.          jnz  if2
  205.          mov  bh,[suspending]     ; if !suspending
  206.          cmp  bh,0
  207.          jnz  if2
  208.          mov  bh,[keymask]          ; key?
  209.          xor  ax,ax
  210.          mov  ds,ax
  211.          mov  ah,[>417]
  212.          mov  ds,cx
  213.          and  ah,bh
  214.          cmp  ah,bh
  215.          jnz  if2
  216.          mov  ax,[running]
  217.          cmp  ax,0
  218.          jnz  if2
  219.          mov  [popflg],1
  220. if2      equ  $
  221.          mov  ax,[popflg]
  222.          cmp  ax,0
  223.          jz   skipex2
  224.          les  bx,[dosbusy]
  225.          seges
  226.          cmp  %[bx],0
  227.          jnz  skipex2
  228.          mov  ax,[diskflag]
  229.          cmp  ax,0
  230.          jnz  skipex2
  231.          mov  ax,[videoflag]
  232.          cmp  ax,0
  233.          jnz  skipex2
  234.          mov  al,>20
  235.          out  >20,al
  236.          mov  [popflg],0
  237.          call execit
  238. skipex2  pop  es
  239.          pop  ds
  240.          pop  cx
  241.          pop  bx
  242.          pop  ax
  243.          iret
  244.          def execit
  245. execit   equ $
  246.          push ax
  247.          push bx
  248.          push cx
  249.          push dx
  250.          push si
  251.          push di
  252.          push ds
  253.          push es
  254.          push bp
  255.          mov  ax,cs
  256.          push ax
  257.          call dores
  258.          pop bp
  259.          pop es
  260.          pop ds
  261.          pop di
  262.          pop si
  263.          pop dx
  264.          pop cx
  265.          pop bx
  266.          pop ax
  267.          ret
  268.          def new28
  269. new28    equ $
  270.          push ax
  271.          push bx
  272.          push ds
  273.          push es
  274.          segcs
  275.          mov  ax,[dgroup]
  276.          mov  ds,ax
  277.          pushf
  278.          segds
  279.          callseg [old28]
  280.          segcs
  281.          mov  ax,[dgroup]
  282.          mov  ds,ax
  283.          mov  ax,[popflg]
  284.          cmp  ax,0
  285.          jz   skipex3
  286.          les  bx,[dosbusy]
  287.          seges
  288.          cmp  %[bx],0
  289.          jz   skipex3
  290.          mov  ax,[diskflag]
  291.          cmp  ax,0
  292.          jnz  skipex3
  293.          mov  ax,[videoflag]
  294.          cmp  ax,0
  295.          jnz  skipex3
  296.          mov  [popflg],0
  297.          call execit
  298. skipex3  equ  $
  299.          pop  es
  300.          pop  ds
  301.          pop  bx
  302.          pop  ax
  303.          iret
  304.          def newbreak
  305. newbreak equ $
  306.          iret
  307.          def newcrit
  308. newcrit  equ $
  309.          mov ax,0
  310.          iret
  311.          end
  312.