home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c004 / 4.ddi / NETBIOS / CTSFG.ASM < prev    next >
Encoding:
Assembly Source File  |  1989-04-18  |  5.2 KB  |  216 lines

  1.     page ,132
  2.  
  3. comment !
  4.  *    netbios version of c-tree server
  5.  *    foreground version asm lang support
  6.  *
  7.  *    This program is the CONFIDENTIAL and PROPRIETARY property 
  8.  *    of FairCom(R) Corporation. Any unauthorized use, reproduction or
  9.  *    transfer of this program is strictly prohibited.
  10.  *
  11.  *      Copyright (c) 1987, 1988, 1989 FairCom Corporation
  12.  *    (Subject to limited distribution and
  13.  *     restricted disclosure only.)
  14.  *    *** ALL RIGHTS RESERVED ***
  15.  *
  16.  *    4006 West Broadway
  17.  *    Columbia, MO 65203
  18.  *
  19.  *
  20.  *    c-tree(R)    Version 4.3
  21.  *            Release C
  22.  *            February 7, 1989 17:30
  23.  *
  24. !
  25.  
  26.  
  27.     include    asm.inc
  28.  
  29.  
  30.     DSEG
  31.  
  32.     extrn __psp:word    ;crt addr of program seg prefix
  33.  
  34.     CSEG
  35.  
  36.  
  37.  
  38.     assume    ds:nothing
  39.  
  40. ;--------------------------------------------------------------------
  41. ;configuration control
  42. ;--------------------------------------------------------------------
  43. ;note: the same source module can be used for any C memory module
  44. ;(with appropiate 'far' modifiers). however it is recommended to
  45. ;assemble with a define (/D on the masm line) of one of the
  46. ;following:  SMALL or COMPACT or MEDIUM or LARGE
  47. ;example:  masm ctsfg /ml /DCOMPACT;
  48. ;--------------------------------------------------------------------
  49.  
  50.  
  51. ;comment out next to use dos default of 20 file max
  52. FID_TABLE_SZ = 255        ;up to 255 files open
  53.  
  54.  
  55.  
  56. ;--------------------------------------------------------------------
  57. ; program segment prefix
  58. ;--------------------------------------------------------------------
  59. ;--------------------------------------------------------------------
  60.  
  61. PSP struc
  62.   pp_int20    dw ?        ;+00 exit instruction
  63.   pp_mtop    dw ?        ; 02 paragraph past end of mem
  64.   pp_4        db ?        ; 04
  65.   pp_cpmcall    db ?        ; 05 long call opcode
  66.   pp_cpmmtop    dw ?        ; 06 long call oprand adj to look like mtop
  67.   pp_cpmcallseg    dw ?        ; 08 rest of long call
  68.   pp_i22term    dd ?        ; 0a exit to parent addr
  69.   pp_i23ctlcp    dd ?        ; 0e ctl-c trap of parent
  70.   pp_i24cerrp    dd ?        ; 12 critical err trap of parent
  71.   pp_parent    dw ?        ; 16 psp of parent
  72.   pp_fidtbl    db 20 dup (?)    ; 18 file id table
  73.   pp_envseg    dw ?        ; 2c seg of environment
  74.   pp_spsave    dw ?        ; 2e sp save while in dos or execing child
  75.   pp_sssave    dw ?        ; 30 ss save "
  76.   pp_fidtbllen    dw ?        ; 32 length of fidtbl
  77.   pp_fidtblptr    dd ?        ; 34 ptr to fidtbl
  78.   pp_shr0    dw ?        ; 38 set to ffff (used by share.exe)
  79.   pp_shr1    dw ?        ; 3a set  to ffff (used by share.exe)
  80.         db 14h dup (?)    ; 3c
  81.   pp_call50    dw ?        ; 50 old convention dos entry
  82.   pp_call50ret    db ?        ; 52
  83.         db 09h dup (?)    ; 53
  84.   pp_fcb0    db 16 dup (?)    ; 5c
  85.   pp_fcb1    db 16 dup (?)    ; 6c
  86.         db 4 dup (?)    ; 7c
  87.   pp_cmdtail    db 128 dup (?)    ; 80
  88. PSP ends
  89.  
  90.  
  91.  
  92.  
  93.  
  94. ;--------------------------------------------------------------------
  95. ;replacement file-id table so dos can open more than 20 files
  96. ;--------------------------------------------------------------------
  97.  
  98.  
  99.     CSEG ;in code segment
  100.  
  101. ifdef FID_TABLE_SZ
  102.   ifdef DEBUG
  103.    public fid_table
  104.   endif
  105. fid_table    db FID_TABLE_SZ dup (0ffh)
  106. endif
  107.  
  108.  
  109.  
  110. ;--------------------------------------------------------------------
  111. ;misc dos traps
  112. ;--------------------------------------------------------------------
  113. ;these are set during server context
  114. ;i24 (critical err) just causes dos call to fail
  115. ;i23 (ctl-brk dos) don't let user trap get control
  116. ;i1b (ctl-brk bios) "    "   "    "    "    "
  117. ;
  118. ;--------------------------------------------------------------------
  119.  
  120. ;misc default traps for task context
  121.  
  122. ifdef DEBUG
  123.   public i24_trap,i1b_trap,i23_trap
  124. endif
  125.  
  126. i24_trap:
  127.     mov    al,3            ;fail the call
  128. i1b_trap:
  129. i23_trap:
  130.     iret
  131.  
  132.  
  133.  
  134.  
  135. ;--------------------------------------------------------------------
  136. ;fanrf - async netbios command completed notification
  137. ;--------------------------------------------------------------------
  138. ;all async ncbs from server have an extra word in front that is set
  139. ;to 1 by this when command completes.
  140. ;
  141. ;--------------------------------------------------------------------
  142.  
  143. ;es:bx -> ncb that has a word flag in front of it
  144.     public    _fanrf
  145. _fanrf proc far
  146.     mov    WO es:[bx-2],1    ;set done flag (xncb.f)
  147.     iret
  148. _fanrf endp
  149.  
  150.  
  151.  
  152. ;--------------------------------------------------------------------
  153. ;fg_init(void)
  154. ;--------------------------------------------------------------------
  155. ;
  156. ;the dos internal handle table is moved to a bigger area so more
  157. ;files can be opened by the server task.
  158. ;--------------------------------------------------------------------
  159.  
  160.  
  161.  
  162.     public _fg_init
  163. _fg_init proc far
  164.     assume ds:DGROUP
  165.     push    bp
  166.     mov    bp,sp
  167.     push    di
  168.     push    si
  169.  
  170.     push    ds
  171.  
  172.     ifdef FID_TABLE_SZ
  173. ; set bigger file id table for dos
  174.     mov    es,__psp
  175.     lds    si,es:[0].pp_fidtblptr
  176.     assume    ds:nothing
  177.     mov    cx,es:[0].pp_fidtbllen
  178.     cmp    cx,FID_TABLE_SZ
  179.     jae    iti2
  180.     mov    di,OTX fid_table
  181.     mov    WO es:[0].pp_fidtblptr,di
  182.     mov    WO es:[0].pp_fidtblptr+2,cs
  183.     mov    es:[0].pp_fidtbllen,FID_TABLE_SZ
  184.     push    cs
  185.     pop    es
  186.     rep    movsb            ;copy already open file ids
  187. iti2:
  188.     endif
  189.  
  190. ;set up error traps
  191.  
  192.     push    cs
  193.     pop    ds
  194.     mov    dx,OTX i23_trap
  195.     DOS    2523h
  196.     mov    dx,OTX i24_trap
  197.     DOS    2524h
  198.     pop    ds
  199.     assume    ds:DGROUP
  200.  
  201.  
  202. ; turn off break checking
  203.  
  204.     mov    dl,0
  205.     DOS    3301h
  206.     pop    si
  207.     pop    di
  208.     pop    bp
  209.     ret
  210. _fg_init endp
  211.     assume    ds:nothing
  212.  
  213.  
  214.     END_MOD
  215.     end
  216.