home *** CD-ROM | disk | FTP | other *** search
- ;
- ; clim_l.asm - EHLLAPI call "C" subroutine
- ;
- ; int HLLC(int far *func, char far *data_str, int far *data_len, int far *retc);
- ;
- ; Sample EHLLAPI call subroutine for "C" Large Model
- ;
- ; This is an IBM HLLC_L.OBJ 100% compatable? replacement.
- ; May be linked in without any changes to calling program.
- ;
- ; rc=HLLC(&func,data_str,&data_len,&retc); // on return rc=retc always
- ;
- ; Address all comments to:
- ;
- ; Wayne L. Gary CIS: 71640,3466
- ; Tarrant County Phone: (871) 334-1026
- ; Data Services
- ; 100 E. Weatherford St.
- ; Ft. Worth, TX 76196
- ;
- IDEAL
- MODEL LARGE
- PUBLIC _HLLC
- CODESEG
- PROC _HLLC FAR
- ;
- funcoff equ 6
- funcseg equ 8
- strgoff equ 10
- strgseg equ 12
- lgthoff equ 14
- lgthseg equ 16
- retcoff equ 18
- retcseg equ 20
- ;
- push bp ;save bp
- mov bp,sp ;set up my stack frame
- push di ;save di
- push si ;save si
- ;
- mov ax,@data ;setup my
- mov ds,ax ; dataseg
- ;
- ; Check HLLAPI active
- mov ax,357Fh ;get 7F vector
- int 021h ;call DOS
- mov ax,es ;get returned segment
- or ax,bx ;get returned offset
- cmp ax,0000h ;is it zero?
- je hllc_not_active ;YES - return error 1
- ;
- ; Get function code
- les bx,[bp+funcoff] ;point to function parm
- mov ah,[byte es:bx] ;get function parm
- mov [byte pcb_func],ah ;store in PCB
- ;
- ; Get data address
- les bx,[bp+strgoff] ;point to data parm
- mov [word pcb_dseg],es ;store in PCB
- mov [word pcb_daddr],bx ;store in PCB
- ;
- ; Get string length
- les bx,[bp+lgthoff] ;point to length parm
- mov ax,[word es:bx] ;get length parm
- mov [word pcb_strlen],ax ;store in PCB
- ;
- ; Get return code - used by function 17 as input
- les bx,[bp+retcoff] ;point to return code parm
- mov ax,[word es:bx] ;get return code
- mov [word pcb_retc],ax ;store in PCB
- ;
- ; Check function 17
- cmp [byte pcb_func],17 ;is this function 17 ?
- je hllc_function_17 ;YES - go handle function 17
- ;
- ; Call EHLLAPI
- mov si,offset pcb_hdr ;address PCB offset
- mov ax,0104h ;set EHLLAPI required
- xor bx,bx ;set EHLLAPI required
- int 07Fh ;call PCSHLL.EXE
- ;
- sti ;allow interrupts
- cmp ax,0104h ;valid return ?
- je hllc_err10 ;NO - set return code 10
- ;
- ; Pass return code to user
- hllc_ret:
- mov ax,@data ;setup my
- mov ds,ax ; dataseg
- les bx,[bp+retcoff] ;point to return code parm
- mov ax,[word pcb_retc] ;set return code
- mov [word es:bx],ax ;store in user field
- ;
- ; Return to user
- pop si ;restore si
- pop di ;restore di
- pop bp ;restore bp
- retf ;return
- ;
- ; Display EHLLAPI not active
- hllc_not_active:
- mov ax,@data ;setup my
- mov ds,ax ; dataseg
- mov dx,offset not_active ;point to not_active
- mov ah,09h ;set display function
- int 021h ;call DOS
- ;
- ; Return error 1
- hllc_err1:
- mov [word pcb_retc],0001h ;set fail return code
- jmp hllc_ret ;setup my
- ;
- ; Return error 10
- hllc_err10:
- mov [word pcb_retc],000Ah ;set fail return code
- jmp hllc_ret ;setup my
- ;
- ; Call EHLLAPI - function 17
- hllc_function_17:
- mov ax,0104h ;set EHLLAPI required
- mov bh,[byte pcb_retc] ;get sub function code
- mov bl,0AAh ;set EHLLAPI required
- mov cx,[word pcb_strlen] ;YES - go handle function 17
- push ds ;save ds
- int 07Fh ;call PCSHLL.EXE
- ;
- pop ds ;restore ds
- cmp ax,0104h ;valid return ?
- je hllc_err10 ;NO - set return code 10
- mov [word pcb_strlen],cx ;set Get Storage length
- mov cx,[word pcb_retc] ;get sub function code
- mov [word pcb_retc],dx ;set return cod for exit
- cmp cl,01h ;is it Get Storage request?
- jne hllc_ret ;NO - continue in mainline
- mov es,[word pcb_dseg] ;Get Storage segment
- mov di,[word pcb_daddr] ;Get Storage offset
- mov [word es:di],bx ;set Get Storage offset
- mov [word es:di+2],ax ;set Get Storage segment
- jmp hllc_ret ;continue in mainline
- ENDP _HLLC
- ;
- DATASEG
- pcb_hdr db 'PCB' ;PCB HEADER (In Caps)
- pcb_func db 0 ;Function Code
- pcb_dseg dw 0 ;String Segment Address
- pcb_daddr dw 0 ;String Offset Address
- pcb_strlen dw 0 ;String Lenght
- pcb_filler db 0 ;Not Used
- pcb_retc dw 0 ;Return Code
- pcb_maxlen dw 25000 ;Maximum User String Size
- pcb_end db 'PCB',13,10,'$' ;PCB TRAILER (In Caps)
- not_active db 'EHLLAPI Not Active',13,10,'$'
- END
- HLLAPI active
- mov ax,357Fh ;get 7F vector
- int 021h ;call DOS
- mov ax,es ;get returned segment
- or ax,bx ;get returned offset
- cmp ax,0000h ;is it zero?
- je hllc_not_active ;YES - return error 1
- ;
- ; Get function code
- les bx,[bp+funcoff] ;point to function parm
- mov ah,[byte es:bx] ;get function parm
- mov [byte pcb_func],ah ;store in PCB
- ;
- ; Get data address
- les bx,[bp+strgoff] ;point to data parm
- mov [word pcb_dseg],es ;store in PCB
- mov [word pcb_daddr],bx ;store in PCB
- ;
- ; Get st