diff -Naur spediv_v0.2/divide.c spediv_v0.2a/divide.c
--- spediv_v0.2/divide.c	2005-07-04 13:30:58.000000000 +0200
+++ spediv_v0.2a/divide.c	2005-07-19 13:13:59.000000000 +0200
@@ -562,7 +562,7 @@
         if (DISK.port_BB & 0x40)
           lba = ((DISK.port_BB & 0x0F) << 24) | (DISK.port_B7 << 16) | (DISK.port_B3 << 8) | DISK.port_AF; 
         else
-          lba=chs2lba(drive, (DISK.port_B7 << 8) | DISK.port_B3, DISK.port_BB & 0x0F, DISK.port_AF);
+          lba = chs2lba(drive, (DISK.port_B7 << 8) | DISK.port_B3, DISK.port_BB & 0x0F, DISK.port_AF);
 
         DISK.buffer_ptr = 0;
         DISK.buffer_len = 0;
@@ -638,19 +638,19 @@
       tlba=lba;
       if (tlba < DISK.mbr.len) {
         DISK.mbr.ptr = lseek(DISK.mbr.fd, (tlba << 9), SEEK_SET);
-        write(DISK.mbr.fd, DISK.buffer + DISK.buffer_len, 512);
+        write(DISK.mbr.fd, DISK.buffer + DISK.buffer_ptr, 512);
       } else {
         tlba-=DISK.mbr.len;
         for (part=0; part<4; part++) {
           if (tlba < DISK.partition[part].len) {
             DISK.partition[part].ptr = lseek(DISK.partition[part].fd, (tlba << 9), SEEK_SET);
-            write(DISK.partition[part].fd, DISK.buffer + DISK.buffer_len, 512);
+            write(DISK.partition[part].fd, DISK.buffer + DISK.buffer_ptr, 512);
             break;
           }
           tlba-=DISK.partition[part].len;
         }
       }
-      DISK.buffer_ptr += 512;
+      DISK.buffer_len=0;
       DISK.port_AB--;
       lba++;
     }
diff -Naur spediv_v0.2/divide.h spediv_v0.2a/divide.h
--- spediv_v0.2/divide.h	2005-06-21 00:38:18.000000000 +0200
+++ spediv_v0.2a/divide.h	2005-07-19 19:36:15.000000000 +0200
@@ -21,6 +21,8 @@
 #ifndef DIVIDE_H
 #define DIVIDE_H
 
+#define DIVIDE_VERSION "v0.2a"
+
 void divide_init();
 void divide_exit();
 void divide_attach_drive(int drive, char *path);
diff -Naur spediv_v0.2/spconf.c spediv_v0.2a/spconf.c
--- spediv_v0.2/spconf.c	2005-06-25 21:41:42.000000000 +0200
+++ spediv_v0.2a/spconf.c	2005-07-12 15:54:55.000000000 +0200
@@ -24,6 +24,7 @@
  *
  */
 
+#include "config.h"
 #include "spconf_p.h"
 #include "spver.h"
 #include "misc.h"
@@ -39,19 +40,23 @@
 #include <string.h>
 #include <errno.h>
 #include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
 #include <stdlib.h>  // for exit()
 
 extern const char *spcf_keynames_ascii[];
 extern const char *spcf_keynames_misc[];
 
-#ifdef HAVE_DIVIDE
-extern char *divide_image_path;
-#endif
-
 char *spcf_init_snapshot = NULL;
 int   spcf_init_snapshot_type;
 char *spcf_init_tapefile = NULL;
 int   spcf_init_tapefile_type;
+#ifdef HAVE_DIVIDE
+#include "z80_type.h"
+#include "divide.h"
+char *spcf_init_diskimage = NULL;
+extern char *divide_image_path;
+#endif
 
 #define MAXLINELEN 512
 static int linectr;
@@ -215,6 +220,9 @@
 {
   int i;
   int found;
+#ifdef HAVE_DIVIDE
+  struct stat st;
+#endif
 
   if(*ftp >= 0 && *ftsubp >= 0) return 1;
 
@@ -239,6 +247,15 @@
       *ftsubp = extensions[i].subtype;
       break;
     }
+#ifdef HAVE_DIVIDE
+  if (!found) {
+    stat(filename, &st);
+    if (S_ISDIR(st.st_mode)) {
+      *ftp = FT_DISKIMAGE;
+      found = 1;
+    }
+  }
+#endif
   
   return found;
 }
@@ -368,7 +385,10 @@
     break;
     
   case OPT_VERSION:
-    fprintf(stderr, "%s\n", SPECTEMU_VERSION);
+    fprintf(stderr, "spectemu version: %s\n", SPECTEMU_VERSION);
+#ifdef HAVE_DIVIDE
+    fprintf(stderr, "divide extension: %s\n", DIVIDE_VERSION);
+#endif
     exit(0);
     break;
   }
@@ -703,7 +723,11 @@
 	spcf_init_tapefile = make_string(spcf_init_tapefile, filenamebuf);
 	spcf_init_tapefile_type = file_subtype;
       }
-      
+#ifdef HAVE_DIVIDE
+      else if(file_type == FT_DISKIMAGE) {
+	spcf_init_diskimage = make_string(spcf_init_diskimage, filenamebuf);
+      }
+#endif      
       file_type = -1;
     }
   }
diff -Naur spediv_v0.2/spconf.h spediv_v0.2a/spconf.h
--- spediv_v0.2/spconf.h	2005-06-13 21:32:58.000000000 +0200
+++ spediv_v0.2a/spconf.h	2005-07-12 13:10:45.000000000 +0200
@@ -28,6 +28,10 @@
 extern int   spcf_init_snapshot_type;
 extern char *spcf_init_tapefile;
 extern int   spcf_init_tapefile_type;
+#ifdef HAVE_DIVIDE
+#define FT_DISKIMAGE 2
+extern char *spcf_init_diskimage;
+#endif
 
 extern void spcf_pre_check_options(int argc, char *argv[]);
 extern int  spcf_read_conf_file(const char *filename);
diff -Naur spediv_v0.2/spmain.c spediv_v0.2a/spmain.c
--- spediv_v0.2/spmain.c	2005-06-16 15:59:55.000000000 +0200
+++ spediv_v0.2a/spmain.c	2005-07-12 13:13:14.000000000 +0200
@@ -42,6 +42,10 @@
 #include <stdlib.h>
 #include <errno.h>
 
+#ifdef HAVE_DIVIDE
+#include "divide.h"
+#endif
+
 int endofsingle;
 
 int sp_nosync = 0;
@@ -224,6 +228,14 @@
     if(!load_immed) pause_play();
     free_string(spcf_init_tapefile);
   }
+#ifdef HAVE_DIVIDE
+  if(spcf_init_diskimage != NULL) {
+    sprintf(msgbuf, "Opening disk image '%s'", spcf_init_diskimage);
+    put_msg(msgbuf);
+    divide_attach_drive(0, spcf_init_diskimage);
+    free_string(spcf_init_diskimage);
+  }
+#endif
 }
 
 static void print_copyright(void)
