home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / cpm / zcpr33 / syslbsrc.lbr / SGRR1.ZY0 / SGRR1.ZY0
Encoding:
Text File  |  1989-07-04  |  2.3 KB  |  75 lines

  1. ;    TITLE    "SGRR1 - Syslib 4.0
  2.     NAME    ('GETRR1')
  3. ;=================================================================
  4. ;   The Libraries, Version 4, (C) 1989 by Alpha Systems Corp.
  5. ;-----------------------------------------------------------------
  6. ; Author  : Harold F. Bower
  7. ;        Derived from SGRR1.Z80 Ver 1.1 by Richard Conn
  8. ; Date    : 4 Jul 89
  9. ; Version : 1.3
  10. ; Module  : SGRR1
  11. ; Abstract: This module provides two two functions: GETRR1 and
  12. ;    GETFS1.  With the file FCB pted to by DE, GETRR1 gets
  13. ;    the random record number of the last record read or
  14. ;    written sequentially from the file.  GETFS1 gets the file
  15. ;    size of the file in terms of records.  The FCB passed to
  16. ;    these two routines is not affected.
  17. ; Revision:
  18. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  19.  
  20. ;  Entry Points
  21.  
  22.     PUBLIC        GETRR1, GETFS1
  23.  
  24. ;  External References
  25.  
  26.     EXT        @BDOSA
  27.  
  28. ; Definitions
  29.  
  30. GFS    EQU    35        ; Get file size command
  31. SRR    EQU    36        ; Set Random Record command
  32.  
  33.     .Z80
  34.     CSEG
  35. ;===============================================================
  36. ; NAME - GETFS1 - Get the file size (in records) of the
  37. ;           specified file.
  38. ; Entry: DE - Address of File Control Block (FCB)
  39. ; Exit :  A = 0, Zero flag Set (Z) if Ok
  40. ;          A = 1, Zero flag Reset (NZ) if overflow
  41. ;     HL - Contains file size in records
  42. ; Uses : AF,HL
  43. ; Requirements: None
  44. ;===============================================================
  45.  
  46. GETFS1:    LD    A,GFS        ; Get File Size
  47.     JR    GET1        ; ..and join with common code
  48.  
  49. ;===============================================================
  50. ; NAME - GETRR1 - Get number of the last record read from
  51. ;           or written to the specified file.
  52. ; Entry: DE - Address of File Control Block (FCB)
  53. ; Exit :  A = 0, Zero flag Set (Z) if OK
  54. ;          A = 1, Zero flag Reset (NZ) if overflow
  55. ;     HL - Contains Record number
  56. ; Uses : AF,HL
  57. ; Requirements: None
  58. ;===============================================================
  59.  
  60. GETRR1:    LD    A,SRR        ; Set Random Record Number
  61. GET1:    PUSH    DE        ; Save regs
  62.     CALL    @BDOSA
  63.     LD    HL,33        ; Offset to Random Record Number
  64.     ADD    HL,DE
  65.     LD    E,(HL)        ; Get Random Record Number in HL
  66.     INC    HL
  67.     LD    D,(HL)
  68.     INC    HL
  69.     LD    A,(HL)        ; Overflow
  70.     EX    DE,HL        ; Number in HL
  71.     POP    DE        ; Restore Registers
  72.     OR    A        ; Set error code
  73.     RET
  74.     END
  75.