From: Alan Cox Date: Sat, 30 May 2015 12:23:28 +0000 (+0100) Subject: sdltrs: Commit emulator patches X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=5d538732aee91cea494cd2c333fb50a8bbaecfaf;p=FUZIX.git sdltrs: Commit emulator patches These are needed to run Fuzix reliably --- diff --git a/Kernel/patches/README b/Kernel/patches/README index 96070309..497348b8 100644 --- a/Kernel/patches/README +++ b/Kernel/patches/README @@ -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 index 00000000..c7f74bda --- /dev/null +++ b/Kernel/patches/sdltrs-fix-iff-flags.patch @@ -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);