rgt%a@LANL.ARPA (Richard Thomsen) (05/26/85)
I need some CP/M help from the experts out there. I am trying to use the FIND FIRST/FIND NEXT calls from CP/M. I have looked at _The_ _Programmer's_ _CP/M_ _Handbook_ by Andy Johnson-Laird. On page 105, he has an example that uses these calls. He uses FIND FIRST to refind the previous file name, then changes the FCB to the ambiguous file name, and uses FIND NEXT to find the next matching ambiguous file name. However, when I try that, it comes back with No Such File. It does not search for the next match of the ambiguous file name, but searches for another copy of the previous file name (I guess). Since I cannot give an FCB address to FIND NEXT, I assumed that it used the last FCB address given. But changing that FCB does not matter; it still does not find any files. A sample of the code follows: LXI D,FCB ;Get the FCB address CALL ZEROFCB ;Clear out all but disk, name, & type LXI D,FCB ;Get the FCB address MVI C,SEARCHF ;Get the code for search for first CALL BDOS ;Re-find the last file LXI H,FCB+1 ;Get address of the FCB MVI A,'?' ;Change it to ambiguous MVI C,11 ;Get size of name and type LOOP: MOV M,A ;Store ambiguous file name INX H ;Increment to next position DCR C ;Decrement count JNZ LOOP ;Loop for all bytes in name and type LXI D,FCB ;Get the FCB address CALL ZEROFCB ;Clear out all but disk, name, & type LXI D,FCB ;Get the FCB address MVI C,SEARCHN ;Get code for search for next CALL BDOS ;Search for next file CPI 0FFH ;See if file was found JZ FILENOTFOUND ;If not, then error (This is not the exact code, but this is essentially what I did by using DDT) I realize there is probably some really dumb error, but I cannot get it to work. It always comes back with reg A = 0FFH with the file not found. Yes, there are more files on the disk. Any ideas would be welcome and greatly appreciated. Richard Thomsen rgt@lanl PS: As all know, CP/M is a trademark of Digital Research.
W8SDZ@SIMTEL20.ARPA (Keith Petersen) (05/26/85)
Richard, you'll find the help you need on the SEARCH NEXT command in the very excellent series of files included in INSIDCPM (believed to be extracted from the book "Inside CP/M"). They're available via FTP from SIMTEL20 as: Filename Type Bytes CRC Directory MICRO:<CPM.INSIDCPM> INSIDCPM.LBR.1 BINARY 26496 B722H --Keith Petersen Arpa: W8SDZ@SIMTEL20.ARPA uucp: ...!{decvax,unc,hao,cbosgd,seismo,aplvax,uci}!brl-bmd!w8sdz uucp: ...!{ihnp4!cbosgd,cmcl2!esquire}!brl-bmd!w8sdz