Minor debugging improvements.
diff --git a/src/cdrom.c b/src/cdrom.c
index aa5dfd3..bef9b77 100644
--- a/src/cdrom.c
+++ b/src/cdrom.c
@@ -527,11 +527,12 @@
             SETBITS_BDA(equipment_list_flags, 0x41);
         else
             SET_EBDA(ata.hdcount, GET_EBDA(ata.hdcount) + 1);
+        // everything is ok, so from now on, the emulation is active
+        SET_EBDA(cdemu.active, 0x01);
     }
 
-    // everything is ok, so from now on, the emulation is active
-    if (GET_EBDA(cdemu.media))
-        SET_EBDA(cdemu.active, 0x01);
+    DEBUGF("cdemu media=%d active=%d\n"
+           , GET_EBDA(cdemu.media), GET_EBDA(cdemu.active));
 
     return 0;
 }
diff --git a/src/disk.c b/src/disk.c
index 9965512..32e4f4b 100644
--- a/src/disk.c
+++ b/src/disk.c
@@ -12,6 +12,9 @@
 #include "util.h" // debug_enter
 #include "ata.h" // ATA_*
 
+#define DEBUGF1(fmt, args...) bprintf(0, fmt , ##args)
+#define DEBUGF(fmt, args...)
+
 
 /****************************************************************
  * Helper functions
diff --git a/src/util.h b/src/util.h
index 6938f0d..36e9a30 100644
--- a/src/util.h
+++ b/src/util.h
@@ -151,8 +151,8 @@
     } while (0)
 
 #define set_code_fail(regs, code) do {          \
-        (regs)->ah = (code);                    \
         set_fail(regs);                         \
+        (regs)->ah = (code);                    \
     } while (0)
 
 // kbd.c