home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / enterprs / cpm / utils / f / rlib12.lbr / LIBDEF.LIB next >
Encoding:
Text File  |  1991-10-19  |  3.4 KB  |  117 lines

  1.  
  2. ;system interface
  3. FCB    EQU    5CH        ;system FCB
  4. tbuf    equ    80h        ;system buffer
  5. sector    equ    80h        ;length of record for disk I/O
  6.  
  7. ;Z3 interface constants
  8. exfcbo    equ    24h        ;Z3 external fcb offset
  9.  
  10. ;ASCII constants
  11. ht    equ    9        ;horizontal tab
  12. cr    equ    0dh        ;carriage return
  13. lf    equ    0ah        ;line feed
  14. spc    equ    20h        ;space
  15.  
  16. ;constants unique to zmlib
  17. mrleof    equ    9eh        ;mREL end-of-file byte
  18. mrlnam    equ    84h        ;first 7 bits marks valid mREL file
  19.  
  20. ;buffer lengths, 128 byte records
  21. sblen    equ    8        ;source files
  22. oblen    equ    8        ;output buffer
  23. cblen    equ    1        ;cmd line or command file
  24.  
  25. ; bit offsets in DATA+OUTOPT
  26. DELFLG    EQU    0        ;option D - delete modules
  27. PUBFLG    EQU    1        ;option P - show names, entry symbols
  28. MODFLG    EQU    2        ;option M - show names only
  29. REPFLG    EQU    3        ;option R - repplace modules
  30. APPFLG    EQU    4        ;option A - append modules
  31. NAMFLG    EQU    5        ;flags redirection to nambuf
  32. SKPFLG    EQU    6        ;set to skip copy of current module
  33.  
  34. ; bit offsets in DATA+STATUS
  35. EOS    EQU    0        ;end of source (mrel eof)
  36. EOM    EQU    1        ;end of mrel module
  37. NDONE    EQU    2        ;name has been transferred
  38. PDONE    EQU    3        ;public symbol end-of-line flag for display
  39. EOF    EQU    7        ;end of file encountered during load
  40.  
  41. ;    INDEX REGISTER OFFSETS TO DATA AREA
  42. status    EQU    0        ;END OF SOURCE FILE FLAG (1=EOS)
  43. TSTMSK    EQU    1        ;BIT TEST MASK
  44. EOFFLG    EQU    2        ;1=END OF FILE
  45. OUTOPT    EQU    3        ;OUTPUT OPTION (1=CRT,2=LST)
  46. LOPCNT    EQU    4        ;LOOP COUNTER
  47. SYMLEN    EQU    5        ;CURRENT SYMBOL LENGTH
  48. WRFLG    EQU    6        ;1=A WRITE OPERATION HAS BEEN PERFORMED
  49. fwid    equ    7        ;items per line for screen display
  50. scrlin    equ    8        ;lines per screen for paging
  51.  
  52. ;=========================================================
  53. ;    MACRO DEFINITIONS
  54.  
  55. ;Initialize file buffer control block to
  56. ;default buffer sizes & location. On entry,
  57. ;DE contains the allocated address. On exit,
  58. ;DE has been incremented by the buffer size
  59. ;and contains the next address allocation.
  60. ;If the buffer is not required (high bit set
  61. ;in the FN field), then allocation is skipped
  62. ;and DE is preserved for the next allocation.
  63. allocb    macro    xx
  64.     local    bypass
  65.     ld    a,(xx&fn)
  66.     bit    7,a        ;;buffer required?
  67.     jr    nz,bypass    ;;jump if not
  68.     ld    a,(xx&opl)    ;;defined size, records
  69.     call    x128        ;;calculate byte size
  70.     ld    (xx&len),hl
  71.     ld    (xx&siz),bc
  72.     ld    (xx&cnt),bc
  73.     ex    de,hl        ;;get buffer start alloc
  74.     ld    (xx&ptr),hl
  75.     ld    (xx&beg),hl
  76.     add    hl,bc        ;;next available alloc
  77.     ex    de,hl        ;;..in DE
  78. bypass:
  79.     endm
  80.  
  81. ;create File Access control Block, including
  82. ;the user area byte and FCB
  83. FILFAB    macro    xx
  84. xx&ptr:    ds    2    ;;->next free buffer loc
  85. xx&cnt:    ds    2    ;;beg+siz-ptr-1 = bytes remaining
  86. xx&beg:    ds    2    ;;address of file buffer
  87. xx&len:    ds    2    ;;length of buffer, 128 byte records
  88. xx&siz:    ds    2    ;;length of buffer, bytes = len*128
  89. xx&du:    ds    1    ;;user area for the file, 0..31
  90. xx&fcb:    ds    1    ;;drive byte for the file FCB
  91. xx&fn:    ds    8    ;;FCB1 filename field
  92. xx&fty:    ds    7    ;;filetype field & balance of FCB1
  93. ;;xx&usr:    ds    4    ;;Z-sys user byte & balance of FCB1
  94. xx&cb2:    ds    1    ;;drive byte (0) for fcb2
  95. xx&fn2:    ds    8    ;;fcb2 filename (used by RENAME)
  96. xx&ft2:    ds    7    ;;filetype field & balance of FCB2
  97.     ds    3,0    ;;for random file access
  98.     endm
  99.  
  100. ;=========================================================
  101.  
  102. gbits    macro    xx
  103.     ld    b,xx
  104.     call    getbit
  105.     endm
  106.  
  107. ;=========================================================
  108.  
  109. ldhlhl    macro
  110.     ld    a,(hl)
  111.     inc    hl
  112.     ld    h,(hl)
  113.     ld    l,a
  114.     endm
  115.  
  116. ;=========================================================
  117.