changeset 158:a4aa3ec95b75 current

fix addCurrent
author kono
date Mon, 21 Jan 2019 10:39:50 +0900
parents dc4c7e7ec5c9
children 1d574c5b3383
files src/v09.c src/vdisk.c
diffstat 2 files changed, 13 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/v09.c	Mon Jan 21 01:00:29 2019 +0900
+++ b/src/v09.c	Mon Jan 21 10:39:50 2019 +0900
@@ -154,7 +154,11 @@
  int i;
  int setterm = 1;
  timerirq = 2;   // use FIRQ default
+#ifdef USE_MMU
  memsize = 512*1024*4;      // full 2 mbute
+#else
+ memsize = 1024*64;         // 64k
+#endif
  escchar='\x1d'; 
  tracelo=0;tracehi=0xffff;
  for(i=1;i<argc;i++) {
@@ -200,7 +204,9 @@
    } else if (strcmp(argv[i],"-m")==0) {
      i++;
      memsize=strtol(argv[i],(char**)0,0) & ~0xffff;
+#ifdef USE_MMU
      if (memsize < 512*1024) memsize = 512*1024;
+#endif
    } else usage();
  }   
  #ifdef MSDOS
--- a/src/vdisk.c	Mon Jan 21 01:00:29 2019 +0900
+++ b/src/vdisk.c	Mon Jan 21 10:39:50 2019 +0900
@@ -21,10 +21,10 @@
 
 static int vdiskdebug = 0;  //   bit 1 trace, bit 2 filename
 
+extern char *prog ;   // for disass
+#ifdef USE_MMU
 Byte pmmu[8];  // process dat mmu
 
-extern char *prog ;   // for disass
-#ifdef USE_MMU
 extern Byte * mem0(Byte *iphymem, Word adr, Byte *immu) ;
 //  smem physical address using system mmu
 //  pmem physical address using caller's mmu
@@ -94,7 +94,7 @@
     pd->fp = 0;
     pd->mode = 0;
     free(pd->dirfp); pd->dirfp = 0;
-    // free(pd->name); pd->name = 0;
+    free(pd->name); pd->name = 0;
 }
 
 /*
@@ -173,7 +173,7 @@
     int i = 0;
     for(;base[i];i++) path[i] = base[i];
     path[i++] = '/';
-    for(int j=0;i<ps;j++,i++) path[i] = name[j];
+    for(int j=0;i<ps-1;j++,i++) path[i] = name[j];
     path[i] = 0;
     if (i>ps)
         printf("overrun i=%d ps=%d\n",i,ps); // err(__LINE__);
@@ -357,7 +357,7 @@
         if (i>pd->sz) 
             return 0;
     }
-    pd->fp = fmemopen(pd->dirfp,pd->sz,"r");
+    pd->fp = fmemopen(pd->dirfp,pd->sz+1,"r");
     return 0;
 }
 
@@ -400,7 +400,7 @@
     os9setdate(buf+FD_Creat,&st.st_ctime);
     err = 0;
 err1:
-    // free(pd.name);     should be free
+    free(pd.name); 
     return err;
 }
 
@@ -925,7 +925,7 @@
     prog = (char*)(pmem(pcreg) - pcreg);
     if (*pmem(pcreg)==0 && *pmem(pcreg+1)==0) {
         // may be we are called from system state
-        // of coursel, this may wrong. but in system state, <$50 process has wrong DAT for pc
+        // of course, this may wrong. but in system state, <$50 process has wrong DAT for pc
         // and we can't know wether we are called from system or user
         prog = (char*)(smem(pcreg) - pcreg);
     }