home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / UTILITY / SYSTEM / SLASH2.ZIP / SLASH.ASM next >
Encoding:
Assembly Source File  |  1991-07-19  |  1.7 KB  |  80 lines

  1.     page    66,132
  2. ;-----------------------------------------------------------------------------;
  3. ;  This routine emulates DOS 2.x/3.x switchchar processing
  4. ;-----------------------------------------------------------------------------;
  5.     .model    small
  6.     .code
  7.  
  8.     org    5ch
  9.  
  10. dos_vect dd    ?            ; old DOS vector number
  11. switch    db    ?            ; switch character
  12. isr    label    byte
  13.  
  14.  
  15.     public    begin
  16.     org    100h
  17. begin:    jmp    initialize
  18.  
  19. ;-----------------------------------------------------------------------------;
  20. ;  DOS service request interceptor
  21. ;-----------------------------------------------------------------------------;
  22. dos_isr proc    far
  23.     cmp    ah,37h            ; abandon interest in all but switch
  24.     je    @f
  25.     jmp    cs:[dos_vect]
  26. @@:
  27.     cmp    al,0
  28.     je    @f
  29.     mov    switch,dl
  30. @@:
  31.     mov    dl,switch
  32.     iret
  33.  
  34. isrlen    equ    $-dos_isr
  35.  
  36. dos_isr endp
  37.  
  38.  
  39. ;-----------------------------------------------------------------------------;
  40. ;        Terminate and stay resident initialization                  ;
  41. ;-----------------------------------------------------------------------------;
  42.  
  43. initialize proc near
  44.  
  45.     mov    switch,'/'        ; initialize switch character
  46.  
  47.     mov    di,offset isr        ; relocate isr routine
  48.     mov    si,offset dos_isr
  49.     mov    cx,isrlen
  50.     rep movsb
  51.  
  52.     mov    es,ds:2ch        ; free unused environment space
  53.     mov    ah,49h
  54.     int    21h
  55.  
  56.     mov    ax,3521h        ; get DOS interrupt vector
  57.     int    21h
  58.     mov    word ptr cs:dos_vect + 2,es
  59.     mov    word ptr cs:dos_vect,bx
  60.  
  61.     push    ds            ; hook us into the interrupt chain
  62.     mov    ax,2521h
  63.     mov    dx,cs
  64.     mov    ds,dx
  65.     mov    dx,offset isr
  66.     int    21h
  67.     pop    ds
  68.  
  69.     mov    ax,offset isr + isrlen    ; compute resident size
  70.     add    ax,15
  71.     mov    cl,4
  72.     shr    ax,cl
  73.     mov    dx,ax
  74.     mov    ah,31h            ; terminate but stay resident
  75.     mov    al,0
  76.     int    21h
  77. initialize endp
  78.  
  79.     end    begin
  80.