home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0020 - 0029 / ibm0020-0029 / ibm0028.tar / ibm0028 / GRLF-C-2.ZIP / GFUNC / TINYFNS.ASM < prev    next >
Encoding:
Assembly Source File  |  1990-05-30  |  2.3 KB  |  154 lines

  1.         page    58,132
  2.  
  3. ;
  4. ; tinyfns.asm
  5. ; contains: getcs(),getss(),getax(),getbx(),getcx(),getdx(),getsi(),getdi(),
  6. ; contains: getbp(),getsp(),ofsspu(),ptrcnv().
  7. ;
  8.         include    model.h
  9.         include    prologue.h
  10.         name    tinyfns
  11.  
  12. ;;    AUTHOR:
  13. ;      Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
  14. ;
  15. ;;    MODIFICATIONS:
  16. ;
  17. ;;;
  18.         pseg tinyfns
  19.  
  20. ;==>--    unsigned getcs()
  21. ;
  22. ;    Returns value of CS register
  23. ;
  24.     cproc    getcs
  25.     if    _LCODE
  26.      mov    ax,[bp+4]
  27.     else
  28.      mov    ax,cs
  29.     endif
  30.     cproce
  31.  
  32. ;==>--    unsigned getss()
  33. ;
  34. ;    Returns value of SS register
  35. ;
  36.     cproc    getss,,,,,<LRA>
  37.     mov    ax,ss
  38.     cproce
  39.  
  40.  
  41. ;==>--    unsigned getax()
  42. ;
  43. ;    Returns value of AX register
  44. ;
  45.     cproc    getax,,,,,<LRA>
  46.                 ;it's already there!
  47.     cproce
  48.  
  49. ;==>--    unsigned getbx()
  50. ;
  51. ;    Returns value of BX register
  52. ;
  53.     cproc    getbx,,,,,<LRA>
  54.     mov    ax,bx
  55.     cproce
  56.  
  57. ;==>--    unsigned getcx()
  58. ;
  59. ;    Returns value of CX register
  60. ;
  61.     cproc    getcx,,,,,<LRA>
  62.     mov    ax,cx
  63.     cproce
  64.  
  65. ;==>--    unsigned getdx()
  66. ;
  67. ;    Returns value of DX register
  68. ;
  69.     cproc    getdx,,,,,<LRA>
  70.     mov    ax,dx
  71.     cproce
  72.  
  73. ;==>--    unsigned getsi()
  74. ;
  75. ;    Returns value of SI register
  76. ;
  77.     cproc    getsi,,,,,<LRA>
  78.     mov    ax,si
  79.     cproce
  80.  
  81. ;==>--    unsigned getdi()
  82. ;
  83. ;    Returns value of DI register
  84. ;
  85.     cproc    getdi,,,,,<LRA>
  86.     mov    ax,di
  87.     cproce
  88.  
  89. ;==>--    unsigned getbp()
  90. ;
  91. ;    Returns value of BP register
  92. ;
  93.     cproc    getbp,,,,,<LRA>
  94.     mov    ax,bp
  95.     cproce
  96.  
  97. ;==>--    unsigned getsp()
  98. ;
  99. ;    Returns value of SP register
  100. ;
  101.     cproc    getsp,,,,,<LRA>
  102.     mov    ax,sp
  103.     cproce
  104.  
  105. ;==>--    unsigned segspu(pointer)
  106. ;    char *pointer;
  107. ;
  108. ;    Return segment of DATA pointer.
  109. ;
  110.     cproc    segspu
  111.     if _LDATA
  112.       push    ds
  113.      lds    ax,dword ptr parm1_
  114.      mov    ax,ds
  115.      pop    ds
  116.     else
  117.      mov    ax,ds
  118.     endif
  119.     cproce
  120.  
  121. ;==>--    unsigned ofsspu(pointer)
  122. ;    char *pointer;
  123. ;
  124. ;    Return offset of DATA pointer.
  125. ;
  126.     cproc    ofsspu
  127.     if _LDATA
  128.      push    ds
  129.      lds    ax,dword ptr parm1_
  130.        pop    ds
  131.     else
  132.      mov    ax,parm1_
  133.     endif
  134.     cproce
  135.  
  136. ;==>--    char *ptrcnv(seg,ofs)
  137. ;    unsigned seg,ofs;
  138. ;
  139. ;    Convert segment:offset to long (far) pointer.  Small data model
  140. ;    programs should declar this function  long ptrcnv(); if they expect
  141. ;    to get a 32 bit value returned.
  142. ;
  143.     cproc    ptrcnv
  144.     ifndef    AXBX32
  145.      mov    dx,parm1_
  146.      mov    ax,parm2_
  147.     else
  148.      mov    ax,parm1_
  149.      mov    bx,parm2_
  150.     endif
  151.     cproce
  152.     endps
  153.     end
  154.