home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_200 / 287_02 / misc.asm < prev    next >
Assembly Source File  |  1989-05-25  |  1KB  |  53 lines

  1.         TITLE   MISCELLANEOUS of GDS
  2.         page    60,132
  3.         .SFCOND
  4. ;
  5. IFDEF   COLOR
  6.   IFDEF HERC
  7.    .err both display type defined
  8.   ENDIF
  9. else
  10.   IFNDEF HERC
  11.     HERC equ 0
  12.   ENDIF
  13. ENDIF
  14.  
  15. smo     equ     4       ; small model offset value
  16.  
  17. DGROUP  group   _DATA
  18. _DATA   segment word public 'DATA'
  19.         assume  ds:DGROUP
  20. _DATA   ends
  21.  
  22. _TEXT   segment byte public 'CODE'
  23.         assume  cs:_TEXT,ds:DGROUP
  24.         public  _nor_ptr, _exchange
  25.  
  26. ;       ret=nor_ptr(ptr);
  27. ;       int huge *ret,*ptr
  28. ;
  29. ;       return pointer with offset < 10h
  30. _nor_ptr proc    near    ;public to c
  31.         push    bp
  32.         mov     bp,sp
  33.         mov     ax,[bp+smo]
  34.         mov     dx,ax
  35.         mov     cl,4
  36.         shr     dx,cl
  37.         add     dx,[bp+smo+2]
  38.         and     ax,0fh
  39.         pop     bp
  40.         ret
  41. _nor_ptr endp
  42.  
  43. _exchange proc   near    ;public to c
  44.         mov     bx,sp
  45.         mov     ax,ss:[bx+smo-2]
  46.         xchg    ah,al
  47.         ret
  48. _exchange endp
  49.  
  50. _TEXT   ends
  51.         end
  52.  
  53.