diff io.c @ 44:b26c23331d02

add more function on vdisk
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 19 Jul 2018 11:31:17 +0900
parents 01519215ec70
children 07c84761da6f
line wrap: on
line diff
--- a/io.c	Tue Jul 17 17:08:09 2018 +0900
+++ b/io.c	Thu Jul 19 11:31:17 2018 +0900
@@ -71,7 +71,7 @@
  *   IOPAGE + 0x31-  YY/MM/DD/HH/MM/SS
  *
  *   IOPAGE + 0x40   Disk control        0x81 read/0x55 write   0 ... ok / 0xff .. error
- *   IOPAGE + 0x41   drive no
+ *   IOPAGE + 0x41   drive no / ( VDISK  0 for system, 1 for user )
  *   IOPAGE + 0x42   LSN2
  *   IOPAGE + 0x43   LSN1
  *   IOPAGE + 0x44   LSN0
@@ -106,8 +106,12 @@
 #ifdef USE_MMU
 extern char *prog ;   // for disass
 extern Byte * mem0(Byte *iphymem, Word adr, Byte *immu) ;
+#define pmem(a)  mem0(phymem,a,mmu)
+#else
+#define pmem(a)  (&mem[a])
 #endif
 
+
 extern int bpskip ;
 extern int stkskip ;
 extern FILE *logfile;
@@ -307,6 +311,7 @@
    }
 }
 
+
 void do_disk(int a, int c) {
    if (a!=0x40+(IOPAGE&0x1ff)) {
       mem[(IOPAGE&0xfe00)+a]=c;
@@ -316,17 +321,17 @@
    int lsn = (mem[IOPAGE+0x42]<<16) + (mem[IOPAGE+0x43]<<8) + mem[IOPAGE+0x44];
    int buf = (mem[IOPAGE+0x45]<<8) + mem[IOPAGE+0x46];
    if (drv > 1 || disk[drv]==0) goto error;
-#ifdef USE_MMU
-   Byte *phy = mem0(phymem,buf,mmu);
-#else
-   Byte *phy = &mem[buf];
-#endif
+   Byte *phy = pmem(buf);
    if (c==0x81) {
       if (lseek(fileno(disk[drv]),lsn*SECSIZE,SEEK_SET)==-1) goto error;
       if (read(fileno(disk[drv]),phy,SECSIZE)==-1) goto error;
    } else if (c==0x55) {
       if (lseek(fileno(disk[drv]),lsn*SECSIZE,SEEK_SET)==-1) goto error;
       if (write(fileno(disk[drv]),phy,SECSIZE)==-1) goto error;
+#ifdef VDISK
+   } else  {
+       do_vdisk(c);
+#endif
    }
    mem[IOPAGE+0x40] = 0;
    return;