# HG changeset patch # User Shinji KONO # Date 1532206084 -32400 # Node ID 498b6fcaf270bbc31d53f5c398ac1b43915666bc # Parent 1430678cd4fb1dff24d0de4be658ec52c5d05d4c vdisk worked diff -r 1430678cd4fb -r 498b6fcaf270 Makefile --- a/Makefile Sat Jul 21 22:44:02 2018 +0900 +++ b/Makefile Sun Jul 22 05:48:04 2018 +0900 @@ -22,7 +22,7 @@ # will be installed to ".." BIN=a09 v09 v09c d09 $(SIM_BIN) v09.rom -TARGETS=$(BIN) $(APPS) vdisk.o +TARGETS=$(BIN) $(APPS) OTHER=monitor.s makerom @@ -33,11 +33,11 @@ a09 : a09.o os9crc.o $(CC) $(CFLAGS) $(V09FLAGS) a09.o os9crc.o -o $@ -v09: v09.o engine.o io.o d09.o trace.o +v09: v09.o engine.o io.o d09.o trace.o vdisk.o $(CC) -o v09 $(CFLAGS) v09.o engine.o io.o d09.o trace.o # with Coco MMU -v09c: v09.c engine.c io.c d09.o trace.o +v09c: v09.c engine.c io.c d09.o trace.o vdisk.o $(CC) -o v09c $(CFLAGS) $(V09FLAGS) -DIOPAGE=0xff80 -DUSE_MMU=1 -DUSE_VDISK v09.c engine.c io.c d09.o trace.c vdisk.c a09.o : a09.c diff -r 1430678cd4fb -r 498b6fcaf270 vdisk.c --- a/vdisk.c Sat Jul 21 22:44:02 2018 +0900 +++ b/vdisk.c Sun Jul 22 05:48:04 2018 +0900 @@ -17,7 +17,7 @@ #include #include -static int vdiskdebug = 1; // 1 trace, 2 filename +static int vdiskdebug = 0; // 1 trace, 2 filename Byte pmmu[8]; // process dat mmu @@ -103,10 +103,10 @@ Byte setcd(char *name) { int len; - for(int i=0;i<256;i++) { + for(int i=0;i<512;i++) { if (cdt[i] && strcmp(name,cdt[i])==0) return i; } - cdtptr &= 0xff; + cdtptr &= 0x1ff; if (cdt[cdtptr]) free(cdt[cdtptr]); cdt[cdtptr] = (char*)malloc(len=strlen(name)+1); strcpy(cdt[cdtptr],name); @@ -127,6 +127,11 @@ if (*s&0x80) putchar(*s&0x7f); } +static void +err(int error) { + printf("err %d\n",error); +} + static char * addCurdir(char *name, PathDesc *pd, int curdir) { int ns =0 ; @@ -155,8 +160,10 @@ int i = 0; for(;base[i];i++) path[i] = base[i]; path[i++] = '/'; - for(int j=0;jps) + printf("overrun i=%d ps=%d\n",i,ps); // err(__LINE__); return path; } @@ -171,10 +178,10 @@ if (*p!=0) { name = (char *)malloc(p-path+1); int i; - for(int i=0;idirfp = (char *)malloc(dircount*DIR_SZ); rewinddir(dir); int i = 0; - while ((dp = readdir(dir)) != NULL) { + while ((dp = readdir(dir)) != NULL && dircount-->=0) { int j = 0; for(j = 0; j < DIR_NM ; j++) { if (j< dp->d_namlen) { @@ -288,7 +295,8 @@ pd->dirfp[i+j+1] = (dp->d_ino&0xff00)>>8; pd->dirfp[i+j+2] = dp->d_ino&0xff; i += DIR_SZ; - if (i>pd->sz) return 0; + if (i>pd->sz) + return 0; } pd->fp = fmemopen(pd->dirfp,pd->sz,"r"); return 0;