home *** CD-ROM | disk | FTP | other *** search
/ Frostbyte's 1980s DOS Shareware Collection / floppyshareware.zip / floppyshareware / APOG / ASM2.ZIP / CLIM_L.ASM < prev    next >
Encoding:
Assembly Source File  |  1990-10-21  |  7.0 KB  |  172 lines

  1. ;
  2. ;                clim_l.asm - EHLLAPI call "C" subroutine
  3. ;
  4. ; int HLLC(int far *func, char far *data_str, int far *data_len, int far *retc);
  5. ;
  6. ;   Sample EHLLAPI call subroutine for "C" Large Model
  7. ;
  8. ;       This is an IBM HLLC_L.OBJ 100% compatable? replacement.
  9. ;       May be linked in without any changes to calling program.
  10. ;
  11. ;       rc=HLLC(&func,data_str,&data_len,&retc);  // on return rc=retc always
  12. ;
  13. ;   Address all comments to:
  14. ;
  15. ;       Wayne L. Gary      CIS: 71640,3466
  16. ;       Tarrant County     Phone: (871) 334-1026
  17. ;       Data Services
  18. ;       100 E. Weatherford St.
  19. ;       Ft. Worth, TX 76196
  20. ;
  21. IDEAL
  22. MODEL LARGE
  23. PUBLIC _HLLC
  24. CODESEG
  25. PROC _HLLC FAR
  26. ;
  27. funcoff    equ    6
  28. funcseg    equ    8
  29. strgoff    equ    10
  30. strgseg    equ    12
  31. lgthoff    equ    14
  32. lgthseg    equ    16
  33. retcoff    equ    18
  34. retcseg    equ    20
  35. ;
  36.            push   bp                       ;save bp
  37.            mov    bp,sp                    ;set up my stack frame
  38.            push   di                       ;save di
  39.            push   si                       ;save si
  40. ;
  41.            mov    ax,@data                 ;setup my
  42.            mov    ds,ax                    ;  dataseg
  43. ;
  44. ;    Check HLLAPI active
  45.            mov    ax,357Fh                 ;get 7F vector
  46.            int    021h                     ;call DOS
  47.            mov    ax,es                    ;get returned segment
  48.            or     ax,bx                    ;get returned offset
  49.            cmp    ax,0000h                 ;is it zero?
  50.            je     hllc_not_active          ;YES - return error 1
  51. ;
  52. ;    Get function code
  53.            les    bx,[bp+funcoff]          ;point to function parm
  54.            mov    ah,[byte es:bx]          ;get function parm
  55.            mov    [byte pcb_func],ah       ;store in PCB
  56. ;
  57. ;    Get data address
  58.            les    bx,[bp+strgoff]          ;point to data parm
  59.            mov    [word pcb_dseg],es       ;store in PCB
  60.            mov    [word pcb_daddr],bx      ;store in PCB
  61. ;
  62. ;    Get string length
  63.            les    bx,[bp+lgthoff]          ;point to length parm
  64.            mov    ax,[word es:bx]          ;get length parm
  65.            mov    [word pcb_strlen],ax     ;store in PCB
  66. ;
  67. ;    Get return code - used by function 17 as input
  68.            les    bx,[bp+retcoff]          ;point to return code parm
  69.            mov    ax,[word es:bx]          ;get return code
  70.            mov    [word pcb_retc],ax       ;store in PCB
  71. ;
  72. ;    Check function 17
  73.            cmp    [byte pcb_func],17       ;is this function 17 ?
  74.            je     hllc_function_17         ;YES - go handle function 17
  75. ;
  76. ;    Call EHLLAPI
  77.            mov    si,offset pcb_hdr        ;address PCB offset
  78.            mov    ax,0104h                 ;set EHLLAPI required
  79.            xor    bx,bx                    ;set EHLLAPI required
  80.            int    07Fh                     ;call PCSHLL.EXE
  81. ;
  82.            sti                             ;allow interrupts
  83.            cmp    ax,0104h                 ;valid return ?
  84.            je     hllc_err10               ;NO - set return code 10
  85. ;
  86. ;   Pass return code to user
  87. hllc_ret:
  88.            mov    ax,@data                 ;setup my
  89.            mov    ds,ax                    ;  dataseg
  90.            les    bx,[bp+retcoff]          ;point to return code parm
  91.            mov    ax,[word pcb_retc]       ;set return code
  92.            mov    [word es:bx],ax          ;store in user field
  93. ;
  94. ;   Return to user
  95.            pop    si                       ;restore si
  96.            pop    di                       ;restore di
  97.            pop    bp                       ;restore bp
  98.            retf                            ;return
  99. ;
  100. ;   Display EHLLAPI not active
  101. hllc_not_active:
  102.            mov    ax,@data                 ;setup my
  103.            mov    ds,ax                    ;  dataseg
  104.            mov    dx,offset not_active     ;point to not_active
  105.            mov    ah,09h                   ;set display function
  106.            int    021h                     ;call DOS
  107. ;
  108. ;   Return error 1
  109. hllc_err1:
  110.            mov    [word pcb_retc],0001h    ;set fail return code
  111.            jmp    hllc_ret                 ;setup my
  112. ;
  113. ;   Return error 10
  114. hllc_err10:
  115.            mov    [word pcb_retc],000Ah    ;set fail return code
  116.            jmp    hllc_ret                 ;setup my
  117. ;
  118. ;    Call EHLLAPI - function 17
  119. hllc_function_17:
  120.            mov    ax,0104h                 ;set EHLLAPI required
  121.            mov    bh,[byte pcb_retc]       ;get sub function code
  122.            mov    bl,0AAh                  ;set EHLLAPI required
  123.            mov    cx,[word pcb_strlen]     ;YES - go handle function 17
  124.            push   ds                       ;save ds
  125.            int    07Fh                     ;call PCSHLL.EXE
  126. ;
  127.            pop    ds                       ;restore ds
  128.            cmp    ax,0104h                 ;valid return ?
  129.            je     hllc_err10               ;NO - set return code 10
  130.            mov    [word pcb_strlen],cx     ;set Get Storage length
  131.            mov    cx,[word pcb_retc]       ;get sub function code
  132.            mov    [word pcb_retc],dx       ;set return cod for exit
  133.            cmp    cl,01h                   ;is it Get Storage request?
  134.            jne    hllc_ret                 ;NO - continue in mainline
  135.            mov    es,[word pcb_dseg]       ;Get Storage segment
  136.            mov    di,[word pcb_daddr]      ;Get Storage offset
  137.            mov    [word es:di],bx          ;set Get Storage offset
  138.            mov    [word es:di+2],ax        ;set Get Storage segment
  139.            jmp    hllc_ret                 ;continue in mainline
  140. ENDP _HLLC
  141. ;
  142. DATASEG
  143. pcb_hdr    db     'PCB'                    ;PCB HEADER (In Caps)
  144. pcb_func   db     0                        ;Function Code
  145. pcb_dseg   dw     0                        ;String Segment Address
  146. pcb_daddr  dw     0                        ;String Offset Address
  147. pcb_strlen dw     0                        ;String Lenght
  148. pcb_filler db     0                        ;Not Used
  149. pcb_retc   dw     0                        ;Return Code
  150. pcb_maxlen dw     25000                    ;Maximum User String Size
  151. pcb_end    db     'PCB',13,10,'$'          ;PCB TRAILER (In Caps)
  152. not_active db     'EHLLAPI Not Active',13,10,'$'
  153.            END
  154.  HLLAPI active
  155.            mov    ax,357Fh                 ;get 7F vector
  156.            int    021h                     ;call DOS
  157.            mov    ax,es                    ;get returned segment
  158.            or     ax,bx                    ;get returned offset
  159.            cmp    ax,0000h                 ;is it zero?
  160.            je     hllc_not_active          ;YES - return error 1
  161. ;
  162. ;    Get function code
  163.            les    bx,[bp+funcoff]          ;point to function parm
  164.            mov    ah,[byte es:bx]          ;get function parm
  165.            mov    [byte pcb_func],ah       ;store in PCB
  166. ;
  167. ;    Get data address
  168.            les    bx,[bp+strgoff]          ;point to data parm
  169.            mov    [word pcb_dseg],es       ;store in PCB
  170.            mov    [word pcb_daddr],bx      ;store in PCB
  171. ;
  172. ;    Get st