home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / cpm / dbaseii / db-chain.doc < prev    next >
Text File  |  1994-07-13  |  4KB  |  169 lines

  1. Date: Thursday, 22 August 1985
  2. From: Bruce Conroy <blc at JPL-VLSI.ARPA>
  3. To:   info-cpm at AMSAA.ARPA
  4. Re:   dBaseII machine language interface
  5.  
  6. Here is a sample dBaseII file which loads and calls a machine
  7. language program.
  8.  
  9. * dBase II file to read diskcat files into dBase format
  10. * 85.0212 BLC
  11. *--!---!---!---!
  12. * modified to load and use diread.z80
  13. * 85.0403 BLC
  14. * uses variable for catalog name, to allow several catalogs
  15. * 85.0405 BLC
  16. set delete on
  17. set talk off
  18. accept 'Date' to today
  19. set date to &today
  20. load diread
  21. accept 'Catalog to Use' to diskcat
  22. use &diskcat
  23. do while T
  24. text
  25. options are:
  26.    <D>isk ID order
  27.    <E>xtention order
  28.    <F>ull Printout
  29.    <N>ame order
  30.    <Q>ualified Printout
  31.    <S>earch for File
  32.    <U>pdate catalog
  33. endtext
  34. wait to command
  35. store !(command) to command
  36. if command='D'
  37.    index on disk:id+name+ext to disk
  38. endif
  39. if command='E'
  40.    index on ext+name+disk:id to ext
  41. endif
  42. if command='F'
  43.    store 'T' to qual
  44.    do printout
  45. endif
  46. if command='N'
  47.    index on name+ext+disk:id to name
  48. endif
  49. if command='Q'
  50.    accept 'Selection Function? ' to qual
  51.    store !(qual) to qual
  52.    do printout
  53. endif
  54. if command='S'
  55.    accept 'Search for? ' to qual
  56.    find &qual
  57.    disp
  58. endif
  59. if command='U'
  60. * directory read
  61. * 85.0403 BLC
  62. ? 'Put new disk in B and press <return>'
  63. wait
  64. reset
  65. copy stru to dir
  66. use dir
  67. store 'UNKNOWN' to d:id
  68. store 'xxxxxxxxxxx' to entry
  69. set call to 41984
  70. call entry
  71. set call to 41987
  72. do while entry # 'NO DATA'
  73.    if $(entry,9,3)="DID"
  74.       store $(entry,1,8) to d:id
  75.    else
  76.       append blank
  77.       replace name with $(entry,1,8)
  78.       replace ext with $(entry,9,3)
  79.       replace cat:date with date()
  80.    endif
  81.    call entry
  82. enddo
  83.    if d:id = 'UNKNOWN'
  84.        ? 'No ID present'
  85.        use &diskcat
  86.    else
  87.       replace all disk:id with d:id
  88.       use &diskcat
  89.       delete all for disk:id=d:id
  90.       append from dir
  91.    endif
  92. enddo
  93.  
  94.  
  95.  
  96. The machine language program is created by:
  97.  
  98. ; diread.z80
  99. ; directory reading program to call from dBase
  100. ; 85.0403 BLC
  101. ;---!---!---!---!
  102. ; buffer added
  103. ; 85.0403 BLC
  104.     public one, two
  105.     cseg
  106.     .z80
  107. bdos    equ 5
  108. findf   equ 17  ;find first funct
  109. findn   equ 18  ;  "   next   "
  110. dmaf    equ 26
  111. one:    jp first    ;a400h=41984
  112. two:    jp next     :a403h=41987
  113. fcb:    db 2        ; code for drive B
  114.         db  "???????????"  ;for name and ext
  115.         ds  24,0    ;rest of fcb all zeroed
  116. psave:  dw 0        ;save the passed parameter
  117. empty:  db  "NO DATA    "
  118. buffer: ds  128     ;reserve a buffer
  119. first:  ld  c,findf
  120.         jp endup
  121. next:   ld  c,findn
  122. endup:  inc hl           ;skip the length byte of dBase string
  123.         ld  (psave),hl   ;save the address
  124.         push    bc       ;save the function
  125.         ld  de,buffer    ;set dma to buffer
  126.         ld  c,dmaf
  127.         call    bdos
  128.         pop bc           ; first or next back
  129.         ld  de,fcb
  130.         call bdos
  131.         cp 255            ;flag for no match
  132.         jp z,nomore
  133.                          ;A has directory code
  134.                          ;file name is at buffer+1+32*A
  135.         ld  hl,buffer+1
  136.         ld  de,32
  137. again:  and a            ;to set z flag
  138.         jp z,gotit
  139.         dec a
  140.         add hl,de
  141.         jp again
  142. gotit:  ld  de,(psave)   ;address of dBase string
  143.         ld  bc,11        ;length of name+extention
  144.         ldir             ;move it into the string
  145.         ret
  146. nomore: ld  hl,empty     ;no data message
  147.         ld  de,(psave)
  148.         ld  bc,11
  149.         ldir
  150.         ret
  151.         end
  152.  
  153.  
  154.  
  155. After assembly, (with M80) the HEX file is created by linking 
  156. such that,the laod address is A400H (41984, above the limit of 
  157. memory used by dBase) as follows:
  158.  
  159. L80 /PA400,DIREAD,DIREAD/X/N/E
  160.  
  161.  
  162. This is a pretty primative example, but it does exercise the
  163. dBase machine language interface functions.
  164.  
  165. If anybody has any information regarding the defaults,
  166. I would also be interested.
  167.  
  168. Bruce Conroy (BLC@JPL-VLSI.ARPA)
  169.