home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_02_02 / 2n02010a < prev    next >
Text File  |  1990-12-17  |  1KB  |  32 lines

  1. if   DOS16M
  2. mov   ax, alias_cs
  3. mov   es, ax              ; get cs's alias in es
  4. or    ax, ax              ; a valid selector will not be zero
  5. jnz   aliased             ; use it if valid
  6.                           ; else make it if not valid
  7. push  cs                  ; push cs for call
  8. xor   ax, ax              ; clear low word of passed pointer
  9. push  ax
  10. call  _D16SegDSAlias      ; D16SegDSAlias returns a data selector which
  11.                           ; points to the same physical memory address
  12.                           ; as the (code) selector which is passed to it
  13. add   sp, 4               ; clear stack
  14. mov   alias_cs, dx        ; store the alias selector
  15. mov   es, dx              ; move alias_cs into es to use it
  16. aliased:
  17. mov   ax, [bp].intno         ; get interrupt #
  18. mov   bx, offset doint
  19. mov   es:[bx+1], al          ; modify the code, this is ok now because
  20.                              ; es is a valid data selector that accesses
  21.                              ; the same memory as cs
  22.  
  23. else  ;;;;;;;;;;;;;;;;; else OS/286
  24.  
  25. mov   bx, cs
  26. xor   bx, 8h                 ; data selector has bit 3 set
  27. mov   es, bx
  28. mov   bx, offset doint       ; offset from start of selector
  29. mov   es: [bx+1],al          ; set the interrupt number
  30.  
  31. endif
  32.