sdltrs: Commit emulator patches
authorAlan Cox <alan@linux.intel.com>
Sat, 30 May 2015 12:23:28 +0000 (13:23 +0100)
committerAlan Cox <alan@linux.intel.com>
Sat, 30 May 2015 12:23:28 +0000 (13:23 +0100)
These are needed to run Fuzix reliably

Kernel/patches/README
Kernel/patches/sdltrs-fix-iff-flags.patch [new file with mode: 0644]

index 9607030..497348b 100644 (file)
@@ -10,4 +10,17 @@ SDCC:
           code is called via push af call foo pop af
 
 
+Note: This patch is now mostly obsolete. Feature #1 is mostly integrated
+into the mainstream SDCC. Feature #2 is only needed for the ZX128 and has
+not yet been ported to a recent compiler
+
+
+
+SDLTRS:
+       Corrects the handling of the IFF flags on interrupt delivery and
+when you do a RETI, which has a subtle difference to a RET. Without these
+fixes Fuzix will crash at random on the emulator.
+
+       For more information on the Z80 IFF flags see section 5.3 of Z80
+Documented: http://www.z80.info/zip/z80-documented.pdf
 
diff --git a/Kernel/patches/sdltrs-fix-iff-flags.patch b/Kernel/patches/sdltrs-fix-iff-flags.patch
new file mode 100644 (file)
index 0000000..c7f74bd
--- /dev/null
@@ -0,0 +1,19 @@
+diff -u --recursive sdltrs_1_1_0/src/z80.c sdltrs_1_1_0.ac/src/z80.c
+--- sdltrs_1_1_0/src/z80.c     2010-02-14 00:38:36.000000000 +0000
++++ sdltrs_1_1_0.ac/src/z80.c  2015-05-30 02:44:06.958734734 +0100
+@@ -1348,6 +1348,7 @@
+     REG_SP -= 2;
+     mem_write_word(REG_SP, REG_PC);
+     z80_state.iff1 = 0;
++    z80_state.iff2 = 0;
+     switch (z80_state.interrupt_mode) {
+     case 0:
+       /* REG_PC = get_irq_vector() & 0x38; */
+@@ -2880,6 +2882,7 @@
+       case 0x4D:      /* reti */
+       /* no support for alerting peripherals, just like ret */
++      z80_state.iff1 = z80_state.iff2;
+       REG_PC = mem_read_word(REG_SP);
+       REG_SP += 2;
+       T_COUNT(14);