1 /*
2  *  CP/M Directory browsing
3  *
4  *  Stefano, 5 Jun 2013
5  *  07/2019: Workaround to stabilize dir_move_next when file operations happen.
6  *  08/2019: Dealing with the bdos() function in a correct way
7  *
8  *
9  *  $Id: dir_move_first.c $
10  */
11 
12 #include <cpm.h>
13 
14 struct fcb fc_dir;
15 
16 char fc_dirpos;
17 char *fc_dirbuf;
18 
19 char dirbuf[134];
20 
dir_move_first()21 int dir_move_first()
22 {
23 	fc_dirbuf=dirbuf;
24 	bdos(CPM_SDMA,fc_dirbuf);
25 	parsefcb(&fc_dir,"*.*");
26 	fc_dirpos=bdos(CPM_FFST,&fc_dir);
27 	fc_dirbuf[133]=0;
28 	return (fc_dirpos==-1?0x24:0);	// Not knowing what to pass for non-zero, let's simulate FLOS error code $24 (= Reached end of directory)
29 }
30