home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ddkx86v5.zip / DDKX86 / SRC / DEV / TESTCFG / TESTCFGA.ASM < prev    next >
Assembly Source File  |  1995-04-14  |  24KB  |  770 lines

  1. ;*DDK*************************************************************************/
  2. ;
  3. ; COPYRIGHT    Copyright (C) 1995 IBM Corporation
  4. ;
  5. ;    The following IBM OS/2 WARP source code is provided to you solely for
  6. ;    the purpose of assisting you in your development of OS/2 WARP device
  7. ;    drivers. You may use this code in accordance with the IBM License
  8. ;    Agreement provided in the IBM Device Driver Source Kit for OS/2. This
  9. ;    Copyright statement may not be removed.;
  10. ;*****************************************************************************/
  11. ;       SCCSID = @(#)testcfga.asm       6.1 92/01/09
  12.         page    56,79
  13.  
  14. ;*** TESTCFGA.ASM - TestCFG Device Driver
  15. ;*
  16. ;*
  17. ;*
  18. ;*
  19. ;*   DESCRIPTION
  20. ;*
  21. ;*     TESTCFG assembly routines.  Mostly workers for TESTCFG C code.
  22. ;*
  23. ;*   MODIFICATION HISTORY
  24. ;*
  25. ;* 6.1  01/15/92 CP20 B731???  Jeff Muir         Original Version
  26. ;* 6.2  05/12/94 R207  83779   Frank Schroeder   Fixed IsAPMPresent()
  27. ;*      09/17/94 RBDD  98451   Jon Grimm         Resource Manager
  28. ;*
  29.  
  30. ; include definitions for DEVHLP and macros
  31. include testcfga.inc
  32.  
  33. .286c
  34. ;
  35. ;       C Startup routine for OS/2 Device Drivers
  36. ;
  37. ;  1.   Provides the user's "main" routine with the address of
  38. ;       the request packet.
  39. ;
  40. ;  2.   Defines the segments in the proper order (data, then code)
  41. ;       so if testcfga.obj is included first in the link line, the
  42. ;       segments for the device driver will be ordered correctly.
  43. ;
  44. ;  3.   Satisfies the C EXTRN for __acrtused, which prevents the startup
  45. ;       logic from being included from the standard C library.
  46.  
  47.         EXTRN   _main:near
  48.         EXTRN   _Device_Help:dword
  49.         PUBLIC  _STRATEGYCFG
  50.         PUBLIC  __acrtused
  51.  
  52. _DATA   segment word public 'DATA'
  53. _DATA   ends
  54.  
  55. CONST   segment word public 'CONST'
  56. CONST   ends
  57.  
  58. _BSS    segment word public 'BSS'
  59. _BSS    ends
  60.  
  61. STATICCODE      segment word public 'CODE'
  62. STATICCODE      ends
  63.  
  64. _TEXT           segment word public 'CODE'
  65. _TEXT           ends
  66.  
  67. INITCODE        segment word public 'CODE'
  68. INITCODE        ends
  69.  
  70. SWAPCODE        segment word public 'CODE'
  71. SWAPCODE        ends
  72.  
  73. DGROUP  group   CONST, _BSS, _DATA
  74.  
  75. StaticGroup     group   STATICCODE, INITCODE
  76. SWAPGROUP       group   SWAPCODE, _TEXT
  77.  
  78.  
  79. STATICCODE segment word public 'CODE'
  80.  
  81.           assume        cs:STATICCODE, ds:DGROUP, es:NOTHING
  82. __acrtused equ 1
  83.  
  84. _STRATEGYCFG proc  far
  85.  
  86.           push  es      ; &reqpacket.hi
  87.           push  bx      ; &reqpacket.lo
  88.           call  _main
  89.           pop   bx
  90.           pop   es
  91.           mov   word ptr es:[bx+3],ax  ; plug in status word
  92.           ret
  93.  
  94. _STRATEGYCFG endp
  95.  
  96. ;----------------------------------------------------------------------------:
  97. ;                                                                            ;
  98. ;   BOOL  ProcRun( ULONG EventId, PUSHORT AwakeCount);                       ;
  99. ;                                                                            ;
  100. ;----------------------------------------------------------------------------;
  101. EventId     equ word ptr [bp+nbase]
  102. AwakeCount  equ dword ptr [bp+nbase+4]
  103.  
  104. NCPROC   _ProcRun
  105.         push    es
  106.         push    bx
  107. .386
  108.         mov     bx, EventId[0]
  109.         mov     ax, EventId[2]
  110.  
  111.         mov     dl,DevHlp_ProcRun                ; Select function
  112.         call    [_Device_Help]                   ; Call devhelp
  113.  
  114.         les     bx, AwakeCount
  115.         mov     es:[bx], ax
  116. .286c
  117.         pop     bx
  118.         pop     es
  119. ENDNCPROC _ProcRun
  120.  
  121.  
  122. STATICCODE  ends
  123.  
  124. SWAPCODE segment word public 'CODE'
  125.           assume        cs:SWAPCODE, ds:DGROUP, es:NOTHING
  126.  
  127. ;---------------------------------------------------------------------------
  128. ; FUNCTION : InB - input byte from port
  129. ;---------------------------------------------------------------------------
  130. NCPROC   _InB
  131.  
  132.         push    dx                      ; save registers
  133.         mov     dx,word ptr [bp+nbase]   ; get I/O address
  134.         in      al,dx                   ; read from the port
  135.                                         ; (AL) - Port value
  136.         pop     dx                      ; restore registers
  137.  
  138. ENDNCPROC _InB
  139.  
  140. ;---------------------------------------------------------------------------
  141. ; FUNCTION : OutB - Output byte to port
  142. ;---------------------------------------------------------------------------
  143. NCPROC   _OutB
  144.  
  145.         push    dx                      ; save registers
  146.         mov     dx,word ptr [bp+nbase]   ; get I/O address
  147.         mov     al,byte ptr [bp+nbase+2] ; get I/O value
  148.         out     dx,al                   ; write to the port
  149.         pop     dx                      ; restore registers
  150.  
  151. ENDNCPROC _OutB
  152.  
  153. ;---------------------------------------------------------------------------
  154. ; FUNCTION : InW - Input word from port
  155. ;---------------------------------------------------------------------------
  156. NCPROC   _InW
  157.  
  158.         push    dx                      ; save registers
  159.         mov     dx,word ptr [bp+nbase]   ; get I/O address
  160.         in      ax,dx                   ; read from the port
  161.                                         ; (AX) - Port value
  162.         pop     dx                      ; restore registers
  163.  
  164. ENDNCPROC _InW
  165.  
  166. ;---------------------------------------------------------------------------
  167. ; FUNCTION : OutW - Output word to port
  168. ;---------------------------------------------------------------------------
  169. NCPROC   _OutW
  170.         push    dx                      ; save registers
  171.         mov     dx,word ptr [bp+nbase]   ; get I/O address
  172.         mov     ax,word ptr [bp+nbase+2] ; get I/O value
  173.         out     dx,ax                   ; write to the port
  174.         pop     dx                      ; restore registers
  175.  
  176.  
  177. ENDNCPROC _OutW
  178.  
  179. ;---------------------------------------------------------------------------
  180. ; FUNCTION : InDW - Input DWord from port
  181. ;---------------------------------------------------------------------------
  182. NCPROC   _InDW
  183.  
  184. .386
  185.         mov     dx,word ptr [bp+nbase]    ; get I/O address
  186.         in      eax,dx                   ; read from the port
  187.                                          ; (EAX) - Port value
  188.         mov     edx,eax                  ; (AX) - low port value
  189.         shr     edx,16                   ; (dx)
  190. .286c
  191.  
  192. ENDNCPROC _InDW
  193.  
  194. ;---------------------------------------------------------------------------
  195. ; FUNCTION : OutDW - Output DWord to port
  196. ;---------------------------------------------------------------------------
  197. NCPROC   _OutDW
  198.  
  199.         push    dx                        ; save registers
  200.         mov     dx,word ptr [bp+nbase]     ; get I/O address
  201. .386
  202.         mov     eax,dword ptr [bp+nbase+2] ; get I/O value
  203.         out     dx,eax                    ; write to the port
  204. .286c
  205.         pop     dx                        ; restore registers
  206.  
  207. ENDNCPROC _OutDW
  208.  
  209. ;---------------------------------------------------------------------------
  210. ; FUNCTION : strlen - determine length of string
  211. ;---------------------------------------------------------------------------
  212. NCPROC   _strlen
  213.  
  214.         push    si                              ; save register
  215.  
  216.         mov     si,word ptr [bp+nbase]           ; (SI) String Offset
  217.         xor     ax,ax                           ; (AX) String Length
  218. sl10:
  219.         cmp     byte ptr [si],0                 ; Is character zero?
  220.         je      slx                             ; yes, end of string
  221.         inc     ax                              ; increase count of chars
  222.         inc     si                              ; move to next char
  223.         jmp     sl10                            ; 
  224. slx:
  225.         pop     si                              ; restore register
  226.  
  227. ENDNCPROC _strlen
  228.  
  229.  
  230. ;***************************************************************************
  231. ; DevHelp Code 15h
  232. ;
  233. ; FUNCTION
  234. ;
  235. ; PhysToVirt - Map Physical Address to Virtual Address
  236. ;
  237. ; DESCRIPTION
  238. ;
  239. ; In the OS/2 Mode, PhysToVirt converts a 32-bit address to a valid
  240. ; selector-offset pair.  In the DOS mode, PhysToVirt converts a 32-bit
  241. ; address to a segment-offset pair.
  242. ;
  243. ; C PROTOCOL
  244. ;
  245. ; USHORT PhysToVirt(ULONG PhysAddr,USHORT Length,PULONG VirtAddr)
  246. ;***************************************************************************
  247. ; parameter equates
  248. PTV_PhysAddrLow    equ    word ptr [bp+nbase]
  249. PTV_PhysAddrHigh   equ    word ptr [bp+nbase+2]
  250. PTV_Length         equ    word ptr [bp+nbase+4]
  251. PTV_VirtAddr       equ    dword ptr [bp+nbase+6]
  252.  
  253. NCPROC   _PhysToVirt
  254.         push    dx                               ; Save registers
  255.         push    cx
  256.         push    bx
  257.         push    di
  258.         push    si
  259.         push    ds
  260.         push    es
  261.         mov     bx,PTV_PhysAddrLow               ; low physical address
  262.         mov     ax,PTV_PhysAddrHigh              ; high physical address
  263.         mov     cx,PTV_Length                    ; length
  264.         mov     dh,1                             ; result
  265.         mov     dl,DevHlp_PhysToVirt             ; Select function
  266.         call    [_Device_Help]                   ; Call devhelp
  267.         jc      ptv10
  268.         mov     dx,es
  269.         les     bx,PTV_VirtAddr                  ; address of VirtAddr
  270.         mov     word ptr es:[bx],di
  271.         mov     word ptr es:[bx+2],dx
  272.         xor     ax,ax
  273.         jmp     ptv20
  274. ptv10:
  275.         mov     ax,1
  276. ptv20:
  277.         pop     es
  278.         pop     ds
  279.         pop     si
  280.         pop     di
  281.         pop     bx
  282.         pop     cx
  283.         pop     dx
  284. ENDNCPROC _PhysToVirt
  285.  
  286. ;***************************************************************************
  287. ; DevHelp Code 27h
  288. ;
  289. ; FUNCTION
  290. ;
  291. ; VerifyAccess - Verify Access to Memory
  292. ;
  293. ; DESCRIPTION
  294. ;
  295. ; This routine verifies that the user process has the correct access rights
  296. ; for the memory that it passed to the device driver. If the process does
  297. ; not have the needed access rights to the memory, then it will be
  298. ; terminated.  If it does have needed access rights, these rights are
  299. ; guaranteed to remain valid until the device driver exits its strategy
  300. ; routine.
  301. ;
  302. ; C PROTOCOL
  303. ;
  304. ; USHORT VerifyAccess(PUCHAR pMem,USHORT MemLen,USHORT AccType);
  305. ;***************************************************************************
  306. ; parameter equates
  307. VA_pMemOff  equ         word ptr [bp+nbase]
  308. VA_pMemSeg  equ         word ptr [bp+nbase+2]
  309. VA_MemLen   equ         word ptr [bp+nbase+4]
  310. VA_AccType  equ         byte ptr [bp+nbase+6]
  311.  
  312. NCPROC   _VerifyAccess
  313.         push    dx                               ; Save register
  314.         push    cx
  315.         push    di
  316.         mov     ax,VA_pMemSeg                    ; Segment
  317.         mov     cx,VA_MemLen                     ; Length of memory area
  318.         mov     di,VA_pMemOff                    ; Offset to memory area
  319.         mov     dh,VA_AccType                    ; Type of Access (0 R, 1 R/W)
  320.         mov     dl,DevHlp_VerifyAccess           ; Select function
  321.         call    dword ptr [_Device_Help]         ; Call devhelp
  322.         jc      va10
  323.         xor     ax,ax
  324.         jmp     vax
  325. va10:   or      ax,1
  326. vax:
  327.         pop     di
  328.         pop     cx
  329.         pop     dx                               ; Restore register
  330. ENDNCPROC _VerifyAccess
  331.  
  332.  
  333. ;***************************************************************************
  334. ; DevHelp Code 32h
  335. ;
  336. ; FUNCTION
  337. ;
  338. ; UnPhysToVirt - Mark Completion of Virtual Address Use
  339. ;
  340. ; DESCRIPTION
  341. ;
  342. ; UnPhysToVirt is required to mark completion of address conversion from
  343. ; VirtToPhys
  344. ;
  345. ; C PROTOCOL
  346. ;
  347. ;   void UnPhysToVirt(void);
  348. ;***************************************************************************
  349. NCPROC   _UnPhysToVirt
  350.         push    dx                               ; Save register
  351.         mov     dl,DevHlp_UnPhysToVirt           ; Select function
  352.         call    dword ptr [_Device_Help]         ; Call devhelp
  353.         pop     dx                               ; Restore register
  354. ENDNCPROC _UnPhysToVirt
  355.  
  356. ;----------------------------------------------------------------------------:
  357. ;                                                                            ;
  358. ;   BOOL ProcBlock( ULONG EventId, ULONG WaitTime, USHORT IntWaitFlag );     ;
  359. ;                                                                            ;
  360. ;----------------------------------------------------------------------------;
  361. EventID     equ   word ptr [bp+nbase]
  362. WaitTime    equ   word ptr [bp+nbase+4]
  363. IntWaitFlag equ   word ptr [bp+nbase+8]
  364.  
  365. NCPROC   _ProcBlock
  366.         push    bx
  367.         push    cx
  368.         push    dx
  369.         push    di
  370.         push    si
  371. .386
  372.         mov     bx, EventId[0]
  373.         mov     ax, EventId[2]
  374.         mov     cx, WaitTime[0]
  375.         mov     di, WaitTime[2]
  376.         mov     dx, IntWaitFlag
  377.         mov     dh, dl
  378.         mov     dl,DevHlp_ProcBlock              ; Select function
  379.         call    [_Device_Help]                   ; Call devhelp
  380. .286c
  381.         pop     si
  382.         pop     di
  383.         pop     dx
  384.         pop     cx
  385.         pop     bx
  386.  
  387. ENDNCPROC _ProcBlock
  388.  
  389. ;***************************************************************************
  390. ;
  391. ; FUNCTION
  392. ;
  393. ; IsAPMPresent
  394. ;
  395. ; DESCRIPTION
  396. ;
  397. ; This routine determines if Advanced Power Management BIOS is present.
  398. ; This routine returns true only when either 16-bit or 32-bit protect
  399. ; mode APM BIOS is found.  When only real mode APM BIOS is found, this
  400. ; routine returns false.
  401. ;
  402. ; C PROTOCOL
  403. ;
  404. ; INT    IsAPMPresent(VOID);
  405. ;***************************************************************************
  406.  
  407. FCPROC   _IsAPMPresent
  408.         push    bx
  409.         push    cx
  410.         push    dx
  411.         push    ds
  412.  
  413.         xor     cx, cx                           ; cx=0, just query APM,
  414.                                                  ; don't establish connection
  415.         mov     al, 16                           ; index 16 (APM info)
  416.         mov     dl, DevHlp_GetDOSVar             ; select function
  417.         call    [_Device_Help]                   ; call devhelp
  418.         jc      short no_apm                     ; error, return 0
  419.  
  420.         push    ax
  421.         pop     ds
  422.         test    WORD PTR ds:[bx].APM_Flags, 03h  ; 16-bit or 32-bit PM APM?
  423.         jz      short no_apm                     ; no, return 0 (no apm)
  424.         mov     ax, 1                            ; otherwise return 1 (apm)
  425.         jmp     short apm_exit
  426.  
  427. no_apm:
  428.         xor     ax, ax
  429. apm_exit:
  430.         pop     ds
  431.         pop     dx
  432.         pop     cx
  433.         pop     bx
  434.  
  435. ENDFCPROC _IsAPMPresent
  436.  
  437. ;***************************************************************************
  438. ;
  439. ; FUNCTION
  440. ;
  441. ; GetDCTable - Get DASD Device Class table
  442. ;
  443. ; DESCRIPTION
  444. ;
  445. ; This routine is used to get the DASD device class table.
  446. ;
  447. ; C PROTOCOL
  448. ;
  449. ; USHORT GetDCTable(PVOID &(DCPtr);
  450. ;***************************************************************************
  451. ; parameter equates
  452. GDV_DCPtr  equ     word ptr [bp+nbase] ; address to place Device Class Table
  453.  
  454. NCPROC   _GetDCTable
  455.         push    dx                             ; Save registers
  456.         push    cx
  457.         push    bx
  458.         push    es
  459.  
  460.         mov     ax,14                          ; Index (Device Class Table)
  461.         mov     cx,1                           ; DASD device class
  462.         mov     dl,DevHlp_GetDosVar            ; Select function
  463.         call    [_Device_Help]                 ; Call devhelp
  464.         jc      gdv10                          ; ax:bx ptr to table
  465.         mov     dx,bx                          ; 
  466.         mov     bx,GDV_DCPtr
  467.         mov     ds:[bx],dx                     ; fill in DCPtr (return it)
  468.         mov     ds:[bx+2],ax
  469.         xor     ax,ax
  470.         jmp     gdv_x
  471. gdv10:
  472.         mov     ax,1
  473. gdv_x:
  474.         pop     es
  475.         pop     bx
  476.         pop     cx
  477.         pop     dx
  478. ENDNCPROC _GetDCTable
  479.  
  480. ;-----------------------------------------------------;
  481. ; VOID _ZeroCB (PBYTE ControlBlock, USHORT Length)    ;
  482. ;                                                     ;
  483. ; Function: Zero fill the input control block         ;
  484. ;                                                     ;
  485. ;-----------------------------------------------------;
  486. CtrlBlk EQU dword ptr [bp+nbase]
  487. BlkLen  EQU  word ptr [bp+nbase+4]
  488.  
  489. NCPROC   _ZeroCB
  490.  
  491.  
  492.         push    es
  493.         push    bx
  494.         push    cx
  495.         push    di
  496. .386
  497.         xor     eax,eax
  498.         les     di,CtrlBlk
  499.         mov     cx,BlkLen
  500.         mov     bx,cx
  501.         and     bx,3
  502.         shr     cx,2
  503.         cmp     cx,0
  504.         je      zcb_rem
  505.         rep     stosd
  506.  
  507. zcb_rem:
  508.         mov     cx,bx
  509.         cmp     cx,0
  510.         je      zcb_ret
  511.         rep     stosb
  512.  
  513. zcb_ret:
  514. .286c
  515.         pop     di
  516.         pop     cx
  517.         pop     bx
  518.         pop     es
  519.  
  520. ENDNCPROC _ZeroCB
  521.  
  522. ;----------------------------------------------------------;
  523. ; VOID _BlockCopy (PBYTE Dest, PBYTE Orig, USHORT Length   ;
  524. ;                                                          ;
  525. ; Function: Copy a block of data                           ;
  526. ;                                                          ;
  527. ;----------------------------------------------------------;
  528. BlkDest  EQU dword ptr [bp+nbase]
  529. BlkSrc   EQU dword ptr [bp+nbase+4]
  530. BlkCLen  EQU  word ptr [bp+nbase+8]
  531.  
  532. NCPROC   _BlockCopy
  533.  
  534.         push    ds
  535.         push    es
  536.         push    di
  537.         push    si
  538.         push    cx
  539.         push    bx
  540. .386
  541.         les     di,BlkDest
  542.         lds     si,BlkSrc
  543.         mov     cx,BlkCLen
  544.  
  545.         mov     bx,cx
  546.         and     bx,3
  547.         shr     cx,2
  548.         cmp     cx,0
  549.         je      bc_rem
  550.         rep     movsd
  551.  
  552. bc_rem:
  553.         mov     cx,bx
  554.         cmp     cx,0
  555.         je      bc_ret
  556.         rep     movsb
  557.  
  558. bc_ret:
  559. .286c
  560.         pop     bx
  561.         pop     cx
  562.         pop     si
  563.         pop     di
  564.         pop     es
  565.         pop     ds
  566.  
  567. ENDNCPROC _BlockCopy
  568.  
  569.  
  570. SWAPCODE  ends
  571.  
  572.  
  573. INITCODE        segment word public 'CODE'
  574.  
  575.           assume        cs:INITCODE, ds:DGROUP, es:NOTHING
  576. ;***************************************************************************
  577. ; FUNCTION
  578. ;
  579. ; SegLimit - determine segment limit
  580. ;
  581. ; DESCRIPTION
  582. ;
  583. ; Returns the current limit of the requested segment.
  584. ;
  585. ;***************************************************************************
  586. NCPROC   _SegLimit
  587.  
  588.         push    es
  589.         push    bx
  590.         push    di
  591.         mov     ax, word ptr [bp+nbase]
  592. ;       lsl     bx, ax                       ; get segment limit
  593.         db      0fh,03,0d8h
  594.         les     di, dword ptr [bp+nbase+2]    ; address of limit var
  595.         mov     word ptr es:[di],bx
  596.         xor     ax,ax
  597.  
  598.         pop     di
  599.         pop     bx
  600.         pop     es
  601.  
  602. ENDNCPROC _SegLimit
  603.  
  604. ;***************************************************************************
  605. ; DevHelp Code 16h
  606. ;
  607. ; FUNCTION
  608. ;
  609. ; VirtToPhys - Map Virtual Address to Physcial Address
  610. ;
  611. ; DESCRIPTION
  612. ;
  613. ; VirtToPhys converts a selector-offset pair to a 32-bit address.
  614. ;
  615. ; C PROTOCOL
  616. ;
  617. ; USHORT VirtToPhys(ULONG VirtAddr,PULONG pPhysAddr)
  618. ;***************************************************************************
  619. ; parameter equates
  620. VTP_VirtAddr       equ    dword ptr [bp+nbase]
  621. VTP_pPhysAddr      equ    dword ptr [bp+nbase+4]
  622.  
  623. NCPROC   _VirtToPhys
  624.         push    dx                               ; Save registers
  625.         push    cx
  626.         push    bx
  627.         push    di
  628.         push    si
  629.         push    ds
  630.         push    es
  631. .386
  632.         lds     si,VTP_VirtAddr
  633.         mov     dl,DevHlp_VirtToPhys             ; Select function
  634.         call    [_Device_Help]                   ; Call devhelp
  635.         jc      vtp10
  636.         les     di,VTP_pPhysAddr                  ; address of PhysAddr
  637.         mov     word ptr es:[di],bx
  638.         mov     word ptr es:[di+2],ax
  639.         xor     ax,ax
  640.         jmp     vtp20
  641. vtp10:
  642.         mov     ax,1
  643. vtp20:
  644. .286c
  645.         pop     es
  646.         pop     ds
  647.         pop     si
  648.         pop     di
  649.         pop     bx
  650.         pop     cx
  651.         pop     dx
  652. ENDNCPROC _VirtToPhys
  653.  
  654. ;***************************************************************************
  655. ; DevHelp Code 34h
  656. ;
  657. ; FUNCTION
  658. ;
  659. ; GetLIDEntry - Get a Logical ID
  660. ;
  661. ; DESCRIPTION
  662. ;
  663. ; This routine is used to obtain a Logical ID (LID) for devices that exist
  664. ; (that is, devices that are awake).
  665. ;
  666. ; C PROTOCOL
  667. ;
  668. ;   USHORT GetLIDEntry(USHORT DeviceID,USHORT RelativeLID,USHORT DeviceState,
  669. ;                      PUSHORT pLID);
  670. ;***************************************************************************
  671. ; parameter equates
  672. GL_DeviceID    equ        byte ptr [bp+nbase]
  673. GL_RelID       equ        byte ptr [bp+nbase+2]
  674. GL_DevState    equ        byte ptr [bp+nbase+4]
  675. GL_pLID        equ        dword ptr [bp+nbase+6]
  676.  
  677. NCPROC   _GetLIDEntry
  678.         push    dx                               ; Save registers
  679.         push    es
  680.         push    bx
  681.  
  682.         mov     al,GL_DeviceID                   ; DeviceID
  683.         mov     bl,GL_RelID                      ; Relative LID
  684.         mov     dh,GL_DevState                   ; Device State
  685.         mov     dl,DevHlp_GetLIDEntry            ; Select function
  686.         call    [_Device_Help]                   ; Call devhelp
  687.         jc      gle10
  688.         les     bx,GL_pLID                       ; Address of Var Addr
  689.         mov     word ptr es:[bx],ax
  690.         xor     ax,ax
  691. gle10:
  692.         pop     bx
  693.         pop     es
  694.         pop     dx
  695. ENDNCPROC _GetLIDEntry
  696.  
  697. ;***************************************************************************
  698. ; DevHelp Code 35h
  699. ;
  700. ; FUNCTION
  701. ;
  702. ; FreeLIDEntry - Release a Logical ID
  703. ;
  704. ; DESCRIPTION
  705. ;
  706. ; This routine is used to release a Logical ID.  This must be done at
  707. ; DEINSTALL or termination time.
  708. ;
  709. ; C PROTOCOL
  710. ;
  711. ; USHORT FreeLIDEntry(USHORT LID);
  712. ;***************************************************************************
  713. ; parameter equates
  714. FL_LID  equ     word ptr [bp+nbase]
  715.  
  716. NCPROC   _FreeLIDEntry
  717.         push    dx                               ; Save registers
  718.  
  719.         mov     ax,FL_LID                        ; LogicalID
  720.         mov     dl,DevHlp_FreeLIDEntry           ; Select function
  721.         call    [_Device_Help]                   ; Call devhelp
  722.         jc      fle10
  723.         xor     ax,ax
  724. fle10:
  725.         pop     dx
  726. ENDNCPROC _FreeLIDEntry
  727.  
  728. ;***************************************************************************
  729. ; DevHelp Code 36h
  730. ;
  731. ; FUNCTION
  732. ;
  733. ; ABIOSCall - Invoke ABIOS Function
  734. ;
  735. ; DESCRIPTION
  736. ;
  737. ; This routine is used to invoke an ABIOS service for the Operating
  738. ; System Transfer Convention.
  739. ;
  740. ; C PROTOCOL
  741. ;
  742. ; USHORT ABIOSCall(USHORT LID, POINTER RBOffset, USHORT Entry);
  743. ;***************************************************************************
  744. ; Parameter equates
  745. AB_LID        equ   word ptr [bp+nbase]
  746. AB_RBOffset   equ   word ptr [bp+nbase+2]
  747. AB_Entry      equ   byte ptr [bp+nbase+4]
  748.  
  749. NCPROC   _ABIOSCall
  750.         push    dx                               ; Save registers
  751.         push    si
  752.  
  753.         mov     ax,AB_LID                        ; LogicalID
  754.         mov     si,AB_RBOffset                   ; RB Offset
  755.         mov     dh,AB_Entry                      ; Entry
  756.         mov     dl,DevHlp_ABIOSCall              ; Select function
  757.         call    [_Device_Help]                   ; Call devhelp
  758.         jc      abc10
  759.         xor     ax,ax
  760. abc10:
  761.         pop     si
  762.         pop     dx
  763.  
  764. ENDNCPROC _ABIOSCall
  765.  
  766.  
  767. INITCODE        ends
  768.  
  769.           end
  770.