diff io.c @ 52:51b437557f42

boot without disk image dir -e on other directory
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 22 Jul 2018 15:52:39 +0900
parents 947cbecdd8d5
children fe88cea67ef0
line wrap: on
line diff
--- a/io.c	Sun Jul 22 05:48:04 2018 +0900
+++ b/io.c	Sun Jul 22 15:52:39 2018 +0900
@@ -331,12 +331,13 @@
    int drv = mem[IOPAGE+0x41];
    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;
    Byte *phy = pmem(buf);
    if (c==0x81) {
+      if (drv > 1 || disk[drv]==0) goto error;
       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 (drv > 1 || disk[drv]==0) goto error;
       if (lseek(fileno(disk[drv]),lsn*SECSIZE,SEEK_SET)==-1) goto error;
       if (write(fileno(disk[drv]),phy,SECSIZE)==-1) goto error;
 #ifdef USE_VDISK