home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0020 - 0029 / ibm0020-0029 / ibm0028.tar / ibm0028 / GRLF-C-2.ZIP / GFUNC / GSETFCB.ASM < prev    next >
Encoding:
Assembly Source File  |  1990-05-30  |  9.2 KB  |  436 lines

  1.         page    58,132
  2.  
  3. ; gsetfcb.asm
  4. ; contains: getfname(),getblk(),setblk(),getlrs(),setlrs(),getlfs(),
  5. ; contains: getcrec(),setcrec(),getfattr(),setfattr(),getrrec(),
  6. ; contains: setrrec()
  7. ;
  8.  
  9.         include    model.h
  10.         include    prologue.h
  11.         include    equ.h
  12.  
  13.         name    gsetfcb
  14.         pseg    gsetfcb
  15.  
  16. ;==>--    char *getfname(table)
  17. ;
  18. ;;    ARGUMENTS:
  19. ;      (struct DISKTABLE *)    table    -    points to disktable
  20. ;
  21. ;;    DESCRIPTION:
  22. ;      This function returns a pointer to the drive number byte
  23. ;      in the FCB.  This is a 12 byte area, the first byte is the drive
  24. ;      number, followed by 8 bytes of filename, followed by three bytes
  25. ;      of file extension.  NOTE: THIS IS NOT A NULL TERMINATED STRING!
  26. ;
  27. ;;    RETURNS:
  28. ;      pointer to drive number byte in FCB
  29. ;
  30. ;;    AUTHOR:
  31. ;     ""   02-APR-1987  14:03:17.68
  32. ;      Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
  33. ;;    MODIFICATIONS
  34. ;
  35. ;;;
  36.     cproc    getfname,,,,,<NOSI,NODI>
  37.     if    _LDATA
  38.      push    ds
  39.      lds    bx,parm1_        ;ds:bx points to DISKTABLE
  40.     else
  41.      mov    bx,parm1_        ;ds:bx points to DISKTABLE
  42.     endif
  43.     add    bx,fcb
  44.     if    _LDATA
  45.      ifdef    AXBX32
  46.       mov    ax,ds            ;return value in AX:BX
  47.      else
  48.       mov    dx,ds            ;return value in DX:AX
  49.       mov    ax,bx    
  50.      endif
  51.         else
  52.      mov    ax,bx
  53.     endif
  54.     if    _LDATA
  55.      pop    ds
  56.     endif
  57.     cproce
  58.  
  59. ;==>--    unsigned getblk(table)
  60. ;
  61. ;;    ARGUMENTS:
  62. ;      (struct DISKTABLE *)    table    -    points to disktable
  63. ;
  64. ;;    DESCRIPTION:
  65. ;      Return the value of the current block number relative to the
  66. ;      beginning of the file, starting with zero (set to zero by the
  67. ;      open function call.
  68. ;
  69. ;;    RETURNS:
  70. ;      Value of the current block number field in the FCB
  71. ;
  72. ;;    AUTHOR:
  73. ;     ""   02-APR-1987  14:15:51.26
  74. ;      Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
  75. ;;;
  76.     cproc    getblk,,,,,<NOSI,NODI>
  77.     if    _LDATA
  78.      push    ds
  79.      lds    bx,parm1_
  80.     else
  81.      mov    bx,parm1_
  82.     endif
  83.     mov    ax,[bx+blocknum]
  84.     if    _LDATA
  85.      pop    ds
  86.     endif
  87.     cproce
  88.  
  89. ;==>--    unsigned setblk(table,newblock)
  90. ;
  91. ;;    ARGUMENTS:
  92. ;      (struct DISKTABLE *)    table    -    points to disktable
  93. ;      (unsigned)        newblock -    new block number
  94. ;
  95. ;;    DESCRIPTION:
  96. ;      Modify the value of the current block number relative to the
  97. ;      beginning of the file, starting with zero (set to zero by the
  98. ;      open function call.
  99. ;
  100. ;;    RETURNS:
  101. ;      Previous value of the current block number field in the FCB
  102. ;
  103. ;;    AUTHOR:
  104. ;     ""   02-APR-1987  14:15:51.26
  105. ;      Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
  106. ;;;
  107.     cproc    setblk,,,,,<NOSI,NODI>
  108.     if    _LDATA
  109.      push    ds
  110.      lds    bx,parm1_
  111.      mov    ax,parm3_
  112.     else
  113.      mov    bx,parm1_
  114.      mov    ax,parm2_
  115.     endif
  116.     xchg    ax,[bx+blocknum]
  117.     if    _LDATA
  118.      pop    ds
  119.     endif
  120.     cproce
  121.  
  122. ;==>--    unsigned getlrs(table)
  123. ;
  124. ;;    ARGUMENTS:
  125. ;      (struct DISKTABLE *)    table    -    points to disktable
  126. ;
  127. ;;    DESCRIPTION:
  128. ;      Return the value of the logical record size in bytes field of
  129. ;      the FCB.  This field is set to 0x80 by the dos open function
  130. ;      call.
  131. ;
  132. ;;    RETURNS:
  133. ;      Value of the logical record size field in the FCB
  134. ;
  135. ;;    AUTHOR:
  136. ;     ""   02-APR-1987  14:15:51.26
  137. ;      Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved. 
  138. ;;;
  139.     cproc    getlrs,,,,,<NOSI,NODI>
  140.     if    _LDATA
  141.      push    ds
  142.      lds    bx,parm1_
  143.     else
  144.      mov    bx,parm1_
  145.     endif
  146.     mov    ax,[bx+lrs]
  147.     if    _LDATA
  148.      pop    ds
  149.     endif
  150.     cproce
  151.  
  152. ;==>--    unsigned setlrs(table,newlrs)
  153. ;
  154. ;;    ARGUMENTS:
  155. ;      (struct DISKTABLE *)    table    -    points to disktable
  156. ;      (unsigned)        newlrs    -    new logical record size
  157. ;
  158. ;;    DESCRIPTION:
  159. ;      Modify the value of the logical record size in bytes field of
  160. ;      the FCB.  This field is set to 0x80 by the dos open function
  161. ;      call.
  162. ;
  163. ;;    RETURNS:
  164. ;      Previous value of the logical record size field field in the FCB
  165. ;
  166. ;;    AUTHOR:
  167. ;     "" 02-APR-1987  14:15:51.26
  168. ;      Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
  169. ;;;
  170.     cproc    setlrs,,,,,<NOSI,NODI>
  171.     if    _LDATA
  172.      push    ds
  173.      lds    bx,parm1_
  174.      mov    ax,parm3_
  175.     else
  176.      mov    bx,parm1_
  177.      mov    ax,parm2_
  178.     endif
  179.     xchg    ax,[bx+lrs]
  180.     if    _LDATA
  181.      pop    ds
  182.     endif
  183.     cproce
  184.  
  185. ;==>--    long getlfs(table)
  186. ;
  187. ;;    ARGUMENTS:
  188. ;      (struct DISKTABLE *)    table    -    points to disktable
  189. ;
  190. ;;    DESCRIPTION:
  191. ;      Return the value of the file size in bytes field of the FCB.
  192. ;
  193. ;;    RETURNS:
  194. ;      Value of the file size in bytes field in the FCB
  195. ;
  196. ;;    AUTHOR:
  197. ;     ""   02-APR-1987  14:15:51.26
  198. ;      Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
  199. ;;;
  200.     cproc    getlfs,,,,,<NOSI,NODI>
  201.     if    _LDATA
  202.      push    ds
  203.      lds    bx,parm1_
  204.     else
  205.      mov    bx,parm1_
  206.     endif
  207.     ifdef    AXBX32
  208.      mov    ax,word ptr[bx+lfs+2]    ;ax=high order word
  209.      mov    bx,word ptr[bx+lfs]    ;bx=low order word
  210.     else
  211.      mov    ax,word ptr[bx+lfs]    ;ax=low order word
  212.      mov    dx,word ptr[bx+lfs+2]    ;dx=high order word
  213.     endif
  214.     if    _LDATA
  215.      pop    ds
  216.     endif
  217.     cproce
  218.  
  219. ;==>--    unsigned getcrec(table)
  220. ;
  221. ;;    ARGUMENTS:
  222. ;      (struct DISKTABLE *)    table    -    points to disktable
  223. ;
  224. ;;    DESCRIPTION:
  225. ;      Return the value of the current relative record number (0-127) of
  226. ;      the FCB.
  227. ;
  228. ;;    RETURNS:
  229. ;      Value of the current relative record number in the FCB
  230. ;
  231. ;;    AUTHOR:
  232. ;     ""   02-APR-1987  14:15:51.26
  233. ;      Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
  234. ;;;
  235.     cproc    getcrec,,,,,<NOSI,NODI>
  236.     if    _LDATA
  237.      push    ds
  238.      lds    bx,parm1_
  239.     else
  240.      mov    bx,parm1_
  241.     endif
  242.     mov    al,[bx+fcbcr]
  243.     xor    ah,ah
  244.     if    _LDATA
  245.      pop    ds
  246.     endif
  247.     cproce
  248.  
  249. ;==>--    unsigned setcrec(table,newcrec)
  250. ;
  251. ;;    ARGUMENTS:
  252. ;      (struct DISKTABLE *)    table    -    points to disktable
  253. ;      (unsigned)        newcrec    -    new current relative record
  254. ;                        number.
  255. ;
  256. ;;    DESCRIPTION:
  257. ;      Modify the value of the current relative record number (0-127) of
  258. ;      the FCB.
  259. ;
  260. ;;    RETURNS:
  261. ;      Previous value of the current relative record number field field 
  262. ;      in the FCB
  263. ;
  264. ;;    AUTHOR:
  265. ;     ""   02-APR-1987  14:15:51.26
  266. ;      Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
  267. ;;;
  268.     cproc    setcrec,,,,,<NOSI,NODI>
  269.     if    _LDATA
  270.      push    ds
  271.      lds    bx,parm1_
  272.      mov    ax,parm3_
  273.     else
  274.      mov    bx,parm1_
  275.      mov    ax,parm2_
  276.     endif
  277.     xchg    al,[bx+fcbcr]
  278.     xor    ah,ah
  279.     if    _LDATA
  280.      pop    ds
  281.     endif
  282.     cproce
  283.  
  284. ;==>--    unsigned getfattr(table)
  285. ;
  286. ;;    ARGUMENTS:
  287. ;      (struct DISKTABLE *)    table    -    points to disktable
  288. ;
  289. ;;    DESCRIPTION:
  290. ;      Return the value of the attribyte byte field of the 
  291. ;      EXTENDED-FCB.
  292. ;
  293. ;;    RETURNS:
  294. ;      Value of the attribyte byte field in the EXTENDED-FCB.
  295. ;
  296. ;;    AUTHOR:
  297. ;     David Nienhiser   02-APR-1987  14:15:51.26
  298. ;      Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
  299. ;;;
  300.     cproc    getfattr,,,,,<NOSI,NODI>
  301.     if    _LDATA
  302.      push    ds
  303.      lds    bx,parm1_
  304.     else
  305.      mov    bx,parm1_
  306.     endif
  307.     mov    al,[bx+fattr]
  308.     xor    ah,ah
  309.     if    _LDATA
  310.      pop    ds
  311.     endif
  312.     cproce
  313.  
  314. ;==>--    unsigned setfattr(table,newattr)
  315. ;
  316. ;;    ARGUMENTS:
  317. ;      (struct DISKTABLE *)    table    -    points to disktable
  318. ;      (unsigned)        newattr    -    new attribute to be set in
  319. ;                        the EXTENDED-FCB
  320. ;
  321. ;;    DESCRIPTION:
  322. ;      Modify the value of the current relative record number (0-127) of
  323. ;      the FCB.
  324. ;
  325. ;;    RETURNS:
  326. ;      Previous value of the attribyte byte field in the EXTENDED-FCB.
  327. ;
  328. ;;    AUTHOR:
  329. ;     ""   02-APR-1987  14:15:51.26
  330. ;      Copyright (C)1987-1989 Greenleaf Software Inc. All Rights Reserved.
  331. ;;;
  332.     cproc    setfattr,,,,,<NOSI,NODI>
  333.     if    _LDATA
  334.      push    ds
  335.      lds    bx,parm1_
  336.      mov    ax,parm3_
  337.     else
  338.      mov    bx,parm1_
  339.      mov    ax,parm2_
  340.     endif
  341.     xchg    al,[bx+fattr]
  342.     xor    ah,ah
  343.     if    _LDATA
  344.      pop    ds
  345.     endif
  346.     cproce
  347.  
  348. ;==>--    long getrrec(table)
  349. ;
  350. ;;    ARGUMENTS:
  351. ;      (struct DISKTABLE *)    table    -    points to disktable
  352. ;
  353. ;;    DESCRIPTION:
  354. ;      Return the value of the relative record number relative to the
  355. ;      beginning of the file, starting with zero.  You must set this
  356. ;      field before doing random read/write operations.
  357. ;
  358. ;;    RETURNS:
  359. ;      Value of the relative record number field in the FCB.
  360. ;
  361. ;;    AUTHOR:
  362. ;     ""   02-APR-1987  14:15:51.26
  363. ;      Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
  364. ;;;
  365.     cproc    getrrec,,,,,<NOSI,NODI>
  366.     if    _LDATA
  367.      push    ds
  368.      lds    bx,parm1_
  369.     else
  370.      mov    bx,parm1_
  371.     endif
  372.     ifdef    AXBX32
  373.      mov    ax,[bx+_fcbr2]        ;AX=High order 16 bits
  374.      mov    bx,[bx+fcbrec]        ;BX=Low order 16 bits
  375.     else
  376.      mov    dx,[bx+_fcbr2]        ;DX=High order 16 bits
  377.      mov    ax,[bx+fcbrec]        ;AX=Low order 16 bits
  378.     endif
  379.     if    _LDATA
  380.      pop    ds
  381.     endif
  382.     cproce
  383.  
  384. ;==>--    long setrrec(table,newrrec)
  385. ;
  386. ;;    ARGUMENTS:
  387. ;      (struct DISKTABLE *)    table    -    points to disktable
  388. ;      (long)        newrrec -    new value for relative
  389. ;                        record number field.
  390. ;
  391. ;;    DESCRIPTION:
  392. ;      Modify the value of the relative record number relative to the
  393. ;      beginning of the file, starting with zero.  You must set this
  394. ;      field before doing random read/write operations.
  395. ;
  396. ;;    RETURNS:
  397. ;      Previous value of the relative record number field in the FCB.
  398. ;
  399. ;;    AUTHOR:
  400. ;     ""   02-APR-1987  14:15:51.26
  401. ;      Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
  402. ;;;
  403.     cproc    setrrec,,,,,<NOSI,NODI>
  404.     if    _LDATA
  405.      push    ds
  406.      lds    bx,parm1_
  407.     else
  408.      mov    bx,parm1_
  409.     endif
  410.     push    [bx+_fcbr2]        ;save upper 16 bits
  411.     push    [bx+fcbrec]        ;save lower 16 bits
  412.     if    _LDATA
  413.      mov    ax,parm3_
  414.      mov    [bx+fcbrec],ax
  415.      mov    ax,parm4_
  416.      mov    [bx+_fcbr2],ax
  417.     else
  418.      mov    ax,parm2_
  419.      mov    [bx+fcbrec],ax
  420.      mov    ax,parm3_
  421.      mov    [bx+_fcbr2],ax
  422.     endif
  423.     ifdef    AXBX32
  424.      pop    bx
  425.      pop    ax
  426.     else
  427.      pop    ax
  428.      pop    dx
  429.     endif
  430.     if    _LDATA
  431.      pop    ds
  432.     endif
  433.     cproce
  434.     endps
  435.     end
  436.