home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0010 - 0019 / ibm0010-0019 / ibm0010.tar / ibm0010 / CDOSDSK6.ZIP / CDOSDSK6.TD0 / QUELIB / QUEASM.ASM < prev    next >
Encoding:
Assembly Source File  |  1989-01-16  |  3.8 KB  |  211 lines

  1. ; ***********************************************************************
  2. ; *                                    *
  3. ; *            Queue Bindings Assembly Module            *
  4. ; *                                    *
  5. ; * Copyright (c) 1986 by Digital Research Inc.                *
  6. ; *                                    *
  7. ; * Modification History:                        *
  8. ; * =====================                        *
  9. ; *                                    *
  10. ; *   Date   Author Version   Modification                *
  11. ; * 02/07/86  NJW     1.0     Initial Version                *
  12. ; *                                    *
  13. ; ***********************************************************************
  14. ;
  15.  
  16. FALSE        equ    0
  17. TRUE        equ    not FALSE
  18.  
  19.  
  20. LARGE_MODEL    equ    FALSE            ; Large or small memory model ?
  21.  
  22.  
  23.  
  24. BDOS        equ    224            ; DRI BDOS entry point
  25. S_SYSDAT    equ    154            ; Return sysdat BDOS function
  26.  
  27.  
  28. ; Subroutines made public:
  29. ; ========================
  30.  
  31. public        __DRIDOS
  32. if LARGE_MODEL
  33. public        __PTRSUB
  34. public        __SYSDAT
  35. endif
  36.  
  37. ; Memory made global:
  38. ; ===================
  39.  
  40. public        __EXTEND            ; __extended_error (lc only has
  41.                         ;     8 significant characters)
  42.  
  43. prog    segment public    'prog'
  44.     assume    cs:prog, ds:data
  45.  
  46. ;
  47. ; ***********************************************************************
  48. ; *                __DRIDOS                *
  49. ; *                ========                *
  50. ; * Action:                                *
  51. ; * Call the DRI BDOS (int 224)                        *
  52. ; *                                    *
  53. ; * Input parameters:                            *
  54. ; * (On stack)        DX parameter                    *
  55. ; *            Routine to call                    *
  56. ; *                                    *
  57. ; * Output parameters:                            *
  58. ; * AX            BDOS error code                    *
  59. ; * __extended_error    CX extended error code                *
  60. ; *                                    *
  61. ; ***********************************************************************
  62. ;
  63. if LARGE_MODEL
  64. __DRIDOS     proc    far
  65. else
  66. __DRIDOS    proc    near
  67. endif
  68.  
  69. ; Set up stack frame
  70.  
  71. push    bp
  72. mov    bp,sp                    ; Stack is [bp] [ret] [dx] [cx]
  73.  
  74. if LARGE_MODEL
  75. push    ds                    ; Save DS too if large model
  76. endif
  77.  
  78. ; Get parameters
  79.  
  80. if LARGE_MODEL
  81. mov    cx,[bp + 6]
  82. lds    dx,[bp + 8]                ; DS:DX is pointer
  83.  
  84. else
  85.  
  86. mov    cx,[bp + 4]
  87. mov    dx,[bp + 6]                ; Function call parameter
  88. endif
  89.  
  90. ; Call the DOS
  91.  
  92. int    BDOS
  93.  
  94. ; Save the extended error code
  95.  
  96. if LARGE_MODEL
  97. pop    ds
  98. endif
  99.  
  100. mov    cs:__EXTEND,cx
  101.  
  102. ; Kill BX (returns an 'int' not a 'long')
  103.  
  104. mov    bx,0
  105.  
  106. ; END
  107.  
  108. pop    bp
  109. ret
  110.  
  111. __DRIDOS endp
  112.  
  113.  
  114. if LARGE_MODEL
  115. ;
  116. ; ***********************************************************************
  117. ; *                __PTRSUB                *
  118. ; *                ========                *
  119. ; * Action:                                *
  120. ; * Convert pointer difference s2-s1 into 16 bit offset.        *
  121. ; *                                    *
  122. ; * Input parameters:                            *
  123. ; * (On Stack):        s1                        *
  124. ; *            s2                        *
  125. ; *                                    *
  126. ; * Output parameters:                            *
  127. ; * ax            (s2-s1) (as offset)                *
  128. ; *                                    *
  129. ; ***********************************************************************
  130. ;
  131. __PTRSUB proc    far
  132.  
  133. ; Set up stack frame
  134.  
  135. push    bp
  136. mov    bp,sp                    ; Stack is [bp] [ret] [s1] [s2]
  137.  
  138. ; Subtract segments to get segment offset (-> bytes)
  139.  
  140. mov    ax,[bp + 12]                ; S2(h)
  141. sub    ax,[bp + 8]                ; S1(h)
  142. mov    cl,4
  143. shl    ax,cl
  144.  
  145. ; Add s2 offset to segment offset
  146.  
  147. add    ax,[bp + 10]                ; S2(l)
  148.  
  149. ; Reset stack
  150.  
  151. pop    bp
  152.  
  153. ; END
  154.  
  155. ret
  156.  
  157. __PTRSUB endp
  158.  
  159.  
  160. ;
  161. ; ***********************************************************************
  162. ; *                __SYSDAT                *
  163. ; *                ========                *
  164. ; * Action:                                *
  165. ; * Return a long pointer to sysdat.                    *
  166. ; *                                    *
  167. ; * Input parameters:                            *
  168. ; * None.                                *
  169. ; *                                    *
  170. ; * Output parameters:                            *
  171. ; * Long pointer to sysdat.                        *
  172. ; *                                    *
  173. ; ***********************************************************************
  174. ;
  175. __SYSDAT proc    far
  176.  
  177. ; Save registers
  178.  
  179. push    es
  180.  
  181. ; Get sysdat segment
  182.  
  183. mov    cl,S_SYSDAT
  184. int    BDOS
  185.  
  186. ; Set return values
  187.  
  188. mov    ax,es                ; AX:BX is long pointer
  189.  
  190. ; Restore registers
  191.  
  192. pop    es
  193.  
  194. ; END
  195.  
  196. ret
  197.  
  198. __SYSDAT endp
  199.  
  200. endif
  201. prog    ends
  202.  
  203.  
  204. data    segment    public 'data'
  205.  
  206. __EXTEND    dw    0            ; Extended error code
  207.  
  208. data    ends
  209.  
  210. end
  211.