remove unused/unmaintained code
authornotaz <notasas@gmail.com>
Sat, 22 Jun 2013 16:16:16 +0000 (19:16 +0300)
committernotaz <notasas@gmail.com>
Sat, 22 Jun 2013 16:16:16 +0000 (19:16 +0300)
RIP Symbian..
mz80 is unused

112 files changed:
cpu/mz80/Makefile [deleted file]
cpu/mz80/Makefile.win [deleted file]
cpu/mz80/driver.h [deleted file]
cpu/mz80/makez80.c [deleted file]
cpu/mz80/mz80.c [deleted file]
cpu/mz80/mz80.h [deleted file]
cpu/mz80/mz80.txt [deleted file]
pico/pico.h
pico/utils.c [deleted file]
platform/uiq2/ClientServer.h [deleted file]
platform/uiq2/Makefile [deleted file]
platform/uiq2/SimpleServer.cpp [deleted file]
platform/uiq2/SimpleServer.h [deleted file]
platform/uiq2/_out/PicodriveN.pkg [deleted file]
platform/uiq2/_out/install.txt [deleted file]
platform/uiq2/_out/readme.txt [deleted file]
platform/uiq2/audio.h [deleted file]
platform/uiq2/audio/AUDIO_MEDIASERVER.DLL [deleted file]
platform/uiq2/audio/AUDIO_MOTOROLA.DLL [deleted file]
platform/uiq2/audio/mediaserver/AUDIO_MEDIASERVER.ARMI [deleted file]
platform/uiq2/audio/mediaserver/PolledAS.h [deleted file]
platform/uiq2/audio/mediaserver/audio_mediaserver.cpp [deleted file]
platform/uiq2/audio/mediaserver/audio_mediaserver.def [deleted file]
platform/uiq2/audio/mediaserver/audio_mediaserver.h [deleted file]
platform/uiq2/audio/mediaserver/audio_mediaserver.mmp [deleted file]
platform/uiq2/audio/mediaserver/polledas.cpp [deleted file]
platform/uiq2/audio/mediaserver/retr.cmd [deleted file]
platform/uiq2/audio/mediaserver/retr2.cmd [deleted file]
platform/uiq2/audio/motorola/AUDIO_MOTOROLA.ARMI [deleted file]
platform/uiq2/audio/motorola/PolledAS.h [deleted file]
platform/uiq2/audio/motorola/audio_motorola.cpp [deleted file]
platform/uiq2/audio/motorola/audio_motorola.def [deleted file]
platform/uiq2/audio/motorola/audio_motorola.h [deleted file]
platform/uiq2/audio/motorola/audio_motorola.mmp [deleted file]
platform/uiq2/audio/motorola/polledas.cpp [deleted file]
platform/uiq2/audio/motorola/retr.cmd [deleted file]
platform/uiq2/audio/motorola/retr2.cmd [deleted file]
platform/uiq2/blit.h [deleted file]
platform/uiq2/blit.s [deleted file]
platform/uiq2/debug.cpp [deleted file]
platform/uiq2/debug.h [deleted file]
platform/uiq2/launcher/App.cpp [deleted file]
platform/uiq2/launcher/App.h [deleted file]
platform/uiq2/launcher/CSimpleTextParser.cpp [deleted file]
platform/uiq2/launcher/CSimpleTextParser.h [deleted file]
platform/uiq2/launcher/Dialogs.cpp [deleted file]
platform/uiq2/launcher/Dialogs.h [deleted file]
platform/uiq2/launcher/Engine.cpp [deleted file]
platform/uiq2/launcher/Engine.h [deleted file]
platform/uiq2/launcher/PICODRIVEN.ARMI [deleted file]
platform/uiq2/launcher/PicoN20x16.bmp [deleted file]
platform/uiq2/launcher/PicoN20x16m.bmp [deleted file]
platform/uiq2/launcher/PicoN32x32.bmp [deleted file]
platform/uiq2/launcher/PicoN32x32m.bmp [deleted file]
platform/uiq2/launcher/PicodriveN.hrh [deleted file]
platform/uiq2/launcher/PicodriveN.mmp [deleted file]
platform/uiq2/launcher/PicodriveN.rss [deleted file]
platform/uiq2/launcher/PicodriveNAif.rss [deleted file]
platform/uiq2/launcher/SimpleClient.cpp [deleted file]
platform/uiq2/launcher/SimpleClient.h [deleted file]
platform/uiq2/launcher/nicemake.c [deleted file]
platform/uiq2/launcher/nicemake.exe [deleted file]
platform/uiq2/launcher/quploadpicol.cmd [deleted file]
platform/uiq2/main.cpp [deleted file]
platform/uiq2/port_config.h [deleted file]
platform/uiq2/port_config.s [deleted file]
platform/uiq2/qconn.cmd [deleted file]
platform/uiq2/quploadpico.cmd [deleted file]
platform/uiq2/quploadpicol.cmd [deleted file]
platform/uiq2/version.h [deleted file]
platform/uiq2/vid.cpp [deleted file]
platform/uiq2/vid.h [deleted file]
platform/uiq3/App.cpp [deleted file]
platform/uiq3/App.h [deleted file]
platform/uiq3/CSimpleTextParser.cpp [deleted file]
platform/uiq3/CSimpleTextParser.h [deleted file]
platform/uiq3/Dialogs.cpp [deleted file]
platform/uiq3/Dialogs.h [deleted file]
platform/uiq3/Engine.cpp [deleted file]
platform/uiq3/Engine.h [deleted file]
platform/uiq3/Makefile [deleted file]
platform/uiq3/Makefile.old [deleted file]
platform/uiq3/PicoDrive.mmp [deleted file]
platform/uiq3/config.txt [deleted file]
platform/uiq3/emu.c [deleted file]
platform/uiq3/engine/PolledAS.h [deleted file]
platform/uiq3/engine/audio_mediaserver.cpp [deleted file]
platform/uiq3/engine/audio_mediaserver.h [deleted file]
platform/uiq3/engine/blit.c [deleted file]
platform/uiq3/engine/blit.h [deleted file]
platform/uiq3/engine/blit.s [deleted file]
platform/uiq3/engine/debug.cpp [deleted file]
platform/uiq3/engine/debug.h [deleted file]
platform/uiq3/engine/main.cpp [deleted file]
platform/uiq3/engine/polledas.cpp [deleted file]
platform/uiq3/engine/vid.cpp [deleted file]
platform/uiq3/engine/vid.h [deleted file]
platform/uiq3/picodrive.hrh [deleted file]
platform/uiq3/picodrive.pkg [deleted file]
platform/uiq3/port_config.h [deleted file]
platform/uiq3/port_config.s [deleted file]
platform/uiq3/rsc/Pico18x18.bmp [deleted file]
platform/uiq3/rsc/Pico18x18m.bmp [deleted file]
platform/uiq3/rsc/Pico40x40.bmp [deleted file]
platform/uiq3/rsc/Pico40x40m.bmp [deleted file]
platform/uiq3/rsc/Pico64x64.bmp [deleted file]
platform/uiq3/rsc/Pico64x64m.bmp [deleted file]
platform/uiq3/rsc/picodrive.rss [deleted file]
platform/uiq3/rsc/picodrive_loc.rss [deleted file]
platform/uiq3/rsc/picodrive_reg.rss [deleted file]
platform/uiq3/uiq3.mak [deleted file]
platform/uiq3/version.h [deleted file]

diff --git a/cpu/mz80/Makefile b/cpu/mz80/Makefile
deleted file mode 100644 (file)
index 2080dda..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-CFLAGS = -Wno-conversion -Wno-sign-compare # -Wno-pointer-sign
-
-all : mz80.asm
-
-mz80.asm : makez80
-       ./makez80 -s -l -x86 $@
-
-makez80 : makez80.o
-
-
-clean :
-       $(RM) makez80 makez80.o mz80.asm
-
diff --git a/cpu/mz80/Makefile.win b/cpu/mz80/Makefile.win
deleted file mode 100644 (file)
index 0fe2dda..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-all : mz80.obj\r
-\r
-mz80.obj : mz80.asm\r
-       nasm -f win32 mz80.asm -o $@\r
-\r
-mz80.asm : makez80.exe\r
-       makez80.exe -s -x86 $@\r
-\r
-makez80.exe : makez80.c\r
-       cl /DWIN32 /W3 makez80.c\r
-\r
-\r
-clean : tidy\r
-       del mz80.obj\r
-\r
-tidy :\r
-       del mz80.asm makez80.exe makez80.obj \r
-\r
diff --git a/cpu/mz80/driver.h b/cpu/mz80/driver.h
deleted file mode 100644 (file)
index 0705ea9..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/* compiler dependence */
-#ifndef UINT8
-typedef unsigned char  UINT8;   /* unsigned  8bit */
-typedef unsigned short UINT16;  /* unsigned 16bit */
-typedef unsigned int   UINT32;  /* unsigned 32bit */
-#endif
-#ifndef INT8
-typedef signed char            INT8;    /* signed  8bit   */
-typedef signed short   INT16;   /* signed 16bit   */
-typedef signed int             INT32;   /* signed 32bit   */
-#endif
-
-
diff --git a/cpu/mz80/makez80.c b/cpu/mz80/makez80.c
deleted file mode 100644 (file)
index 653d82e..0000000
+++ /dev/null
@@ -1,9512 +0,0 @@
-/* Multi-Z80 32 Bit emulator */\r
-\r
-/* Copyright 1996, 1997, 1998, 1999, 2000 Neil Bradley, All rights reserved\r
- *\r
- * License agreement:\r
- *\r
- * (MZ80 Refers to both the assembly and C code emitted by makeZ80.c and \r
- *      makeZ80.c itself)\r
- *\r
- * MZ80 May be distributed in unmodified form to any medium.\r
- *\r
- * MZ80 May not be sold, or sold as a part of a commercial package without\r
- * the express written permission of Neil Bradley (neil@synthcom.com). This\r
- * includes shareware.\r
- *\r
- * Modified versions of MZ80 may not be publicly redistributed without author\r
- * approval (neil@synthcom.com). This includes distributing via a publicly\r
- * accessible LAN. You may make your own source modifications and distribute\r
- * MZ80 in source or object form, but if you make modifications to MZ80\r
- * then it should be noted in the top as a comment in makeZ80.c.\r
- *\r
- * MZ80 Licensing for commercial applications is available. Please email\r
- * neil@synthcom.com for details.\r
- *\r
- * Synthcom Systems, Inc, and Neil Bradley will not be held responsible for\r
- * any damage done by the use of MZ80. It is purely "as-is".\r
- *\r
- * If you use MZ80 in a freeware application, credit in the following text:\r
- *\r
- * "Multi-Z80 CPU emulator by Neil Bradley (neil@synthcom.com)"\r
- *\r
- * must accompany the freeware application within the application itself or\r
- * in the documentation.\r
- *\r
- * Legal stuff aside:\r
- *\r
- * If you find problems with MZ80, please email the author so they can get\r
- * resolved. If you find a bug and fix it, please also email the author so\r
- * that those bug fixes can be propogated to the installed base of MZ80\r
- * users. If you find performance improvements or problems with MZ80, please\r
- * email the author with your changes/suggestions and they will be rolled in\r
- * with subsequent releases of MZ80.\r
- *\r
- * The whole idea of this emulator is to have the fastest available 32 bit\r
- * Multi-Z80 emulator for the PC, giving maximum performance. \r
- *\r
- */ \r
-\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <assert.h>\r
-\r
-#define        VERSION                                         "3.4"\r
-\r
-#define TRUE                           0xff\r
-#define FALSE                          0x0\r
-#define INVALID                                        0xff\r
-\r
-#define UINT32                         unsigned long int\r
-#define UINT8                          unsigned char\r
-\r
-#define        TIMING_REGULAR                  0x00\r
-#define        TIMING_XXCB                             0x01\r
-#define        TIMING_CB                               0xcb\r
-#define        TIMING_DDFD                             0xdd\r
-#define        TIMING_ED                               0xed\r
-#define        TIMING_EXCEPT                   0x02\r
-\r
-FILE *fp = NULL;\r
-char string[150];\r
-char cpubasename[150];\r
-static char mz80Index[50];\r
-static char mz80IndexHalfHigh[50];\r
-static char mz80IndexHalfLow[50];\r
-char majorOp[50];\r
-char procname[150];\r
-UINT32 dwGlobalLabel = 0;\r
-\r
-enum\r
-{\r
-       MZ80_ASSEMBLY_X86,\r
-       MZ80_C,\r
-       MZ80_UNKNOWN\r
-};\r
-\r
-UINT8 bPlain = FALSE;\r
-UINT8 bNoTiming = FALSE;\r
-UINT8 bUseStack = 0;\r
-UINT8 bCurrentMode = TIMING_REGULAR;   // Current timing mode\r
-UINT8 b16BitIo = FALSE;\r
-UINT8 bThroughCallHandler = FALSE;\r
-UINT8 bOS2 = FALSE;\r
-UINT8 bWhat = MZ80_UNKNOWN;\r
-\r
-void ProcBegin(UINT32 dwOpcode);\r
-\r
-UINT8 *pbLocalReg[8] =\r
-{\r
-       "ch",\r
-       "cl",\r
-       "dh",\r
-       "dl",\r
-       "bh",\r
-       "bl",\r
-       "dl",\r
-       "al"\r
-};\r
-\r
-UINT8 *pbLocalRegC[8] =\r
-{\r
-       "cpu.z80B",\r
-       "cpu.z80C",\r
-       "cpu.z80D",\r
-       "cpu.z80E",\r
-       "cpu.z80H",\r
-       "cpu.z80L",\r
-       "barf",\r
-       "cpu.z80A"\r
-};\r
-\r
-UINT8 *pbPushReg[8] = \r
-{\r
-       "cl",\r
-       "ch",\r
-       "byte [_z80de]",\r
-       "byte [_z80de + 1]",\r
-       "bl",\r
-       "bh",\r
-       "ah",\r
-       "al"\r
-};\r
-\r
-UINT8 *pbFlags[8] =\r
-{\r
-       "nz",\r
-       "z",\r
-       "nc",\r
-       "c",\r
-       "po",\r
-       "pe",\r
-       "ns",\r
-       "s"\r
-};\r
-\r
-UINT8 *pbRegPairC[] =\r
-{\r
-       "cpu.z80BC",\r
-       "cpu.z80DE",\r
-       "cpu.z80HL",\r
-       "cpu.z80sp"\r
-};\r
-\r
-UINT8 *pbFlagsC[8] =\r
-{\r
-       "(!(cpu.z80F & Z80_FLAG_ZERO))",\r
-       "(cpu.z80F & Z80_FLAG_ZERO)",\r
-       "(!(cpu.z80F & Z80_FLAG_CARRY))",\r
-       "(cpu.z80F & Z80_FLAG_CARRY)",\r
-       "(!(cpu.z80F & Z80_FLAG_OVERFLOW_PARITY))",\r
-       "(cpu.z80F & Z80_FLAG_OVERFLOW_PARITY)",\r
-       "(!(cpu.z80F & Z80_FLAG_SIGN))",\r
-       "(cpu.z80F & Z80_FLAG_SIGN)"\r
-};\r
-\r
-UINT8 *pbMathReg[8] =\r
-{\r
-       "ch",\r
-       "cl",\r
-       "byte [_z80de + 1]",\r
-       "byte [_z80de]",\r
-       "bh",\r
-       "bl",\r
-       "INVALID",\r
-       "al"\r
-};\r
-\r
-UINT8 *pbMathRegC[8] =\r
-{\r
-       "cpu.z80B",\r
-       "cpu.z80C",\r
-       "cpu.z80D",\r
-       "cpu.z80E",\r
-       "cpu.z80H",\r
-       "cpu.z80L",\r
-       "bTemp",\r
-       "cpu.z80A"\r
-};\r
-\r
-UINT8 *pbRegPairs[4] = \r
-{\r
-       "cx",   // BC\r
-       "word [_z80de]", // DE\r
-       "bx",   // HL\r
-       "word [_z80sp]"  // SP\r
-};\r
-\r
-UINT8 *pbRegPairsC[4] = \r
-{\r
-       "cpu.z80BC",    // BC\r
-       "cpu.z80DE", // DE\r
-       "cpu.z80HL",    // HL\r
-       "cpu.z80sp"  // SP\r
-};\r
-\r
-UINT8 *pbPopRegPairs[4] = \r
-{\r
-       "cx",   // BC\r
-       "word [_z80de]", // DE\r
-       "bx",   // HL\r
-       "ax"  // SP\r
-};\r
-\r
-UINT8 *pbPopRegPairC[4] = \r
-{\r
-       "cpu.z80BC",\r
-       "cpu.z80DE",\r
-       "cpu.z80HL",\r
-       "cpu.z80AF"\r
-};\r
-\r
-UINT8 *pbIndexedRegPairs[4] = \r
-{\r
-       "cx",   // BC\r
-       "word [_z80de]", // DE\r
-       "di",   // IX/IY\r
-       "word [_z80sp]"  // SP\r
-};\r
-\r
-// Timing tables\r
-\r
-UINT8 bTimingRegular[0x100] =\r
-{\r
-       0x04, 0x0a, 0x07, 0x06, 0x04, 0x04, 0x07, 0x04, 0x04, 0x0b, 0x07, 0x06, 0x04, 0x04, 0x07, 0x04,\r
-       0x08, 0x0a, 0x07, 0x06, 0x04, 0x04, 0x07, 0x04, 0x0c, 0x0b, 0x07, 0x06, 0x04, 0x04, 0x07, 0x04,\r
-       0x07, 0x0a, 0x10, 0x06, 0x04, 0x04, 0x07, 0x04, 0x07, 0x0b, 0x10, 0x06, 0x04, 0x04, 0x07, 0x04,\r
-       0x07, 0x0a, 0x0d, 0x06, 0x0b, 0x0b, 0x0a, 0x04, 0x07, 0x0b, 0x0d, 0x06, 0x04, 0x04, 0x07, 0x04,\r
-\r
-       0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07, 0x04,\r
-       0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07, 0x04,\r
-       0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07, 0x04,\r
-       0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x04, 0x07, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07, 0x04,\r
-\r
-       0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07, 0x04,\r
-       0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07, 0x04,\r
-       0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07, 0x04,\r
-       0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07, 0x04,\r
-\r
-       0x05, 0x0a, 0x0a, 0x0a, 0x0a, 0x0b, 0x07, 0x0b, 0x05, 0x0a, 0x0a, 0x00, 0x0a, 0x11, 0x07, 0x0b,\r
-       0x05, 0x0a, 0x0a, 0x0b, 0x0a, 0x0b, 0x07, 0x0b, 0x05, 0x04, 0x0a, 0x0b, 0x0a, 0x00, 0x07, 0x0b,\r
-       0x05, 0x0a, 0x0a, 0x13, 0x0a, 0x0b, 0x07, 0x0b, 0x05, 0x04, 0x0a, 0x04, 0x0a, 0x00, 0x07, 0x0b,\r
-       0x05, 0x0a, 0x0a, 0x04, 0x0a, 0x0b, 0x07, 0x0b, 0x05, 0x06, 0x0a, 0x04, 0x0a, 0x00, 0x07, 0x0b\r
-};\r
-\r
-UINT8 bTimingCB[0x100] =\r
-{\r
-       0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, \r
-       0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, \r
-       0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, \r
-       0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, \r
-\r
-       0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0c, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0c, 0x08, \r
-       0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0c, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0c, 0x08, \r
-       0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0c, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0c, 0x08, \r
-       0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0c, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0c, 0x08, \r
-       0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, \r
-       0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, \r
-       0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, \r
-       0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, \r
-       0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, \r
-       0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, \r
-       0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, \r
-       0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08\r
-};\r
-\r
-UINT8 bTimingXXCB[0x100] =\r
-{\r
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, \r
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, \r
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, \r
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, \r
-       0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14,\r
-       0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14,\r
-       0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14,\r
-       0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14,\r
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, \r
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, \r
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, \r
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, \r
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, \r
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, \r
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, \r
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00\r
-};\r
-\r
-UINT8 bTimingDDFD[0x100] =\r
-{\r
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \r
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \r
-       0x00, 0x0e, 0x14, 0x0a, 0x09, 0x09, 0x09, 0x00, 0x00, 0x0f, 0x14, 0x0a, 0x09, 0x09, 0x09, 0x00, \r
-       0x00, 0x00, 0x00, 0x00, 0x17, 0x17, 0x13, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \r
-\r
-       0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x13, 0x00, \r
-       0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x13, 0x00, \r
-\r
-       0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x13, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x13, 0x09,\r
-       0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x13, 0x00, \r
-       0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x13, 0x00, \r
-       0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x13, 0x00, \r
-       0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x13, 0x00, \r
-       0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x13, 0x00, \r
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \r
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \r
-       0x00, 0x0e, 0x00, 0x17, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \r
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00\r
-};\r
-\r
-UINT8 bTimingED[0x100] = \r
-{\r
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \r
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \r
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \r
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \r
-\r
-       0x0c, 0x0c, 0x0f, 0x14, 0x08, 0x0e, 0x08, 0x09, 0x0c, 0x0c, 0x0f, 0x14, 0x08, 0x0e, 0x08, 0x09,\r
-       0x0c, 0x0c, 0x0f, 0x14, 0x08, 0x08, 0x08, 0x09, 0x0c, 0x0c, 0x0f, 0x14, 0x08, 0x08, 0x08, 0x09,\r
-       0x0c, 0x0c, 0x0f, 0x14, 0x08, 0x08, 0x08, 0x12, 0x0c, 0x0c, 0x0f, 0x14, 0x08, 0x08, 0x08, 0x12,\r
-       0x0c, 0x0c, 0x0f, 0x14, 0x08, 0x08, 0x08, 0x00, 0x0c, 0x0c, 0x0f, 0x14, 0x08, 0x08, 0x08, 0x00,\r
-\r
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \r
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \r
-       0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, \r
-       0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, \r
-\r
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \r
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \r
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \r
-       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 \r
-};\r
-\r
-void EDHandler(UINT32 dwOpcode);\r
-void DDHandler(UINT32 dwOpcode);\r
-void FDHandler(UINT32 dwOpcode);\r
-void CBHandler(UINT32 dwOpcode);\r
-\r
-void PushPopOperations(UINT32 dwOpcode);\r
-void AddRegpairOperations(UINT32 dwOpcode);\r
-void CallHandler(UINT32 dwOpcode);\r
-void MiscHandler(UINT32 dwOpcode);\r
-void IMHandler(UINT32 dwOpcode);\r
-void IRHandler(UINT32 dwOpcode);\r
-void LdRegPairImmediate(UINT32 dwOpcode);\r
-void LoadImmediate(UINT32 dwOpcode);\r
-void LdRegpairPtrByte(UINT32 dwOpcode);\r
-void MathOperation(UINT32 dwOpcode);\r
-void RegIntoMemory(UINT32 dwOpcode);\r
-void JpHandler(UINT32 dwOpcode);\r
-void LdRegImmediate(UINT32 dwOpcode);\r
-void IncRegister(UINT32 dwOpcode);\r
-void DecRegister(UINT32 dwOpcode);\r
-void IncDecRegpair(UINT32 dwOpcode);\r
-void LdRegReg(UINT32 dwOpcode);\r
-void MathOperationDirect(UINT32 dwOpcode);\r
-void JrHandler(UINT32 dwOpcode);\r
-void RetHandler(UINT32 dwOpcode);\r
-void RestartHandler(UINT32 dwOpcode);\r
-void ToRegFromHl(UINT32);\r
-void RraRlaHandler(UINT32);\r
-void LdByteRegpair(UINT32);\r
-void IncDecHLPtr(UINT32 dwOpcode);\r
-void InOutHandler(UINT32 dwOpcode);\r
-void RLCRRCRLRRSLASRASRLHandler(UINT32 dwOpcode);\r
-void BITHandler(UINT32 dwOpcode);\r
-void RESSETHandler(UINT32 dwOpcode);\r
-void PushPopOperationsIndexed(UINT32 dwOpcode);\r
-void LDILDRLDIRLDDRHandler(UINT32);\r
-void LdRegpair(UINT32 dwOpcode);\r
-void ExtendedRegIntoMemory(UINT32 dwOpcode);\r
-void NegHandler(UINT32 dwOpcode);\r
-void ExtendedInHandler(UINT32 dwOpcode);\r
-void ExtendedOutHandler(UINT32 dwOpcode);\r
-void RetIRetNHandler(UINT32 dwOcode);\r
-void AdcSbcRegpair(UINT32 dwOpcode);\r
-void CPICPDCPIRCPDRHandler(UINT32 dwOpcode);\r
-void RRDRLDHandler(UINT32 dwOpcode);\r
-void UndocRegToIndex(UINT32 dwOpcode);\r
-void UndocIndexToReg(UINT32 dwOpcode);\r
-void MathOperationIndexed(UINT32 dwOpcode);\r
-void IncDecIndexed(UINT32 dwOpcode);\r
-void DDFDCBHandler(UINT32 dwOpcode);\r
-void JPIXIYHandler(UINT32 dwOpcode);\r
-void AddIndexHandler(UINT32 dwOpcode);\r
-void SPToIndex(UINT32 dwOpcode);\r
-void LdByteToIndex(UINT32 dwOpcode);\r
-void LdRegIndexOffset(UINT32 dwOpcode);\r
-void IncDecIndexReg(UINT32 dwOpcode);\r
-void ExIndexed(UINT32 dwOpcode);\r
-void UndocIncDecIndexReg(UINT32 dwOpcode);\r
-void UndocLoadHalfIndexReg(UINT32 dwOpcode);\r
-void UndocMathIndex(UINT32 dwOpcode);\r
-void ddcbBitWise(UINT32 dwOpcode);\r
-void LdIndexPtrReg(UINT32 dwOpcode);\r
-void StoreIndexReg(UINT32 dwOpcode);\r
-void LoadIndexReg(UINT32 dwOpcode);\r
-void OTIROTDROUTIOUTDHandler(UINT32 dwOpcode);\r
-void INIRINDRINIINDHandler(UINT32 dwOpcode);\r
-\r
-struct sOp\r
-{\r
-       UINT32 bOpCode;\r
-       void (*Emitter)(UINT32);\r
-};\r
-\r
-struct sOp StandardOps[] =\r
-{\r
-       {0xd3,  InOutHandler},          // V\r
-       {0xdb,  InOutHandler},          // V\r
-\r
-       {0x0a, LdByteRegpair},          // V\r
-       {0x1a, LdByteRegpair},          // V\r
-\r
-       {0x17,  RraRlaHandler},         // V\r
-       {0x1f,  RraRlaHandler},         // V\r
-\r
-       {0x05,  DecRegister},           // V\r
-       {0x0d,  DecRegister},           // V\r
-       {0x15,  DecRegister},           // V\r
-       {0x1d,  DecRegister},           // V\r
-       {0x25,  DecRegister},           // V\r
-       {0x2d,  DecRegister},           // V\r
-       {0x3d,  DecRegister},           // V\r
-\r
-       {0x04,  IncRegister},           // V\r
-       {0x0c,  IncRegister},           // V\r
-       {0x14,  IncRegister},           // V\r
-       {0x1c,  IncRegister},           // V\r
-       {0x24,  IncRegister},           // V\r
-       {0x2c,  IncRegister},           // V\r
-       {0x3c,  IncRegister},           // V\r
-\r
-       {0x32,  RegIntoMemory}, // V\r
-       {0x22,  RegIntoMemory}, // V\r
-\r
-       {0xc3,  JpHandler},                     // V\r
-       {0xc2, JpHandler},                      // V\r
-       {0xca, JpHandler},                      // V\r
-       {0xd2, JpHandler},                      // V\r
-       {0xda, JpHandler},                      // V\r
-       {0xe2, JpHandler},                      // V\r
-       {0xea, JpHandler},                      // V\r
-       {0xf2, JpHandler},                      // V\r
-       {0xfa, JpHandler},                      // V\r
-\r
-\r
-       {0x06, LdRegImmediate},         // V\r
-       {0x0e, LdRegImmediate},         // V\r
-       {0x16, LdRegImmediate},         // V\r
-       {0x1e, LdRegImmediate},         // V\r
-       {0x26, LdRegImmediate},         // V\r
-       {0x2e, LdRegImmediate},         // V\r
-       {0x3e, LdRegImmediate},         // V\r
-\r
-       {0x0b,  IncDecRegpair},         // V\r
-       {0x1b,  IncDecRegpair},         // V\r
-       {0x2b,  IncDecRegpair},         // V\r
-       {0x3b,  IncDecRegpair},         // V\r
-\r
-       {0x03,  IncDecRegpair},         // V\r
-       {0x13,  IncDecRegpair},         // V\r
-       {0x23,  IncDecRegpair},         // V\r
-       {0x33,  IncDecRegpair},         // V\r
-\r
-       {0x34,  IncDecHLPtr},           // V\r
-       {0x35,  IncDecHLPtr},           // V\r
-\r
-       {0xcb,  CBHandler},\r
-       {0xdd,  DDHandler},\r
-       {0xed,  EDHandler},\r
-       {0xfd,  FDHandler},\r
-\r
-       {0x01,  LdRegPairImmediate},    // V\r
-       {0x11,  LdRegPairImmediate},    // V\r
-       {0x21,  LdRegPairImmediate},    // V\r
-       {0x31,  LdRegPairImmediate},    // V\r
-\r
-       {0xe3,  MiscHandler},   // V\r
-       {0x2a,  MiscHandler},   // V\r
-       {0xfb,  MiscHandler},   // V\r
-       {0xf9,  MiscHandler},   // V\r
-       {0xd9,  MiscHandler},   // V\r
-       {0x76,  MiscHandler},   // V\r
-       {0x3f,  MiscHandler},   // V\r
-       {0x37,  MiscHandler},   // V\r
-       {0x27,  MiscHandler},   // V\r
-       {0x07,  MiscHandler},   // V\r
-       {0x08,  MiscHandler},   // V\r
-       {0x00,  MiscHandler},   // V\r
-       {0xe9,  MiscHandler},   // V\r
-       {0xeb,  MiscHandler},   // V\r
-       {0xf3,  MiscHandler},   // V\r
-       {0x3a,  MiscHandler},   // V\r
-       {0x10,  MiscHandler},   // V\r
-       {0x2f,  MiscHandler},   // V\r
-       {0x0f,  MiscHandler},   // V\r
-\r
-       {0x02, LdRegpairPtrByte},       // V\r
-       {0x12, LdRegpairPtrByte},       // V\r
-\r
-       {0x70, LdRegpairPtrByte},       // V\r
-       {0x71, LdRegpairPtrByte},       // V\r
-       {0x72, LdRegpairPtrByte},       // V\r
-       {0x73, LdRegpairPtrByte},       // V\r
-       {0x74, LdRegpairPtrByte},       // V\r
-       {0x75, LdRegpairPtrByte},       // V\r
-       {0x77, LdRegpairPtrByte},       // V\r
-\r
-       {0x36, LdRegpairPtrByte},       // V\r
-\r
-       {0x80,  MathOperation}, // V\r
-       {0x81,  MathOperation}, // V\r
-       {0x82,  MathOperation}, // V\r
-       {0x83,  MathOperation}, // V\r
-       {0x84,  MathOperation}, // V\r
-       {0x85,  MathOperation}, // V\r
-       {0x86,  MathOperation}, // V\r
-       {0x87,  MathOperation}, // V\r
-       {0x88,  MathOperation}, // V\r
-       {0x89,  MathOperation}, // V\r
-       {0x8a,  MathOperation}, // V\r
-       {0x8b,  MathOperation}, // V\r
-       {0x8c,  MathOperation}, // V\r
-       {0x8d,  MathOperation}, // V\r
-       {0x8e,  MathOperation}, // V\r
-       {0x8f,  MathOperation}, // V\r
-       {0x90,  MathOperation}, // V\r
-       {0x91,  MathOperation}, // V\r
-       {0x92,  MathOperation}, // V\r
-       {0x93,  MathOperation}, // V\r
-       {0x94,  MathOperation}, // V\r
-       {0x95,  MathOperation}, // V\r
-       {0x96,  MathOperation}, // V\r
-       {0x97,  MathOperation}, // V\r
-       {0x98,  MathOperation}, // V\r
-       {0x99,  MathOperation}, // V\r
-       {0x9a,  MathOperation}, // V\r
-       {0x9b,  MathOperation}, // V\r
-       {0x9c,  MathOperation}, // V\r
-       {0x9d,  MathOperation}, // V\r
-       {0x9e,  MathOperation}, // V\r
-       {0x9f,  MathOperation}, // V\r
-       {0xa0,  MathOperation}, // V\r
-       {0xa1,  MathOperation}, // V\r
-       {0xa2,  MathOperation}, // V\r
-       {0xa3,  MathOperation}, // V\r
-       {0xa4,  MathOperation}, // V\r
-       {0xa5,  MathOperation}, // V\r
-       {0xa6,  MathOperation}, // V\r
-       {0xa7,  MathOperation}, // V\r
-       {0xa8,  MathOperation}, // V\r
-       {0xa9,  MathOperation}, // V\r
-       {0xaa,  MathOperation}, // V\r
-       {0xab,  MathOperation}, // V\r
-       {0xac,  MathOperation}, // V\r
-       {0xad,  MathOperation}, // V\r
-       {0xae,  MathOperation}, // V\r
-       {0xaf,  MathOperation}, // V\r
-       {0xb0,  MathOperation}, // V\r
-       {0xb1,  MathOperation}, // V\r
-       {0xb2,  MathOperation}, // V\r
-       {0xb3,  MathOperation}, // V\r
-       {0xb4,  MathOperation}, // V\r
-       {0xb5,  MathOperation}, // V\r
-       {0xb6,  MathOperation}, // V\r
-       {0xb7,  MathOperation}, // V\r
-       {0xb8,  MathOperation}, // V\r
-       {0xb9,  MathOperation}, // V\r
-       {0xba,  MathOperation}, // V\r
-       {0xbb,  MathOperation}, // V\r
-       {0xbc,  MathOperation}, // V\r
-       {0xbd,  MathOperation}, // V\r
-       {0xbe,  MathOperation}, // V\r
-       {0xbf,  MathOperation}, // V\r
-\r
-       {0x40, LdRegReg},       // V\r
-       {0x41, LdRegReg},       // V\r
-       {0x42, LdRegReg},       // V\r
-       {0x43, LdRegReg},       // V\r
-       {0x44, LdRegReg},       // V\r
-       {0x45, LdRegReg},       // V\r
-       {0x47, LdRegReg},       // V\r
-       {0x48, LdRegReg},       // V\r
-       {0x49, LdRegReg},       // V\r
-       {0x4a, LdRegReg},       // V\r
-       {0x4b, LdRegReg},       // V\r
-       {0x4c, LdRegReg},       // V\r
-       {0x4d, LdRegReg},       // V\r
-       {0x4f, LdRegReg},       // V\r
-       {0x50, LdRegReg},       // V\r
-       {0x51, LdRegReg},       // V\r
-       {0x52, LdRegReg},       // V\r
-       {0x53, LdRegReg},       // V\r
-       {0x54, LdRegReg},       // V\r
-       {0x55, LdRegReg},       // V\r
-       {0x57, LdRegReg},       // V\r
-       {0x58, LdRegReg},       // V\r
-       {0x59, LdRegReg},       // V\r
-       {0x5a, LdRegReg},       // V\r
-       {0x5b, LdRegReg},       // V\r
-       {0x5c, LdRegReg},       // V\r
-       {0x5d, LdRegReg},       // V\r
-       {0x5f, LdRegReg},       // V\r
-       {0x60, LdRegReg},       // V\r
-       {0x61, LdRegReg},       // V\r
-       {0x62, LdRegReg},       // V\r
-       {0x63, LdRegReg},       // V\r
-       {0x64, LdRegReg},       // V\r
-       {0x65, LdRegReg},       // V\r
-       {0x67, LdRegReg},       // V\r
-       {0x68, LdRegReg},       // V\r
-       {0x69, LdRegReg},       // V\r
-       {0x6a, LdRegReg},       // V\r
-       {0x6b, LdRegReg},       // V\r
-       {0x6c, LdRegReg},       // V\r
-       {0x6d, LdRegReg},       // V\r
-       {0x6f, LdRegReg},       // V\r
-       {0x78, LdRegReg},       // V\r
-       {0x79, LdRegReg},       // V\r
-       {0x7a, LdRegReg},       // V\r
-       {0x7b, LdRegReg},       // V\r
-       {0x7c, LdRegReg},       // V\r
-       {0x7d, LdRegReg},       // V\r
-       {0x7f, LdRegReg},       // V\r
-\r
-       {0xc6,  MathOperationDirect},   // V\r
-       {0xce,  MathOperationDirect},   // V\r
-       {0xd6,  MathOperationDirect},   // V\r
-       {0xde,  MathOperationDirect},   // V\r
-       {0xe6,  MathOperationDirect},   // V\r
-       {0xee,  MathOperationDirect},   // V\r
-       {0xf6,  MathOperationDirect},   // V\r
-       {0xfe,  MathOperationDirect},   // V\r
-\r
-       {0x18,  JrHandler},     // V\r
-       {0x20,  JrHandler},     // V\r
-       {0x28,  JrHandler},     // V\r
-       {0x30,  JrHandler},     // V\r
-       {0x38,  JrHandler},\r
-\r
-       {0xc4, CallHandler},    // V\r
-       {0xcc, CallHandler},    // V\r
-       {0xcd, CallHandler},    // V\r
-       {0xd4, CallHandler},    // V\r
-       {0xdc, CallHandler},    // V\r
-       {0xe4, CallHandler},    // V\r
-       {0xec, CallHandler},    // V\r
-       {0xf4, CallHandler},    // V\r
-       {0xfc, CallHandler},    // V\r
-\r
-       {0xc9,  RetHandler},    // V\r
-       {0xc0,  RetHandler},    // V\r
-       {0xc8,  RetHandler},    // V\r
-       {0xd0,  RetHandler},    // V\r
-       {0xd8,  RetHandler},    // V\r
-       {0xe0,  RetHandler},    // V\r
-       {0xe8,  RetHandler},    // V\r
-       {0xf0,  RetHandler},    // V\r
-       {0xf8,  RetHandler},    // V\r
-\r
-       {0xc7,  RestartHandler}, // V\r
-       {0xcf,  RestartHandler}, // V\r
-       {0xd7,  RestartHandler}, // V\r
-       {0xdf,  RestartHandler}, // V\r
-       {0xe7,  RestartHandler}, // V\r
-       {0xef,  RestartHandler}, // V\r
-       {0xf7,  RestartHandler}, // V\r
-       {0xff,  RestartHandler}, // V\r
-\r
-       {0x46,  ToRegFromHl},   // V\r
-       {0x4e,  ToRegFromHl},   // V\r
-       {0x56,  ToRegFromHl},   // V\r
-       {0x5e,  ToRegFromHl},   // V\r
-       {0x66,  ToRegFromHl},   // V\r
-       {0x6e,  ToRegFromHl},   // V\r
-       {0x7e,  ToRegFromHl},\r
-\r
-       {0x09,  AddRegpairOperations},  // V\r
-       {0x19,  AddRegpairOperations},  // V\r
-       {0x29,  AddRegpairOperations},  // V\r
-       {0x39,  AddRegpairOperations},  // V\r
-\r
-       {0xc5,  PushPopOperations},     // V\r
-       {0xd5,  PushPopOperations},     // V\r
-       {0xe5,  PushPopOperations},     // V\r
-       {0xf5,  PushPopOperations},     // V\r
-       {0xc1,  PushPopOperations},     // V\r
-       {0xd1,  PushPopOperations},     // V\r
-       {0xe1,  PushPopOperations},     // V\r
-       {0xf1,  PushPopOperations},     // V\r
-\r
-       // Terminator\r
-\r
-       {0xffffffff, NULL}  \r
-};\r
-\r
-struct sOp CBOps[] =\r
-{\r
-       {0x00,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x01,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x02,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x03,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x04,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x05,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x06,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x07,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x08,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x09,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x0a,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x0b,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x0c,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x0d,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x0e,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x0f,  RLCRRCRLRRSLASRASRLHandler},\r
-\r
-       {0x10,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x11,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x12,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x13,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x14,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x15,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x16,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x17,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x18,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x19,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x1a,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x1b,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x1c,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x1d,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x1e,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x1f,  RLCRRCRLRRSLASRASRLHandler},\r
-\r
-       {0x20,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x21,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x22,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x23,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x24,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x25,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x26,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x27,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x28,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x29,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x2a,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x2b,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x2c,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x2d,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x2e,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x2f,  RLCRRCRLRRSLASRASRLHandler},\r
-\r
-       {0x30,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x31,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x32,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x33,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x34,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x35,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x36,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x37,  RLCRRCRLRRSLASRASRLHandler},\r
-\r
-       {0x38,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x39,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x3a,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x3b,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x3c,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x3d,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x3e,  RLCRRCRLRRSLASRASRLHandler},\r
-       {0x3f,  RLCRRCRLRRSLASRASRLHandler},\r
-\r
-       {0x40,  BITHandler},\r
-       {0x41,  BITHandler},\r
-       {0x42,  BITHandler},\r
-       {0x43,  BITHandler},\r
-       {0x44,  BITHandler},\r
-       {0x45,  BITHandler},\r
-       {0x46,  BITHandler},\r
-       {0x47,  BITHandler},\r
-       {0x48,  BITHandler},\r
-       {0x49,  BITHandler},\r
-       {0x4a,  BITHandler},\r
-       {0x4b,  BITHandler},\r
-       {0x4c,  BITHandler},\r
-       {0x4d,  BITHandler},\r
-       {0x4e,  BITHandler},\r
-       {0x4f,  BITHandler},\r
-\r
-       {0x50,  BITHandler},\r
-       {0x51,  BITHandler},\r
-       {0x52,  BITHandler},\r
-       {0x53,  BITHandler},\r
-       {0x54,  BITHandler},\r
-       {0x55,  BITHandler},\r
-       {0x56,  BITHandler},\r
-       {0x57,  BITHandler},\r
-       {0x58,  BITHandler},\r
-       {0x59,  BITHandler},\r
-       {0x5a,  BITHandler},\r
-       {0x5b,  BITHandler},\r
-       {0x5c,  BITHandler},\r
-       {0x5d,  BITHandler},\r
-       {0x5e,  BITHandler},\r
-       {0x5f,  BITHandler},\r
-\r
-       {0x60,  BITHandler},\r
-       {0x61,  BITHandler},\r
-       {0x62,  BITHandler},\r
-       {0x63,  BITHandler},\r
-       {0x64,  BITHandler},\r
-       {0x65,  BITHandler},\r
-       {0x66,  BITHandler},\r
-       {0x67,  BITHandler},\r
-       {0x68,  BITHandler},\r
-       {0x69,  BITHandler},\r
-       {0x6a,  BITHandler},\r
-       {0x6b,  BITHandler},\r
-       {0x6c,  BITHandler},\r
-       {0x6d,  BITHandler},\r
-       {0x6e,  BITHandler},\r
-       {0x6f,  BITHandler},\r
-\r
-       {0x70,  BITHandler},\r
-       {0x71,  BITHandler},\r
-       {0x72,  BITHandler},\r
-       {0x73,  BITHandler},\r
-       {0x74,  BITHandler},\r
-       {0x75,  BITHandler},\r
-       {0x76,  BITHandler},\r
-       {0x77,  BITHandler},\r
-       {0x78,  BITHandler},\r
-       {0x79,  BITHandler},\r
-       {0x7a,  BITHandler},\r
-       {0x7b,  BITHandler},\r
-       {0x7c,  BITHandler},\r
-       {0x7d,  BITHandler},\r
-       {0x7e,  BITHandler},\r
-       {0x7f,  BITHandler},\r
-\r
-       // RES\r
-\r
-       {0x80,  RESSETHandler},\r
-       {0x81,  RESSETHandler},\r
-       {0x82,  RESSETHandler},\r
-       {0x83,  RESSETHandler},\r
-       {0x84,  RESSETHandler},\r
-       {0x85,  RESSETHandler},\r
-       {0x86,  RESSETHandler},\r
-       {0x87,  RESSETHandler},\r
-       {0x88,  RESSETHandler},\r
-       {0x89,  RESSETHandler},\r
-       {0x8a,  RESSETHandler},\r
-       {0x8b,  RESSETHandler},\r
-       {0x8c,  RESSETHandler},\r
-       {0x8d,  RESSETHandler},\r
-       {0x8e,  RESSETHandler},\r
-       {0x8f,  RESSETHandler},\r
-\r
-       {0x90,  RESSETHandler},\r
-       {0x91,  RESSETHandler},\r
-       {0x92,  RESSETHandler},\r
-       {0x93,  RESSETHandler},\r
-       {0x94,  RESSETHandler},\r
-       {0x95,  RESSETHandler},\r
-       {0x96,  RESSETHandler},\r
-       {0x97,  RESSETHandler},\r
-       {0x98,  RESSETHandler},\r
-       {0x99,  RESSETHandler},\r
-       {0x9a,  RESSETHandler},\r
-       {0x9b,  RESSETHandler},\r
-       {0x9c,  RESSETHandler},\r
-       {0x9d,  RESSETHandler},\r
-       {0x9e,  RESSETHandler},\r
-       {0x9f,  RESSETHandler},\r
-\r
-       {0xa0,  RESSETHandler},\r
-       {0xa1,  RESSETHandler},\r
-       {0xa2,  RESSETHandler},\r
-       {0xa3,  RESSETHandler},\r
-       {0xa4,  RESSETHandler},\r
-       {0xa5,  RESSETHandler},\r
-       {0xa6,  RESSETHandler},\r
-       {0xa7,  RESSETHandler},\r
-       {0xa8,  RESSETHandler},\r
-       {0xa9,  RESSETHandler},\r
-       {0xaa,  RESSETHandler},\r
-       {0xab,  RESSETHandler},\r
-       {0xac,  RESSETHandler},\r
-       {0xad,  RESSETHandler},\r
-       {0xae,  RESSETHandler},\r
-       {0xaf,  RESSETHandler},\r
-\r
-       {0xb0,  RESSETHandler},\r
-       {0xb1,  RESSETHandler},\r
-       {0xb2,  RESSETHandler},\r
-       {0xb3,  RESSETHandler},\r
-       {0xb4,  RESSETHandler},\r
-       {0xb5,  RESSETHandler},\r
-       {0xb6,  RESSETHandler},\r
-       {0xb7,  RESSETHandler},\r
-       {0xb8,  RESSETHandler},\r
-       {0xb9,  RESSETHandler},\r
-       {0xba,  RESSETHandler},\r
-       {0xbb,  RESSETHandler},\r
-       {0xbc,  RESSETHandler},\r
-       {0xbd,  RESSETHandler},\r
-       {0xbe,  RESSETHandler},\r
-       {0xbf,  RESSETHandler},\r
-\r
-       // SET\r
-\r
-       {0xc0,  RESSETHandler},\r
-       {0xc1,  RESSETHandler},\r
-       {0xc2,  RESSETHandler},\r
-       {0xc3,  RESSETHandler},\r
-       {0xc4,  RESSETHandler},\r
-       {0xc5,  RESSETHandler},\r
-       {0xc6,  RESSETHandler},\r
-       {0xc7,  RESSETHandler},\r
-       {0xc8,  RESSETHandler},\r
-       {0xc9,  RESSETHandler},\r
-       {0xca,  RESSETHandler},\r
-       {0xcb,  RESSETHandler},\r
-       {0xcc,  RESSETHandler},\r
-       {0xcd,  RESSETHandler},\r
-       {0xce,  RESSETHandler},\r
-       {0xcf,  RESSETHandler},\r
-\r
-       {0xd0,  RESSETHandler},\r
-       {0xd1,  RESSETHandler},\r
-       {0xd2,  RESSETHandler},\r
-       {0xd3,  RESSETHandler},\r
-       {0xd4,  RESSETHandler},\r
-       {0xd5,  RESSETHandler},\r
-       {0xd6,  RESSETHandler},\r
-       {0xd7,  RESSETHandler},\r
-       {0xd8,  RESSETHandler},\r
-       {0xd9,  RESSETHandler},\r
-       {0xda,  RESSETHandler},\r
-       {0xdb,  RESSETHandler},\r
-       {0xdc,  RESSETHandler},\r
-       {0xdd,  RESSETHandler},\r
-       {0xde,  RESSETHandler},\r
-       {0xdf,  RESSETHandler},\r
-\r
-       {0xe0,  RESSETHandler},\r
-       {0xe1,  RESSETHandler},\r
-       {0xe2,  RESSETHandler},\r
-       {0xe3,  RESSETHandler},\r
-       {0xe4,  RESSETHandler},\r
-       {0xe5,  RESSETHandler},\r
-       {0xe6,  RESSETHandler},\r
-       {0xe7,  RESSETHandler},\r
-       {0xe8,  RESSETHandler},\r
-       {0xe9,  RESSETHandler},\r
-       {0xea,  RESSETHandler},\r
-       {0xeb,  RESSETHandler},\r
-       {0xec,  RESSETHandler},\r
-       {0xed,  RESSETHandler},\r
-       {0xee,  RESSETHandler},\r
-       {0xef,  RESSETHandler},\r
-\r
-       {0xf0,  RESSETHandler},\r
-       {0xf1,  RESSETHandler},\r
-       {0xf2,  RESSETHandler},\r
-       {0xf3,  RESSETHandler},\r
-       {0xf4,  RESSETHandler},\r
-       {0xf5,  RESSETHandler},\r
-       {0xf6,  RESSETHandler},\r
-       {0xf7,  RESSETHandler},\r
-       {0xf8,  RESSETHandler},\r
-       {0xf9,  RESSETHandler},\r
-       {0xfa,  RESSETHandler},\r
-       {0xfb,  RESSETHandler},\r
-       {0xfc,  RESSETHandler},\r
-       {0xfd,  RESSETHandler},\r
-       {0xfe,  RESSETHandler},\r
-       {0xff,  RESSETHandler},\r
-\r
-       // Terminator\r
-\r
-       {0xffffffff, NULL}  \r
-};\r
-\r
-struct sOp EDOps[] =\r
-{\r
-       {0x67,  RRDRLDHandler},\r
-       {0x6f,  RRDRLDHandler},\r
-       {0x42,  AdcSbcRegpair},\r
-       {0x4a,  AdcSbcRegpair},\r
-       {0x52,  AdcSbcRegpair},\r
-       {0x5a,  AdcSbcRegpair},\r
-       {0x62,  AdcSbcRegpair},\r
-       {0x6a,  AdcSbcRegpair},\r
-       {0x72,  AdcSbcRegpair},\r
-       {0x7a,  AdcSbcRegpair},  \r
-       {0x45,  RetIRetNHandler},\r
-       {0x4d,  RetIRetNHandler},\r
-       {0x44,  NegHandler},\r
-       {0xa0,  LDILDRLDIRLDDRHandler},\r
-       {0xa8,  LDILDRLDIRLDDRHandler},\r
-       {0xb0,  LDILDRLDIRLDDRHandler},\r
-       {0xb8,  LDILDRLDIRLDDRHandler},\r
-       {0x57, IRHandler},\r
-       {0x5F, IRHandler},\r
-       {0x47, IRHandler},\r
-       {0x4F, IRHandler},\r
-       {0x46,  IMHandler},\r
-       {0x56,  IMHandler},\r
-       {0x5e,  IMHandler},\r
-       {0x4b,  LdRegpair},\r
-       {0x5b,  LdRegpair},\r
-       {0x7b,  LdRegpair},\r
-       {0x43,  ExtendedRegIntoMemory},\r
-       {0x53,  ExtendedRegIntoMemory},\r
-       {0x63,  ExtendedRegIntoMemory},\r
-       {0x73,  ExtendedRegIntoMemory},\r
-       {0x40, ExtendedInHandler},\r
-       {0x48, ExtendedInHandler},\r
-       {0x50, ExtendedInHandler},\r
-       {0x58, ExtendedInHandler},\r
-       {0x60, ExtendedInHandler},\r
-       {0x68, ExtendedInHandler},\r
-       {0x78, ExtendedInHandler},\r
-       {0x41, ExtendedOutHandler},\r
-       {0x49, ExtendedOutHandler},\r
-       {0x51, ExtendedOutHandler},\r
-       {0x59, ExtendedOutHandler},\r
-       {0x61, ExtendedOutHandler},\r
-       {0x69, ExtendedOutHandler},\r
-       {0x79, ExtendedOutHandler}, \r
-       {0xa1,  CPICPDCPIRCPDRHandler},\r
-       {0xa9,  CPICPDCPIRCPDRHandler},\r
-       {0xb1,  CPICPDCPIRCPDRHandler},\r
-       {0xb9,  CPICPDCPIRCPDRHandler},\r
-\r
-       {0xbb,  OTIROTDROUTIOUTDHandler},                       // OTDR\r
-       {0xb3,  OTIROTDROUTIOUTDHandler},                       // OTIR\r
-       {0xab,  OTIROTDROUTIOUTDHandler},                       // OUTD\r
-       {0xa3,  OTIROTDROUTIOUTDHandler},                       // OUTI\r
-\r
-       {0xb2,  INIRINDRINIINDHandler},                         // INIR\r
-       {0xba,  INIRINDRINIINDHandler},                         // INDR\r
-       {0xa2,  INIRINDRINIINDHandler},                         // INI\r
-       {0xaa,  INIRINDRINIINDHandler},                         // IND\r
-\r
-       // Terminator\r
-\r
-       {0xffffffff, NULL}  \r
-};\r
-\r
-struct sOp DDFDOps[] =\r
-{\r
-       {0x35,  IncDecIndexed},\r
-       {0x34,  IncDecIndexed},\r
-       {0xcb,  DDFDCBHandler},\r
-       {0x86,  MathOperationIndexed},\r
-       {0x8e,  MathOperationIndexed},\r
-       {0x96,  MathOperationIndexed},\r
-       {0x9e,  MathOperationIndexed},\r
-       {0xa6,  MathOperationIndexed},\r
-       {0xae,  MathOperationIndexed},\r
-       {0xb6,  MathOperationIndexed},\r
-       {0xbe,  MathOperationIndexed},\r
-\r
-       {0xe1,  PushPopOperationsIndexed},\r
-       {0xe5,  PushPopOperationsIndexed},\r
-       {0x21,  LoadImmediate},\r
-       {0xe9,  JPIXIYHandler},\r
-       {0x09,  AddIndexHandler},\r
-       {0x19,  AddIndexHandler},\r
-       {0x29,  AddIndexHandler},\r
-       {0x39,  AddIndexHandler},\r
-       {0xf9,  SPToIndex},\r
-       {0x36,  LdByteToIndex},\r
-       {0x46,  LdRegIndexOffset},\r
-       {0x4e,  LdRegIndexOffset},\r
-       {0x56,  LdRegIndexOffset},\r
-       {0x5e,  LdRegIndexOffset},\r
-       {0x66,  LdRegIndexOffset},\r
-       {0x6e,  LdRegIndexOffset},\r
-       {0x7e,  LdRegIndexOffset}, \r
-\r
-       {0x70,  LdIndexPtrReg},\r
-       {0x71,  LdIndexPtrReg},\r
-       {0x72,  LdIndexPtrReg},\r
-       {0x73,  LdIndexPtrReg},\r
-       {0x74,  LdIndexPtrReg},\r
-       {0x75,  LdIndexPtrReg},\r
-       {0x77,  LdIndexPtrReg},\r
-\r
-       {0x23,  IncDecIndexReg},\r
-       {0x2b,  IncDecIndexReg},\r
-\r
-       {0x22,  StoreIndexReg},\r
-       {0x2a,  LoadIndexReg},\r
-       {0xe3,  ExIndexed},\r
-\r
-       {0x44,  UndocRegToIndex},\r
-       {0x45,  UndocRegToIndex},\r
-       {0x4c,  UndocRegToIndex},\r
-       {0x4d,  UndocRegToIndex},\r
-       {0x54,  UndocRegToIndex},\r
-       {0x55,  UndocRegToIndex},\r
-       {0x5c,  UndocRegToIndex},\r
-       {0x5d,  UndocRegToIndex},\r
-       {0x7c,  UndocRegToIndex},\r
-       {0x7d,  UndocRegToIndex},\r
-\r
-       {0x60,  UndocIndexToReg},\r
-       {0x61,  UndocIndexToReg},\r
-       {0x62,  UndocIndexToReg},\r
-       {0x63,  UndocIndexToReg},\r
-       {0x64,  UndocIndexToReg},\r
-       {0x65,  UndocIndexToReg},\r
-       {0x67,  UndocIndexToReg},\r
-       {0x68,  UndocIndexToReg},\r
-       {0x69,  UndocIndexToReg},\r
-       {0x6a,  UndocIndexToReg},\r
-       {0x6b,  UndocIndexToReg},\r
-       {0x6c,  UndocIndexToReg},\r
-       {0x6d,  UndocIndexToReg},\r
-       {0x6f,  UndocIndexToReg},\r
-\r
-       {0x24,  UndocIncDecIndexReg},\r
-       {0x25,  UndocIncDecIndexReg},\r
-       {0x2c,  UndocIncDecIndexReg},\r
-       {0x2d,  UndocIncDecIndexReg},\r
-\r
-       {0x26,  UndocLoadHalfIndexReg},\r
-       {0x2e,  UndocLoadHalfIndexReg},\r
-\r
-       {0x84,  UndocMathIndex},\r
-       {0x85,  UndocMathIndex},\r
-       {0x8c,  UndocMathIndex},\r
-       {0x8d,  UndocMathIndex},\r
-\r
-       {0x94,  UndocMathIndex},\r
-       {0x95,  UndocMathIndex},\r
-       {0x9c,  UndocMathIndex},\r
-       {0x9d,  UndocMathIndex},\r
-\r
-       {0xa4,  UndocMathIndex},\r
-       {0xa5,  UndocMathIndex},\r
-       {0xac,  UndocMathIndex},\r
-       {0xad,  UndocMathIndex},\r
-\r
-       {0xb4,  UndocMathIndex},\r
-       {0xb5,  UndocMathIndex},\r
-       {0xbc,  UndocMathIndex},\r
-       {0xbd,  UndocMathIndex},\r
-\r
-       // Terminator\r
-\r
-       {0xffffffff, NULL}\r
-};\r
-\r
-struct sOp DDFDCBOps[] =\r
-{\r
-       {0x06,  ddcbBitWise},\r
-       {0x0e,  ddcbBitWise},\r
-       {0x16,  ddcbBitWise},\r
-       {0x1e,  ddcbBitWise},\r
-       {0x26,  ddcbBitWise},\r
-       {0x2e,  ddcbBitWise},\r
-       {0x3e,  ddcbBitWise},\r
-       {0x46,  ddcbBitWise},\r
-       {0x4e,  ddcbBitWise},\r
-       {0x56,  ddcbBitWise},\r
-       {0x5e,  ddcbBitWise},\r
-       {0x66,  ddcbBitWise},\r
-       {0x6e,  ddcbBitWise},\r
-       {0x76,  ddcbBitWise},\r
-       {0x7e,  ddcbBitWise},\r
-       {0x86,  ddcbBitWise},\r
-       {0x8e,  ddcbBitWise},\r
-       {0x96,  ddcbBitWise},\r
-       {0x9e,  ddcbBitWise},\r
-       {0xa6,  ddcbBitWise},\r
-       {0xae,  ddcbBitWise},\r
-       {0xb6,  ddcbBitWise},\r
-       {0xbe,  ddcbBitWise},\r
-       {0xc6,  ddcbBitWise},\r
-       {0xce,  ddcbBitWise},\r
-       {0xd6,  ddcbBitWise},\r
-       {0xde,  ddcbBitWise},\r
-       {0xe6,  ddcbBitWise},\r
-       {0xee,  ddcbBitWise},\r
-       {0xf6,  ddcbBitWise},\r
-       {0xfe,  ddcbBitWise},\r
-\r
-       // Terminator\r
-\r
-       {0xffffffff, NULL}\r
-};\r
-\r
-void InvalidInstructionC(UINT32 dwCount)\r
-{\r
-       fprintf(fp, "                           InvalidInstruction(%ld);\n", dwCount);\r
-}\r
-\r
-UINT32 Timing(UINT8 bWho, UINT32 dwOpcode)\r
-{\r
-       UINT32 dwTiming = 0;\r
-\r
-       assert(dwOpcode < 0x100);\r
-\r
-       if (TIMING_REGULAR == bWho)     // Regular?\r
-               dwTiming = bTimingRegular[dwOpcode];\r
-       else\r
-       if (TIMING_CB == bWho)\r
-               dwTiming = bTimingCB[dwOpcode];\r
-       else\r
-       if (TIMING_DDFD == bWho)\r
-               dwTiming = bTimingDDFD[dwOpcode];\r
-       else\r
-       if (TIMING_ED == bWho)\r
-               dwTiming = bTimingED[dwOpcode];\r
-       else\r
-       if (TIMING_XXCB == bWho)\r
-               dwTiming = bTimingXXCB[dwOpcode];\r
-       else\r
-       if (TIMING_EXCEPT == bWho)\r
-               dwTiming = dwOpcode;\r
-       else\r
-               assert(0);\r
-\r
-       if (0 == dwTiming)\r
-       {       \r
-               fprintf(stderr, "Opcode: %.2x:%.2x - Not zero!\n", bWho, dwOpcode);\r
-               fclose(fp);\r
-               exit(1);\r
-       }\r
-\r
-       return(dwTiming);\r
-}\r
-\r
-void IndexedOffset(UINT8 *Localmz80Index)\r
-{\r
-       fprintf(fp, "           mov     dl, [esi]       ; Fetch our offset\n");\r
-       fprintf(fp, "           inc     esi             ; Move past the offset\n");\r
-       fprintf(fp, "           or      dl, dl          ; Is this bad boy signed?\n");\r
-       fprintf(fp, "           jns     notSigned%ld    ; Nope!\n", dwGlobalLabel);\r
-       fprintf(fp, "           dec     dh                      ; Make it FFable\n");\r
-       fprintf(fp, "notSigned%ld:\n", dwGlobalLabel);\r
-       fprintf(fp, "           add     dx, [_z80%s]    ; Our offset!\n", Localmz80Index);\r
-       ++dwGlobalLabel;\r
-}\r
-\r
-void CBHandler(UINT32 dwOpcode)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               fprintf(fp, ";\n");\r
-               fprintf(fp, "; Handler for all CBxx instructions\n");\r
-               fprintf(fp, ";\n");\r
-               sprintf(string, "RegInst%.2x", dwOpcode);\r
-               ProcBegin(0xffffffff);\r
-               fprintf(fp, "           mov     dl, [esi]\n");\r
-               fprintf(fp, "           inc     esi\n");\r
-               fprintf(fp, "           jmp     dword [z80PrefixCB+edx*4]\n\n");\r
-               fprintf(fp, "\n\n");\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "                           CBHandler();\n");\r
-       }\r
-       else\r
-       {\r
-               assert(0);      \r
-       }\r
-}\r
-\r
-void EDHandler(UINT32 dwOpcode)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               fprintf(fp, ";\n");\r
-               fprintf(fp, "; Handler for all EDxx instructions\n");\r
-               fprintf(fp, ";\n");\r
-               sprintf(string, "RegInst%.2x", dwOpcode);\r
-               ProcBegin(0xffffffff);\r
-               fprintf(fp,     "               mov     dl, [esi]\n");\r
-               fprintf(fp, "           inc     esi\n");\r
-               fprintf(fp,     "               jmp     dword [z80PrefixED+edx*4]\n\n");\r
-               fprintf(fp, "\n\n");\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "                           EDHandler();\n");\r
-       }\r
-       else\r
-       {\r
-               assert(0);      \r
-       }\r
-}\r
-\r
-void DDHandler(UINT32 dwOpcode)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               fprintf(fp, ";\n");\r
-               fprintf(fp, "; Handler for all DDxx instructions\n");\r
-               fprintf(fp, ";\n");\r
-               sprintf(string, "RegInst%.2x", dwOpcode);\r
-               ProcBegin(0xffffffff);\r
-               fprintf(fp,     "               mov     dl, [esi]\n");\r
-               fprintf(fp, "           inc     esi\n");\r
-               fprintf(fp,     "               jmp     dword [z80PrefixDD+edx*4]\n\n");\r
-               fprintf(fp, "\n\n");\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "                           DDHandler();\n");\r
-       }\r
-       else\r
-       {\r
-               assert(0);      \r
-       }\r
-}\r
-\r
-void FDHandler(UINT32 dwOpcode)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               fprintf(fp, ";\n");\r
-               fprintf(fp, "; Handler for all FDxx instructions\n");\r
-               fprintf(fp, ";\n");\r
-               sprintf(string, "RegInst%.2x", dwOpcode);\r
-               ProcBegin(0xffffffff);\r
-               fprintf(fp,     "               mov     dl, [esi]\n");\r
-               fprintf(fp, "           inc     esi\n");\r
-               fprintf(fp,     "               jmp     dword [z80PrefixFD+edx*4]\n\n");\r
-               fprintf(fp, "\n\n");\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "                           FDHandler();\n");\r
-       }\r
-       else\r
-       {\r
-               assert(0);      \r
-       }\r
-}\r
-\r
-StandardHeader()\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               fprintf(fp,"; For assembly by NASM only\n");\r
-               fprintf(fp,"bits 32\n\n");\r
-\r
-               fprintf(fp,"; Theory of operation\n\n");\r
-               fprintf(fp,"; EDI=General purpose\n");\r
-               fprintf(fp,"; ESI=Program counter + base address\n");\r
-               fprintf(fp,"; EBP=z80Base\n");\r
-               fprintf(fp,"; AX=AF\n");\r
-               fprintf(fp,"; BX=HL\n");\r
-               fprintf(fp,"; CX=BC\n");\r
-               fprintf(fp,"; DX=General purpose\n\n"); \r
-\r
-               if (bUseStack)\r
-                       fprintf(fp, "; Using stack calling conventions\n");\r
-               else\r
-                       fprintf(fp, "; Using register calling conventions\n");\r
-\r
-               if (b16BitIo)\r
-                       fprintf(fp, "; Extended input/output instructions treat (BC) as I/O address\n");\r
-               else\r
-                       fprintf(fp, "; Extended input/output instructions treat (C) as I/O address\n\n");\r
-\r
-               fprintf(fp, "IFF1               equ     01h\n");\r
-               fprintf(fp, "IFF2               equ     02h\n");\r
-\r
-               fprintf(fp, "CPUREG_PC          equ     00h\n");\r
-               fprintf(fp, "CPUREG_SP          equ     01h\n");\r
-               fprintf(fp, "CPUREG_AF          equ     02h\n");\r
-               fprintf(fp, "CPUREG_BC          equ     03h\n");\r
-               fprintf(fp, "CPUREG_DE          equ     04h\n");\r
-               fprintf(fp, "CPUREG_HL          equ     05h\n");\r
-               fprintf(fp, "CPUREG_AFPRIME             equ     06h\n");\r
-               fprintf(fp, "CPUREG_BCPRIME             equ     07h\n");\r
-               fprintf(fp, "CPUREG_DEPRIME             equ     08h\n");\r
-               fprintf(fp, "CPUREG_HLPRIME             equ     09h\n");\r
-               fprintf(fp, "CPUREG_IX          equ     0ah\n");\r
-               fprintf(fp, "CPUREG_IY          equ     0bh\n");\r
-               fprintf(fp, "CPUREG_I           equ     0ch\n");\r
-               fprintf(fp, "CPUREG_A           equ     0dh\n");\r
-               fprintf(fp, "CPUREG_F           equ     0eh\n");\r
-               fprintf(fp, "CPUREG_B           equ     0fh\n");\r
-               fprintf(fp, "CPUREG_C           equ     10h\n");\r
-               fprintf(fp, "CPUREG_D           equ     11h\n");\r
-               fprintf(fp, "CPUREG_E           equ     12h\n");\r
-               fprintf(fp, "CPUREG_H           equ     13h\n");\r
-               fprintf(fp, "CPUREG_L           equ     14h\n");\r
-               fprintf(fp, "CPUREG_IFF1                equ     15h\n");\r
-               fprintf(fp, "CPUREG_IFF2                equ     16h\n");\r
-               fprintf(fp, "CPUREG_CARRY               equ     17h\n");\r
-               fprintf(fp, "CPUREG_NEGATIVE            equ     18h\n");\r
-               fprintf(fp, "CPUREG_PARITY              equ     19h\n");\r
-               fprintf(fp, "CPUREG_OVERFLOW            equ     1ah\n");\r
-               fprintf(fp, "CPUREG_HALFCARRY           equ     1bh\n");\r
-               fprintf(fp, "CPUREG_ZERO                equ     1ch\n");\r
-               fprintf(fp, "CPUREG_SIGN                equ     1dh\n");\r
-               fprintf(fp, "CPUREG_MAXINDEX            equ     1eh\n\n");\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "/* Multi-Z80 32 Bit emulator */\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "/* Copyright 1996-2000 Neil Bradley, All rights reserved\n");\r
-               fprintf(fp, " *\n");\r
-               fprintf(fp, " * License agreement:\n");\r
-               fprintf(fp, " *\n");\r
-               fprintf(fp, " * (MZ80 Refers to both the assembly code emitted by makeZ80.c and makeZ80.c\n");\r
-               fprintf(fp, " * itself)\n");\r
-               fprintf(fp, " *\n");\r
-               fprintf(fp, " * MZ80 May be distributed in unmodified form to any medium.\n");\r
-               fprintf(fp, " *\n");\r
-               fprintf(fp, " * MZ80 May not be sold, or sold as a part of a commercial package without\n");\r
-               fprintf(fp, " * the express written permission of Neil Bradley (neil@synthcom.com). This\n");\r
-               fprintf(fp, " * includes shareware.\n");\r
-               fprintf(fp, " *\n");\r
-               fprintf(fp, " * Modified versions of MZ80 may not be publicly redistributed without author\n");\r
-               fprintf(fp, " * approval (neil@synthcom.com). This includes distributing via a publicly\n");\r
-               fprintf(fp, " * accessible LAN. You may make your own source modifications and distribute\n");\r
-               fprintf(fp, " * MZ80 in source or object form, but if you make modifications to MZ80\n");\r
-               fprintf(fp, " * then it should be noted in the top as a comment in makeZ80.c.\n");\r
-               fprintf(fp, " *\n");\r
-               fprintf(fp, " * MZ80 Licensing for commercial applications is available. Please email\n");\r
-               fprintf(fp, " * neil@synthcom.com for details.\n");\r
-               fprintf(fp, " *\n");\r
-               fprintf(fp, " * Synthcom Systems, Inc, and Neil Bradley will not be held responsible for\n");\r
-               fprintf(fp, " * any damage done by the use of MZ80. It is purely \"as-is\".\n");\r
-               fprintf(fp, " *\n");\r
-               fprintf(fp, " * If you use MZ80 in a freeware application, credit in the following text:\n");\r
-               fprintf(fp, " *\n");\r
-               fprintf(fp, " * \"Multi-Z80 CPU emulator by Neil Bradley (neil@synthcom.com)\"\n");\r
-               fprintf(fp, " *\n");\r
-               fprintf(fp, " * must accompany the freeware application within the application itself or\n");\r
-               fprintf(fp, " * in the documentation.\n");\r
-               fprintf(fp, " *\n");\r
-               fprintf(fp, " * Legal stuff aside:\n");\r
-               fprintf(fp, " *\n");\r
-               fprintf(fp, " * If you find problems with MZ80, please email the author so they can get\n");\r
-               fprintf(fp, " * resolved. If you find a bug and fix it, please also email the author so\n");\r
-               fprintf(fp, " * that those bug fixes can be propogated to the installed base of MZ80\n");\r
-               fprintf(fp, " * users. If you find performance improvements or problems with MZ80, please\n");\r
-               fprintf(fp, " * email the author with your changes/suggestions and they will be rolled in\n");\r
-               fprintf(fp, " * with subsequent releases of MZ80.\n");\r
-               fprintf(fp, " *\n");\r
-               fprintf(fp, " * The whole idea of this emulator is to have the fastest available 32 bit\n");\r
-               fprintf(fp, " * Multi-Z80 emulator for the PC, giving maximum performance. \n");\r
-               fprintf(fp, " */\n\n");\r
-               fprintf(fp, "#include <stdio.h>\n");\r
-               fprintf(fp, "#include <stdlib.h>\n");\r
-               fprintf(fp, "#include <string.h>\n");\r
-               fprintf(fp, "#include \"mz80.h\"\n");\r
-\r
-               // HACK HACK\r
-\r
-               fprintf(fp, "UINT32 z80intAddr;\n");\r
-               fprintf(fp, "UINT32 z80pc;\n");\r
-       }                         \r
-       else\r
-       {\r
-               // Whoops. Unknown emission type.\r
-\r
-               assert(0);\r
-       }\r
-\r
-       fprintf(fp, "\n\n");\r
-}\r
-\r
-Alignment()\r
-{\r
-       fprintf(fp, "\ntimes ($$-$) & 3 nop     ; pad with NOPs to 4-byte boundary\n\n");\r
-}\r
-\r
-void ProcBegin(UINT32 dwOpcode)\r
-{\r
-       Alignment();\r
-       fprintf(fp, "%s:\n", procname);\r
-}\r
-\r
-void SetSubFlagsSZHVC(UINT8 *pszLeft, UINT8 *pszRight)\r
-{\r
-       fprintf(fp, "                           cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | \n");\r
-       fprintf(fp, "                                                      Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |\n");\r
-       fprintf(fp, "                                                           pbSubSbcTable[((UINT32) %s << 8) | %s];\n", pszLeft, pszRight);\r
-}\r
-\r
-void SetSbcFlagsSZHVC(UINT8 *pszLeft, UINT8 *pszRight)\r
-{\r
-       fprintf(fp, "                           cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | \n");\r
-       fprintf(fp, "                                                      Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |\n");\r
-       fprintf(fp, "                                                           pbSubSbcTable[((UINT32) %s << 8) | %s | (((UINT32) cpu.z80F & Z80_FLAG_CARRY) << 16)];\n", pszLeft, pszRight);\r
-}\r
-\r
-void SetAddFlagsSZHVC(UINT8 *pszLeft, UINT8 *pszRight)\r
-{\r
-       fprintf(fp, "                           cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | \n");\r
-       fprintf(fp, "                                                      Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |\n");\r
-       fprintf(fp, "                                                           pbAddAdcTable[((UINT32) %s << 8) | %s];\n", pszLeft, pszRight);\r
-}\r
-\r
-void SetAdcFlagsSZHVC(UINT8 *pszLeft, UINT8 *pszRight)\r
-{\r
-       fprintf(fp, "                           cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | \n");\r
-       fprintf(fp, "                                                      Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |\n");\r
-       fprintf(fp, "                                                           pbAddAdcTable[((UINT32) %s << 8) | %s | (((UINT32) cpu.z80F & Z80_FLAG_CARRY) << 16)];\n", pszLeft, pszRight);\r
-}\r
-\r
-UINT32 dwOverflowCount = 0;\r
-\r
-SetOverflow()\r
-{\r
-       fprintf(fp, "           seto    dl\n");\r
-       fprintf(fp, "           and     ah, 0fbh        ; Knock out parity/overflow\n");\r
-       fprintf(fp, "           shl     dl, 2\n");\r
-       fprintf(fp, "           or              ah, dl\n");\r
-}\r
-       \r
-void FetchNextInstruction(UINT32 dwOpcode)\r
-{\r
-       if (0xffffffff != dwOpcode)\r
-       {\r
-               fprintf(fp, "           sub     edi, byte %ld\n", Timing(bCurrentMode, dwOpcode));\r
-               \r
-               if (bCurrentMode == TIMING_REGULAR)\r
-                       fprintf(fp, "           js      near noMoreExec\n");\r
-               else\r
-                       fprintf(fp, "           js      near noMoreExec\n");\r
-       }\r
-\r
-       fprintf(fp, "           mov     dl, byte [esi]  ; Get our next instruction\n");\r
-       fprintf(fp, "           inc     esi             ; Increment PC\n");\r
-       fprintf(fp, "           jmp     dword [z80regular+edx*4]\n\n");\r
-}\r
-\r
-void WriteValueToMemory(UINT8 *pszAddress, UINT8 *pszValue)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               fprintf(fp, "           mov     [cyclesRemaining], edi\n");\r
-               fprintf(fp, "           mov     [_z80af], ax    ; Store AF\n");\r
-\r
-               // First off, load our byte to write into al after we've saved AF\r
-\r
-               if (strcmp(pszValue, "al") != 0)\r
-                       fprintf(fp, "           mov     al, %s  ; And our data to write\n", pszValue);\r
-               if (strcmp(pszValue, "[esi]") == 0)     // Immediate value?\r
-                       fprintf(fp, "           inc     esi     ; Increment our program counter\n");\r
-\r
-               // Now get the address in DX - regardless of what it is\r
-\r
-               if (strcmp(pszAddress, "[_z80de]") == 0 ||\r
-                        strcmp(pszAddress, "[_orgval]") == 0 ||\r
-                        strcmp(pszAddress, "[_z80ix]") == 0 ||\r
-                        strcmp(pszAddress, "[_z80iy]") == 0)\r
-                       fprintf(fp, "           mov     dx, %s\n", pszAddress);\r
-\r
-               fprintf(fp, "           mov     edi, [_z80MemWrite]     ; Point to the write array\n\n", cpubasename);\r
-               fprintf(fp, "checkLoop%ld:\n", dwGlobalLabel);\r
-               fprintf(fp, "           cmp     [edi], word 0ffffh ; End of our list?\n");\r
-               fprintf(fp, "           je      memoryWrite%ld  ; Yes - go write it!\n", dwGlobalLabel);\r
-\r
-               if (strcmp(pszAddress, "[_z80de]") == 0 ||\r
-                        strcmp(pszAddress, "[_orgval]") == 0 ||\r
-                        strcmp(pszAddress, "[_z80ix]") == 0 ||\r
-                        strcmp(pszAddress, "[_z80iy]") == 0)\r
-                       fprintf(fp, "           cmp     dx, [edi]       ; Are we smaller?\n", pszAddress);\r
-               else\r
-                       fprintf(fp, "           cmp     %s, [edi]       ; Are we smaller?\n", pszAddress);\r
-\r
-               fprintf(fp, "           jb      nextAddr%ld     ; Yes... go to the next addr\n", dwGlobalLabel);\r
-\r
-               if (strcmp(pszAddress, "[_z80de]") == 0 ||\r
-                        strcmp(pszAddress, "[_orgval]") == 0 ||\r
-                        strcmp(pszAddress, "[_z80ix]") == 0 ||\r
-                        strcmp(pszAddress, "[_z80iy]") == 0)\r
-                       fprintf(fp, "           cmp     dx, [edi+4]     ; Are we smaller?\n", pszAddress);\r
-               else\r
-                       fprintf(fp, "           cmp     %s, [edi+4]     ; Are we smaller?\n", pszAddress);\r
-       \r
-               fprintf(fp, "           jbe     callRoutine%ld  ; If not, go call it!\n\n", dwGlobalLabel);\r
-               fprintf(fp, "nextAddr%ld:\n", dwGlobalLabel);\r
-               fprintf(fp, "           add     edi, 10h                ; Next structure, please\n");\r
-               fprintf(fp, "           jmp     short checkLoop%ld\n\n", dwGlobalLabel);\r
-               fprintf(fp, "callRoutine%ld:\n", dwGlobalLabel);\r
-       \r
-               // Save off our registers!\r
-       \r
-               if ((strcmp(pszAddress, "dx") != 0) && (strcmp(pszAddress, "[_z80de]") != 0) &&\r
-                        (strcmp(pszAddress, "[_z80ix]") != 0) &&\r
-                        (strcmp(pszAddress, "[_orgval]") != 0) &&\r
-                        (strcmp(pszAddress, "[_z80iy]") != 0))\r
-                       fprintf(fp, "           mov     dx, %s  ; Get our address to target\n", pszAddress);\r
-       \r
-               fprintf(fp, "           call    WriteMemoryByte ; Go write the data!\n");\r
-               fprintf(fp, "           jmp     short WriteMacroExit%ld\n", dwGlobalLabel);\r
-       \r
-               fprintf(fp, "memoryWrite%ld:\n", dwGlobalLabel);\r
-       \r
-               if (strcmp(pszValue, "[esi]") == 0)\r
-                       fprintf(fp, "           mov     [ebp + e%s], al ; Store our direct value\n", pszAddress);\r
-               else\r
-               {\r
-                       if (pszValue[0] == 'b' && pszValue[1] == 'y' && pszValue[2] == 't')\r
-                       {\r
-                               fprintf(fp, "           mov     edi, edx\n");\r
-                               assert(strcmp(pszValue, "dl") != 0);\r
-       \r
-                               fprintf(fp, "           mov     dl, %s\n", pszValue);\r
-       \r
-                               if (strcmp(pszAddress, "dx") == 0)\r
-                                       fprintf(fp, "           mov     [ebp + edi], dl\n");\r
-                               else\r
-                                       fprintf(fp, "           mov     [ebp + e%s], dl\n", pszAddress);\r
-       \r
-                               fprintf(fp, "           mov     edx, edi\n");\r
-                       }\r
-                       else\r
-                       {\r
-                               if (strcmp(pszAddress, "[_z80de]") != 0 &&\r
-                                        strcmp(pszAddress, "[_orgval]") != 0 &&\r
-                                        strcmp(pszAddress, "[_z80ix]") != 0 &&\r
-                                        strcmp(pszAddress, "[_z80iy]") != 0)\r
-                                       fprintf(fp, "           mov     [ebp + e%s], %s\n", pszAddress, pszValue);\r
-                               else\r
-                                       fprintf(fp, "           mov     [ebp + edx], al\n");\r
-                       }\r
-               }\r
-\r
-               fprintf(fp, "           mov     ax, [_z80af] ; Get our accumulator and flags\n");\r
-       \r
-               fprintf(fp, "WriteMacroExit%ld:\n", dwGlobalLabel);\r
-               fprintf(fp, "           mov     edi, [cyclesRemaining]\n");\r
-\r
-               ++dwGlobalLabel;\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "                           psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */\n");\r
-               fprintf(fp, "                           while (psMemWrite->lowAddr != 0xffffffff)\n");\r
-               fprintf(fp, "                           {\n");\r
-               fprintf(fp, "                                   if ((%s >= psMemWrite->lowAddr) && (%s <= psMemWrite->highAddr))\n", pszAddress, pszAddress);\r
-               fprintf(fp, "                                   {\n");\r
-               fprintf(fp, "                                           cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;\n");\r
-               fprintf(fp, "                                           if (psMemWrite->memoryCall)\n");\r
-               fprintf(fp, "                                           {\n");\r
-               fprintf(fp, "                                                   psMemWrite->memoryCall(%s, %s, psMemWrite);\n", pszAddress, pszValue);\r
-               fprintf(fp, "                                           }\n");\r
-               fprintf(fp, "                                           else\n");\r
-               fprintf(fp, "                                           {\n");\r
-               fprintf(fp, "                                                   *((UINT8 *) psMemWrite->pUserArea + (%s - psMemWrite->lowAddr)) = %s;\n", pszAddress, pszValue);\r
-               fprintf(fp, "                                           }\n");\r
-               fprintf(fp, "                                           psMemWrite = NULL;\n");\r
-               fprintf(fp, "                                           break;\n");\r
-               fprintf(fp, "                                   }\n");\r
-               fprintf(fp, "                                   ++psMemWrite;\n");\r
-               fprintf(fp, "                           }\n\n");\r
-               fprintf(fp, "                           if (psMemWrite)\n");\r
-               fprintf(fp, "                           {\n");\r
-               fprintf(fp, "                                   cpu.z80Base[%s] = (UINT8) %s;\n", pszAddress, pszValue);\r
-               fprintf(fp, "                           }\n\n");\r
-       }\r
-}\r
-\r
-void WriteWordToMemory(UINT8 *pszAddress, UINT8 *pszTarget)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               fprintf(fp, "           mov     [cyclesRemaining], edi\n");\r
-               fprintf(fp, "           mov     edi, [_z80MemWrite]     ; Point to the write array\n\n", cpubasename);\r
-               fprintf(fp, "checkLoop%ld:\n", dwGlobalLabel);\r
-               fprintf(fp, "           cmp     [edi], word 0ffffh ; End of the list?\n");\r
-               fprintf(fp, "           je              memoryWrite%ld\n", dwGlobalLabel);\r
-               fprintf(fp, "           cmp     %s, [edi]       ; Are we smaller?\n", pszAddress);\r
-               fprintf(fp, "           jb              nextAddr%ld             ; Yes, go to the next address\n", dwGlobalLabel);\r
-               fprintf(fp, "           cmp     %s, [edi+4]     ; Are we bigger?\n", pszAddress);\r
-               fprintf(fp, "           jbe     callRoutine%ld\n\n", dwGlobalLabel);\r
-               fprintf(fp, "nextAddr%ld:\n", dwGlobalLabel);\r
-               fprintf(fp, "           add     edi, 10h                ; Next structure!\n");\r
-               fprintf(fp, "           jmp     short checkLoop%ld\n\n", dwGlobalLabel);\r
-               fprintf(fp, "callRoutine%ld:\n", dwGlobalLabel);\r
-\r
-               fprintf(fp, "           push    ax              ; Save this for later\n");\r
-\r
-               // Write the LSB\r
-\r
-               fprintf(fp, "           push    dx\n");\r
-\r
-               if (strcmp(pszTarget, "ax") != 0)\r
-               {\r
-                       fprintf(fp, "           mov     ax, %s\n", pszTarget);\r
-               }\r
-               else\r
-               {\r
-                       fprintf(fp, "           xchg    ah, al\n");\r
-               }\r
-\r
-               fprintf(fp, "           call    WriteMemoryByte\n");\r
-               fprintf(fp, "           pop     dx\n");\r
-               fprintf(fp, "           pop     ax\n");\r
-               fprintf(fp, "           inc     dx\n\n");\r
-\r
-               fprintf(fp, "           push    ax\n");\r
-               fprintf(fp, "           push    dx\n");\r
-\r
-               if (strcmp(pszTarget, "ax") != 0)\r
-               {\r
-                       fprintf(fp, "           mov     ax, %s\n", pszTarget);\r
-                       fprintf(fp, "           xchg    ah, al\n");\r
-               }\r
-\r
-               fprintf(fp, "           call    WriteMemoryByte\n");\r
-               fprintf(fp, "           pop     dx\n");\r
-               fprintf(fp, "           pop     ax      ; Restore us!\n");\r
-\r
-               fprintf(fp, "           jmp     writeExit%ld\n\n", dwGlobalLabel);\r
-\r
-               fprintf(fp, "memoryWrite%ld:\n", dwGlobalLabel);\r
-\r
-               if (strlen(pszTarget) != 2)\r
-               {\r
-                       fprintf(fp, "           mov     di, %s\n", pszTarget);\r
-                       fprintf(fp, "           mov     [ebp + e%s], di ; Store our word\n", pszAddress);\r
-               }\r
-               else\r
-               {\r
-                       if (strcmp(pszTarget, "ax") != 0)\r
-                       {\r
-                               fprintf(fp, "           mov     [ebp + e%s], %s ; Store our word\n", pszAddress, pszTarget);\r
-                       }\r
-                       else\r
-                       {\r
-                               fprintf(fp, "           xchg    ah, al  ; Swap for later\n");\r
-                               fprintf(fp, "           mov     [ebp + e%s], %s ; Store our word\n", pszAddress, pszTarget);\r
-                               fprintf(fp, "           xchg    ah, al  ; Restore\n");\r
-                       }\r
-               }\r
-       \r
-               fprintf(fp, "writeExit%ld:\n", dwGlobalLabel);\r
-               fprintf(fp, "           mov     edi, [cyclesRemaining]\n");\r
-       \r
-               dwGlobalLabel++;\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "                           psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */\n");\r
-               fprintf(fp, "                           while (psMemWrite->lowAddr != 0xffffffff)\n");\r
-               fprintf(fp, "                           {\n");\r
-               fprintf(fp, "                                   if ((%s >= psMemWrite->lowAddr) && (%s <= psMemWrite->highAddr))\n", pszAddress, pszAddress);\r
-               fprintf(fp, "                                   {\n");\r
-               fprintf(fp, "                                           cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;\n");\r
-\r
-               fprintf(fp, "                                           if (psMemWrite->memoryCall)\n");\r
-               fprintf(fp, "                                           {\n");\r
-               fprintf(fp, "                                                   psMemWrite->memoryCall(%s, (%s & 0xff), psMemWrite);\n", pszAddress, pszTarget);\r
-               fprintf(fp, "                                                   psMemWrite->memoryCall(%s + 1, (%s >> 8), psMemWrite);\n", pszAddress, pszTarget);\r
-               fprintf(fp, "                                           }\n");\r
-               fprintf(fp, "                                           else\n");\r
-               fprintf(fp, "                                           {\n");\r
-               fprintf(fp, "                                                   *((UINT8 *) psMemWrite->pUserArea + (%s - psMemWrite->lowAddr)) = %s;\n", pszAddress, pszTarget);\r
-               fprintf(fp, "                                                   *((UINT8 *) psMemWrite->pUserArea + (%s - psMemWrite->lowAddr) + 1) = %s >> 8;\n", pszAddress, pszTarget);\r
-               fprintf(fp, "                                           }\n");\r
-\r
-               fprintf(fp, "                                           psMemWrite = NULL;\n");\r
-               fprintf(fp, "                                           break;\n");\r
-               fprintf(fp, "                                   }\n");\r
-               fprintf(fp, "                                   ++psMemWrite;\n");\r
-               fprintf(fp, "                           }\n\n");\r
-               fprintf(fp, "                           if (psMemWrite)\n");\r
-               fprintf(fp, "                           {\n");\r
-               fprintf(fp, "                                   cpu.z80Base[%s] = (UINT8) %s;\n", pszAddress, pszTarget);\r
-               fprintf(fp, "                                   cpu.z80Base[%s + 1] = (UINT8) ((UINT32) %s >> 8);\n", pszAddress, pszTarget);\r
-               fprintf(fp, "                           }\n\n");\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-void WriteValueToIo(UINT8 *pszIoAddress, UINT8 *pszValue)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               fprintf(fp, "           mov     [cyclesRemaining], edi\n");\r
-               fprintf(fp, "           mov     [_z80af], ax    ; Store AF\n");\r
-\r
-               if (strcmp(pszValue, "al") != 0)\r
-                       fprintf(fp, "           mov     al, %s  ; And our data to write\n", pszValue);\r
-               if (strcmp(pszValue, "[esi]") == 0)     // Immediate value?\r
-                       fprintf(fp, "           inc     esi     ; Increment our program counter\n");\r
-\r
-               fprintf(fp, "           mov     edi, [_z80IoWrite]      ; Point to the I/O write array\n\n", cpubasename);\r
-               fprintf(fp, "checkLoop%ld:\n", dwGlobalLabel);\r
-               fprintf(fp, "           cmp     [edi], word 0ffffh ; End of our list?\n");\r
-               fprintf(fp, "           je      WriteMacroExit%ld       ; Yes - ignore it!\n", dwGlobalLabel);\r
-               fprintf(fp, "           cmp     %s, [edi]       ; Are we smaller?\n", pszIoAddress);\r
-               fprintf(fp, "           jb      nextAddr%ld     ; Yes... go to the next addr\n", dwGlobalLabel);\r
-               fprintf(fp, "           cmp     %s, [edi+2]     ; Are we bigger?\n", pszIoAddress);\r
-               fprintf(fp, "           jbe     callRoutine%ld  ; If not, go call it!\n\n", dwGlobalLabel);\r
-               fprintf(fp, "nextAddr%ld:\n", dwGlobalLabel);\r
-               fprintf(fp, "           add     edi, 0ch                ; Next structure, please\n");\r
-               fprintf(fp, "           jmp     short checkLoop%ld\n\n", dwGlobalLabel);\r
-               fprintf(fp, "callRoutine%ld:\n", dwGlobalLabel);\r
-\r
-               // Save off our registers!\r
-\r
-               if (strcmp(pszIoAddress, "dx") != 0)\r
-                       fprintf(fp, "           mov     dx, %s  ; Get our address to target\n", pszIoAddress);\r
-\r
-               fprintf(fp, "           call    WriteIOByte     ; Go write the data!\n");\r
-       \r
-               fprintf(fp, "WriteMacroExit%ld:\n", dwGlobalLabel);\r
-               fprintf(fp, "           mov     edi, [cyclesRemaining]\n");\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "                           psIoWrite = cpu.z80IoWrite;     /* Beginning of our handler */\n");\r
-               fprintf(fp, "                           while (psIoWrite->lowIoAddr != 0xffff)\n");\r
-               fprintf(fp, "                           {\n");\r
-               fprintf(fp, "                                   if ((%s >= psIoWrite->lowIoAddr) && (%s <= psIoWrite->highIoAddr))\n", pszIoAddress, pszIoAddress);\r
-               fprintf(fp, "                                   {\n");\r
-               fprintf(fp, "                                           cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;\n");\r
-               fprintf(fp, "                                           psIoWrite->IOCall(%s, %s, psIoWrite);\n", pszIoAddress, pszValue);\r
-               fprintf(fp, "                                           psIoWrite = NULL;\n");\r
-               fprintf(fp, "                                           break;\n");\r
-               fprintf(fp, "                                   }\n");\r
-               fprintf(fp, "                                   ++psIoWrite;\n");\r
-               fprintf(fp, "                           }\n\n");\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }       \r
-       \r
-       ++dwGlobalLabel;\r
-}\r
-\r
-void ReadValueFromMemory(UINT8 *pszAddress, UINT8 *pszTarget)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               fprintf(fp, "           mov     [cyclesRemaining], edi\n");\r
-               fprintf(fp, "           mov     edi, [_z80MemRead]      ; Point to the read array\n\n", cpubasename);\r
-               fprintf(fp, "checkLoop%ld:\n", dwGlobalLabel);\r
-               fprintf(fp, "           cmp     [edi], word 0ffffh ; End of the list?\n");\r
-               fprintf(fp, "           je              memoryRead%ld\n", dwGlobalLabel);\r
-               fprintf(fp, "           cmp     e%s, [edi]      ; Are we smaller?\n", pszAddress);\r
-               fprintf(fp, "           jb              nextAddr%ld             ; Yes, go to the next address\n", dwGlobalLabel);\r
-               fprintf(fp, "           cmp     e%s, [edi+4]    ; Are we bigger?\n", pszAddress);\r
-               fprintf(fp, "           jbe     callRoutine%ld\n\n", dwGlobalLabel);\r
-               fprintf(fp, "nextAddr%ld:\n", dwGlobalLabel);\r
-               fprintf(fp, "           add     edi, 10h                ; Next structure!\n");\r
-               fprintf(fp, "           jmp     short checkLoop%ld\n\n", dwGlobalLabel);\r
-               fprintf(fp, "callRoutine%ld:\n", dwGlobalLabel);\r
-\r
-               if (strcmp(pszAddress, "dx") != 0)\r
-                       fprintf(fp, "           mov     dx, %s  ; Get our address\n", pszAddress);\r
-       \r
-               fprintf(fp, "           call    ReadMemoryByte  ; Standard read routine\n");\r
-       \r
-               // Yes, these are intentionally reversed!\r
-       \r
-               if (strcmp(pszTarget, "al") == 0)\r
-                       fprintf(fp, "           mov     [_z80af], al    ; Save our new accumulator\n");\r
-               else\r
-               if (strcmp(pszTarget, "ah") == 0)\r
-                       fprintf(fp, "           mov     [_z80af + 1], al        ; Save our new flags\n");\r
-               else\r
-                       fprintf(fp, "           mov     %s, al  ; Put our returned value here\n", pszTarget);\r
-       \r
-               // And are properly restored HERE:\r
-       \r
-               fprintf(fp, "           mov     ax, [_z80af]    ; Get our AF back\n");\r
-       \r
-               // Restore registers here...\r
-       \r
-               fprintf(fp, "           jmp     short readExit%ld\n\n", dwGlobalLabel);\r
-               fprintf(fp, "memoryRead%ld:\n", dwGlobalLabel);\r
-       \r
-               if (pszTarget[0] == 'b' && pszTarget[1] == 'y' && pszTarget[2] == 't')\r
-               {\r
-                       fprintf(fp, "           mov     di, dx\n");\r
-                       fprintf(fp, "           mov     dl, [ebp + e%s]\n", pszAddress);\r
-                       fprintf(fp, "           mov     %s, dl\n", pszTarget);\r
-                       fprintf(fp, "           mov     dx, di\n");\r
-               }\r
-               else\r
-                       fprintf(fp, "           mov     %s, [ebp + e%s] ; Get our data\n\n", pszTarget, pszAddress);\r
-       \r
-               fprintf(fp, "readExit%ld:\n", dwGlobalLabel);\r
-               fprintf(fp, "           mov     edi, [cyclesRemaining]\n");\r
-       \r
-               dwGlobalLabel++;\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "                           psMemRead = cpu.z80MemRead;     /* Beginning of our handler */\n");\r
-               fprintf(fp, "                           while (psMemRead->lowAddr != 0xffffffff)\n");\r
-               fprintf(fp, "                           {\n");\r
-               fprintf(fp, "                                   if ((%s >= psMemRead->lowAddr) && (%s <= psMemRead->highAddr))\n", pszAddress, pszAddress);\r
-               fprintf(fp, "                                   {\n");\r
-               fprintf(fp, "                                           cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;\n");\r
-               fprintf(fp, "                                           if (psMemRead->memoryCall)\n");\r
-               fprintf(fp, "                                           {\n");\r
-               fprintf(fp, "                                                   %s = psMemRead->memoryCall(%s, psMemRead);\n", pszTarget, pszAddress);\r
-               fprintf(fp, "                                           }\n");\r
-               fprintf(fp, "                                           else\n");\r
-               fprintf(fp, "                                           {\n");\r
-               fprintf(fp, "                                                   %s = *((UINT8 *) psMemRead->pUserArea + (%s - psMemRead->lowAddr));\n", pszTarget, pszAddress);\r
-               fprintf(fp, "                                           }\n");\r
-               fprintf(fp, "                                           psMemRead = NULL;\n");\r
-               fprintf(fp, "                                           break;\n");\r
-               fprintf(fp, "                                   }\n");\r
-               fprintf(fp, "                                   ++psMemRead;\n");\r
-               fprintf(fp, "                           }\n\n");\r
-               fprintf(fp, "                           if (psMemRead)\n");\r
-               fprintf(fp, "                           {\n");\r
-               fprintf(fp, "                                   %s = cpu.z80Base[%s];\n", pszTarget, pszAddress);\r
-               fprintf(fp, "                           }\n\n");\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-\r
-void ReadWordFromMemory(UINT8 *pszAddress, UINT8 *pszTarget)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               fprintf(fp, "           mov     [cyclesRemaining], edi\n");\r
-               fprintf(fp, "           mov     edi, [_z80MemRead]      ; Point to the read array\n\n", cpubasename);\r
-               fprintf(fp, "checkLoop%ld:\n", dwGlobalLabel);\r
-               fprintf(fp, "           cmp     [edi], word 0ffffh ; End of the list?\n");\r
-               fprintf(fp, "           je              memoryRead%ld\n", dwGlobalLabel);\r
-               fprintf(fp, "           cmp     %s, [edi]       ; Are we smaller?\n", pszAddress);\r
-               fprintf(fp, "           jb              nextAddr%ld             ; Yes, go to the next address\n", dwGlobalLabel);\r
-               fprintf(fp, "           cmp     %s, [edi+4]     ; Are we bigger?\n", pszAddress);\r
-               fprintf(fp, "           jbe     callRoutine%ld\n\n", dwGlobalLabel);\r
-               fprintf(fp, "nextAddr%ld:\n", dwGlobalLabel);\r
-               fprintf(fp, "           add     edi, 10h                ; Next structure!\n");\r
-               fprintf(fp, "           jmp     short checkLoop%ld\n\n", dwGlobalLabel);\r
-               fprintf(fp, "callRoutine%ld:\n", dwGlobalLabel);\r
-\r
-               if (strcmp(pszAddress, "dx") != 0)\r
-                       fprintf(fp, "           mov     dx, %s  ; Get our address\n", pszAddress);\r
-\r
-               if (strcmp(pszTarget, "ax") != 0)\r
-                       fprintf(fp, "           push    ax              ; Save this for later\n");\r
-\r
-               fprintf(fp, "           push    dx              ; Save address\n");\r
-               fprintf(fp, "           call    ReadMemoryByte  ; Standard read routine\n");\r
-               fprintf(fp, "           pop     dx              ; Restore our address\n");\r
-\r
-               fprintf(fp, "           inc     dx              ; Next byte, please\n");\r
-\r
-               fprintf(fp, "           push    ax              ; Save returned byte\n");\r
-               fprintf(fp, "           call    ReadMemoryByte  ; Standard read routine\n");\r
-               fprintf(fp, "           xchg    ah, al  ; Swap for endian's sake\n");\r
-               fprintf(fp, "           pop     dx      ; Restore LSB\n");\r
-\r
-               fprintf(fp, "           mov     dh, ah  ; Our word is now in DX\n");\r
-\r
-               // DX Now has our data and our address is toast\r
-       \r
-               if (strcmp(pszTarget, "ax") != 0)\r
-               {\r
-                       fprintf(fp, "           pop     ax              ; Restore this\n");\r
-       \r
-                       if (strcmp(pszTarget, "dx") != 0)\r
-                       {\r
-                               fprintf(fp, "           mov     %s, dx  ; Store our word\n", pszTarget);\r
-                       }\r
-               }\r
-               else\r
-                       fprintf(fp, "           mov     ax, dx\n");\r
-\r
-               if (strcmp(pszTarget, "ax") == 0)\r
-               {\r
-                       fprintf(fp, "           xchg    ah, al\n");\r
-               }\r
-       \r
-               fprintf(fp, "           jmp     readExit%ld\n\n", dwGlobalLabel);\r
-       \r
-               fprintf(fp, "memoryRead%ld:\n", dwGlobalLabel);\r
-       \r
-               if (strlen(pszTarget) == 2)\r
-               {\r
-                       fprintf(fp, "           mov     %s, [ebp + e%s]\n", pszTarget, pszAddress);\r
-                       if (strcmp(pszTarget, "ax") == 0)\r
-                       {\r
-                               fprintf(fp, "           xchg    ah, al\n");\r
-                       }\r
-               }\r
-               else\r
-               {\r
-                       fprintf(fp, "           mov     dx, [ebp + e%s]\n", pszAddress);\r
-                       fprintf(fp, "           mov     %s, dx\n", pszTarget);\r
-               }\r
-       \r
-               fprintf(fp, "readExit%ld:\n", dwGlobalLabel);\r
-               fprintf(fp, "           mov     edi, [cyclesRemaining]\n");\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "                           psMemRead = cpu.z80MemRead;     /* Beginning of our handler */\n");\r
-               fprintf(fp, "                           while (psMemRead->lowAddr != 0xffffffff)\n");\r
-               fprintf(fp, "                           {\n");\r
-               fprintf(fp, "                                   if ((%s >= psMemRead->lowAddr) && (%s <= psMemRead->highAddr))\n", pszAddress, pszAddress);\r
-               fprintf(fp, "                                   {\n");\r
-               fprintf(fp, "                                           cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;\n");\r
-               fprintf(fp, "                                           if (psMemRead->memoryCall)\n");\r
-               fprintf(fp, "                                           {\n");\r
-               fprintf(fp, "                                                   %s = psMemRead->memoryCall(%s, psMemRead);\n", pszTarget, pszAddress);\r
-               fprintf(fp, "                                                   %s |= (UINT32) ((UINT32) psMemRead->memoryCall(%s + 1, psMemRead) << 8);\n", pszTarget, pszAddress);\r
-               fprintf(fp, "                                           }\n");\r
-               fprintf(fp, "                                           else\n");\r
-               fprintf(fp, "                                           {\n");\r
-               fprintf(fp, "                                                   %s = *((UINT8 *) psMemRead->pUserArea + (%s - psMemRead->lowAddr));\n", pszTarget, pszAddress);\r
-               fprintf(fp, "                                                   %s |= (UINT32) ((UINT32) *((UINT8 *) psMemRead->pUserArea + (%s - psMemRead->lowAddr + 1)) << 8);\n", pszTarget, pszAddress);\r
-               fprintf(fp, "                                           }\n");\r
-               fprintf(fp, "                                           psMemRead = NULL;\n");\r
-               fprintf(fp, "                                           break;\n");\r
-               fprintf(fp, "                                   }\n");\r
-               fprintf(fp, "                                   ++psMemRead;\n");\r
-               fprintf(fp, "                           }\n\n");\r
-               fprintf(fp, "                           if (psMemRead)\n");\r
-               fprintf(fp, "                           {\n");\r
-               fprintf(fp, "                                   %s = cpu.z80Base[%s];\n", pszTarget, pszAddress);\r
-               fprintf(fp, "                                   %s |= (UINT32) ((UINT32) cpu.z80Base[%s + 1] << 8);\n", pszTarget, pszAddress);\r
-               fprintf(fp, "                           }\n\n");\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-\r
-       dwGlobalLabel++;\r
-}\r
-\r
-\r
-void ReadValueFromIo(UINT8 *pszIoAddress, UINT8 *pszTarget)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               fprintf(fp, "           mov     [cyclesRemaining], edi\n");\r
-               fprintf(fp, "           mov     edi, [_z80IoRead]       ; Point to the read array\n\n", cpubasename);\r
-               fprintf(fp, "checkLoop%ld:\n", dwGlobalLabel);\r
-               fprintf(fp, "           cmp     [edi], word 0ffffh ; End of the list?\n");\r
-               fprintf(fp, "           je              ioRead%ld\n", dwGlobalLabel);\r
-               fprintf(fp, "           cmp     %s, [edi]       ; Are we smaller?\n", pszIoAddress);\r
-               fprintf(fp, "           jb              nextAddr%ld             ; Yes, go to the next address\n", dwGlobalLabel);\r
-               fprintf(fp, "           cmp     %s, [edi+2]     ; Are we bigger?\n", pszIoAddress);\r
-               fprintf(fp, "           jbe     callRoutine%ld\n\n", dwGlobalLabel);\r
-               fprintf(fp, "nextAddr%ld:\n", dwGlobalLabel);\r
-               fprintf(fp, "           add     edi, 0ch                ; Next structure!\n");\r
-               fprintf(fp, "           jmp     short checkLoop%ld\n\n", dwGlobalLabel);\r
-               fprintf(fp, "callRoutine%ld:\n", dwGlobalLabel);\r
-\r
-               if (strcmp(pszIoAddress, "dx") != 0)\r
-                       fprintf(fp, "           mov     dx, %s  ; Get our address\n", pszIoAddress);\r
-\r
-               fprintf(fp, "           call    ReadIOByte      ; Standard read routine\n");\r
-\r
-               // Yes, these are intentionally reversed!\r
-       \r
-               if (strcmp(pszTarget, "al") == 0)\r
-                       fprintf(fp, "           mov     [_z80af], al    ; Save our new accumulator\n");\r
-               else\r
-               if (strcmp(pszTarget, "ah") == 0)\r
-                       fprintf(fp, "           mov     [_z80af + 1], ah        ; Save our new flags\n");\r
-               else\r
-               if (strcmp(pszTarget, "dl") == 0)\r
-                       fprintf(fp, "           mov     [_z80de], al    ; Put it in E\n");\r
-               else\r
-               if (strcmp(pszTarget, "dh") == 0)\r
-                       fprintf(fp, "           mov     [_z80de + 1], al ; Put it in D\n");\r
-               else\r
-               if (strcmp(pszTarget, "*dl") == 0)\r
-                       fprintf(fp, "           mov     dl, al  ; Put it in DL for later consumption\n");\r
-               else\r
-                       fprintf(fp, "           mov     %s, al  ; Put our returned value here\n", pszTarget);\r
-\r
-               // And are properly restored HERE:\r
-\r
-               fprintf(fp, "           mov     ax, [_z80af]    ; Get our AF back\n");\r
-\r
-               // Restore registers here...\r
-\r
-               fprintf(fp, "           jmp     short readExit%ld\n\n", dwGlobalLabel);\r
-               fprintf(fp, "ioRead%ld:\n", dwGlobalLabel);\r
-       \r
-               if (strcmp(pszTarget, "*dl") == 0)\r
-                       fprintf(fp, "           mov     dl, 0ffh        ; An unreferenced read\n");\r
-               else\r
-                       fprintf(fp, "           mov     %s, 0ffh        ; An unreferenced read\n", pszTarget);\r
-               fprintf(fp, "readExit%ld:\n", dwGlobalLabel);\r
-               fprintf(fp, "           mov     edi, [cyclesRemaining]\n");\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "                           psIoRead = cpu.z80IoRead;       /* Beginning of our handler */\n");\r
-               fprintf(fp, "                           while (psIoRead->lowIoAddr != 0xffff)\n");\r
-               fprintf(fp, "                           {\n");\r
-               fprintf(fp, "                                   if ((%s >= psIoRead->lowIoAddr) && (%s <= psIoRead->highIoAddr))\n", pszIoAddress, pszIoAddress);\r
-               fprintf(fp, "                                   {\n");\r
-               fprintf(fp, "                                           cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;\n");\r
-               fprintf(fp, "                                           %s = psIoRead->IOCall(%s, psIoRead);\n", pszTarget, pszIoAddress);\r
-               fprintf(fp, "                                           psIoRead = NULL;\n");\r
-               fprintf(fp, "                                           break;\n");\r
-               fprintf(fp, "                                   }\n");\r
-               fprintf(fp, "                                   ++psIoRead;\n");\r
-               fprintf(fp, "                           }\n\n");\r
-               fprintf(fp, "                           if (psIoRead)\n");\r
-               fprintf(fp, "                           {\n");\r
-               fprintf(fp, "                                   %s = 0xff; /* Unclaimed I/O read */\n", pszTarget);\r
-               fprintf(fp, "                           }\n\n");\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-\r
-       dwGlobalLabel++;\r
-}\r
-\r
-// Basic instruction set area\r
-\r
-void MiscHandler(UINT32 dwOpcode)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               if (dwOpcode == 0xe3)\r
-               {\r
-                       if (bThroughCallHandler)\r
-                       {\r
-                               fprintf(fp, "           call    PopWord\n");\r
-                               fprintf(fp, "           xchg    bx, [_wordval]\n");\r
-                               fprintf(fp, "           call    PushWord\n");\r
-                       }\r
-                       else\r
-                       {\r
-                               fprintf(fp, "           mov     dx, word [_z80sp]\n");\r
-                               fprintf(fp, "           xchg    bx, [ebp+edx]\n");\r
-                               fprintf(fp, "           xor     edx, edx\n");\r
-                       }\r
-               }\r
-\r
-               if (dwOpcode == 0x2a)\r
-               {\r
-                       fprintf(fp, "           mov     dx, [esi]       ; Get address to load\n");\r
-                       fprintf(fp, "           add     esi, 2  ; Skip over it so we don't execute it\n");\r
-\r
-                       ReadWordFromMemory("dx", "bx");\r
-                       fprintf(fp, "           xor     edx, edx\n");\r
-               }\r
-\r
-               if (dwOpcode == 0xfb)\r
-               {\r
-                       fprintf(fp, "           or              dword [_z80iff], IFF1   ; Indicate interrupts are enabled now\n");\r
-                       fprintf(fp, "           sub     edi, 4  ; Takes 4 cycles!\n");\r
-                       fprintf(fp, "           mov     [dwEITiming], edi       ; Snapshot our current timing\n");\r
-                       fprintf(fp, "           mov     [bEIExit], byte 1       ; Indicate we're exiting because of an EI\n");\r
-                       fprintf(fp, "           xor     edi, edi        ; Force next instruction to exit\n");\r
-                       fprintf(fp, "           mov     dl, byte [esi]  ; Get our next instruction\n");\r
-                       fprintf(fp, "           inc     esi     ; Next PC\n");\r
-                       fprintf(fp, "           jmp     dword [z80regular+edx*4]\n\n");\r
-               }\r
-\r
-               if (dwOpcode == 0xf9)\r
-                       fprintf(fp, "           mov     word [_z80sp], bx\n");\r
-\r
-               if (dwOpcode == 0xd9)\r
-               {\r
-                       fprintf(fp, "           mov     [cyclesRemaining], edi\n");\r
-                       fprintf(fp, "           mov     di, [_z80de]\n");\r
-                       fprintf(fp, "           xchg    cx, [_z80bcprime]\n");\r
-                       fprintf(fp, "           xchg    di, [_z80deprime]\n");\r
-                       fprintf(fp, "           xchg    bx, [_z80hlprime]\n");\r
-                       fprintf(fp, "           mov     [_z80de], di\n");\r
-                       fprintf(fp, "           mov     edi, [cyclesRemaining]\n");\r
-               }\r
-\r
-               if (dwOpcode == 0x76)\r
-               {\r
-                       fprintf(fp, "           mov     dword [_z80halted], 1   ; We've halted the chip!\n");\r
-       \r
-                       if (FALSE == bNoTiming)\r
-                       {\r
-                               fprintf(fp, "           xor     edi, edi\n");\r
-                               fprintf(fp, "           mov     [cyclesRemaining], edi\n");\r
-                       }\r
-       \r
-                       fprintf(fp, "           jmp     noMoreExec\n");\r
-                       return;\r
-               }\r
-       \r
-               if (dwOpcode == 0x3f)\r
-               {\r
-                       fprintf(fp, "           mov     dl, ah\n");\r
-                       fprintf(fp, "           and     dl, 01h\n");\r
-                       fprintf(fp, "           shl     dl, 4\n");\r
-                       fprintf(fp, "           xor     ah, 01h\n");\r
-                       fprintf(fp, "           and     ah, 0edh\n");\r
-                       fprintf(fp, "           or      ah, dl\n");\r
-               }\r
-       \r
-               if (dwOpcode == 0x37)\r
-               {\r
-                       fprintf(fp, "           or      ah, 1\n");\r
-                       fprintf(fp, "           and     ah,0edh\n");\r
-               }\r
-       \r
-               if (dwOpcode == 0x27)\r
-               {\r
-                       fprintf(fp, "           mov     dh, ah\n");\r
-                       fprintf(fp, "           and     dh, 02ah\n");\r
-                       fprintf(fp, "           test    ah, 02h ; Were we doing a subtraction?\n");\r
-                       fprintf(fp, "           jnz     handleNeg ; Nope!\n");\r
-                       fprintf(fp, "           sahf\n");\r
-                       fprintf(fp, "           daa\n");\r
-                       fprintf(fp, "           lahf\n");\r
-                       fprintf(fp, "           jmp     short endDaa\n");\r
-                       fprintf(fp, "handleNeg:\n");\r
-                       fprintf(fp, "           sahf\n");\r
-                       fprintf(fp, "           das\n");\r
-                       fprintf(fp, "           lahf\n");\r
-                       fprintf(fp, "endDaa:\n");\r
-                       fprintf(fp, "           and     ah, 0d5h\n");\r
-                       fprintf(fp, "           or      ah, dh\n");\r
-                       fprintf(fp, "           xor     edx, edx\n");\r
-               }\r
-       \r
-               if (dwOpcode == 0x08)\r
-               {\r
-                       fprintf(fp, "           xchg    ah, al\n");\r
-                       fprintf(fp, "           xchg    ax, [_z80afprime]\n");\r
-                       fprintf(fp, "           xchg    ah, al\n");\r
-               }\r
-       \r
-               if (dwOpcode == 0x07)\r
-               {\r
-                       fprintf(fp, "           sahf\n");\r
-                       fprintf(fp, "           rol     al, 1\n");\r
-                       fprintf(fp, "           lahf\n");\r
-                       fprintf(fp, "           and     ah, 0edh\n");\r
-               }\r
-       \r
-               if (dwOpcode == 0x0f)\r
-               {\r
-                       fprintf(fp, "           sahf\n");\r
-                       fprintf(fp, "           ror     al, 1\n");\r
-                       fprintf(fp, "           lahf\n");\r
-                       fprintf(fp, "           and     ah, 0edh\n");\r
-               }\r
-       \r
-               if (dwOpcode == 0xe9)\r
-               {\r
-                       fprintf(fp, "           mov     si, bx\n");\r
-                       fprintf(fp, "           and     esi, 0ffffh\n");\r
-                       fprintf(fp, "           add     esi, ebp\n");\r
-               }\r
-       \r
-               if (dwOpcode == 0xeb)\r
-                       fprintf(fp, "           xchg    [_z80de], bx    ; Exchange DE & HL\n");\r
-       \r
-               if (dwOpcode == 0x2f)\r
-               {\r
-                       fprintf(fp, "           not     al\n");\r
-                       fprintf(fp, "           or      ah, 012h        ; N And H are now on!\n");\r
-               }\r
-       \r
-               if (dwOpcode == 0x10)   // DJNZ\r
-               {\r
-                       fprintf(fp, "           mov     dl, [esi] ; Get our relative offset\n");\r
-                       fprintf(fp, "           inc     esi     ; Next instruction, please!\n");\r
-                       fprintf(fp, "           dec     ch      ; Decrement B\n");\r
-                       fprintf(fp, "           jz      noJump  ; Don't take the jump if it's done!\n");\r
-                       fprintf(fp, "; Otherwise, take the jump\n");\r
-       \r
-                       fprintf(fp, "           sub     edi, 5\n");\r
-       \r
-                       fprintf(fp, "           xchg    eax, edx\n");\r
-                       fprintf(fp, "           cbw\n");\r
-                       fprintf(fp, "           xchg    eax, edx\n");\r
-                       fprintf(fp, "           sub     esi, ebp\n");\r
-                       fprintf(fp, "           add     si, dx\n");\r
-                       fprintf(fp, "           add     esi, ebp\n");\r
-                       fprintf(fp, "noJump:\n");\r
-                       fprintf(fp, "           xor     edx, edx\n");\r
-               }\r
-       \r
-               if (dwOpcode == 0x3a)   // LD A,(xxxx)\r
-               {\r
-                       fprintf(fp, "           mov     dx, [esi]       ; Get our address\n");\r
-                       fprintf(fp, "           add     esi, 2          ; Skip past the address\n");\r
-                       ReadValueFromMemory("dx", "al");\r
-                       fprintf(fp, "           xor     edx, edx        ; Make sure we don't hose things\n");\r
-               }\r
-       \r
-               if (dwOpcode == 0xf3)   // DI\r
-               {\r
-                       fprintf(fp, "           and     dword [_z80iff], (~IFF1)        ; Not in an interrupt\n");\r
-               }\r
-       \r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               if (dwOpcode == 0x76)           // HALT!\r
-               {\r
-                       fprintf(fp, "                           cpu.z80halted = 1;\n");\r
-                       fprintf(fp, "                           dwElapsedTicks += sdwCyclesRemaining;\n");\r
-\r
-                       fprintf(fp, "                           sdwCyclesRemaining = 0;\n");\r
-               }\r
-               else\r
-               if (dwOpcode == 0x2f)           // CPL\r
-               {\r
-                       fprintf(fp, "                           cpu.z80A ^= 0xff;\n");\r
-                       fprintf(fp, "                           cpu.z80F |= (Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY);\n");\r
-               }\r
-               else\r
-               if (dwOpcode == 0xd9)           // EXX\r
-               {\r
-                       fprintf(fp, "                           dwTemp = cpu.z80DE;\n");\r
-                       fprintf(fp, "                           cpu.z80DE = cpu.z80deprime;\n");\r
-                       fprintf(fp, "                           cpu.z80deprime = dwTemp;\n");\r
-\r
-                       fprintf(fp, "                           dwTemp = cpu.z80BC;\n");\r
-                       fprintf(fp, "                           cpu.z80BC = cpu.z80bcprime;\n");\r
-                       fprintf(fp, "                           cpu.z80bcprime = dwTemp;\n");\r
-\r
-                       fprintf(fp, "                           dwTemp = cpu.z80HL;\n");\r
-                       fprintf(fp, "                           cpu.z80HL = cpu.z80hlprime;\n");\r
-                       fprintf(fp, "                           cpu.z80hlprime = dwTemp;\n");\r
-               }\r
-               else\r
-               if (dwOpcode == 0xf9)           // LD SP, HL\r
-               {\r
-                       fprintf(fp, "                           cpu.z80sp = cpu.z80HL;\n");\r
-               }\r
-               else\r
-               if (dwOpcode == 0x27)           // DAA\r
-               {\r
-                       fprintf(fp, "                           dwAddr = (((cpu.z80F & Z80_FLAG_CARRY) | \n");\r
-                       fprintf(fp, "                                           ((cpu.z80F & Z80_FLAG_HALF_CARRY) >> 3) | \n");\r
-                       fprintf(fp, "                                           ((cpu.z80F & Z80_FLAG_NEGATIVE) << 1)) << 8) | cpu.z80A;\n");\r
-                       fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);\n");\r
-                       fprintf(fp, "                           cpu.z80F |= (wDAATable[dwAddr] >> 8);\n");\r
-                       fprintf(fp, "                           cpu.z80A = wDAATable[dwAddr] & 0xff;\n");\r
-               }\r
-               else\r
-               if (dwOpcode == 0x2a)\r
-               {\r
-                       fprintf(fp, "                           dwAddr = *pbPC++;\n");\r
-                       fprintf(fp, "                           dwAddr |= ((UINT32) *pbPC++ << 8);\n");\r
-                       ReadWordFromMemory("dwAddr", "cpu.z80HL");\r
-               }\r
-               else\r
-               if (dwOpcode == 0xe3)           // EX (SP), HL\r
-               {\r
-                       ReadWordFromMemory("cpu.z80sp", "dwAddr");\r
-                       WriteWordToMemory("cpu.z80sp", "cpu.z80HL");\r
-                       fprintf(fp, "                           cpu.z80HL = dwAddr;\n");\r
-               }\r
-               else\r
-               if (dwOpcode == 0xe9)           // JP (HL)\r
-               {\r
-                       fprintf(fp, "                           pbPC = cpu.z80Base + cpu.z80HL;\n");\r
-               }\r
-               else\r
-               if (0x08 == dwOpcode)           // EX AF, AF'\r
-               {\r
-                       fprintf(fp, "                           dwAddr = (UINT32) cpu.z80AF;\n");\r
-                       fprintf(fp, "                           cpu.z80AF = cpu.z80afprime;\n");\r
-                       fprintf(fp, "                           cpu.z80afprime = dwAddr;\n");\r
-               }\r
-               else\r
-               if (0xeb == dwOpcode)           // EX DE, HL\r
-               {\r
-                       fprintf(fp, "                           dwAddr = cpu.z80DE;\n");\r
-                       fprintf(fp, "                           cpu.z80DE = cpu.z80HL;\n");\r
-                       fprintf(fp, "                           cpu.z80HL = dwAddr;\n");\r
-               }\r
-               else\r
-               if (0x10 == dwOpcode)           // DJNZ\r
-               {\r
-                       fprintf(fp, "                           sdwAddr = (INT8) *pbPC++;       /* Get LSB first */\n");\r
-                       fprintf(fp, "                           if (--cpu.z80B)\n");\r
-                       fprintf(fp, "                           {\n");\r
-                       fprintf(fp, "                                   dwElapsedTicks += 5;    /* 5 More for jump taken */\n");\r
-                       fprintf(fp, "                                   cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;\n");\r
-                       fprintf(fp, "                                   sdwAddr = (sdwAddr + (INT32) cpu.z80pc) & 0xffff;\n");\r
-                       fprintf(fp, "                                   pbPC = cpu.z80Base + sdwAddr;   /* Normalize the address */\n");\r
-                       fprintf(fp, "                           }\n");\r
-               }\r
-               else\r
-               if (0x37 == dwOpcode)   // SCF\r
-               {\r
-                       fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE);\n");\r
-                       fprintf(fp, "                           cpu.z80F |= Z80_FLAG_CARRY;\n");\r
-               }\r
-               else\r
-               if (0x3f == dwOpcode)   // CCF\r
-               {\r
-                       fprintf(fp, "                           bTemp = (cpu.z80F & Z80_FLAG_CARRY) << 4;\n");\r
-                       fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE);\n");\r
-                       fprintf(fp, "                           cpu.z80F ^= Z80_FLAG_CARRY;\n");\r
-               }\r
-               else\r
-               if (0x07 == dwOpcode)   // RLCA\r
-               {\r
-                       fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY);\n");\r
-                       fprintf(fp, "                           cpu.z80F |= (cpu.z80A >> 7);\n");\r
-                       fprintf(fp, "                           cpu.z80A = (cpu.z80A << 1) | (cpu.z80A >> 7);\n");\r
-               }\r
-               else\r
-               if (0x0f == dwOpcode)   // RRCA\r
-               {\r
-                       fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY);\n");\r
-                       fprintf(fp, "                           cpu.z80F |= (cpu.z80A & Z80_FLAG_CARRY);\n");\r
-                       fprintf(fp, "                           cpu.z80A = (cpu.z80A >> 1) | (cpu.z80A << 7);\n");\r
-               }\r
-               else\r
-               if (0x3a == dwOpcode)   // LD A, (xxxxh)\r
-               {\r
-                       fprintf(fp, "                           dwTemp = *pbPC++;\n");\r
-                       fprintf(fp, "                           dwTemp |= (((UINT32) *pbPC++) << 8);\n");\r
-                       ReadValueFromMemory("dwTemp", "cpu.z80A");\r
-               }\r
-               else\r
-               if (0xf3 == dwOpcode)   // DI\r
-               {\r
-                       fprintf(fp, "                           cpu.z80iff &= (~IFF1);\n");\r
-               }\r
-               else\r
-               if (0xfb == dwOpcode)   // EI\r
-               {\r
-                       fprintf(fp, "                           cpu.z80iff |= IFF1;\n");\r
-               }\r
-               else\r
-               if (0x00 == dwOpcode)   // NOP\r
-               {\r
-                       fprintf(fp, "                           /* Intentionally not doing anything - NOP! */\n");\r
-               }\r
-               else\r
-               {\r
-                       InvalidInstructionC(1);\r
-               }\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-       \r
-}\r
-\r
-void LdRegPairImmediate(UINT32 dwOpcode)\r
-{\r
-       UINT8 bOp = 0;\r
-\r
-       bOp = (dwOpcode >> 4) & 0x3;\r
-\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               if (bOp == 0)\r
-                       fprintf(fp, "           mov     cx, [esi]       ; Get our immediate value of BC\n");\r
-               else\r
-               if (bOp == 2)\r
-                       fprintf(fp, "           mov     bx, [esi]       ; Get our immediate value of HL\n");\r
-               else\r
-               if (bOp == 1)\r
-               {\r
-                       fprintf(fp, "           mov     dx, [esi]       ; Get our immediate value of DE\n");\r
-                       fprintf(fp, "           mov     word [_z80de], dx ; Store DE\n");\r
-                       fprintf(fp, "           xor     edx, edx\n");\r
-               }\r
-               else\r
-               if (bOp == 3)\r
-               {\r
-                       fprintf(fp, "           mov     dx, [esi]       ; Get our immediate value of SP\n");\r
-                       fprintf(fp, "           mov     word [_z80sp], dx       ; Store it!\n");\r
-                       fprintf(fp, "           xor     edx, edx\n");\r
-               }\r
-       \r
-               fprintf(fp, "           add     esi, 2\n");\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "                           %s = *pbPC++;   /* LSB First */\n", pbRegPairC[bOp]);\r
-               fprintf(fp, "                           %s |= (((UINT32) *pbPC++ << 8));        /* Now the MSB */\n", pbRegPairC[bOp]);\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-void LdRegpairPtrByte(UINT32 dwOpcode)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               if (dwOpcode == 0x36)   // Immediate into (HL)\r
-                       WriteValueToMemory("bx", "[esi]");\r
-\r
-               if (dwOpcode == 0x12)\r
-                       WriteValueToMemory("[_z80de]", "al");   // (DE), A\r
-\r
-               if (dwOpcode == 0x2)            // (BC), A\r
-                       WriteValueToMemory("cx", "al");\r
-\r
-               if (dwOpcode >= 0x70 && dwOpcode < 0x78)\r
-                       WriteValueToMemory("bx", pbMathReg[dwOpcode & 0x07]);\r
-\r
-               fprintf(fp, "           xor     edx, edx\n");\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               if (dwOpcode == 0x36)\r
-                       WriteValueToMemory("cpu.z80HL", "*pbPC++");\r
-\r
-               if (dwOpcode == 0x12)\r
-                       WriteValueToMemory("cpu.z80DE", "cpu.z80A");\r
-\r
-               if (dwOpcode == 0x02)\r
-                       WriteValueToMemory("cpu.z80BC", "cpu.z80A");\r
-\r
-               if (dwOpcode >= 0x70 && dwOpcode < 0x78)\r
-                       WriteValueToMemory("cpu.z80HL", pbMathRegC[dwOpcode & 0x07]);\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-void MathOperation(UINT32 dwOrgOpcode)\r
-{\r
-       UINT8 bRegister;\r
-       UINT32 dwOpcode;\r
-       UINT8 tempstr[150];\r
-\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOrgOpcode);\r
-\r
-               dwOpcode = dwOrgOpcode;\r
-               bRegister = dwOpcode & 0x07;\r
-               dwOpcode &= 0xf8;\r
-\r
-               if (dwOpcode == 0x80)\r
-                       strcpy(tempstr, "add");\r
-               if (dwOpcode == 0x88)\r
-                       strcpy(tempstr, "adc");\r
-               if (dwOpcode == 0x90)\r
-                       strcpy(tempstr, "sub");\r
-               if (dwOpcode == 0x98)\r
-                       strcpy(tempstr, "sbb");\r
-               if (dwOpcode == 0xa0)\r
-                       strcpy(tempstr, "and");\r
-               if (dwOpcode == 0xa8)\r
-                       strcpy(tempstr, "xor");\r
-               if (dwOpcode == 0xb0)\r
-                       strcpy(tempstr, "or");\r
-               if (dwOpcode == 0xb8)\r
-                       strcpy(tempstr, "cmp");\r
-       \r
-               // Let's see if we have to deal with (HL) or #xxh\r
-       \r
-               if (bRegister == 0x6)\r
-               {\r
-                       // We have to deal with (HL)\r
-       \r
-                       ReadValueFromMemory("bx", "dl");\r
-               }\r
-       \r
-               if (bRegister != 0x06 && bRegister < 0xff)\r
-               {\r
-                       fprintf(fp, "           sahf\n");\r
-                       fprintf(fp, "           %s      al, %s\n", tempstr, pbMathReg[bRegister]);\r
-                       fprintf(fp, "           lahf\n");\r
-               }\r
-               else    // If it's (HL)....\r
-               {\r
-                       fprintf(fp, "           sahf\n");\r
-                       fprintf(fp, "           %s      al, dl\n", tempstr);\r
-                       fprintf(fp, "           lahf\n");\r
-               }\r
-       \r
-               if (dwOpcode != 0xa8 && dwOpcode != 0xa0 && dwOpcode != 0xb0)\r
-                       SetOverflow();\r
-       \r
-               if (dwOpcode == 0xa8)\r
-                       fprintf(fp, "           and     ah, 0ech        ; Only these flags matter!\n");\r
-       \r
-               if (dwOpcode == 0xa0)\r
-               {\r
-                       fprintf(fp, "           and     ah, 0ech        ; Only these flags matter!\n");\r
-                       fprintf(fp, "           or      ah, 010h        ; Half carry gets set\n");\r
-               }\r
-       \r
-               if (dwOpcode == 0xb0)\r
-                       fprintf(fp, "           and     ah, 0ech ; No H, N, or C\n");\r
-       \r
-               if (dwOpcode == 0xb8)\r
-                       fprintf(fp, "           or      ah, 02h ; Set N for compare!\n");\r
-       \r
-               if (dwOpcode == 0x80 || dwOpcode == 0x88)\r
-                       fprintf(fp, "           and     ah, 0fdh ; No N!\n");\r
-       \r
-               if (dwOpcode == 0x90 || dwOpcode == 0x98)\r
-                       fprintf(fp, "           or      ah, 02h ; N Gets set!\n");\r
-\r
-               if (bRegister == 0x6)\r
-                       fprintf(fp, "           xor     edx, edx        ; Zero this...\n");\r
-       \r
-               FetchNextInstruction(dwOrgOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               dwOpcode = dwOrgOpcode;\r
-               bRegister = dwOpcode & 0x07;\r
-               dwOpcode &= 0xf8;\r
-\r
-               if (6 == bRegister)             // Deal with (HL)\r
-               {\r
-                       ReadValueFromMemory("cpu.z80HL", "bTemp");\r
-               }\r
-\r
-               if (dwOpcode == 0xa0)\r
-               {\r
-                       fprintf(fp, "                           cpu.z80A &= %s;\n", pbMathRegC[bRegister]);\r
-               }\r
-               else\r
-               if (dwOpcode == 0xa8)\r
-               {\r
-                       fprintf(fp, "                           cpu.z80A ^= %s;\n", pbMathRegC[bRegister]);\r
-               }\r
-               else\r
-               if (dwOpcode == 0xb0)\r
-               {\r
-                       fprintf(fp, "                           cpu.z80A |= %s;\n", pbMathRegC[bRegister]);\r
-               }\r
-               else\r
-               if (dwOpcode == 0xb8)\r
-               {\r
-                       // Don't do anything. We just do flags!\r
-               }\r
-               else\r
-               if (dwOpcode == 0x88)           // ADC\r
-               {\r
-                       fprintf(fp, "                           bTemp2 = cpu.z80A + %s + (cpu.z80F & Z80_FLAG_CARRY);\n", pbMathRegC[bRegister]);\r
-               }\r
-               else\r
-               if (dwOpcode == 0x90)           // SUB\r
-               {\r
-                       fprintf(fp, "                           bTemp2 = cpu.z80A - %s;\n", pbMathRegC[bRegister]);\r
-               }                                                                                 \r
-               else\r
-               if (dwOpcode == 0x80)           // ADD\r
-               {\r
-                       fprintf(fp, "                           bTemp2 = cpu.z80A + %s;\n", pbMathRegC[bRegister]);\r
-               }\r
-               else\r
-               if (dwOpcode == 0x98)           // SBC\r
-               {\r
-                       fprintf(fp, "                           bTemp2 = cpu.z80A - %s - (cpu.z80F & Z80_FLAG_CARRY);\n", pbMathRegC[bRegister]);\r
-               }\r
-               else\r
-               {\r
-                       InvalidInstructionC(1);\r
-               }\r
-\r
-               // Now do flag fixup\r
-\r
-               if (0xb0 == dwOpcode || 0xa8 == dwOpcode)\r
-               {\r
-                       fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);\n");\r
-                       fprintf(fp, "                           cpu.z80F |= bPostORFlags[cpu.z80A];\n\n");\r
-               }\r
-\r
-               if (0xa0 == dwOpcode)\r
-               {\r
-                       fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);\n");\r
-                       fprintf(fp, "                           cpu.z80F |= bPostANDFlags[cpu.z80A];\n\n");\r
-               }\r
-\r
-               if (0xb8 == dwOpcode || 0x90 == dwOpcode)\r
-               {\r
-                       SetSubFlagsSZHVC("cpu.z80A", pbMathRegC[bRegister]);\r
-\r
-                       if (0x90 == dwOpcode)\r
-                       {\r
-                               fprintf(fp, "                           cpu.z80A = bTemp2;\n");\r
-                       }\r
-               }\r
-\r
-               if (0x80 == dwOpcode)           // Add fixup\r
-               {\r
-                       SetAddFlagsSZHVC("cpu.z80A", pbMathRegC[bRegister]);\r
-                       fprintf(fp, "                           cpu.z80A = bTemp2;\n");\r
-               }\r
-\r
-               if (0x88 == dwOpcode)           // Adc fixup\r
-               {\r
-                       SetAdcFlagsSZHVC("cpu.z80A", pbMathRegC[bRegister]);\r
-                       fprintf(fp, "                           cpu.z80A = bTemp2;\n");\r
-               }\r
-\r
-               if (0x98 == dwOpcode)           // Sbc fixup\r
-               {\r
-                       SetSbcFlagsSZHVC("cpu.z80A", pbMathRegC[bRegister]);\r
-                       fprintf(fp, "                           cpu.z80A = bTemp2;\n");\r
-               }\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-void RegIntoMemory(UINT32 dwOpcode)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               fprintf(fp, "           mov     dx, [esi]       ; Get our address to write to\n");\r
-               fprintf(fp, "           add     esi, 2          ; Next address, please...\n");\r
-\r
-               if (0x32 == dwOpcode)           // LD (xxxx), A\r
-                       WriteValueToMemory("dx", "al");\r
-               if (0x22 == dwOpcode)           // LD (xxxx), HL\r
-               {\r
-                       WriteWordToMemory("dx", "bx");\r
-               }\r
-\r
-               fprintf(fp, "           xor     edx, edx        ; Zero our upper byte\n");\r
-\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "                           dwTemp = *pbPC++;\n");\r
-               fprintf(fp, "                           dwTemp |= ((UINT32) *pbPC++ << 8);\n");\r
-\r
-               if (0x32 == dwOpcode)\r
-                       WriteValueToMemory("dwTemp", "cpu.z80A");\r
-               if (0x22 == dwOpcode)\r
-                       WriteWordToMemory("dwTemp", "cpu.z80HL");\r
-\r
-               return;\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-void JpHandler(UINT32 dwOpcode)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               if (0xc3 == dwOpcode)   // If it's a straight jump...\r
-               {\r
-                       fprintf(fp, "           mov     si, [esi]       ; Get our new address\n");\r
-                       fprintf(fp, "           and     esi, 0ffffh     ; Only the lower 16 bits\n");\r
-                       fprintf(fp, "           add     esi, ebp                ; Our new address!\n");\r
-               }\r
-               else    // It's a conditional handler...\r
-               {\r
-                       fprintf(fp, "           sahf            ; Restore our flags\n");\r
-                       fprintf(fp, "           j%s     takeJump%ld     ; We're going to take a jump\n", pbFlags[(dwOpcode >> 3) & 0x07], dwGlobalLabel);\r
-                       fprintf(fp, "           add     esi, 2          ; Skip past the address\n");\r
-                       fprintf(fp, "           jmp     short nextInst%ld        ; Go execute the next instruction\n", dwGlobalLabel);\r
-                       fprintf(fp, "takeJump%ld:\n", dwGlobalLabel);\r
-       \r
-                       fprintf(fp, "           mov     si, [esi]       ; Get our new offset\n");\r
-                       fprintf(fp, "           and     esi, 0ffffh     ; Only the lower WORD is valid\n");\r
-                       fprintf(fp, "           add     esi, ebp                ; Our new address!\n");\r
-                       fprintf(fp, "nextInst%ld:\n", dwGlobalLabel);\r
-                       ++dwGlobalLabel;\r
-               }\r
-       \r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "                                   dwAddr = *pbPC++;       /* Get LSB first */\n");\r
-               fprintf(fp, "                                   dwAddr |= ((UINT32) *pbPC++ << 8); /* Get MSB last */\n");\r
-\r
-               if (0xc3 != dwOpcode)\r
-               {\r
-                       fprintf(fp, "                           if %s\n", pbFlagsC[(dwOpcode >> 3) & 0x07]);\r
-                       fprintf(fp, "                           {\n");\r
-                       fprintf(fp, "                                   pbPC = cpu.z80Base + dwAddr;    /* Normalize the address */\n");\r
-                       fprintf(fp, "                           }\n");\r
-               }\r
-               else            // Regular jump here\r
-               {\r
-                       fprintf(fp, "                           pbPC = cpu.z80Base + dwAddr;    /* Normalize the address */\n");\r
-               }\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-void LdRegImmediate(UINT32 dwOpcode)\r
-{\r
-       UINT8 bOp;\r
-\r
-       bOp = (dwOpcode >> 3) & 0x7;\r
-\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-\r
-               if (bOp != 2 && bOp != 3)\r
-                       fprintf(fp, "           mov     %s, [esi]       ; Get our immediate value\n", pbMathReg[bOp]);\r
-               else\r
-               {\r
-                       fprintf(fp, "           mov     dl, [esi]       ; Get our immediate value\n");\r
-                       fprintf(fp, "           mov     %s, dl  ; Store our new value\n", pbMathReg[bOp]);\r
-               }\r
-       \r
-               fprintf(fp, "           inc     esi\n");\r
-       \r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "                           %s = *pbPC++;   /* Get immediate byte into register */\n", pbMathRegC[bOp]);\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-void IncRegister(UINT32 dwOpcode)\r
-{\r
-       UINT32 dwOpcode1 = 0;\r
-\r
-       dwOpcode1 = (dwOpcode >> 3) & 0x07;\r
-\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               fprintf(fp, "           sahf\n");\r
-               fprintf(fp,     "               inc     %s\n", pbMathReg[dwOpcode1]);\r
-               fprintf(fp,     "               lahf\n");\r
-               SetOverflow();\r
-               fprintf(fp, "           and     ah, 0fdh        ; Knock out N!\n");\r
-\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);\n");\r
-               fprintf(fp ,"                           cpu.z80F |= bPostIncFlags[%s++];\n", pbMathRegC[dwOpcode1]);\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-void DecRegister(UINT32 dwOpcode)\r
-{\r
-       UINT32 dwOpcode1 = 0;\r
-\r
-       dwOpcode1 = (dwOpcode >> 3) & 0x07;\r
-\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               fprintf(fp, "           sahf\n");\r
-               fprintf(fp,     "               dec     %s\n", pbMathReg[dwOpcode1]);\r
-               fprintf(fp,     "               lahf\n");\r
-               SetOverflow();\r
-               fprintf(fp, "           or      ah, 02h ; Set negative!\n");\r
-\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY);\n");\r
-               fprintf(fp ,"                           cpu.z80F |= bPostDecFlags[%s--];\n", pbMathRegC[dwOpcode1]);\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-void IncDecRegpair(UINT32 dwOpcode)\r
-{\r
-       UINT32 dwOpcode1 = 0;\r
-\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               if ((dwOpcode & 0x0f) == 3)     // Increment?\r
-                       fprintf(fp,     "               inc     %s\n", pbRegPairs[(dwOpcode >> 4) & 0x03]);\r
-               else\r
-                       fprintf(fp,     "               dec     %s\n", pbRegPairs[(dwOpcode >> 4) & 0x03]);\r
-\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               if ((dwOpcode & 0x0f) == 3)     // Increment\r
-                       fprintf(fp, "                           %s++;\n", pbRegPairC[(dwOpcode >> 4) & 0x03]);\r
-               else\r
-                       fprintf(fp, "                           %s--;\n", pbRegPairC[(dwOpcode >> 4) & 0x03]);\r
-               fprintf(fp, "                           %s &= 0xffff;\n", pbRegPairC[(dwOpcode >> 4) & 0x03]);\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-void LdRegReg(UINT32 dwOpcode)\r
-{\r
-       UINT8 bDestination;\r
-       UINT8 bSource;\r
-\r
-       bDestination = (dwOpcode >> 3) & 0x07;\r
-       bSource = (dwOpcode) & 0x07;\r
-\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-\r
-               ProcBegin(dwOpcode);\r
-       \r
-               if (bSource != bDestination)\r
-               {\r
-                       if (bSource == 2 && bDestination == 3)\r
-                       {\r
-                               fprintf(fp, "           mov     dl, byte [_z80de + 1]\n");\r
-                               fprintf(fp, "           mov     [_z80de], dl\n");\r
-                       }\r
-                       else\r
-                       if (bSource == 3 && bDestination == 2)\r
-                       {\r
-                               fprintf(fp, "           mov     dl, byte [_z80de]\n");\r
-                               fprintf(fp, "           mov     [_z80de + 1], dl\n");\r
-                       }\r
-                       else\r
-                               fprintf(fp, "           mov     %s, %s\n", pbMathReg[bDestination], pbMathReg[bSource]);\r
-               }\r
-       \r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               if (bDestination != bSource)\r
-               {\r
-                       fprintf(fp, "                           %s = %s;\n",\r
-                                         pbMathRegC[bDestination],\r
-                                         pbMathRegC[bSource]);\r
-               }\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-void MathOperationDirect(UINT32 dwOpcode)\r
-{\r
-       UINT8 tempstr[4];\r
-\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               if (dwOpcode == 0xc6)\r
-                       strcpy(tempstr, "add");\r
-               if (dwOpcode == 0xce)\r
-                       strcpy(tempstr, "adc");\r
-               if (dwOpcode == 0xd6)\r
-                       strcpy(tempstr, "sub");\r
-               if (dwOpcode == 0xde)\r
-                       strcpy(tempstr, "sbb");\r
-               if (dwOpcode == 0xe6)\r
-                       strcpy(tempstr, "and");\r
-               if (dwOpcode == 0xee)\r
-                       strcpy(tempstr, "xor");\r
-               if (dwOpcode == 0xf6)\r
-                       strcpy(tempstr, "or");\r
-               if (dwOpcode == 0xfe)\r
-                       strcpy(tempstr, "cmp");\r
-       \r
-               ProcBegin(dwOpcode);\r
-       \r
-               // Let's see if we have to deal with (HL) or #xxh\r
-       \r
-               fprintf(fp, "           sahf\n");\r
-               fprintf(fp, "           %s      al, [esi]\n", tempstr);\r
-               fprintf(fp, "           lahf\n");\r
-       \r
-               if (dwOpcode != 0xee && dwOpcode != 0xe6 && dwOpcode != 0xf6)\r
-               {\r
-                       SetOverflow();\r
-               }\r
-       \r
-               if (dwOpcode == 0xe6)\r
-               {\r
-                       fprintf(fp, "           and     ah, 0ech ; Only parity, half carry, sign, zero\n");\r
-                       fprintf(fp, "           or      ah, 10h ; Half carry\n");\r
-               }\r
-       \r
-               if (dwOpcode == 0xc6 || dwOpcode == 0xce)\r
-                       fprintf(fp, "           and     ah, 0fdh ; Knock out N!\n");\r
-       \r
-               if (dwOpcode == 0xd6 || dwOpcode == 0xde || dwOpcode == 0xfe)\r
-                       fprintf(fp, "           or      ah, 02h ; Set negative!\n");\r
-\r
-               if (dwOpcode == 0xf6 || dwOpcode == 0xee)\r
-                       fprintf(fp, "           and     ah, 0ech        ; No H, N, or C\n");\r
-       \r
-               fprintf(fp, "           inc     esi\n");\r
-       \r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               if (0xfe == dwOpcode)   // Cp\r
-               {\r
-                       SetSubFlagsSZHVC("cpu.z80A", "*pbPC++");\r
-               }\r
-               else\r
-               if (0xe6 == dwOpcode)   // And\r
-               {\r
-                       fprintf(fp, "                           cpu.z80A &= *pbPC++;\n");\r
-                       fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);\n");\r
-                       fprintf(fp, "                           cpu.z80F |= bPostANDFlags[cpu.z80A];\n\n");\r
-               }\r
-               else\r
-               if (0xf6 == dwOpcode)   // Or\r
-               {\r
-                       fprintf(fp, "                           cpu.z80A |= *pbPC++;\n");\r
-                       fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);\n");\r
-                       fprintf(fp, "                           cpu.z80F |= bPostORFlags[cpu.z80A];\n\n");\r
-               }\r
-               else\r
-               if (0xc6 == dwOpcode)   // Add\r
-               {\r
-                       fprintf(fp, "                           bTemp = *pbPC++;\n");\r
-                       SetAddFlagsSZHVC("cpu.z80A", "bTemp");\r
-                       fprintf(fp, "                           cpu.z80A += bTemp;\n");\r
-               }\r
-               else\r
-               if (0xce == dwOpcode)   // Adc\r
-               {\r
-                       fprintf(fp, "                           bTemp = *pbPC++ + (cpu.z80F & Z80_FLAG_CARRY);\n");\r
-                       SetAdcFlagsSZHVC("cpu.z80A", "bTemp");\r
-                       fprintf(fp, "                           cpu.z80A += bTemp;\n");\r
-               }\r
-               else\r
-               if (0xd6 == dwOpcode)   // Sub\r
-               {\r
-                       fprintf(fp, "                           bTemp = *pbPC++;\n");\r
-                       SetSubFlagsSZHVC("cpu.z80A", "bTemp");\r
-                       fprintf(fp, "                           cpu.z80A -= bTemp;\n");\r
-               }\r
-               else\r
-               if (0xde == dwOpcode)   // Sbc\r
-               {\r
-                       fprintf(fp, "                           bTemp = *pbPC++ + (cpu.z80F & Z80_FLAG_CARRY);\n");\r
-                       SetSbcFlagsSZHVC("cpu.z80A", "bTemp");\r
-                       fprintf(fp, "                           cpu.z80A = cpu.z80A - bTemp;\n");\r
-               }\r
-               else\r
-               if (0xee == dwOpcode)   // Xor\r
-               {\r
-                       fprintf(fp, "                           cpu.z80A ^= *pbPC++;\n");\r
-                       fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);\n");\r
-                       fprintf(fp, "                           cpu.z80F |= bPostORFlags[cpu.z80A];\n\n");\r
-               }\r
-               else\r
-                       InvalidInstructionC(1);\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-// JR cc, addr\r
-\r
-void JrHandler(UINT32 dwOpcode)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-       \r
-               fprintf(fp, "           sub     esi, ebp\n");\r
-               fprintf(fp, "           and     esi, 0ffffh\n");\r
-               fprintf(fp, "           add     esi, ebp\n");\r
-\r
-               fprintf(fp, "           mov     dl, [esi] ; Get our relative offset\n");\r
-               fprintf(fp, "           inc     esi     ; Next instruction, please!\n");\r
-\r
-               if (dwOpcode != 0x18)\r
-               {\r
-                       fprintf(fp, "           sahf\n");\r
-                       fprintf(fp,     "               j%s     takeJump%ld\n", pbFlags[(dwOpcode >> 3) & 0x3], dwGlobalLabel);\r
-                       fprintf(fp, "           jmp     short noJumpMan%ld\n", dwGlobalLabel);\r
-                       fprintf(fp, "takeJump%ld:\n", dwGlobalLabel);\r
-\r
-                       if (FALSE == bNoTiming)\r
-                       {\r
-                               fprintf(fp, "           sub     edi, 5\n");\r
-                       }\r
-               }\r
-               else    // It's a JR\r
-               {\r
-                       fprintf(fp, "           cmp     dl, 0feh        ; Jump to self?\n");\r
-                       fprintf(fp, "           je              yesJrMan        ; Yup! Bail out!\n");\r
-               }\r
-       \r
-               fprintf(fp, "           xchg    eax, edx\n");\r
-               fprintf(fp, "           cbw\n");\r
-               fprintf(fp, "           xchg    eax, edx\n");\r
-               fprintf(fp, "           sub     esi, ebp\n");\r
-               fprintf(fp, "           add     si, dx\n");\r
-               fprintf(fp, "           and     esi, 0ffffh     ; Only the lower 16 bits\n");\r
-               fprintf(fp, "           add     esi, ebp\n");\r
-               fprintf(fp, "           xor     dh, dh\n");\r
-               fprintf(fp, "noJumpMan%ld:\n", dwGlobalLabel++);\r
-\r
-               FetchNextInstruction(dwOpcode);\r
-       \r
-               if (0x18 == dwOpcode)\r
-               {\r
-                       fprintf(fp,"yesJrMan:\n");\r
-\r
-                       fprintf(fp, "           xor     edx, edx                ; Zero me for later\n");\r
-                       fprintf(fp, "           mov     edi, edx\n");\r
-                       fprintf(fp, "           mov     [cyclesRemaining], edx\n");\r
-                       fprintf(fp, "           sub     esi, 2  ; Back to the instruction again\n");\r
-                       fprintf(fp, "           jmp     noMoreExec\n\n");\r
-               }\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "                           sdwAddr = (INT8) *pbPC++;       /* Get LSB first */\n");\r
-               fprintf(fp, "                           cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;\n");\r
-               fprintf(fp, "                           sdwAddr = (sdwAddr + (INT32) cpu.z80pc) & 0xffff;\n");\r
-\r
-               if (0x18 != dwOpcode)\r
-               {\r
-                       fprintf(fp, "                           if %s\n", pbFlagsC[(dwOpcode >> 3) & 0x03]);\r
-               }\r
-\r
-               fprintf(fp, "                           {\n");\r
-\r
-               fprintf(fp, "                           sdwCyclesRemaining -= 5;\n");\r
-\r
-               fprintf(fp, "                                   pbPC = cpu.z80Base + sdwAddr;   /* Normalize the address */\n");\r
-               fprintf(fp, "                           }\n");\r
-               \r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-void CallHandler(UINT32 dwOpcode)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               if (dwOpcode != 0xcd)\r
-               {\r
-                       fprintf(fp, "           sahf            ; Restore our flags\n");\r
-                       fprintf(fp, "           j%s     takeJump%ld     ; We're going call in this case\n", pbFlags[(dwOpcode >> 3) & 0x07], dwGlobalLabel);\r
-                       fprintf(fp, "           add     esi, 2          ; Skip past the address\n");\r
-                       fprintf(fp, "           jmp     short noCallTaken%ld     ; Go execute the next instruction\n", dwGlobalLabel);\r
-                       fprintf(fp, "takeJump%ld:\n", dwGlobalLabel);\r
-       \r
-                       fprintf(fp, "           sub     edi, 7\n");\r
-               }\r
-\r
-\r
-               if (bThroughCallHandler)\r
-               {\r
-                       fprintf(fp, "           mov     dx, [esi]       ; Get our call to address\n");\r
-                       fprintf(fp, "           mov     [_z80pc], dx ; Store our new program counter\n");\r
-                       fprintf(fp, "           add     esi, 2          ; Skip to our new address to be pushed\n");\r
-                       fprintf(fp, "           sub     esi, ebp                ; Value to push onto the \"stack\"\n");\r
-                       fprintf(fp, "           mov     [_wordval], si  ; Store our return address on the stack\n");\r
-                       fprintf(fp, "           mov     si, dx          ; Our new address\n");\r
-                       fprintf(fp, "           add     esi, ebp        ; And our base address\n");\r
-                       fprintf(fp, "           call    PushWord        ; Go push our orgval to the stack\n");\r
-               }\r
-               else\r
-               {\r
-                       fprintf(fp, "           mov     dx, [esi]       ; Get our call to address\n");\r
-                       fprintf(fp, "           mov     [_z80pc], dx ; Store our new program counter\n");\r
-                       fprintf(fp, "           add     esi, 2          ; Skip to our new address to be pushed\n");\r
-                       fprintf(fp, "           sub     esi, ebp                ; Value to push onto the \"stack\"\n");\r
-                       fprintf(fp, "           mov     dx, word [_z80sp] ; Get the current stack pointer\n");\r
-                       fprintf(fp, "           sub     dx, 2           ; Back up two bytes\n");\r
-                       fprintf(fp, "           mov     [ebp+edx], si ; PUSH It!\n");\r
-                       fprintf(fp, "           mov     word [_z80sp], dx       ; Store our new stack pointer\n");\r
-                       fprintf(fp, "           mov     si, [_z80pc] ; Get our new program counter\n");\r
-                       fprintf(fp, "           add     esi, ebp                ; Naturalize it!\n");\r
-               }\r
-\r
-               if (dwOpcode != 0xcd)\r
-                       fprintf(fp, "noCallTaken%ld:\n", dwGlobalLabel++);\r
-\r
-               fprintf(fp, "           xor     edx, edx\n");\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "                           dwAddr = *pbPC++;       /* Get LSB first */\n");\r
-               fprintf(fp, "                           dwAddr |= ((UINT32) *pbPC++ << 8); /* Get MSB last */\n");\r
-\r
-               if (0xcd != dwOpcode)\r
-               {\r
-                       fprintf(fp, "                           if %s\n", pbFlagsC[(dwOpcode >> 3) & 0x07]);\r
-                       fprintf(fp, "                           {\n");\r
-                       fprintf(fp, "                                   cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;\n");\r
-                       fprintf(fp, "                                   pbSP = (cpu.z80Base + cpu.z80sp - 1);   /* Normalize the stack pointer */\n");\r
-                       fprintf(fp, "                                   *pbSP-- = cpu.z80pc >> 8;       /* MSB */\n");\r
-                       fprintf(fp, "                                   *pbSP = (UINT8) cpu.z80pc;      /* LSB */\n");\r
-                       fprintf(fp, "                                   cpu.z80sp -= 2; /* Back our stack up */\n");\r
-                       fprintf(fp, "                                   pbPC = cpu.z80Base + dwAddr;    /* Normalize the address */\n");\r
-                       fprintf(fp, "                           }\n");\r
-               }\r
-               else            // Just a regular call\r
-               {\r
-                       fprintf(fp, "                           cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;\n");\r
-                       fprintf(fp, "                           pbSP = (cpu.z80Base + cpu.z80sp - 1);   /* Normalize the stack pointer */\n");\r
-                       fprintf(fp, "                           *pbSP-- = cpu.z80pc >> 8;       /* LSB */\n");\r
-                       fprintf(fp, "                           *pbSP = (UINT8) cpu.z80pc;      /* MSB */\n");\r
-                       fprintf(fp, "                           cpu.z80sp -= 2; /* Back our stack up */\n");\r
-                       fprintf(fp, "                           pbPC = cpu.z80Base + dwAddr;    /* Normalize the address */\n");\r
-               }\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-void RetHandler(UINT32 dwOpcode)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               if (dwOpcode != 0xc9)\r
-               {\r
-                       fprintf(fp, "           sahf\n");\r
-                       fprintf(fp, "           j%s     takeReturn%ld\n", pbFlags[(dwOpcode >> 3) & 0x07], dwGlobalLabel);\r
-                       fprintf(fp, "           jmp     short retNotTaken%ld\n", dwGlobalLabel);\r
-                       fprintf(fp, "takeReturn%ld:\n", dwGlobalLabel);\r
-\r
-                       if (FALSE == bNoTiming)\r
-                       {\r
-                               fprintf(fp, "           sub     edi, byte 6\n");\r
-                       }\r
-               }\r
-\r
-\r
-               if (bThroughCallHandler)\r
-               {\r
-                       fprintf(fp, "           call    PopWord\n");\r
-                       fprintf(fp, "           xor     esi, esi\n");\r
-                       fprintf(fp, "           mov     si, dx\n");\r
-                       fprintf(fp,     "               add     esi, ebp\n");\r
-                       fprintf(fp, "           xor     edx, edx\n");\r
-               }\r
-               else     \r
-               {\r
-                       fprintf(fp, "           mov     dx, word [_z80sp]       ; Get our current stack pointer\n");\r
-                       fprintf(fp, "           mov     si, [edx+ebp]   ; Get our return address\n");\r
-                       fprintf(fp, "           and     esi, 0ffffh             ; Only within 64K!\n");\r
-                       fprintf(fp, "           add     esi, ebp                        ; Add in our base address\n");\r
-                       fprintf(fp, "           add     word [_z80sp], 02h      ; Remove our two bytes from the stack\n");\r
-                       fprintf(fp, "           xor     edx, edx\n");\r
-               }\r
-\r
-               if (dwOpcode != 0xc9)\r
-                       fprintf(fp, "retNotTaken%ld:\n", dwGlobalLabel++);\r
-\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               if (dwOpcode != 0xc9)\r
-               {\r
-                       fprintf(fp, "                           if %s\n", pbFlagsC[(dwOpcode >> 3) & 0x07]);\r
-                       fprintf(fp, "                           {\n");\r
-                       fprintf(fp, "                                   dwElapsedTicks += 6;\n");\r
-               }\r
-\r
-               fprintf(fp, "                           pbSP = cpu.z80Base + cpu.z80sp; /* Normalize our stack PTR */\n");\r
-               fprintf(fp, "                           dwAddr = *pbSP++;       /* Pop LSB */\n");\r
-               fprintf(fp, "                           dwAddr |= ((UINT32) *pbSP << 8);        /* Pop MSB */\n");\r
-               fprintf(fp, "                           cpu.z80sp += 2; /* Pop the word off */\n");\r
-               fprintf(fp, "                           pbPC = (cpu.z80Base + dwAddr);  /* Point PC to our return address */\n");\r
-\r
-               if (dwOpcode != 0xc9)\r
-               {\r
-                       fprintf(fp, "                           }\n");\r
-               }\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-void RestartHandler(UINT32 dwOpcode)\r
-{\r
-       UINT32 dwOpcode1 = 0;\r
-\r
-       dwOpcode1 = dwOpcode & 0x38;\r
-\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               if (bThroughCallHandler)\r
-               {\r
-                       fprintf(fp, "           sub     esi, ebp\n");\r
-                       fprintf(fp, "           mov     [_wordval], si  ; Store our return address\n");\r
-                       fprintf(fp, "           call    PushWord\n");\r
-                       fprintf(fp, "           xor     esi, esi\n");\r
-                       fprintf(fp, "           mov     si, %.4lxh\n", dwOpcode1);\r
-                       fprintf(fp, "           add     esi, ebp\n");\r
-               }\r
-               else \r
-               {\r
-                       fprintf(fp, "           mov     dx, word [_z80sp]       ; Get our stack pointer\n");\r
-                       fprintf(fp, "           sub     dx, 2           ; Make room for the new value!\n");\r
-                       fprintf(fp, "           mov     word [_z80sp], dx       ; Store our new stack pointer\n");\r
-                       fprintf(fp, "           sub     esi, ebp                ; Get our real PC\n");\r
-                       fprintf(fp, "           mov     [ebp+edx], si   ; Our return address\n");\r
-                       fprintf(fp, "           mov     si, 0%.2xh      ; Our new call address\n", dwOpcode1);\r
-                       fprintf(fp, "           add     esi, ebp        ; Back to the base!\n");\r
-               }\r
-       \r
-               fprintf(fp, "           xor     edx, edx\n");\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "                           cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;\n");\r
-               fprintf(fp, "                           pbSP = (cpu.z80Base + cpu.z80sp - 1);   /* Normalize the stack pointer */\n");\r
-               fprintf(fp, "                           *pbSP-- = cpu.z80pc >> 8;       /* LSB */\n");\r
-               fprintf(fp, "                           *pbSP = (UINT8) cpu.z80pc;      /* MSB */\n");\r
-               fprintf(fp, "                           cpu.z80sp -= 2; /* Back our stack up */\n");\r
-               fprintf(fp, "                           pbPC = cpu.z80Base + 0x%.2x;    /* Normalize the address */\n", dwOpcode1);\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-void ToRegFromHl(UINT32 dwOpcode)\r
-{\r
-       UINT8 bReg;\r
-\r
-       bReg = (dwOpcode >> 3) & 0x07;\r
-\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               if (bReg != 2 && bReg != 3)\r
-                       ReadValueFromMemory("bx", pbMathReg[bReg]);\r
-               else\r
-               {\r
-                       ReadValueFromMemory("bx", pbLocalReg[bReg]);\r
-                       fprintf(fp, "           mov     %s, %s\n", pbMathReg[bReg], pbLocalReg[bReg]);\r
-               }\r
-\r
-               fprintf(fp, "           xor     edx, edx\n");\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               ReadValueFromMemory("cpu.z80HL", pbLocalRegC[bReg]);\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-void AddRegpairOperations(UINT32 dwOpcode)\r
-{\r
-       UINT8 bRegpair;\r
-\r
-       bRegpair = (dwOpcode >> 4) & 0x3;\r
-\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               fprintf(fp, "           mov     dh, ah  ; Get our flags\n");\r
-               fprintf(fp, "           and     dh, 0ech        ; Preserve the top three and bits 2 & 3\n");\r
-       \r
-               fprintf(fp, "           mov     [_orgval], bx   ; Store our original value\n");\r
-               fprintf(fp, "           add     bx, %s\n", pbRegPairs[bRegpair]);\r
-               fprintf(fp, "           lahf\n");\r
-       \r
-               fprintf(fp, "           mov     [cyclesRemaining], edi\n");\r
-               fprintf(fp, "           mov     di, [_orgval]   ; Get original\n");\r
-               fprintf(fp, "           xor     di, bx ; XOR It with our computed value\n");\r
-               fprintf(fp, "           xor     di, %s\n", pbRegPairs[bRegpair]);\r
-               fprintf(fp, "           and     di, 1000h       ; Just our half carry\n");\r
-               fprintf(fp, "           or              dx, di  ; Or in our flags\n");\r
-               fprintf(fp, "           and     ah, 01h ; Just carry\n");\r
-               fprintf(fp, "           or      ah, dh\n");\r
-               fprintf(fp, "           mov     edi, [cyclesRemaining]\n");     \r
-               fprintf(fp, "           xor     edx, edx\n");   \r
-       \r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "                   cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY);\n");\r
-               fprintf(fp, "                   dwTemp = cpu.z80HL + %s;\n", pbRegPairsC[bRegpair]);\r
-               fprintf(fp, "                   cpu.z80F |= ((dwTemp >> 16) & Z80_FLAG_CARRY) | (((cpu.z80HL ^ dwTemp ^ %s) >> 8) & Z80_FLAG_HALF_CARRY);\n", pbRegPairsC[bRegpair]);\r
-               fprintf(fp, "                   cpu.z80HL = dwTemp & 0xffff;\n");\r
-\r
-               return;\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-void PushPopOperations(UINT32 dwOpcode)\r
-{\r
-       UINT8 bRegPair;\r
-\r
-       bRegPair = ((dwOpcode >> 4) & 0x3) << 1;\r
-\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               if ((dwOpcode & 0xcf) == 0xc5)  // Push\r
-               {\r
-                       fprintf(fp, "           sub     word [_z80sp], 2\n");\r
-                       fprintf(fp, "           mov     dx, [_z80sp]\n");\r
-                       WriteWordToMemory("dx", pbPopRegPairs[bRegPair >> 1]);\r
-               }\r
-               else    // Pop\r
-               {\r
-                       fprintf(fp, "           mov     dx, [_z80sp]\n");\r
-                       ReadWordFromMemory("dx", pbPopRegPairs[bRegPair >> 1]);\r
-                       fprintf(fp, "           add     word [_z80sp], 2\n");\r
-               }       \r
-\r
-               fprintf(fp, "           xor     edx, edx\n");\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               if ((dwOpcode & 0xcf) == 0xc5)          // Push?\r
-               {\r
-                       fprintf(fp, "                                   cpu.z80sp -= 2;\n");\r
-                       fprintf(fp, "                                   pbSP = (cpu.z80Base + cpu.z80sp);       /* Normalize the stack pointer */\n");\r
-                       \r
-                       WriteWordToMemory("cpu.z80sp", pbPopRegPairC[bRegPair >> 1]);\r
-                       return;\r
-               }\r
-               else\r
-               {\r
-                       ReadWordFromMemory("cpu.z80sp", pbPopRegPairC[bRegPair >> 1]);\r
-\r
-                       fprintf(fp, "                                   cpu.z80sp += 2;\n");\r
-                       fprintf(fp, "                                   pbSP = (cpu.z80Base + cpu.z80sp);       /* Normalize the stack pointer */\n");\r
-                       return;\r
-               }\r
-               \r
-               InvalidInstructionC(1);\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-void RraRlaHandler(UINT32 dwOpcode)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               fprintf(fp, "           sahf\n");\r
-               if (dwOpcode == 0x1f)\r
-                       fprintf(fp, "           rcr     al, 1\n");\r
-               else\r
-                       fprintf(fp, "           rcl     al, 1\n");\r
-       \r
-               fprintf(fp, "           lahf\n");\r
-               fprintf(fp, "           and     ah, 0edh\n");\r
-       \r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               if (0x1f == dwOpcode)           // RRA\r
-               {\r
-                       fprintf(fp, "                           bTemp = (cpu.z80F & Z80_FLAG_CARRY) << 7;\n");\r
-                       fprintf(fp, "                           cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY)) | (cpu.z80A & Z80_FLAG_CARRY);\n");\r
-                       fprintf(fp, "                           cpu.z80A = ((cpu.z80A >> 1) | bTemp);\n");\r
-               }\r
-               else                                                            // RLA\r
-               {\r
-                       fprintf(fp, "                           bTemp = cpu.z80A >> 7;\n");\r
-                       fprintf(fp, "                           cpu.z80A = (cpu.z80A << 1) | (cpu.z80F & Z80_FLAG_CARRY);\n");\r
-                       fprintf(fp, "                           cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY)) | bTemp;\n");\r
-               }\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-void LdByteRegpair(UINT32 dwOpcode)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               if (dwOpcode == 0x0a)\r
-                       ReadValueFromMemory("cx", "al");\r
-               if (dwOpcode == 0x1a)\r
-               {\r
-                       fprintf(fp, "           mov     dx, [_z80de]\n");\r
-                       ReadValueFromMemory("dx", "al");\r
-               }\r
-\r
-               fprintf(fp, "           xor     edx, edx\n");\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               if (dwOpcode == 0x0a)\r
-                       ReadValueFromMemory("cpu.z80BC", "cpu.z80A");\r
-               if (dwOpcode == 0x1a)\r
-                       ReadValueFromMemory("cpu.z80DE", "cpu.z80A");\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-void IncDecHLPtr(UINT32 dwOpcode)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               ReadValueFromMemory("bx", "dl");\r
-\r
-               fprintf(fp, "           sahf\n");\r
-\r
-               if (dwOpcode == 0x34)\r
-                       fprintf(fp, "           inc     dl\n");\r
-               else\r
-                       fprintf(fp, "           dec     dl\n");\r
-               fprintf(fp, "           lahf\n");\r
-\r
-               fprintf(fp, "           o16     pushf\n");\r
-               fprintf(fp, "           shl     edx, 16\n");\r
-               fprintf(fp, "           and     ah, 0fbh        ;       Knock out parity/overflow\n");\r
-               fprintf(fp, "           pop     dx\n");\r
-               fprintf(fp, "           and     dh, 08h ; Just the overflow\n");\r
-               fprintf(fp, "           shr     dh, 1   ; Shift it into position\n");\r
-               fprintf(fp, "           or      ah, dh  ; OR It in with the real flags\n");\r
-       \r
-               fprintf(fp, "           shr     edx, 16\n");\r
-       \r
-               if (dwOpcode == 0x34)\r
-                       fprintf(fp, "           and     ah, 0fdh        ; Knock out N!\n");\r
-               else\r
-                       fprintf(fp, "           or              ah, 02h ; Make it N!\n");\r
-       \r
-               WriteValueToMemory("bx", "dl");\r
-               fprintf(fp, "           xor     edx, edx\n");\r
-\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               ReadValueFromMemory("cpu.z80HL", "bTemp");\r
-\r
-               fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);\n");\r
-\r
-               if (0x34 == dwOpcode)\r
-                       fprintf(fp ,"                           cpu.z80F |= bPostIncFlags[bTemp];\n");\r
-               else\r
-                       fprintf(fp ,"                           cpu.z80F |= bPostDecFlags[bTemp];\n");\r
-               \r
-               if (0x34 == dwOpcode)\r
-                       fprintf(fp, "                           bTemp++;\n");\r
-               else\r
-                       fprintf(fp, "                           bTemp--;\n");\r
-       \r
-               WriteValueToMemory("cpu.z80HL", "bTemp");\r
-               return;\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-void InOutHandler(UINT32 dwOpcode)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               fprintf(fp, "           mov     dl, [esi]       ; Get our address to 'out' to\n");\r
-               fprintf(fp, "           inc     esi     ; Next address\n");\r
-\r
-               if (b16BitIo)\r
-               {\r
-                       fprintf(fp, "           mov     dh, al  ; Upper 8 bits are the A register for 16 bit addressing\n");\r
-               }\r
-\r
-               if (0xd3 == dwOpcode)\r
-                       WriteValueToIo("dx", "al");\r
-               else\r
-                       ReadValueFromIo("dx", "al");\r
-\r
-               fprintf(fp, "           xor     edx, edx\n");\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp ,"                   dwTemp = *pbPC++;\n");\r
-\r
-               if (0xd3 == dwOpcode)\r
-                       WriteValueToIo("dwTemp", "cpu.z80A");\r
-               else\r
-                       ReadValueFromIo("dwTemp", "cpu.z80A");\r
-\r
-               // Not supposed to set flags for immediate instruction!\r
-\r
-               return;\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-// CB Area\r
-\r
-void RESSETHandler(UINT32 dwOpcode)\r
-{\r
-       UINT8 op = 0;\r
-\r
-       op = dwOpcode & 0x07;\r
-\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               if ((2 == op) || (3 == op))\r
-                       fprintf(fp, "           mov     dx, [_z80de]    ; Move DE into something half usable\n");\r
-\r
-               if ((dwOpcode & 0x07) == 6)     // (HL)?\r
-                       ReadValueFromMemory("bx", "dl");\r
-\r
-               if ((dwOpcode & 0xc0) == 0x80)\r
-                       fprintf(fp, "           and %s, 0%.2xh  ; Reset a bit\n",         \r
-                                                       pbLocalReg[op],\r
-                                                       0xff - (1 << ((dwOpcode >> 3) & 0x7)));\r
-\r
-               if ((dwOpcode & 0xc0) == 0xc0)\r
-                       fprintf(fp, "           or      %s, 0%.2xh      ; Set a bit\n",    \r
-                                                       pbLocalReg[op],\r
-                                                       (1 << ((dwOpcode >> 3) & 0x7)));\r
-\r
-               if ((2 == op) || (3 == op))\r
-               {\r
-                       fprintf(fp, "           mov     [_z80de], dx    ; Once modified, put it back\n");\r
-                       fprintf(fp, "           xor     edx, edx\n");\r
-               }\r
-\r
-               if ((dwOpcode & 0x07) == 6)     // (HL)?\r
-               {\r
-                       WriteValueToMemory("bx", "dl");\r
-                       fprintf(fp, "           xor     edx, edx\n");\r
-               }\r
-\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               if (6 == op)                    // (HL)?\r
-                       ReadValueFromMemory("cpu.z80HL", "bTemp");\r
-\r
-               if ((dwOpcode & 0xc0) == 0x80)  // RES\r
-                       fprintf(fp, "                           %s &= 0x%.2x;\n", pbMathRegC[op], (UINT8) ~((UINT8) 1 << ((dwOpcode >> 3) & 0x07)));\r
-               else                                                                            // SET\r
-                       fprintf(fp, "                           %s |= 0x%.2x;\n", pbMathRegC[op], 1 << ((dwOpcode >> 3) & 0x07));\r
-\r
-               if (6 == op)                    // (HL)?\r
-                       WriteValueToMemory("cpu.z80HL", "bTemp");\r
-       }\r
-       else\r
-               assert(0);\r
-}\r
-\r
-void BITHandler(UINT32 dwOpcode)\r
-{\r
-       UINT8 op = 0;\r
-       UINT8 bBitVal = 0;\r
-\r
-       op = dwOpcode & 0x07;\r
-       bBitVal = 1 << ((dwOpcode >> 3) & 0x07);\r
-\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               if ((dwOpcode & 0x07) == 6)     // (HL)?\r
-                       ReadValueFromMemory("bx", "dl");\r
-\r
-               fprintf(fp, "           mov     byte [_z80af], ah ; Store F\n");\r
-               fprintf(fp, "           sahf\n");\r
-\r
-               if ((dwOpcode & 0x07) == 6)\r
-                       fprintf(fp, "           test    dl, 0%.2xh      ; Do a bitwise check\n", 1 << ((dwOpcode >> 3) & 0x7));\r
-               else\r
-                       fprintf(fp, "           test %s, 0%.2xh ; Do a bitwise check\n", pbMathReg[op], 1 << ((dwOpcode >> 3) & 0x7));\r
-\r
-               fprintf(fp, "           lahf\n");\r
-               fprintf(fp, "           and     ah, 0c0h        ; Only care about Z and S\n");\r
-               fprintf(fp, "           or      ah, 10h ; Set half carry to 1\n");\r
-\r
-               fprintf(fp, "           and     byte [_z80af], 029h             ; Only zero/non-zero!\n");\r
-               fprintf(fp, "           or      ah, byte [_z80af]       ; Put it in with the real flags\n");\r
-\r
-               if (6 == (dwOpcode & 0x07))     // (HL)?\r
-                       fprintf(fp, "           xor     edx, edx\n");\r
-\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               if (6 == op)                    // (HL)?\r
-                       ReadValueFromMemory("cpu.z80HL", "bTemp");\r
-\r
-               fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);\n");\r
-               fprintf(fp, "                           cpu.z80F |= (Z80_FLAG_HALF_CARRY);\n");\r
-               fprintf(fp, "                           if (!(%s & 0x%.2lx))\n", pbMathRegC[op], bBitVal);\r
-               fprintf(fp, "                           {\n");\r
-               fprintf(fp, "                                   cpu.z80F |= Z80_FLAG_ZERO;\n");\r
-               fprintf(fp, "                           }\n");\r
-       }\r
-       else\r
-               assert(0);\r
-}\r
-\r
-void RLCRRCRLRRSLASRASRLHandler(UINT32 dwOpcode)\r
-{\r
-       UINT8 op = 0;\r
-\r
-       op = dwOpcode & 0x07;\r
-\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               if ((2 == op) || (3 == op))\r
-                       fprintf(fp, "           mov     dx, [_z80de]    ; Move DE into something half usable\n");\r
-\r
-               if ((dwOpcode & 0x07) == 6)     // (HL)?\r
-                       ReadValueFromMemory("bx", "dl");\r
-\r
-               fprintf(fp, "           sahf\n");\r
-\r
-               if ((dwOpcode & 0xf8) == 0)\r
-                       fprintf(fp, "           rol     %s, 1\n", pbLocalReg[op]);\r
-               else\r
-               if ((dwOpcode & 0xf8) == 0x08)\r
-                       fprintf(fp, "           ror     %s, 1\n", pbLocalReg[op]);\r
-               else\r
-               if ((dwOpcode & 0xf8) == 0x10)\r
-                       fprintf(fp, "           rcl     %s, 1\n", pbLocalReg[op]);\r
-               else\r
-               if ((dwOpcode & 0xf8) == 0x18)\r
-                       fprintf(fp, "           rcr     %s, 1\n", pbLocalReg[op]);\r
-               else\r
-               if ((dwOpcode & 0xf8) == 0x20 || (dwOpcode & 0xf8) == 0x30)\r
-                       fprintf(fp, "           shl     %s, 1\n", pbLocalReg[op]);\r
-               else\r
-               if ((dwOpcode & 0xf8) == 0x28)\r
-                       fprintf(fp, "           sar     %s, 1\n", pbLocalReg[op]);\r
-               else\r
-               if ((dwOpcode & 0xf8) == 0x38)\r
-                       fprintf(fp, "           shr     %s, 1\n", pbLocalReg[op]);\r
-               else\r
-                       assert(0);\r
-       \r
-               fprintf(fp, "           lahf\n");\r
-\r
-               if ((dwOpcode & 0xf8) >= 0x20)\r
-               {\r
-                       if ((dwOpcode & 0xf8) == 0x30)\r
-                               fprintf(fp, "           or      %s, 1   ; Slide in a 1 bit (SLIA)\n", pbLocalReg[op]);\r
-                       fprintf(fp, "           and     ah, 0edh        ; Clear H and N\n");\r
-               }\r
-               else\r
-               {\r
-                       fprintf(fp, "           and     ah, 029h        ; Clear H and N\n");\r
-                       fprintf(fp, "           mov     byte [_z80af], ah\n");\r
-\r
-                       fprintf(fp, "           or      %s, %s\n", pbLocalReg[op], pbLocalReg[op]);\r
-       \r
-                       fprintf(fp,     "               lahf\n");\r
-                       fprintf(fp, "           and     ah, 0c4h        ; Sign, zero, and parity\n");\r
-                       fprintf(fp, "           or      ah, byte [_z80af]\n");\r
-               }\r
-\r
-               if ((2 == op) || (3 == op))\r
-               {\r
-                       fprintf(fp, "           mov     [_z80de], dx    ; Once modified, put it back\n");\r
-                       fprintf(fp, "           xor     edx, edx\n");\r
-               }\r
-\r
-               if ((dwOpcode & 0x07) == 6)     // (HL)?\r
-               {\r
-                       WriteValueToMemory("bx", "dl");\r
-                       fprintf(fp, "           xor     edx, edx\n");\r
-               }\r
-\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               if (6 == op)                                            // (HL)?\r
-                       ReadValueFromMemory("cpu.z80HL", "bTemp");\r
-\r
-               dwOpcode &= 0xf8;                       // Just the instruction\r
-\r
-               if (0 == dwOpcode)              // RLC\r
-               {\r
-                       fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);\n");\r
-                       fprintf(fp, "                           bTemp2 = (%s >> 7);\n", pbMathRegC[op]);\r
-                       fprintf(fp, "                           %s = (%s << 1) | bTemp2;\n", pbMathRegC[op], pbMathRegC[op]);\r
-                       fprintf(fp, "                           cpu.z80F |= bTemp2 | bPostORFlags[%s];\n", pbMathRegC[op]);\r
-               }\r
-               else\r
-               if (0x08 == dwOpcode)           // RRC\r
-               {\r
-                       fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);\n");\r
-                       fprintf(fp, "                           cpu.z80F |= (%s & Z80_FLAG_CARRY);\n", pbMathRegC[op]);\r
-                       fprintf(fp, "                           %s = (%s >> 1) | (%s << 7);\n", pbMathRegC[op], pbMathRegC[op], pbMathRegC[op]);\r
-                       fprintf(fp, "                           cpu.z80F |= bPostORFlags[%s];\n", pbMathRegC[op]);\r
-               }\r
-               else\r
-               if (0x10 == dwOpcode)           // RL\r
-               {\r
-                       fprintf(fp, "                           bTemp2 = cpu.z80F & Z80_FLAG_CARRY;\n");\r
-                       fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);\n");\r
-                       fprintf(fp, "                           cpu.z80F |= (%s >> 7);\n", pbMathRegC[op]);\r
-                       fprintf(fp, "                           %s = (%s << 1) | bTemp2;\n", pbMathRegC[op], pbMathRegC[op]);\r
-                       fprintf(fp, "                           cpu.z80F |= bPostORFlags[%s];\n", pbMathRegC[op]);\r
-               }\r
-               else\r
-               if (0x18 == dwOpcode)           // RR\r
-               {\r
-                       fprintf(fp, "                           bTemp2 = (cpu.z80F & Z80_FLAG_CARRY) << 7;\n");\r
-                       fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);\n");\r
-                       fprintf(fp, "                           cpu.z80F |= (%s & Z80_FLAG_CARRY);\n", pbMathRegC[op]);\r
-                       fprintf(fp, "                           %s = (%s >> 1) | bTemp2;\n", pbMathRegC[op], pbMathRegC[op]);\r
-                       fprintf(fp, "                           cpu.z80F |= bPostORFlags[%s];\n", pbMathRegC[op]);\r
-               }\r
-               else\r
-               if ((0x20 == dwOpcode) || (0x30 == dwOpcode))   // SLA/SRL\r
-               {\r
-                       fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);\n");\r
-                       fprintf(fp, "                           cpu.z80F |= (%s >> 7);\n", pbMathRegC[op]);\r
-                       fprintf(fp, "                           %s = (%s << 1);\n", pbMathRegC[op], pbMathRegC[op]);\r
-                       fprintf(fp, "                           cpu.z80F |= bPostORFlags[%s];\n", pbMathRegC[op]);\r
-               }\r
-               else\r
-               if (0x28 == dwOpcode)           // SRA\r
-               {\r
-                       fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);\n");\r
-                       fprintf(fp, "                           cpu.z80F |= (%s & Z80_FLAG_CARRY);\n", pbMathRegC[op]);\r
-                       fprintf(fp, "                           %s = (%s >> 1) | (%s & 0x80);\n", pbMathRegC[op], pbMathRegC[op], pbMathRegC[op]);\r
-                       fprintf(fp, "                           cpu.z80F |= bPostORFlags[%s];\n", pbMathRegC[op]);\r
-               }\r
-               else\r
-               if (0x38 == dwOpcode)           // SRL\r
-               {\r
-                       fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);\n");\r
-                       fprintf(fp, "                           cpu.z80F |= (%s & Z80_FLAG_CARRY);\n", pbMathRegC[op]);\r
-                       fprintf(fp, "                           %s = (%s >> 1);\n", pbMathRegC[op], pbMathRegC[op], pbMathRegC[op]);\r
-                       fprintf(fp, "                           cpu.z80F |= bPostORFlags[%s];\n", pbMathRegC[op]);\r
-               }\r
-               else\r
-               {\r
-                       InvalidInstructionC(2);\r
-               }\r
-\r
-               if (6 == op)                                            // (HL)?\r
-                       WriteValueToMemory("cpu.z80HL", "bTemp");\r
-       }\r
-       else\r
-               assert(0);\r
-}\r
-\r
-// ED Area\r
-\r
-void RRDRLDHandler(UINT32 dwOpcode)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               ReadValueFromMemory("bx", "dl");        // Get (HL)\r
-               fprintf(fp, "           mov     dh, dl  ; Put a copy in DH\n");\r
-\r
-               if (0x6f == dwOpcode)   // RLD\r
-               {\r
-                       fprintf(fp, "           shr     dh, 4   ; Get our upper nibble in position\n");\r
-                       fprintf(fp, "           shl     dl, 4   ; Get our lower nibble into the higher position\n");\r
-                       fprintf(fp, "           shl     ecx, 16 ; Save this for later\n");\r
-                       fprintf(fp, "           mov     cl, al\n");\r
-                       fprintf(fp, "           and     cl, 0fh\n       ; Only the lower nibble\n");\r
-                       fprintf(fp, "           or      dl, cl  ; OR In A->(HL) transfer\n");\r
-                       fprintf(fp, "           and     al, 0f0h        ; Only the upper 4 bits remain\n");\r
-                       fprintf(fp, "           or      al, dh  ; OR It in to our accumulator\n");\r
-                       fprintf(fp, "           shr     ecx, 16 ; Restore this\n");\r
-               }\r
-               else                    //      RRD\r
-               if (0x67 == dwOpcode)\r
-               {\r
-                       fprintf(fp, "           shr     dl, 4   ; Upper nibble to lower nibble\n");\r
-                       fprintf(fp, "           shl     ecx, 16 ; Save this\n");\r
-                       fprintf(fp, "           mov     cl, al\n");\r
-                       fprintf(fp, "           shl     cl, 4\n");\r
-                       fprintf(fp, "           or      dl, cl  ; OR In what was in A\n");\r
-                       fprintf(fp, "           and     al, 0f0h        ; Knock out lower part\n");\r
-                       fprintf(fp, "           and     dh, 0fh ; Only the lower nibble\n");\r
-                       fprintf(fp, "           or      al, dh  ; OR In our nibble\n");\r
-                       fprintf(fp, "           shr     ecx, 16 ; Restore this\n");\r
-               }\r
-               else    // Whoops!\r
-                       assert(0);\r
-\r
-               // This routine assumes that the new value to be placed at (HL) is in DL\r
-\r
-               fprintf(fp, "           and     ah, 29h ; Retain carry & two undefined bits\n");\r
-               fprintf(fp, "           mov     dh, ah  ; Store our flags away for later\n");\r
-\r
-               fprintf(fp, "           or      al, al  ; Get our flags\n");\r
-               fprintf(fp, "           lahf\n");\r
-               fprintf(fp, "           and     ah,0c4h ; Only partiy, zero, and sign\n");\r
-               fprintf(fp, "           or      ah, dh  ; OR In our old flags\n");\r
-\r
-               // Now go write the value back\r
-\r
-               WriteValueToMemory("bx", "dl");\r
-               fprintf(fp, "           xor     edx, edx        ; Zero out this for later\n");\r
-       \r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               if (0x67 == dwOpcode)   //      RRD\r
-               {\r
-                       ReadValueFromMemory("cpu.z80HL", "bTemp");\r
-                       fprintf(fp, "                           bTemp2 = (cpu.z80A & 0x0f) << 4;\n");\r
-                       fprintf(fp, "                           cpu.z80A = (cpu.z80A & 0xf0) | (bTemp & 0x0f);\n");\r
-                       fprintf(fp, "                           bTemp = (bTemp >> 4) | bTemp2;\n");\r
-\r
-                       WriteValueToMemory("cpu.z80HL", "bTemp");\r
-                       fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);\n");\r
-                       fprintf(fp, "                           cpu.z80F |= bPostORFlags[cpu.z80A];\n");\r
-               }\r
-               else\r
-               if (0x6f == dwOpcode)   // RLD\r
-               {\r
-                       ReadValueFromMemory("cpu.z80HL", "bTemp");\r
-\r
-                       fprintf(fp, "                           bTemp2 = (cpu.z80A & 0x0f);\n");\r
-                       fprintf(fp, "                           cpu.z80A = (cpu.z80A & 0xf0) | (bTemp >> 4);\n");\r
-                       fprintf(fp, "                           bTemp = (bTemp << 4) | bTemp2;\n");\r
-\r
-                       WriteValueToMemory("cpu.z80HL", "bTemp");\r
-                       fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);\n");\r
-                       fprintf(fp, "                           cpu.z80F |= bPostORFlags[cpu.z80A];\n");\r
-               }\r
-               else\r
-                       InvalidInstructionC(2);\r
-       }\r
-       else\r
-               assert(0);\r
-}\r
-\r
-void CPICPDCPIRCPDRHandler(UINT32 dwOpcode)\r
-{\r
-       UINT32 dwRepeatOb = 0;\r
-\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               if (dwOpcode == 0xb1 || dwOpcode == 0xb9)\r
-               {\r
-                       fprintf(fp, "cpRepeat%ld:\n", dwGlobalLabel);\r
-                       dwRepeatOb = dwGlobalLabel;\r
-                       ++dwGlobalLabel;\r
-               }\r
-\r
-               // Now go get the data from the source\r
-\r
-               ReadValueFromMemory("bx", "dl");\r
-\r
-               // Target data is in DL\r
-\r
-               fprintf(fp, "           mov     byte [_z80af], ah\n");\r
-               fprintf(fp, "           sahf\n");\r
-               fprintf(fp, "           cmp     al, dl  ; Do our comparison\n");\r
-               fprintf(fp, "           lahf\n");\r
-               fprintf(fp, "           and     ah, 0fah        ; No P/V or carry!\n");\r
-               fprintf(fp, "           dec     cx      ; Dec BC\n");\r
-               fprintf(fp, "           jz      notBcZero%ld\n", dwGlobalLabel);\r
-               fprintf(fp, "           or      ah, 04h ; P/V set when BC not zero\n");\r
-               fprintf(fp, "notBcZero%ld:\n", dwGlobalLabel);\r
-               fprintf(fp, "           or      ah, 02h ; N Gets set when we do compares\n");\r
-               fprintf(fp, "           mov     dl, byte [_z80af]\n");\r
-               fprintf(fp, "           and     dl, 01h\n");\r
-               fprintf(fp, "           or      ah, dl  ; Preserve carry!\n");\r
-       \r
-               if (dwOpcode == 0xa1 || dwOpcode == 0xb1)\r
-                       fprintf(fp, "           inc     bx      ; Increment!\n");\r
-               if (dwOpcode == 0xa9 || dwOpcode == 0xb9)\r
-                       fprintf(fp, "           dec     bx      ; Decrement!\n");\r
-\r
-               // Let's see if we repeat...\r
-       \r
-               if (dwOpcode == 0xb1 || dwOpcode == 0xb9)\r
-               {\r
-                       fprintf(fp, "           sahf\n");\r
-                       fprintf(fp, "           jz      BCDone%ld\n", dwRepeatOb);\r
-                       fprintf(fp, "           jnp     BCDone%ld\n", dwRepeatOb);\r
-\r
-                       if (FALSE == bNoTiming)\r
-                       {\r
-                               fprintf(fp, "           sub     edi, dword 21\n");\r
-                               fprintf(fp, "           js              BCDoneExit%ld\n", dwRepeatOb);\r
-                       }\r
-\r
-                       fprintf(fp, "           jmp     cpRepeat%ld\n", dwRepeatOb);\r
-\r
-                       fprintf(fp, "BCDoneExit%ld:\n", dwRepeatOb);\r
-                       fprintf(fp, "           sub     esi, 2  ;       Back up to the instruction again\n");\r
-                       fprintf(fp, "           jmp     noMoreExec\n\n");\r
-                       fprintf(fp, "BCDone%ld:\n", dwRepeatOb);\r
-               }\r
-       \r
-               fprintf(fp, "           xor     edx, edx\n");\r
-       \r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               if (0xb1 == dwOpcode || 0xb9 == dwOpcode)       // Repeat instruction?\r
-               {\r
-                       fprintf(fp, "                           while ((sdwCyclesRemaining >= 0) && (cpu.z80BC))\n");\r
-               }\r
-\r
-               fprintf(fp, "                           {\n");                  \r
-\r
-               ReadValueFromMemory("cpu.z80HL", "bTemp");\r
-\r
-               if (0xb1 == dwOpcode || 0xa1 == dwOpcode)\r
-               {\r
-                       fprintf(fp, "                           cpu.z80HL++;\n");\r
-                       fprintf(fp, "                           cpu.z80HL &= 0xffff;\n");\r
-               }\r
-               else\r
-               {\r
-                       fprintf(fp, "                           cpu.z80HL--;\n");\r
-                       fprintf(fp, "                           cpu.z80HL &= 0xffff;\n");\r
-               }\r
-\r
-               fprintf(fp, "                           cpu.z80BC--;\n");\r
-               fprintf(fp, "                           cpu.z80BC &= 0xffff;\n");\r
-\r
-               if (0xb1 == dwOpcode || 0xb9 == dwOpcode)       // Repeat?\r
-               {\r
-                       fprintf(fp, "                           sdwCyclesRemaining -= 16;\n");\r
-                       fprintf(fp, "                           if (cpu.z80A == bTemp)\n");\r
-                       fprintf(fp, "                           {\n");\r
-                       fprintf(fp, "                                   break;\n");\r
-                       fprintf(fp, "                           }\n");\r
-               }\r
-\r
-               fprintf(fp, "                           }\n");\r
-\r
-               // Now figure out what's going on\r
-\r
-               fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);\n");\r
-               fprintf(fp, "                           cpu.z80F |= (pbSubSbcTable[((UINT32) cpu.z80A << 8) | bTemp] & (Z80_FLAG_SIGN | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO));\n");\r
-               fprintf(fp, "                           if (cpu.z80BC)\n");\r
-               fprintf(fp, "                           {\n");\r
-               fprintf(fp, "                                   cpu.z80F |= Z80_FLAG_OVERFLOW_PARITY;\n");\r
-\r
-               fprintf(fp, "                           }\n");\r
-       }\r
-       else\r
-               assert(0);\r
-}\r
-\r
-void INIRINDRINIINDHandler(UINT32 dwOpcode)\r
-{\r
-       UINT32 dwTempLabel = 0;\r
-\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               dwTempLabel = dwGlobalLabel;\r
-               dwGlobalLabel++;\r
-\r
-               if (0xba == dwOpcode || 0xb2 == dwOpcode)\r
-                       fprintf(fp, "loopIt%ld:\n", dwTempLabel);\r
-\r
-               // Fetch what's at (C) and put it in (HL)\r
-\r
-               fprintf(fp, "           push    cx      ; Save BC\n");\r
-       \r
-               if (b16BitIo == FALSE)\r
-                       fprintf(fp, "           xor     ch, ch ; We want 8 bit ports\n");\r
-       \r
-               ReadValueFromIo("cx", "*dl");           // Put our value in DL\r
-               fprintf(fp, "           pop     cx      ; Restore BC\n");\r
-       \r
-               WriteValueToMemory("bx", "dl");\r
-       \r
-               if (0xa2 == dwOpcode || 0xb2 == dwOpcode)\r
-                       fprintf(fp, "           inc     bx      ; Increment HL\n");\r
-               else\r
-               if (0xaa == dwOpcode || 0xba == dwOpcode)\r
-                       fprintf(fp, "           dec     bx      ; Decrement HL\n");\r
-       \r
-               // Now we decrement B\r
-       \r
-               fprintf(fp, "           dec     ch      ; Decrement B (of C)\n");\r
-       \r
-               // Emit this instruction if we repeat\r
-       \r
-               if (0xba == dwOpcode || 0xb2 == dwOpcode)\r
-               {\r
-                       fprintf(fp, "           jz      near finalExit%ld\n", dwTempLabel);\r
-\r
-                       // Otherwise, we need to loop again\r
-\r
-                       if (FALSE == bNoTiming)\r
-                       {\r
-                               fprintf(fp, "           sub     edi, dword 21\n");\r
-                               fprintf(fp, "           js              loopExit%ld\n", dwTempLabel);\r
-                       }\r
-\r
-                       fprintf(fp, "           jmp     loopIt%ld\n\n", dwTempLabel);\r
-                       fprintf(fp, "loopExit%ld:\n", dwTempLabel);\r
-                       fprintf(fp, "           sub     esi, 2\n");\r
-                       fprintf(fp, "           jmp     noMoreExec\n\n");\r
-               }\r
-       \r
-               // Now let's fix up the flags\r
-\r
-               fprintf(fp, "finalExit%ld:\n", dwTempLabel);    \r
-               fprintf(fp, "           jnz     clearFlag%ld\n", dwTempLabel);\r
-               fprintf(fp, "           or      ah, 040h        ; Set the Zero flag!\n");\r
-               fprintf(fp, "           jmp     short continue%ld\n", dwTempLabel);\r
-               fprintf(fp, "clearFlag%ld:\n", dwTempLabel);\r
-               fprintf(fp, "           and     ah, 0bfh        ; Clear the zero flag\n");\r
-               fprintf(fp, "continue%ld:\n", dwTempLabel);\r
-               fprintf(fp, "           or      ah, 02h ; Set negative!\n");\r
-               fprintf(fp, "           xor     edx, edx\n");\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               if (0xb2 == dwOpcode || 0xba == dwOpcode)       // Repeat instruction?\r
-               {\r
-                       fprintf(fp, "                           while ((sdwCyclesRemaining > 0) && (cpu.z80B))\n");\r
-               }\r
-\r
-               fprintf(fp, "                           {\n");                  \r
-\r
-               ReadValueFromIo("cpu.z80B", "bTemp");\r
-               WriteValueToMemory("cpu.z80HL", "bTemp");\r
-\r
-               if (0xb2 == dwOpcode || 0xa2 == dwOpcode)\r
-               {\r
-                       fprintf(fp, "                           cpu.z80HL++;\n");\r
-                       fprintf(fp, "                           cpu.z80HL &= 0xffff;\n");\r
-               }\r
-               else\r
-               {\r
-                       fprintf(fp, "                           cpu.z80HL--;\n");\r
-                       fprintf(fp, "                           cpu.z80HL &= 0xffff;\n");\r
-               }\r
-\r
-               fprintf(fp, "                           sdwCyclesRemaining -= 16;\n");\r
-       \r
-               fprintf(fp, "                           cpu.z80B--;\n");\r
-               fprintf(fp, "                           }\n");\r
-\r
-               // Now figure out what's going on\r
-\r
-               fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);\n");\r
-               fprintf(fp, "                           cpu.z80F |= (bPostORFlags[bTemp] & (Z80_FLAG_SIGN | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY));\n");\r
-               fprintf(fp, "                           if (cpu.z80B)\n");\r
-               fprintf(fp, "                           {\n");\r
-               fprintf(fp, "                                   cpu.z80F |= Z80_FLAG_OVERFLOW_PARITY;\n");\r
-\r
-               fprintf(fp, "                                   pbPC -= 2;\n");\r
-\r
-               fprintf(fp, "                           }\n");\r
-       }\r
-       else\r
-               assert(0);\r
-}\r
-\r
-void OTIROTDROUTIOUTDHandler(UINT32 dwOpcode)\r
-{\r
-       UINT32 dwTempLabel = 0;\r
-\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               dwTempLabel = dwGlobalLabel;\r
-               dwGlobalLabel++;\r
-\r
-               if (0xbb == dwOpcode || 0xb3 == dwOpcode)\r
-                       fprintf(fp, "loopIt%ld:\n", dwTempLabel);\r
-\r
-               // Fetch what's at (HL) and put it in DL\r
-\r
-               ReadValueFromMemory("bx", "dl");\r
-\r
-               fprintf(fp, "           push    cx      ; Save BC\n");\r
-               if (b16BitIo == FALSE)\r
-                       fprintf(fp, "           xor     ch, ch  ; No 16 bit for this instruction!\n");\r
-               WriteValueToIo("cx", "dl");\r
-               fprintf(fp, "           pop     cx      ; Restore BC now that it has been \"OUT\"ed\n");\r
-       \r
-               if (0xa3 == dwOpcode || 0xb3 == dwOpcode)\r
-                       fprintf(fp, "           inc     bx      ; Increment HL\n");\r
-               else\r
-               if (0xab == dwOpcode || 0xbb == dwOpcode)\r
-                       fprintf(fp, "           dec     bx      ; Decrement HL\n");\r
-       \r
-               // Now we decrement B\r
-\r
-               fprintf(fp, "           dec     ch      ; Decrement B (of C)\n");\r
-       \r
-               // Emit this instruction if we repeat\r
-       \r
-               if (0xbb == dwOpcode || 0xb3 == dwOpcode)\r
-               {\r
-                       fprintf(fp, "           jz      near finalExit%ld\n", dwTempLabel);\r
-\r
-                       // Otherwise, we need to loop again\r
-\r
-                       if (FALSE == bNoTiming)\r
-                       {\r
-                               fprintf(fp, "           sub     edi, dword 21\n");\r
-                               fprintf(fp, "           js              loopExit%ld\n", dwTempLabel);\r
-                       }\r
-\r
-                       fprintf(fp, "           jmp     loopIt%ld\n\n", dwTempLabel);\r
-                       fprintf(fp, "loopExit%ld:\n", dwTempLabel);\r
-                       fprintf(fp, "           sub     esi, 2\n");\r
-                       fprintf(fp, "           jmp     noMoreExec\n\n");\r
-               }\r
-       \r
-               // Now let's fix up the flags\r
-\r
-               fprintf(fp, "finalExit%ld:\n", dwTempLabel);    \r
-               fprintf(fp, "           jnz     clearFlag%ld\n", dwTempLabel);\r
-               fprintf(fp, "           or      ah, 040h        ; Set the Zero flag!\n");\r
-               fprintf(fp, "           jmp     short continue%ld\n", dwTempLabel);\r
-               fprintf(fp, "clearFlag%ld:\n", dwTempLabel);\r
-               fprintf(fp, "           and     ah, 0bfh        ; Clear the zero flag\n");\r
-               fprintf(fp, "continue%ld:\n", dwTempLabel);\r
-               fprintf(fp, "           or      ah, 02h ; Set negative!\n");\r
-               fprintf(fp, "           xor     edx, edx\n");\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               if (0xb3 == dwOpcode || 0xbb == dwOpcode)       // Repeat instruction?\r
-               {\r
-                       fprintf(fp, "                           while ((sdwCyclesRemaining > 0) && (cpu.z80B))\n");\r
-               }\r
-\r
-               fprintf(fp, "                           {\n");\r
-               \r
-               ReadValueFromMemory("cpu.z80HL", "bTemp");\r
-               WriteValueToIo("cpu.z80BC", "bTemp");\r
-\r
-               if (0xb3 == dwOpcode || 0xa3 == dwOpcode)\r
-               {\r
-                       fprintf(fp, "                           cpu.z80HL++;\n");\r
-                       fprintf(fp, "                           cpu.z80HL &= 0xffff;\n");\r
-               }\r
-               else\r
-               {\r
-                       fprintf(fp, "                           cpu.z80HL--;\n");\r
-                       fprintf(fp, "                           cpu.z80HL &= 0xffff;\n");\r
-               }\r
-\r
-               fprintf(fp, "                           sdwCyclesRemaining -= 16;\n");\r
-       \r
-               fprintf(fp, "                           cpu.z80B--;\n");\r
-               fprintf(fp, "                           }\n");\r
-\r
-               // Now figure out what's going on\r
-\r
-               fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);\n");\r
-               fprintf(fp, "                           cpu.z80F |= (bPostORFlags[bTemp] & (Z80_FLAG_SIGN | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY));\n");\r
-               fprintf(fp, "                           if (cpu.z80B)\n");\r
-               fprintf(fp, "                           {\n");\r
-               fprintf(fp, "                                   cpu.z80F |= Z80_FLAG_OVERFLOW_PARITY;\n");\r
-\r
-               fprintf(fp, "                           }\n");\r
-       }\r
-       else\r
-               assert(0);\r
-}\r
-\r
-void AdcSbcRegpair(UINT32 dwOpcode)\r
-{\r
-       UINT8 bOp = 0;\r
-\r
-       bOp = (dwOpcode >> 4) & 0x03;\r
-\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               fprintf(fp, "           mov     dx, %s  ; Get our original register\n", pbRegPairs[bOp]);\r
-               fprintf(fp, "           mov     [_orgval], dx   ; Store this for later half carry computation\n");\r
-               fprintf(fp, "           mov     [_orgval2], bx  ; Store this, too\n");\r
-               fprintf(fp, "           sahf            ; Restore our flags\n");\r
-\r
-               if ((dwOpcode & 0xcf) == 0x4a)\r
-                       fprintf(fp, "           adc     bx, dx  ; Do the operation!\n");\r
-               else\r
-                       fprintf(fp, "           sbb     bx, dx  ; Do the operation!\n");\r
-\r
-               fprintf(fp, "           lahf            ; Get our new flags\n");\r
-       \r
-               if ((dwOpcode & 0xcf) != 0x4a)\r
-               {\r
-                       SetOverflow();\r
-                       fprintf(fp, "           and     ah, 0edh        ; Knock out negative & half carry flags\n");\r
-                       fprintf(fp, "           or      ah, 02h ; Negative!\n");\r
-                       fprintf(fp, "           mov     [_z80hl], bx\n");\r
-                       fprintf(fp, "           xor     bx, [_orgval]\n");\r
-                       fprintf(fp, "           xor     bx, [_orgval2]\n");\r
-                       fprintf(fp, "           and     bh, 10h ; Half carry?\n");\r
-                       fprintf(fp, "           or      ah, bh  ; OR It in if so\n");\r
-                       fprintf(fp, "           mov     bx, [_z80hl]\n");\r
-               }\r
-               else\r
-               {\r
-                       SetOverflow();\r
-                       fprintf(fp, "           and     ah, 0edh        ; Knock out negative & half carry flags\n");\r
-                       fprintf(fp, "           mov     [_z80hl], bx\n");\r
-                       fprintf(fp, "           xor     bx, [_orgval]\n");\r
-                       fprintf(fp, "           xor     bx, [_orgval2]\n");\r
-                       fprintf(fp, "           and     bh, 10h ; Half carry?\n");\r
-                       fprintf(fp, "           or      ah, bh  ; OR It in if so\n");\r
-                       fprintf(fp, "           mov     bx, [_z80hl]\n");\r
-               }\r
-\r
-               fprintf(fp, "           xor     edx, edx        ; Make sure we don't hose things\n");\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               if ((dwOpcode & 0xcf) == 0x4a)  // ADC\r
-               {\r
-                       fprintf(fp, "                           dwTemp = cpu.z80HL + %s + (cpu.z80F & Z80_FLAG_CARRY);\n", pbRegPairsC[bOp]);\r
-                       fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);\n");\r
-                       fprintf(fp, "                           cpu.z80F |= ((dwTemp >> 8) & Z80_FLAG_SIGN);\n");\r
-                       fprintf(fp, "                           if (0 == (dwTemp & 0xffff))\n");\r
-                       fprintf(fp, "                           {\n");\r
-                       fprintf(fp, "                                   cpu.z80F |= Z80_FLAG_ZERO;\n");\r
-                       fprintf(fp, "                           }\n");\r
-                       fprintf(fp, "                           cpu.z80F |= (((cpu.z80HL ^ dwTemp ^ %s) >> 8) & Z80_FLAG_HALF_CARRY);\n", pbRegPairsC[bOp]);\r
-                       fprintf(fp, "                           cpu.z80F |= ((((%s ^ cpu.z80HL ^ 0x8000) & (%s ^ dwTemp)) >> 13) & Z80_FLAG_OVERFLOW_PARITY);\n", pbRegPairsC[bOp], pbRegPairsC[bOp]);\r
-                       fprintf(fp, "                           cpu.z80F |= ((dwTemp >> 16) & Z80_FLAG_CARRY);\n");\r
-                       fprintf(fp, "                           cpu.z80HL = dwTemp & 0xffff;\n");\r
-                       return;\r
-               }\r
-               else                                                                            // SBC\r
-               {\r
-                       fprintf(fp, "                           dwTemp = cpu.z80HL - %s - (cpu.z80F & Z80_FLAG_CARRY);\n", pbRegPairsC[bOp]);\r
-                       fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);\n");\r
-                       fprintf(fp, "                           cpu.z80F |= ((dwTemp >> 8) & Z80_FLAG_SIGN);\n");\r
-                       fprintf(fp, "                           if (0 == (dwTemp & 0xffff))\n");\r
-                       fprintf(fp, "                           {\n");\r
-                       fprintf(fp, "                                   cpu.z80F |= Z80_FLAG_ZERO;\n");\r
-                       fprintf(fp, "                           }\n");\r
-                       fprintf(fp, "                           cpu.z80F |= (((cpu.z80HL ^ dwTemp ^ %s) >> 8) & Z80_FLAG_HALF_CARRY);\n", pbRegPairsC[bOp]);\r
-                       fprintf(fp, "                           cpu.z80F |= ((((%s ^ cpu.z80HL) & (%s ^ dwTemp)) >> 13) & Z80_FLAG_OVERFLOW_PARITY);\n", pbRegPairsC[bOp], pbRegPairsC[bOp]);\r
-                       fprintf(fp, "                           cpu.z80F |= ((dwTemp >> 16) & Z80_FLAG_CARRY);\n");\r
-                       fprintf(fp, "                           cpu.z80HL = dwTemp & 0xffff;\n");\r
-                       return;\r
-               }\r
-       }\r
-       else\r
-               assert(0);\r
-}\r
-\r
-void RetIRetNHandler(UINT32 dwOpcode)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               if (bThroughCallHandler)\r
-               {\r
-                       fprintf(fp, "           call    PopWord\n");\r
-                       fprintf(fp, "           xor     esi, esi\n");\r
-                       fprintf(fp, "           mov     si, dx\n");\r
-                       fprintf(fp,     "               add     esi, ebp\n");\r
-               }\r
-               else \r
-               {\r
-                       fprintf(fp,     "               mov     dx, word [_z80sp]       ; Get our current stack pointer\n");\r
-                       fprintf(fp, "           mov     si, [edx+ebp]   ; Get our return address\n");\r
-                       fprintf(fp, "           and     esi, 0ffffh             ; Only within 64K!\n");\r
-                       fprintf(fp,     "               add     esi, ebp                        ; Add in our base address\n");\r
-                       fprintf(fp,     "               add     word [_z80sp], 02h      ; Remove our two bytes from the stack\n");\r
-               }\r
-       \r
-               if (dwOpcode == 0x45)\r
-               {\r
-                       fprintf(fp, "           xor     edx, edx\n");\r
-                       fprintf(fp, "           mov     dl, [_z80iff]   ; Get interrupt flags\n");\r
-                       fprintf(fp, "           shr     dl, 1           ; Move IFF2->IFF1\n");\r
-                       fprintf(fp, "           and     [_z80iff], dword (~IFF1)        ; Get rid of IFF 1\n");\r
-                       fprintf(fp, "           and     dl, IFF1        ; Just want the IFF 1 value now\n");\r
-                       fprintf(fp, "           or      dword [_z80iff], edx\n");\r
-               }\r
-\r
-               fprintf(fp, "           xor     edx, edx        ; Make sure we don't hose things\n");\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               if (0x4d == dwOpcode)           // RETI\r
-               {\r
-                       fprintf(fp, "                           pbSP = cpu.z80Base + cpu.z80sp; /* Normalize our stack PTR */\n");\r
-                       fprintf(fp, "                           dwAddr = *pbSP++;       /* Pop LSB */\n");\r
-                       fprintf(fp, "                           dwAddr |= ((UINT32) *pbSP << 8);        /* Pop MSB */\n");\r
-                       fprintf(fp, "                           cpu.z80sp += 2; /* Pop the word off */\n");\r
-                       fprintf(fp, "                           pbPC = (cpu.z80Base + dwAddr);  /* Point PC to our return address */\n");\r
-               }\r
-               else\r
-               if (0x45 == dwOpcode)           // RETN\r
-               {\r
-                       fprintf(fp, "                           pbSP = cpu.z80Base + cpu.z80sp; /* Normalize our stack PTR */\n");\r
-                       fprintf(fp, "                           dwAddr = *pbSP++;       /* Pop LSB */\n");\r
-                       fprintf(fp, "                           dwAddr |= ((UINT32) *pbSP << 8);        /* Pop MSB */\n");\r
-                       fprintf(fp, "                           cpu.z80sp += 2; /* Pop the word off */\n");\r
-                       fprintf(fp, "                           pbPC = (cpu.z80Base + dwAddr);  /* Point PC to our return address */\n");\r
-                       fprintf(fp, "                           cpu.z80iff &= ~(IFF1);  /* Keep IFF2 around */\n");\r
-                       fprintf(fp, "                           cpu.z80iff |= ((cpu.z80iff >> 1) & IFF1);       /* IFF2->IFF1 */\n");\r
-               }\r
-               else\r
-               {\r
-                       InvalidInstructionC(2);\r
-               }\r
-       }\r
-       else\r
-               assert(0);\r
-}\r
-\r
-void ExtendedOutHandler(UINT32 dwOpcode)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               if (b16BitIo == FALSE)\r
-                       fprintf(fp, "           mov     dl, cl  ; Address in DX... (C)\n");\r
-               else\r
-                       fprintf(fp, "           mov     dx, cx  ; Address in DX... (BC)\n");\r
-       \r
-               WriteValueToIo("dx", pbMathReg[(dwOpcode >> 3) & 0x07]);\r
-\r
-               fprintf(fp, "           xor     edx, edx\n");\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               if (b16BitIo == FALSE)\r
-                       fprintf(fp, "                           dwAddr = cpu.z80C;\n");\r
-               else\r
-                       fprintf(fp, "                           dwAddr = cpu.z80BC;\n");\r
-\r
-               WriteValueToIo("dwAddr", pbMathRegC[(dwOpcode >> 3) & 0x07]);\r
-       }\r
-       else\r
-               assert(0);\r
-}\r
-\r
-void ExtendedInHandler(UINT32 dwOpcode)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               if (b16BitIo == FALSE)\r
-                       fprintf(fp, "           mov     dl, cl  ; Address in DX... (C)\n");\r
-               else\r
-                       fprintf(fp, "           mov     dx, cx  ; Address in DX... (BC)\n");\r
-       \r
-               ReadValueFromIo("dx", pbMathReg[(dwOpcode >> 3) & 0x07]);\r
-\r
-               fprintf(fp, ";\n; Remember, this variant of the IN instruction modifies the flags\n;\n\n");\r
-               fprintf(fp, "           sahf    ; Restore our flags\n");\r
-               fprintf(fp, "           mov     dh, ah  ; Save flags for later\n");\r
-       \r
-               if (0x50 == dwOpcode || 0x58 == dwOpcode)\r
-               {\r
-                       fprintf(fp, "           mov     dl, %s\n", pbMathReg[(dwOpcode >> 3) & 0x07]);\r
-                       fprintf(fp, "           or      dl, dl\n");\r
-               }\r
-               else\r
-                       fprintf(fp, "           or      %s, %s;\n", pbMathReg[(dwOpcode >> 3) & 0x07], pbMathReg[(dwOpcode >> 3) & 0x07]);\r
-\r
-               fprintf(fp, "           lahf\n");\r
-               fprintf(fp, "           and     dh, 029h        ; Only keep carry and two unused flags\n");\r
-               fprintf(fp, "           and     ah, 0d4h\n");\r
-               fprintf(fp, "           or      ah, dh\n");\r
-\r
-               fprintf(fp, "           xor     edx, edx\n");\r
-\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               if (b16BitIo == FALSE)\r
-                       fprintf(fp, "                           dwAddr = cpu.z80C;\n");\r
-               else\r
-                       fprintf(fp, "                           dwAddr = cpu.z80BC;\n");\r
-\r
-               ReadValueFromIo("dwAddr", pbMathRegC[(dwOpcode >> 3) & 0x07]);\r
-\r
-               // Set flags!\r
-\r
-               fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);\n");\r
-               fprintf(fp, "                           cpu.z80F |= bPostORFlags[%s];\n", pbMathRegC[(dwOpcode >> 3) & 0x07]);\r
-       }\r
-       else\r
-               assert(0);\r
-}\r
-\r
-void NegHandler(UINT32 dwOpcode)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               fprintf(fp, "           sahf\n");\r
-               fprintf(fp, "           sub     dh, al\n");\r
-               fprintf(fp, "           lahf\n");\r
-               fprintf(fp, "           mov     al, dh\n");\r
-       \r
-               SetOverflow();\r
-               fprintf(fp, "           or      ah, 02h\n");\r
-               fprintf(fp, "           xor     edx, edx\n");\r
-\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               SetSubFlagsSZHVC("0", "cpu.z80A");\r
-               fprintf(fp, "                           cpu.z80A = 0 - cpu.z80A;\n");\r
-       }\r
-       else\r
-               assert(0);\r
-}\r
-\r
-void ExtendedRegIntoMemory(UINT32 dwOpcode)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               fprintf(fp, "           mov     dx, [esi]       ; Get our address to write to\n");\r
-               fprintf(fp, "           add     esi, 2          ; Next address, please...\n");\r
-\r
-               if (dwOpcode == 0x43)\r
-                       WriteValueToMemory("dx", "cl");\r
-               if (dwOpcode == 0x53)\r
-                       WriteValueToMemory("dx", "byte [_z80de]");\r
-               if (dwOpcode == 0x63)\r
-                       WriteValueToMemory("dx", "bl");\r
-               if (dwOpcode == 0x73)\r
-                       WriteValueToMemory("dx", "byte [_z80sp]");\r
-\r
-               fprintf(fp, "           inc     dx\n");\r
-\r
-               if (dwOpcode == 0x43)\r
-                       WriteValueToMemory("dx", "ch");\r
-               if (dwOpcode == 0x53)\r
-                       WriteValueToMemory("dx", "byte [_z80de + 1]");\r
-               if (dwOpcode == 0x63)\r
-                       WriteValueToMemory("dx", "bh");\r
-               if (dwOpcode == 0x73)\r
-                       WriteValueToMemory("dx", "byte [_z80sp + 1]");\r
-       \r
-               fprintf(fp, "           xor     edx, edx        ; Zero our upper word\n");\r
-\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "           dwTemp = *pbPC++;\n");\r
-               fprintf(fp, "           dwTemp |= ((UINT32) *pbPC++ << 8);\n");\r
-\r
-               if (0x43 == dwOpcode)           //      LD (xxxxh), BC\r
-                       WriteWordToMemory("dwTemp", "cpu.z80BC");\r
-               if (0x53 == dwOpcode)           //      LD (xxxxh), DE\r
-                       WriteWordToMemory("dwTemp", "cpu.z80DE");\r
-               if (0x63 == dwOpcode)           //      LD (xxxxh), HL\r
-                       WriteWordToMemory("dwTemp", "cpu.z80HL");\r
-               if (0x73 == dwOpcode)           //      LD (xxxxh), SP\r
-                       WriteWordToMemory("dwTemp", "cpu.z80sp");\r
-       }\r
-       else\r
-               assert(0);\r
-}\r
-\r
-void LdRegpair(UINT32 dwOpcode)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               fprintf(fp, "           mov     dx, [esi]       ; Get address to load\n");\r
-               fprintf(fp, "           add     esi, 2  ; Skip over it so we don't execute it\n");\r
-       \r
-               if (dwOpcode == 0x4b)\r
-                       ReadValueFromMemory("dx", "cl");\r
-               if (dwOpcode == 0x5b)\r
-                       ReadValueFromMemory("dx", "byte [_z80de]");\r
-               if (dwOpcode == 0x7b)\r
-                       ReadValueFromMemory("dx", "byte [_z80sp]");\r
-       \r
-               fprintf(fp, "           inc     dx\n");\r
-       \r
-               if (dwOpcode == 0x4b)\r
-                       ReadValueFromMemory("dx", "ch");\r
-               if (dwOpcode == 0x5b)\r
-                       ReadValueFromMemory("dx", "byte [_z80de + 1]");\r
-               if (dwOpcode == 0x7b)\r
-                       ReadValueFromMemory("dx", "byte [_z80sp + 1]");\r
-\r
-               fprintf(fp, "           xor     edx, edx\n");\r
-\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "           dwTemp = *pbPC++;\n");\r
-               fprintf(fp, "           dwTemp |= ((UINT32) *pbPC++ << 8);\n");\r
-\r
-               if (0x4b == dwOpcode)\r
-                       ReadWordFromMemory("dwTemp", "cpu.z80BC");\r
-               if (0x5b == dwOpcode)\r
-                       ReadWordFromMemory("dwTemp", "cpu.z80DE");\r
-               if (0x7b == dwOpcode)\r
-                       ReadWordFromMemory("dwTemp", "cpu.z80sp");\r
-       }\r
-       else\r
-               assert(0);\r
-}\r
-\r
-void LDILDRLDIRLDDRHandler(UINT32 dwOpcode)\r
-{\r
-       UINT32 dwOrgGlobal = 0;\r
-\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               if (dwOpcode == 0xb0 || dwOpcode == 0xb8)\r
-               {\r
-                       dwOrgGlobal = dwGlobalLabel;\r
-                       fprintf(fp, "ldRepeat%ld:\n", dwGlobalLabel);\r
-               }\r
-\r
-               ReadValueFromMemory("bx", "dl");        \r
-\r
-               // Here we write the byte back to the target\r
-       \r
-               WriteValueToMemory("[_z80de]", "dl");\r
-\r
-               // Now we decide what to do\r
-       \r
-               if ((dwOpcode & 0x0f) == 0)\r
-               {\r
-                       fprintf(fp, "           inc     bx      ; Increment HL\n");\r
-                       fprintf(fp, "           inc     word [_z80de]   ; Increment DE\n");\r
-               }\r
-               else\r
-               {\r
-                       fprintf(fp, "           dec     bx      ; Decrement HL\n");\r
-                       fprintf(fp, "           dec     word [_z80de]   ; Decrement DE\n");\r
-               }\r
-       \r
-               fprintf(fp, "           dec     cx      ; Decrement BC\n");\r
-       \r
-               if (dwOpcode == 0xb0 || dwOpcode == 0xb8)\r
-               {\r
-                       if (FALSE == bNoTiming)\r
-                       {\r
-                               fprintf(fp, "           jz      noMore%ld\n", dwGlobalLabel);\r
-                               fprintf(fp, "           sub     edi, dword 16   ; 16 T-States per iteration\n");\r
-                               fprintf(fp, "           js      noMore%ld\n", dwGlobalLabel);\r
-                       }\r
-                       else\r
-                       {\r
-                               fprintf(fp, "           jz      noMore%ld\n", dwGlobalLabel);\r
-                       }\r
-       \r
-                       fprintf(fp, "           jmp     ldRepeat%ld ; Loop until we're done!\n", dwOrgGlobal);\r
-                       fprintf(fp, "noMore%ld:\n", dwGlobalLabel);\r
-               }\r
-       \r
-               fprintf(fp, "           and     ah, 0e9h ; Knock out H & N and P/V\n");\r
-               fprintf(fp, "           or              cx, cx  ; Flag BC\n");\r
-               fprintf(fp, "           jz      atZero%ld ; We're done!\n", dwGlobalLabel);\r
-       \r
-               if (dwOpcode == 0xb0 || dwOpcode == 0xb8)\r
-               {\r
-                       // It's a repeat, so let's readjust ESI, shall we?\r
-       \r
-                       fprintf(fp, "           or      ah, 04h ; Non-zero - we're still going!\n");\r
-                       fprintf(fp, "           sub     esi, 2  ; Adjust back to the beginning of the instruction\n");\r
-                       fprintf(fp, "           jmp     noMoreExec\n\n");\r
-               }\r
-               else\r
-               if (dwOpcode == 0xa0 || dwOpcode == 0xa8)\r
-               {\r
-                       fprintf(fp, "           or      ah, 04h ; Non-zero - we're still going!\n");\r
-               }\r
-       \r
-               fprintf(fp, "atZero%ld:\n", dwGlobalLabel);\r
-               ++dwGlobalLabel;\r
-       \r
-               fprintf(fp, "           xor     edx, edx        ; Make sure we don't hose things\n");\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               // This is the actual move\r
-\r
-               if (0xb0 == dwOpcode || 0xb8 == dwOpcode)       // Repeat instruction?\r
-               {\r
-                       fprintf(fp, "                           while ((sdwCyclesRemaining > 0) && (cpu.z80BC))\n");\r
-\r
-                       fprintf(fp, "                           {\n");                  \r
-               }\r
-\r
-               ReadValueFromMemory("cpu.z80HL", "bTemp");\r
-               WriteValueToMemory("cpu.z80DE", "bTemp");\r
-\r
-               if ((dwOpcode & 0x0f) == 0)\r
-               {\r
-                       fprintf(fp, "                                   ++cpu.z80HL;\n");\r
-                       fprintf(fp, "                                   ++cpu.z80DE;\n");\r
-               }\r
-               else                            \r
-               {\r
-                       fprintf(fp, "                                   --cpu.z80HL;\n");\r
-                       fprintf(fp, "                                   --cpu.z80DE;\n");\r
-               }\r
-\r
-               fprintf(fp, "                           --cpu.z80BC;\n");\r
-               fprintf(fp, "                           cpu.z80HL &= 0xffff;\n");\r
-               fprintf(fp, "                           cpu.z80DE &= 0xffff;\n");\r
-               fprintf(fp, "                           cpu.z80BC &= 0xffff;\n");\r
-\r
-               if (0xb0 == dwOpcode || 0xb8 == dwOpcode)       // Repeat instruction?\r
-               {\r
-                       fprintf(fp, "                           sdwCyclesRemaining -= 21;\n");\r
-\r
-                       fprintf(fp, "                           }\n");\r
-               }\r
-\r
-               // Time for a flag fixup!\r
-\r
-               fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY);\n");\r
-               fprintf(fp, "                           if (cpu.z80BC)\n");\r
-               fprintf(fp, "                           {\n");\r
-\r
-               if (0xb0 == dwOpcode || 0xb8 == dwOpcode)\r
-               {\r
-                       fprintf(fp, "                                   pbPC -= 2;      /* Back up so we hit this instruction again */\n");\r
-               }\r
-\r
-               fprintf(fp, "                                   cpu.z80F |= Z80_FLAG_OVERFLOW_PARITY;\n");\r
-               fprintf(fp, "                           }\n");\r
-\r
-               if (0xb0 == dwOpcode || 0xb8 == dwOpcode)       // Repeat instruction?\r
-               {\r
-                       fprintf(fp, "                           sdwCyclesRemaining -= 16;\n");\r
-               }\r
-       }\r
-       else\r
-               assert(0);\r
-}\r
-\r
-void IMHandler(UINT32 dwOpcode)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               if (dwOpcode == 0x46)\r
-                       fprintf(fp, "           mov     dword [_z80interruptMode], 0 ; IM 0\n");\r
-\r
-               if (dwOpcode == 0x56)\r
-               {\r
-                       fprintf(fp, "           mov     dword [_z80interruptMode], 1 ; Interrupt mode 1\n");\r
-                       fprintf(fp, "           mov     word [_z80intAddr], 038h        ; Interrupt mode 1 cmd!\n");\r
-               }\r
-\r
-               if (dwOpcode == 0x5e)\r
-                       fprintf(fp, "           mov     dword [_z80interruptMode], 2 ; IM 2\n");\r
-\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               if (0x46 == dwOpcode)           // IM 0\r
-                       fprintf(fp, "                           cpu.z80interruptMode = 0;\n");\r
-\r
-               if (0x56 == dwOpcode)           // IM 1\r
-               {\r
-                       fprintf(fp, "                           cpu.z80interruptMode = 1;\n");\r
-                       fprintf(fp, "                           cpu.z80intAddr = 0x38;\n");\r
-               }\r
-\r
-               if (0x5e == dwOpcode)           // IM 2\r
-                       fprintf(fp, "                           cpu.z80interruptMode = 2;\n");\r
-       }\r
-       else\r
-               assert(0);\r
-       \r
-}\r
-\r
-void IRHandler(UINT32 dwOpcode)\r
-{\r
-   char *src, *dst;\r
-\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-          switch(dwOpcode) \r
-               {\r
-               case 0x57:  \r
-                               dst = "al"; src="[_z80i]"; break;\r
-                  case 0x5F:  \r
-                               dst = "al"; src="[_z80r]"; break;\r
-                  case 0x47:  \r
-                               dst = "[_z80i]"; src="al"; break;\r
-                  case 0x4F:  \r
-                               dst = "[_z80r]"; src="al"; break;\r
-          }\r
-\r
-          ProcBegin(dwOpcode);\r
-\r
-          fprintf(fp, "           mov     %s, %s\n",dst,src);\r
-       \r
-               if (dwOpcode == 0x5f)\r
-               {\r
-                       fprintf(fp, "           and     ah, 029h        ; No N, H, Z, or S!\n");\r
-                       fprintf(fp, "           or      al,al   ; Get appropriate flags\n");\r
-                       fprintf(fp, "           o16 pushf\n");\r
-                       fprintf(fp, "           pop     dx\n");\r
-                       fprintf(fp, "           and     dl, 0c0h\n");\r
-                       fprintf(fp, "           or      ah, dl  ; OR In our S & Z flags\n");\r
-       \r
-                       fprintf(fp, "           mov     dl, [_z80iff]\n");\r
-                       fprintf(fp, "           and     dl, IFF2\n");\r
-                       fprintf(fp, "           shl     dl, 1\n");\r
-                       fprintf(fp, "           or      ah, dl\n");\r
-\r
-                       // Randomize R\r
-\r
-                       fprintf(fp, "           mov     edx, [dwLastRSample]\n");\r
-                       fprintf(fp, "           sub     edx, edi\n");\r
-                       fprintf(fp, "           add     edx, [_z80rCounter]\n");\r
-                       fprintf(fp, "           shr     edx, 2\n");\r
-                       fprintf(fp, "           and     edx, 07fh\n");\r
-                       fprintf(fp, "           and     byte [_z80r], 80h\n");\r
-                       fprintf(fp, "           or              byte [_z80r], dl\n");\r
-\r
-                       fprintf(fp, "           xor     edx, edx\n");\r
-                       fprintf(fp, "           mov     [dwLastRSample], edi\n");\r
-               }\r
-\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               if (0x5f == dwOpcode)           // LD A, R\r
-               {\r
-                       fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);\n");\r
-                       fprintf(fp, "                           cpu.z80F |= bPostORFlags[cpu.z80r];\n");\r
-                       fprintf(fp, "                           cpu.z80F = (cpu.z80F & ~(Z80_FLAG_OVERFLOW_PARITY)) | ((cpu.z80iff & IFF2) << 1);\n");\r
-                       fprintf(fp, "                           cpu.z80A = cpu.z80r;\n");\r
-\r
-                       // Now randomize a little\r
-\r
-                       fprintf(fp, "                           bTemp = (cpu.z80r + (cpu.z80B + sdwCyclesRemaining + 1 + cpu.z80H)) ^ cpu.z80A;\n");\r
-                       fprintf(fp, "                           cpu.z80r = (cpu.z80r & 0x80) | (bTemp & 0x7f);\n");\r
-               }\r
-               else\r
-               if (0x47 == dwOpcode)           // LD I, A\r
-               {\r
-                       fprintf(fp, "                           cpu.z80i = cpu.z80A;\n");\r
-               }\r
-               else\r
-               if (0x57 == dwOpcode)           // LD A, I\r
-               {\r
-                       fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO | Z80_FLAG_SIGN);\n");\r
-                       fprintf(fp, "                           cpu.z80F |= ((cpu.z80iff & IFF2) << 1);\n");\r
-                       fprintf(fp, "                           cpu.z80A = cpu.z80i;\n");\r
-                       fprintf(fp, "                           cpu.z80F |= bPostORFlags[cpu.z80A];\n");\r
-               }\r
-               else\r
-               if (0x4f == dwOpcode)           // LD R, A\r
-               {\r
-                       fprintf(fp, "                           cpu.z80r = cpu.z80A;\n");\r
-               }\r
-               else\r
-               {\r
-                       InvalidInstructionC(2);\r
-               }\r
-       }\r
-       else\r
-               assert(0);\r
-}\r
-\r
-// DD/FD Area\r
-\r
-void DDFDCBHandler(UINT32 dwOpcode)\r
-{\r
-       UINT32 dwData = 0;\r
-\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               fprintf(fp, "%sInst%.2x:\n", majorOp, dwOpcode);\r
-               fprintf(fp, "           mov     dx, [esi]       ; Get our instruction (and offset)\n");\r
-               fprintf(fp, "           add     esi, 2  ; Increment our PC\n");\r
-\r
-               fprintf(fp, "           mov     byte [_orgval], dl ; Store our value\n");\r
-               fprintf(fp, "           or      dl, dl\n");\r
-               fprintf(fp, "           js      notNeg%ld\n", dwGlobalLabel);\r
-               fprintf(fp, "           mov     byte [_orgval + 1], 00h;\n");\r
-\r
-               fprintf(fp, "           jmp     short jumpHandler%ld\n", dwGlobalLabel);\r
-               fprintf(fp, "notNeg%ld:\n", dwGlobalLabel);\r
-               fprintf(fp, "           mov     byte [_orgval + 1], 0ffh;       It's negative\n");\r
-               fprintf(fp, "jumpHandler%ld:\n", dwGlobalLabel++);\r
-               fprintf(fp, "           shl     ebx, 16 ; Save BX away\n");\r
-               fprintf(fp, "           mov     bx, [_z80%s]\n", mz80Index);\r
-               fprintf(fp, "           add     [_orgval], bx\n");\r
-               fprintf(fp, "           shr     ebx, 16 ; Restore BX\n");\r
-               fprintf(fp, "           mov     dl, dh  ; Get our instruction\n");\r
-               fprintf(fp, "           xor     dh, dh  ; Zero this\n");\r
-               fprintf(fp, "           jmp     dword [z80ddfdcbInstructions+edx*4]\n\n");\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               if (strcmp("cpu.z80IX", mz80Index) == 0)\r
-                       dwData = 0;\r
-               else\r
-                       dwData = 1;\r
-\r
-               fprintf(fp, "                           DDFDCBHandler(%d);\n", dwData);\r
-       }\r
-       else\r
-               assert(0);\r
-}\r
-\r
-void LoadIndexReg(UINT32 dwOpcode)\r
-{\r
-       UINT8 string[150];\r
-\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               sprintf(string, "[_z80%s]", mz80Index);\r
-\r
-               fprintf(fp, "           mov     dx, [esi]        ; Get our address to store\n");\r
-               fprintf(fp, "           add     esi, 2\n");\r
-\r
-               ReadWordFromMemory("dx", string);\r
-               fprintf(fp, "           xor     edx, edx\n");\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "                           dwAddr = *pbPC++;\n");\r
-               fprintf(fp, "                           dwAddr |= ((UINT32) *pbPC++ << 8);\n");\r
-               ReadWordFromMemory("dwAddr", mz80Index);\r
-       }\r
-       else\r
-               assert(0);\r
-}\r
-\r
-void StoreIndexReg(UINT32 dwOpcode)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               fprintf(fp, "           mov     dx, [esi]        ; Get our address to store\n");\r
-               fprintf(fp, "           add     esi, 2\n");\r
-               fprintf(fp, "           mov     [_orgval], dx\n");\r
-\r
-               fprintf(fp, "           mov     dl, [_z80%s]\n", mz80Index);\r
-               WriteValueToMemory("[_orgval]", "dl");\r
-\r
-               fprintf(fp, "           inc     word [_orgval]\n");\r
-\r
-               fprintf(fp, "           mov     dl, [_z80%s + 1]\n", mz80Index);\r
-               WriteValueToMemory("[_orgval]", "dl");\r
-               fprintf(fp, "           xor     edx, edx\n");\r
-       \r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "                           dwAddr = *pbPC++;\n");\r
-               fprintf(fp, "                           dwAddr |= ((UINT32) *pbPC++ << 8);\n");\r
-               WriteWordToMemory("dwAddr", mz80Index);\r
-       }\r
-       else\r
-               assert(0);\r
-}\r
-\r
-void LdIndexPtrReg(UINT32 dwOpcode)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               IndexedOffset(mz80Index);\r
-\r
-               // DX Contains the address\r
-\r
-               WriteValueToMemory("dx", pbMathReg[dwOpcode & 0x07]);\r
-               fprintf(fp, "           xor     edx, edx\n");\r
-\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "                           sdwAddr = (INT8) *pbPC++;       // Get the offset\n");\r
-               fprintf(fp, "                           sdwAddr = ((INT32) %s + sdwAddr) & 0xffff;\n", mz80Index);\r
-\r
-               WriteValueToMemory("sdwAddr", pbMathRegC[dwOpcode & 0x07]);\r
-       }\r
-       else\r
-               assert(0);\r
-}\r
-\r
-void UndocMathIndex(UINT32 dwOpcode)\r
-{\r
-       UINT32 dwOpcode1 = 0;\r
-       UINT8 *pbIndexReg = NULL;\r
-\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               if (dwOpcode & 1)\r
-                       fprintf(fp, "           mov     dl, byte [_z80%s]\n", mz80Index);\r
-               else\r
-                       fprintf(fp, "           mov     dl, byte [_z80%s + 1]\n", mz80Index);\r
-\r
-               // Info is in DL - let's do the math operation\r
-\r
-               fprintf(fp, "           sahf            ; Store our flags in x86 flag reg\n");\r
-\r
-               dwOpcode1 = (dwOpcode & 0xf8);  // Only the operation\r
-\r
-               if (dwOpcode1 == 0x80)\r
-                       fprintf(fp, "           add     al, dl\n");\r
-               else\r
-               if (dwOpcode1 == 0x88)\r
-                       fprintf(fp, "           adc     al, dl\n");\r
-               else\r
-               if (dwOpcode1 == 0x90)\r
-                       fprintf(fp, "           sub     al, dl\n");\r
-               else\r
-               if (dwOpcode1 == 0x98)\r
-                       fprintf(fp, "           sbb     al, dl\n");\r
-               else\r
-               if (dwOpcode1 == 0xa0)\r
-                       fprintf(fp, "           and     al, dl\n");\r
-               else\r
-               if (dwOpcode1 == 0xa8)\r
-                       fprintf(fp, "           xor     al, dl\n");\r
-               else\r
-               if (dwOpcode1 == 0xb0)\r
-                       fprintf(fp, "           or      al, dl\n");\r
-               else\r
-               if (dwOpcode1 == 0xb8)\r
-                       fprintf(fp, "           cmp     al, dl\n");\r
-               else\r
-                       assert(0);\r
-\r
-               fprintf(fp, "           lahf            ; Get flags back into AH\n");\r
-\r
-               if (dwOpcode1 != 0xa8 && dwOpcode1 != 0xa0 && dwOpcode1 != 0xb0)\r
-               {\r
-                       SetOverflow();\r
-               }\r
-\r
-               if (dwOpcode1 == 0xa8)\r
-                       fprintf(fp, "           and     ah, 0ech        ; Only these flags matter!\n");\r
-\r
-               if (dwOpcode1 == 0xa0)\r
-               {\r
-                       fprintf(fp, "           and     ah, 0ech        ; Only these flags matter!\n");\r
-                       fprintf(fp, "           or      ah, 010h        ; Half carry gets set\n");\r
-               }\r
-\r
-               if (dwOpcode1 == 0xb0)\r
-                       fprintf(fp, "           and     ah, 0ech ; No H, N, or C\n");\r
-       \r
-               if (dwOpcode1 == 0xb8)\r
-                       fprintf(fp, "           or      ah, 02h ; Negative gets set on a compare\n");\r
-       \r
-               if (dwOpcode1 == 0x80 || dwOpcode1 == 0x88)\r
-                       fprintf(fp, "           and     ah, 0fdh ; No N!\n");\r
-       \r
-               if (dwOpcode1 == 0x90 || dwOpcode1 == 0x98)\r
-                       fprintf(fp, "           or      ah, 02h ; N Gets set!\n");\r
-       \r
-               if (dwOpcode1 == 0xb0)\r
-                       fprintf(fp, "           and     ah, 0ech ; No H, N, or C\n");\r
-       \r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               if (dwOpcode & 1)\r
-                       pbIndexReg = mz80IndexHalfLow;\r
-               else\r
-                       pbIndexReg = mz80IndexHalfHigh;\r
-\r
-               dwOpcode1 = (dwOpcode & 0xf8);  // Only the operation\r
-\r
-               if (0x80 == dwOpcode1)  // ADD\r
-               {\r
-                       fprintf(fp, "                           bTemp2 = cpu.z80A + %s;\n", pbIndexReg);\r
-                       SetAddFlagsSZHVC("cpu.z80A", pbIndexReg);\r
-               }\r
-               else\r
-               if (0x88 == dwOpcode1)  // ADC\r
-               {\r
-                       fprintf(fp, "                           bTemp2 = cpu.z80A + %s + (cpu.z80F & Z80_FLAG_CARRY);\n", pbIndexReg);\r
-                       SetAdcFlagsSZHVC("cpu.z80A", pbIndexReg);\r
-               }\r
-               else\r
-               if (0x90 == dwOpcode1)  // SUB\r
-               {\r
-                       fprintf(fp, "                           bTemp2 = cpu.z80A - %s;\n", pbIndexReg);\r
-                       SetSubFlagsSZHVC("cpu.z80A", pbIndexReg);\r
-               }\r
-               else                                                            \r
-               if (0x98 == dwOpcode1)  // SBC\r
-               {\r
-                       fprintf(fp, "                           bTemp2 = cpu.z80A - %s - (cpu.z80F & Z80_FLAG_CARRY);\n", pbIndexReg);\r
-                       SetSbcFlagsSZHVC("cpu.z80A", pbIndexReg);\r
-               }\r
-               else\r
-               if (0xa0 == dwOpcode1)  // AND\r
-               {\r
-                       fprintf(fp, "                           cpu.z80A &= %s;\n", pbIndexReg);\r
-                       fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);\n");\r
-                       fprintf(fp, "                           cpu.z80F |= bPostANDFlags[cpu.z80A];\n\n");\r
-               }\r
-               else\r
-               if (0xa8 == dwOpcode1)  // XOR\r
-               {\r
-                       fprintf(fp, "                           cpu.z80A ^= %s;\n", pbIndexReg);\r
-                       fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);\n");\r
-                       fprintf(fp, "                           cpu.z80F |= bPostORFlags[cpu.z80A];\n\n");\r
-               }\r
-               else\r
-               if (0xb0 == dwOpcode1)  // OR\r
-               {\r
-                       fprintf(fp, "                           cpu.z80A |= %s;\n", pbIndexReg);\r
-                       fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);\n");\r
-                       fprintf(fp, "                           cpu.z80F |= bPostORFlags[cpu.z80A];\n\n");\r
-               }\r
-               else\r
-               if (0xb8 == dwOpcode1)  // CP - Don't do anything! Just flags!\r
-               {\r
-                       fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);\n");\r
-                       fprintf(fp, "                           cpu.z80F |= bPostORFlags[cpu.z80A];\n\n");\r
-               }\r
-               else\r
-               {\r
-                       assert(0);\r
-               }\r
-\r
-               InvalidInstructionC(2);\r
-       }\r
-       else\r
-               assert(0);\r
-}\r
-\r
-void UndocLoadHalfIndexReg(UINT32 dwOpcode)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               fprintf(fp, "           mov     dl, [esi]       ; Get immediate byte to load\n");\r
-               fprintf(fp, "           inc     esi     ; Next byte\n");\r
-\r
-               if (dwOpcode == 0x26)\r
-                       fprintf(fp, "           mov     byte [_z80%s + 1], dl\n", mz80Index);\r
-               if (dwOpcode == 0x2e)\r
-                       fprintf(fp, "           mov     byte [_z80%s], dl\n", mz80Index);\r
-\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               if (dwOpcode & 0x08)\r
-                       fprintf(fp, "                   %s = *pbPC++;\n", mz80IndexHalfLow);\r
-               else\r
-                       fprintf(fp, "                   %s = *pbPC++;\n", mz80IndexHalfHigh);\r
-       }\r
-       else\r
-               assert(0);\r
-}\r
-\r
-void UndocIncDecIndexReg(UINT32 dwOpcode)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               fprintf(fp, "           sahf\n");\r
-\r
-               if (dwOpcode == 0x24)\r
-                       fprintf(fp, "           inc     byte [_z80%s + 1]\n", mz80Index);\r
-               if (dwOpcode == 0x25)\r
-                       fprintf(fp, "           dec     byte [_z80%s + 1]\n", mz80Index);\r
-\r
-               if (dwOpcode == 0x2c)\r
-                       fprintf(fp, "           inc     byte [_z80%s]\n", mz80Index);\r
-               if (dwOpcode == 0x2d)\r
-                       fprintf(fp, "           dec     byte [_z80%s]\n", mz80Index);\r
-\r
-               fprintf(fp,     "               lahf\n");\r
-               SetOverflow();\r
-\r
-               if ((0x24 == dwOpcode) || (0x2c == dwOpcode))\r
-                       fprintf(fp, "           and     ah, 0fdh        ; Knock out N!\n");\r
-               else\r
-                       fprintf(fp, "           or      ah, 02h ; Set negative!\n");\r
-\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);\n");\r
-\r
-               if (0x24 == dwOpcode || 0x2c == dwOpcode)\r
-               {\r
-                       if (dwOpcode & 0x08)\r
-                               fprintf(fp, "                           cpu.z80F |= bPostIncFlags[%s++];\n", mz80IndexHalfLow);\r
-                       else    \r
-                               fprintf(fp, "                           cpu.z80F |= bPostIncFlags[%s++];\n", mz80IndexHalfHigh);\r
-               }\r
-               else\r
-               {\r
-                       if (dwOpcode & 0x08)\r
-                               fprintf(fp, "                           cpu.z80F |= bPostDecFlags[%s--];\n", mz80IndexHalfLow);\r
-                       else    \r
-                               fprintf(fp, "                           cpu.z80F |= bPostDecFlags[%s--];\n", mz80IndexHalfHigh);\r
-               }\r
-       }\r
-       else\r
-               assert(0);\r
-}\r
-\r
-void ExIndexed(UINT32 dwOpcode)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               if( bThroughCallHandler )\r
-               {\r
-                       fprintf(fp, "           mov dx, word [_z80%s]\n", mz80Index);\r
-                       fprintf(fp, "           push dx\n");\r
-                       fprintf(fp, "           call PopWord\n");\r
-                       fprintf(fp, "           mov     [_z80%s], dx\n", mz80Index);\r
-                       fprintf(fp, "           pop dx\n");\r
-                       fprintf(fp, "           mov [_wordval], dx\n" );\r
-                       fprintf(fp, "           call PushWord\n" );\r
-               }  \r
-               else  \r
-               {\r
-                       fprintf(fp, "           mov     [cyclesRemaining], edi\n");\r
-                       fprintf(fp, "           mov     dx, word [_z80sp]\n");\r
-                       fprintf(fp, "           xor     edi, edi\n");\r
-                       fprintf(fp, "           mov     di, [_z80%s]\n", mz80Index);\r
-                       fprintf(fp, "           xchg    di, [ebp+edx]\n");\r
-                       fprintf(fp, "           mov     [_z80%s], di\n", mz80Index);\r
-                       fprintf(fp, "           xor     edx, edx\n");\r
-                       fprintf(fp, "           mov     edi, [cyclesRemaining]\n");\r
-               }\r
-\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               ReadWordFromMemory("cpu.z80sp", "dwAddr");\r
-               WriteWordToMemory("cpu.z80sp", mz80Index);\r
-               fprintf(fp, "                           %s = dwAddr;\n", mz80Index);\r
-       }\r
-       else\r
-               assert(0);\r
-}\r
-\r
-void IncDecIndexReg(UINT32 dwOpcode)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               if (dwOpcode == 0x23)\r
-                       fprintf(fp, "           inc     word [_z80%s]   ; Increment our mz80Index register\n", mz80Index);\r
-               else\r
-                       fprintf(fp, "           dec     word [_z80%s]   ; Increment our mz80Index register\n", mz80Index);\r
-\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               if (0x23 == dwOpcode)\r
-               {\r
-                       fprintf(fp, "                           %s++;\n", mz80Index);\r
-               }\r
-               else\r
-               {\r
-                       fprintf(fp, "                           %s--;\n", mz80Index);\r
-               }\r
-\r
-               fprintf(fp, "                           %s &= 0xffff;\n", mz80Index);\r
-       }\r
-       else\r
-               assert(0);\r
-}\r
-\r
-void LdRegIndexOffset(UINT32 dwOpcode)\r
-{\r
-       UINT32 dwOpcode1 = 0;\r
-\r
-       dwOpcode1 = (dwOpcode & 0x38) >> 3;\r
-       \r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               IndexedOffset(mz80Index);\r
-       \r
-               ReadValueFromMemory("dx", pbMathReg[dwOpcode1]);\r
-       \r
-               fprintf(fp, "           xor     edx, edx        ; Make sure we don't hose things\n");\r
-               dwGlobalLabel++;\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "                           sdwAddr = (INT8) *pbPC++;       // Get the offset\n");\r
-               fprintf(fp, "                           sdwAddr = ((INT32) %s + sdwAddr) & 0xffff;\n", mz80Index);\r
-\r
-               ReadValueFromMemory("sdwAddr", pbMathRegC[dwOpcode1]);\r
-       }\r
-       else\r
-               assert(0);\r
-}\r
-\r
-void LdByteToIndex(UINT32 dwOpcode)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               fprintf(fp, "           mov     dx, [esi]       ; Get our address\n");\r
-               fprintf(fp, "           add     esi, 2  ; Skip over our storage bytes\n");\r
-               fprintf(fp, "           mov     [cyclesRemaining], edi\n");\r
-               fprintf(fp, "           mov     di, dx  ; Store it here for later\n");\r
-               fprintf(fp, "           xor     dh, dh\n");\r
-               fprintf(fp, "           or      dl, dl\n");\r
-               fprintf(fp, "           jns     noNegate%ld\n", dwGlobalLabel);\r
-               fprintf(fp, "           dec     dh\n");\r
-               fprintf(fp, "noNegate%ld:\n", dwGlobalLabel);\r
-               fprintf(fp, "           add     dx, [_z80%s]    ; Add in our index\n", mz80Index);\r
-               fprintf(fp, "           mov     [_orgval], dx   ; Store our address to write to\n");\r
-               fprintf(fp, "           mov     dx, di\n");\r
-               fprintf(fp, "           xchg    dh, dl\n");\r
-               fprintf(fp, "           mov     edi, [cyclesRemaining]\n");\r
-       \r
-               WriteValueToMemory("[_orgval]", "dl");\r
-       \r
-               fprintf(fp, "           xor     edx, edx\n");\r
-               ++dwGlobalLabel;\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "                           sdwAddr = (INT8) *pbPC++;       // Get the offset\n");\r
-               fprintf(fp, "                           sdwAddr = ((INT32) %s + sdwAddr) & 0xffff;\n", mz80Index);\r
-\r
-               WriteValueToMemory("sdwAddr", "*pbPC++");\r
-       }\r
-       else\r
-               assert(0);\r
-}\r
-\r
-\r
-void SPToIndex(UINT32 dwOpcode)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               fprintf(fp, "           mov     dx, [_z80%s] ; Get our source register\n", mz80Index);\r
-               fprintf(fp, "           mov     word [_z80sp], dx       ; Store our new SP\n");\r
-               fprintf(fp, "           xor     edx, edx\n");\r
-\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "                           cpu.z80sp = %s;\n", mz80Index);\r
-       }\r
-       else\r
-               assert(0);\r
-}\r
-\r
-void AddIndexHandler(UINT32 dwOpcode)\r
-{\r
-       UINT8 bRegPair;\r
-\r
-       bRegPair = dwOpcode >> 4;\r
-\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               fprintf(fp, "           mov     dh, ah  ; Get our flags\n");\r
-               fprintf(fp, "           and     dh, 0ech        ; Preserve the top three and bits 2 & 3\n");\r
-\r
-               fprintf(fp, "           mov     [cyclesRemaining], edi\n");\r
-               fprintf(fp, "           mov     di, [_z80%s]    ; Get our value\n", mz80Index);\r
-               fprintf(fp, "           mov     [_orgval], di   ; Store our original value\n");\r
-               fprintf(fp, "           add     di, %s\n", pbIndexedRegPairs[(dwOpcode & 0x30) >> 4]);\r
-               fprintf(fp, "           lahf\n");\r
-               fprintf(fp, "           mov     [_z80%s], di    ; Store our register back\n", mz80Index);\r
-\r
-               fprintf(fp, "           mov     di, [_orgval]   ; Get original\n");\r
-               fprintf(fp, "           xor     di, word [_z80%s] ; XOR It with our computed value\n", mz80Index);\r
-               fprintf(fp, "           xor     di, %s\n", pbIndexedRegPairs[(dwOpcode & 0x30) >> 4]);\r
-               fprintf(fp, "           and     di, 1000h       ; Just our half carry\n");\r
-               fprintf(fp, "           or              dx, di  ; Or in our flags\n");\r
-               fprintf(fp, "           and     ah, 01h ; Just carry\n");\r
-               fprintf(fp, "           or      ah, dh\n");\r
-               fprintf(fp, "           mov     edi, [cyclesRemaining]\n");\r
-               fprintf(fp, "           xor     edx, edx\n");\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               if (bRegPair != 2)\r
-               { \r
-                       fprintf(fp, "                   cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY);\n");\r
-                       fprintf(fp, "                   dwTemp = %s + %s;\n", mz80Index, pbRegPairsC[bRegPair]);\r
-                       fprintf(fp, "                   cpu.z80F |= ((dwTemp >> 16) & Z80_FLAG_CARRY) | (((%s ^ dwTemp ^ %s) >> 8) & Z80_FLAG_HALF_CARRY);\n", mz80Index, pbRegPairsC[bRegPair]);\r
-                       fprintf(fp, "                   %s = dwTemp & 0xffff;\n", mz80Index);\r
-               }\r
-               else\r
-               {\r
-                       fprintf(fp, "                   cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY);\n");\r
-                       fprintf(fp, "                   dwTemp = %s + %s;\n", mz80Index, mz80Index);\r
-                       fprintf(fp, "                   cpu.z80F |= ((dwTemp >> 16) & Z80_FLAG_CARRY) | (((%s ^ dwTemp ^ %s) >> 8) & Z80_FLAG_HALF_CARRY);\n", mz80Index, pbRegPairsC[bRegPair]);\r
-                       fprintf(fp, "                   %s = dwTemp & 0xffff;\n", mz80Index);\r
-               }\r
-       }\r
-       else\r
-               assert(0);\r
-}\r
-\r
-void JPIXIYHandler(UINT32 dwOpcode)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               fprintf(fp, "           mov     dx, [_z80%s]    ; Get our value\n", mz80Index);\r
-               fprintf(fp, "           mov     esi, edx                ; New PC!\n");\r
-               fprintf(fp, "           add     esi, ebp                ; Add in our base\n");\r
-               fprintf(fp, "           xor     edx, edx\n");\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "                           pbPC = cpu.z80Base + %s;\n", mz80Index);\r
-       }\r
-       else\r
-               assert(0);\r
-}\r
-\r
-void IncDecIndexed(UINT32 dwOpcode)\r
-{\r
-       UINT8 szIndex[30];\r
-\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               IndexedOffset(mz80Index);\r
-\r
-               fprintf(fp, "           mov     [_orgval], dx\n");\r
-\r
-               ReadValueFromMemory("dx", "dl");\r
-\r
-               fprintf(fp, "           sahf\n");\r
-\r
-               if (dwOpcode == 0x34)\r
-                       fprintf(fp, "           inc     dl\n");\r
-               else\r
-                       fprintf(fp, "           dec     dl\n");\r
-               fprintf(fp, "           lahf\n");\r
-\r
-               fprintf(fp, "           o16     pushf\n");\r
-               fprintf(fp, "           shl     edx, 16\n");\r
-               fprintf(fp, "           and     ah, 0fbh        ;       Knock out parity/overflow\n");\r
-               fprintf(fp, "           pop     dx\n");\r
-               fprintf(fp, "           and     dh, 08h ; Just the overflow\n");\r
-               fprintf(fp, "           shr     dh, 1   ; Shift it into position\n");\r
-               fprintf(fp, "           or      ah, dh  ; OR It in with the real flags\n");\r
-\r
-               fprintf(fp, "           shr     edx, 16\n");\r
-\r
-               if (dwOpcode == 0x34)\r
-                       fprintf(fp, "           and     ah, 0fdh        ; Knock out N!\n");\r
-               else\r
-                       fprintf(fp, "           or              ah, 02h ; Make it N!\n");\r
-\r
-               WriteValueToMemory("[_orgval]", "dl");\r
-\r
-               fprintf(fp, "           xor     edx, edx\n");\r
-\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "                           sdwAddr = (INT8) *pbPC++;       /* Get LSB first */\n");\r
-               fprintf(fp, "                           dwAddr = (sdwAddr + (INT32) %s) & 0xffff;\n", mz80Index);\r
-\r
-               ReadValueFromMemory("dwAddr", "bTemp");\r
-\r
-               fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);\n");\r
-               \r
-               if (0x34 == dwOpcode)\r
-               {\r
-                       fprintf(fp ,"                           cpu.z80F |= bPostIncFlags[bTemp++];\n");\r
-               }\r
-               else\r
-               {\r
-                       fprintf(fp ,"                           cpu.z80F |= bPostDecFlags[bTemp--];\n");\r
-               }\r
-       \r
-               WriteValueToMemory("dwAddr", "bTemp");\r
-       }\r
-       else\r
-               assert(0);\r
-}\r
-\r
-void MathOperationIndexed(UINT32 dwOpcode)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               IndexedOffset(mz80Index);\r
-               ReadValueFromMemory("dx", "dl");\r
-\r
-               fprintf(fp, "           sahf\n");\r
-\r
-               if (dwOpcode == 0x86)           // Add\r
-                       fprintf(fp, "           add     al, dl\n");\r
-               if (dwOpcode == 0x8e)           // Adc\r
-                       fprintf(fp, "           adc     al, dl\n");\r
-               if (dwOpcode == 0x96)           // Sub\r
-                       fprintf(fp, "           sub     al, dl\n");\r
-               if (dwOpcode == 0x9e)           // Sbc\r
-                       fprintf(fp, "           sbb     al, dl\n");\r
-               if (dwOpcode == 0xa6)           // And\r
-                       fprintf(fp, "           and     al, dl\n");\r
-               if (dwOpcode == 0xae)           // Xor\r
-                       fprintf(fp, "           xor     al, dl\n");\r
-               if (dwOpcode == 0xb6)           //      Or\r
-                       fprintf(fp, "           or      al, dl\n");\r
-               if (dwOpcode == 0xbe)           // Cp\r
-                       fprintf(fp, "           cmp     al, dl\n");\r
-\r
-               fprintf(fp, "           lahf\n");\r
-\r
-               if (dwOpcode == 0x86 || dwOpcode == 0x8e)\r
-               {\r
-                       SetOverflow();\r
-                       fprintf(fp, "           and     ah, 0fdh        ; Knock out negative\n");\r
-               }\r
-\r
-               if (dwOpcode == 0x96 || dwOpcode == 0x9e || dwOpcode == 0xbe)\r
-               {\r
-                       SetOverflow();\r
-                       fprintf(fp, "           or      ah, 02h ; Set negative\n");\r
-               }\r
-\r
-               if (dwOpcode == 0xae || dwOpcode == 0xb6)\r
-                       fprintf(fp, "           and     ah, 0ech        ; Knock out H, N, and C\n");\r
-\r
-               if (dwOpcode == 0xa6)\r
-               {\r
-                       fprintf(fp, "           and     ah,0fch ; Knock out N & C\n");\r
-                       fprintf(fp, "           or      ah, 10h ; Set half carry\n");\r
-               }\r
-\r
-               fprintf(fp, "           xor     edx, edx\n");\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "                           sdwAddr = (INT8) *pbPC++;       /* Get LSB first */\n");\r
-               fprintf(fp, "                           dwAddr = (sdwAddr + (INT32) %s) & 0xffff;\n", mz80Index);\r
-\r
-               ReadValueFromMemory("dwAddr", "bTemp");\r
-\r
-               if (0x86 == dwOpcode)           // ADD A, (IX/IY+nn)\r
-               {\r
-                       SetAddFlagsSZHVC("cpu.z80A", "bTemp");\r
-                       fprintf(fp, "                           cpu.z80A += bTemp;\n");\r
-               }\r
-               else\r
-               if (0x8e == dwOpcode)           // ADC A, (IX/IY+nn)\r
-               {\r
-                       fprintf(fp, "                           bTemp2 = (cpu.z80F & Z80_FLAG_CARRY);\n");\r
-                       SetAdcFlagsSZHVC("cpu.z80A", "bTemp");\r
-                       fprintf(fp, "                           cpu.z80A += bTemp + bTemp2;\n");\r
-               }\r
-               else\r
-               if (0x96 == dwOpcode)           // SUB A, (IX/IY+nn)\r
-               {\r
-                       SetSubFlagsSZHVC("cpu.z80A", "bTemp");\r
-                       fprintf(fp, "                           cpu.z80A -= bTemp;\n");\r
-               }\r
-               else\r
-               if (0x9e == dwOpcode)           // SBC A, (IX/IY+nn)\r
-               {\r
-                       fprintf(fp, "                           bTemp2 = cpu.z80A;\n");\r
-                       fprintf(fp, "                           cpu.z80A = cpu.z80A - bTemp - (cpu.z80F & Z80_FLAG_CARRY);\n");\r
-                       SetSbcFlagsSZHVC("bTemp2", "bTemp");\r
-               }\r
-               else\r
-               if (0xa6 == dwOpcode)           // AND A, (IX/IY+nn)\r
-               {\r
-                       fprintf(fp, "                           cpu.z80A &= bTemp;\n");\r
-                       fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);\n");\r
-                       fprintf(fp, "                           cpu.z80F |= bPostANDFlags[cpu.z80A];\n\n");\r
-               }\r
-               else\r
-               if (0xae == dwOpcode)           // XOR A, (IX/IY+nn)\r
-               {\r
-                       fprintf(fp, "                           cpu.z80A ^= bTemp;\n");\r
-                       fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);\n");\r
-                       fprintf(fp, "                           cpu.z80F |= bPostORFlags[cpu.z80A];\n\n");\r
-               }\r
-               else\r
-               if (0xb6 == dwOpcode)           // OR A, (IX/IY+nn)\r
-               {\r
-                       fprintf(fp, "                           cpu.z80A |= bTemp;\n");\r
-                       fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);\n");\r
-                       fprintf(fp, "                           cpu.z80F |= bPostORFlags[cpu.z80A];\n\n");\r
-               }\r
-               else\r
-               if (0xbe == dwOpcode)           // CP A, (IX/IY+nn)\r
-               {\r
-                       SetSubFlagsSZHVC("cpu.z80A", "bTemp");\r
-               }\r
-               else\r
-                       InvalidInstructionC(2);\r
-       }\r
-       else\r
-               assert(0);\r
-}\r
-\r
-void UndocIndexToReg(UINT32 dwOpcode)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               if ((dwOpcode & 0x07) == 2 || (dwOpcode & 0x07) == 3)\r
-                       fprintf(fp, "   mov     dx, [_z80de]    ; Get DE\n");\r
-\r
-               if ((dwOpcode & 0x07) == 4)\r
-                       fprintf(fp, "   mov     dh, byte [_z80%s + 1]\n", mz80Index);\r
-               if ((dwOpcode & 0x07) == 5)\r
-                       fprintf(fp, "   mov     dl, byte [_z80%s]\n", mz80Index);\r
-\r
-               fprintf(fp, "           mov   byte [_z80%s + %ld], %s\n", mz80Index, 1 - ((dwOpcode & 0x08) >> 3), pbLocalReg[dwOpcode & 0x07]);\r
-               fprintf(fp, "           xor     edx, edx\n");\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               if (dwOpcode != 0x64 && dwOpcode != 0x65 && dwOpcode != 0x6c && dwOpcode != 0x6d)\r
-               {\r
-                       if (dwOpcode & 0x08)\r
-                               fprintf(fp, "                   %s = %s;\n", mz80IndexHalfLow, pbLocalRegC[dwOpcode & 0x07]);\r
-                       else\r
-                               fprintf(fp, "                   %s = %s;\n", mz80IndexHalfHigh, pbLocalRegC[dwOpcode & 0x07]);\r
-               }\r
-               else            // IX/IY High/low weirdness afoot...\r
-               {\r
-                       // We don't generate any code for ld indexH, indexH and ld indexL, indexL\r
-\r
-                       if (0x65 == dwOpcode)           // LD indexH, indexL\r
-                       {\r
-                               fprintf(fp, "                   %s = %s;\n", mz80IndexHalfHigh, mz80IndexHalfLow);\r
-                       }\r
-                       else\r
-                       if (0x6c == dwOpcode)           // LD indexH, indexL\r
-                       {\r
-                               fprintf(fp, "                   %s = %s;\n", mz80IndexHalfLow, mz80IndexHalfHigh);\r
-                       }\r
-               }\r
-       }\r
-       else\r
-               assert(0);\r
-}\r
-\r
-void UndocRegToIndex(UINT32 dwOpcode)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               if ((dwOpcode & 0x38) == 0x10 || (dwOpcode & 0x38) == 0x18)\r
-                       fprintf(fp, "           mov     dx, [_z80de]    ; Get a usable copy of DE here\n");\r
-\r
-               fprintf(fp, "           mov     %s, byte [_z80%s + %ld]\n", pbLocalReg[(dwOpcode >> 3) & 0x07], mz80Index, 1 - (dwOpcode & 1));\r
-\r
-               if ((dwOpcode & 0x38) == 0x10 || (dwOpcode & 0x38) == 0x18)\r
-                       fprintf(fp, "           mov     [_z80de], dx    ; Put it back!\n");\r
-\r
-               fprintf(fp, "           xor     edx, edx\n");\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               if (dwOpcode & 1)\r
-                       fprintf(fp, "                   %s = %s;\n", pbLocalRegC[(dwOpcode >> 3) & 0x07], mz80IndexHalfLow);\r
-               else\r
-                       fprintf(fp, "                   %s = %s;\n", pbLocalRegC[(dwOpcode >> 3) & 0x07], mz80IndexHalfHigh);\r
-       }\r
-       else\r
-               assert(0);\r
-}\r
-\r
-void LoadImmediate(UINT32 dwOpcode)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-\r
-               fprintf(fp, "           mov     dx, [esi]       ; Get our word to load\n");\r
-               fprintf(fp, "           add     esi, 2  ; Advance past the word\n");\r
-               fprintf(fp, "           mov     [_z80%s], dx ; Store our new value\n", mz80Index);\r
-               fprintf(fp, "           xor     edx, edx\n");\r
-\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "           %s = *pbPC++;\n", mz80Index);\r
-               fprintf(fp, "           %s |= ((UINT32) *pbPC++ << 8);\n", mz80Index);\r
-       }\r
-       else\r
-               assert(0);\r
-}\r
-\r
-void PushPopOperationsIndexed(UINT32 dwOpcode)\r
-{\r
-       UINT8 bRegPair;\r
-       UINT8 bRegBaseLsb[25];\r
-       UINT8 bRegBaseMsb[25];\r
-       UINT8 string[150];\r
-\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               sprintf(bRegBaseLsb, "byte [_z80%s]", mz80Index);\r
-               sprintf(bRegBaseMsb, "byte [_z80%s + 1]", mz80Index);\r
-\r
-               sprintf(string, "[_z80%s]", mz80Index);\r
-\r
-               ProcBegin(dwOpcode);\r
-\r
-               if (dwOpcode == 0xe5)   // Push IX/IY\r
-               {\r
-                       fprintf(fp, "           sub     word [_z80sp], 2\n");\r
-                       fprintf(fp, "           mov     dx, [_z80sp]\n");\r
-       \r
-                       WriteWordToMemory("dx", string);                \r
-               }\r
-               else    // Pop\r
-               {\r
-                       fprintf(fp, "           mov     dx, [_z80sp]\n");\r
-                       ReadWordFromMemory("dx", string);\r
-                       fprintf(fp, "           add     word [_z80sp], 2\n");\r
-               }       \r
-\r
-               fprintf(fp, "           xor     edx, edx\n");\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               if (0xe5 == dwOpcode)   // Push IX/IY\r
-               {\r
-                       fprintf(fp, "                                   cpu.z80sp -= 2;\n");\r
-                       fprintf(fp, "                                   pbSP = (cpu.z80Base + cpu.z80sp);       /* Normalize the stack pointer */\n");\r
-                       \r
-                       WriteWordToMemory("cpu.z80sp", mz80Index);\r
-               }\r
-               else\r
-               if (0xe1 == dwOpcode)   // Pop IX/IY\r
-               {\r
-                       ReadWordFromMemory("cpu.z80sp", mz80Index);\r
-\r
-                       fprintf(fp, "                                   cpu.z80sp += 2;\n");\r
-                       fprintf(fp, "                                   pbSP = (cpu.z80Base + cpu.z80sp);       /* Normalize the stack pointer */\n");\r
-                       return;\r
-               }\r
-       }\r
-       else\r
-               assert(0);\r
-}\r
-\r
-// DDFD XXCB Instructions\r
-\r
-void ddcbBitWise(UINT32 dwOpcode)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               ProcBegin(dwOpcode);\r
-       \r
-               // NOTE: _orgval contains the address to get from. It includes the offset\r
-               // already computed plus the mz80Index register.\r
-\r
-               // Read our byte\r
-\r
-               fprintf(fp, "           mov     dx, [_orgval]   ; Get our target address\n");\r
-               ReadValueFromMemory("dx", "dl");\r
-\r
-               // Do the operation\r
-\r
-               if (dwOpcode != 0x06 && dwOpcode != 0x0e &&\r
-                        dwOpcode != 0x16 && dwOpcode != 0x1e &&\r
-                        dwOpcode != 0x26 && dwOpcode != 0x2e &&\r
-                        dwOpcode != 0x3e && (dwOpcode & 0xc7) != 0x86 &&\r
-                        (dwOpcode & 0xc7) != 0xc6)\r
-               {\r
-                       fprintf(fp, "           mov     dh, ah  ; Store our original flags\n");\r
-                       fprintf(fp, "           and     dh, 29h ; Keep our old flags\n");\r
-               }\r
-\r
-               if ((dwOpcode & 0xc7) != 0x86 && (dwOpcode & 0xc7) != 0xc6)\r
-                       fprintf(fp, "           sahf            ; Restore our flags\n");\r
-\r
-               if (dwOpcode == 0x06)\r
-                       fprintf(fp, "           rol     dl, 1\n");\r
-               if (dwOpcode == 0x0e)\r
-                       fprintf(fp, "           ror     dl, 1\n");\r
-               if (dwOpcode == 0x16)\r
-                       fprintf(fp, "           rcl     dl, 1\n");\r
-               if (dwOpcode == 0x1e)\r
-                       fprintf(fp, "           rcr     dl, 1\n");\r
-               if (dwOpcode == 0x26)\r
-                       fprintf(fp, "           shl     dl, 1\n");\r
-               if (dwOpcode == 0x2e)\r
-                       fprintf(fp, "           sar     dl, 1\n");\r
-               if (dwOpcode == 0x3e)\r
-                       fprintf(fp, "           shr     dl, 1\n");\r
-\r
-               // BIT, AND, and OR\r
-\r
-               if ((dwOpcode & 0xc7) == 0x46)\r
-                       fprintf(fp, "           test    dl, 0%.2xh      ; Is it set?\n", (1 << ((dwOpcode >> 3) & 0x07)));\r
-               else\r
-               if ((dwOpcode & 0xc7) == 0x86)\r
-                       fprintf(fp, "           and     dl, 0%.2xh      ; Reset the bit\n", \r
-                                               0xff - (1 << ((dwOpcode >> 3) & 0x07)));\r
-               else\r
-               if ((dwOpcode & 0xc7) == 0xc6)\r
-                       fprintf(fp, "           or      dl, 0%.2xh      ; Set the bit\n",\r
-                                               (1 << ((dwOpcode >> 3) & 0x07)));\r
-       \r
-               if ((dwOpcode & 0xc7) != 0x86 && (dwOpcode & 0xc7) != 0xc6)\r
-                       fprintf(fp, "           lahf            ; Get our flags back\n");  \r
-\r
-               // Do the flag fixup (if any)\r
-\r
-               if (dwOpcode == 0x26 || dwOpcode == 0x2e || ((dwOpcode & 0xc7) == 0x46))\r
-                       fprintf(fp, "           and     ah, 0edh        ; No Half carry or negative!\n");\r
-       \r
-               if (dwOpcode == 0x06 || dwOpcode == 0x0e ||\r
-                        dwOpcode == 0x16 || dwOpcode == 0x1e ||\r
-                        dwOpcode == 0x3e)\r
-                       fprintf(fp, "           and     ah, 0edh        ; Knock out H & N\n");\r
-\r
-               // BIT!\r
-\r
-               if ((dwOpcode & 0xc7) == 0x46)\r
-               {\r
-                       fprintf(fp, "           or      ah, 10h ; OR In our half carry\n");\r
-                       fprintf(fp, "           and     ah, 0d0h ; New flags\n");\r
-                       fprintf(fp, "           or      ah, dh  ; OR In our old flags\n");\r
-               }\r
-\r
-               // Now write our data back if it's not a BIT instruction\r
-\r
-               if ((dwOpcode & 0xc7) != 0x46)  // If it's not a BIT, write it back\r
-                       WriteValueToMemory("[_orgval]", "dl");\r
-       \r
-               fprintf(fp, "           xor     edx, edx\n");\r
-               FetchNextInstruction(dwOpcode);\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               if (0x06 == dwOpcode)           // RLC\r
-               {\r
-                       fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);\n");\r
-                       fprintf(fp, "                           bTemp2 = (bTemp >> 7);\n");\r
-                       fprintf(fp, "                           bTemp = (bTemp << 1) | bTemp2;\n");\r
-                       fprintf(fp, "                           cpu.z80F |= bTemp2 | bPostORFlags[bTemp];\n");\r
-                       WriteValueToMemory("dwAddr", "bTemp");\r
-               }\r
-               else\r
-               if (0x0e == dwOpcode)           // RRC\r
-               {\r
-                       fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);\n");\r
-                       fprintf(fp, "                           cpu.z80F |= (bTemp & Z80_FLAG_CARRY);\n");\r
-                       fprintf(fp, "                           bTemp = (bTemp >> 1) | (bTemp << 7);\n");\r
-                       fprintf(fp, "                           cpu.z80F |= bPostORFlags[bTemp];\n");\r
-                       WriteValueToMemory("dwAddr", "bTemp");\r
-               }\r
-               else\r
-               if (0x16 == dwOpcode)           // RL\r
-               {\r
-                       fprintf(fp, "                           bTemp2 = cpu.z80F & Z80_FLAG_CARRY;\n");\r
-                       fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);\n");\r
-                       fprintf(fp, "                           cpu.z80F |= (bTemp >> 7);\n");\r
-                       fprintf(fp, "                           bTemp = (bTemp << 1) | bTemp2;\n");\r
-                       fprintf(fp, "                           cpu.z80F |= bPostORFlags[bTemp];\n");\r
-                       WriteValueToMemory("dwAddr", "bTemp");\r
-               }\r
-               else\r
-               if (0x1e == dwOpcode)           // RR\r
-               {\r
-                       fprintf(fp, "                           bTemp2 = (cpu.z80F & Z80_FLAG_CARRY) << 7;\n");\r
-                       fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);\n");\r
-                       fprintf(fp, "                           cpu.z80F |= (bTemp & Z80_FLAG_CARRY);\n");\r
-                       fprintf(fp, "                           bTemp = (bTemp >> 1) | bTemp2;\n");\r
-                       fprintf(fp, "                           cpu.z80F |= bPostORFlags[bTemp];\n");\r
-                       WriteValueToMemory("dwAddr", "bTemp");\r
-               }\r
-               else\r
-               if (0x26 == dwOpcode)           // SLA\r
-               {\r
-                       fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);\n");\r
-                       fprintf(fp, "                           cpu.z80F |= (bTemp >> 7);\n");\r
-                       fprintf(fp, "                           bTemp = (bTemp << 1);\n");\r
-                       fprintf(fp, "                           cpu.z80F |= bPostORFlags[bTemp];\n");\r
-                       WriteValueToMemory("dwAddr", "bTemp");\r
-               }\r
-               else\r
-               if (0x2e == dwOpcode)           // SRA\r
-               {\r
-                       fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);\n");\r
-                       fprintf(fp, "                           cpu.z80F |= (bTemp & Z80_FLAG_CARRY);\n");\r
-                       fprintf(fp, "                           bTemp = (bTemp >> 1) | (bTemp & 0x80);\n");\r
-                       fprintf(fp, "                           cpu.z80F |= bPostORFlags[bTemp];\n");\r
-                       WriteValueToMemory("dwAddr", "bTemp");\r
-               }\r
-               else\r
-               if (0x3e == dwOpcode)           // SRL\r
-               {\r
-                       fprintf(fp, "                           cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);\n");\r
-                       fprintf(fp, "                           cpu.z80F |= (bTemp & Z80_FLAG_CARRY);\n");\r
-                       fprintf(fp, "                           bTemp = (bTemp >> 1);\n");\r
-                       fprintf(fp, "                           cpu.z80F |= bPostORFlags[bTemp];\n");\r
-                       WriteValueToMemory("dwAddr", "bTemp");\r
-               }\r
-               else\r
-               if ((dwOpcode & 0xc0) == 0x40)  // BIT\r
-               {\r
-                       fprintf(fp, "                           cpu.z80F = (cpu.z80F & ~(Z80_FLAG_ZERO | Z80_FLAG_NEGATIVE)) | Z80_FLAG_HALF_CARRY;\n");\r
-                       fprintf(fp, "                           if (!(bTemp & 0x%.2x))\n", 1 << ((dwOpcode >> 3) & 0x07));\r
-                       fprintf(fp, "                           {\n");\r
-                       fprintf(fp, "                                   cpu.z80F |= Z80_FLAG_ZERO;\n");\r
-                       fprintf(fp, "                           }\n");\r
-               }\r
-               else\r
-               if ((dwOpcode & 0xc0) == 0x80)  // RES\r
-               {\r
-                       fprintf(fp, "                           bTemp &= 0x%.2x;\n", ~(1 << ((dwOpcode >> 3) & 0x07)) & 0xff);\r
-                       WriteValueToMemory("dwAddr", "bTemp");\r
-               }\r
-               else\r
-               if ((dwOpcode & 0xc0) == 0xC0)  // SET\r
-               {\r
-                       fprintf(fp, "                           bTemp |= 0x%.2x;\n", 1 << ((dwOpcode >> 3) & 0x07));\r
-                       WriteValueToMemory("dwAddr", "bTemp");\r
-               }\r
-               else\r
-                       InvalidInstructionC(4);\r
-       }\r
-       else\r
-               assert(0);\r
-}\r
-\r
-GetTicksCode()\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               fprintf(fp, "           global  _%sGetElapsedTicks\n", cpubasename);\r
-               fprintf(fp, "           global  %sGetElapsedTicks_\n", cpubasename);\r
-               fprintf(fp, "           global  %sGetElapsedTicks\n", cpubasename);\r
-       \r
-               Alignment();\r
-               sprintf(procname, "%sGetElapsedTicks_", cpubasename);\r
-               ProcBegin(0xffffffff);\r
-               fprintf(fp, "_%sGetElapsedTicks:\n", cpubasename);\r
-               fprintf(fp, "%sGetElapsedTicks:\n", cpubasename);\r
-       \r
-               if (bUseStack)\r
-                       fprintf(fp, "           mov     eax, [esp+4]    ; Get our context address\n");\r
-       \r
-               fprintf(fp, "           or      eax, eax        ; Should we clear it?\n");\r
-               fprintf(fp, "           jz      getTicks\n");\r
-               fprintf(fp, "           xor     eax, eax\n");\r
-               fprintf(fp, "           xchg    eax, [dwElapsedTicks]\n");\r
-               fprintf(fp, "           ret\n");\r
-               fprintf(fp, "getTicks:\n");\r
-               fprintf(fp, "           mov     eax, [dwElapsedTicks]\n");\r
-               fprintf(fp, "           ret\n");\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "/* This will return the elapsed ticks */\n\n");\r
-               fprintf(fp, "UINT32 %sGetElapsedTicks(UINT32 dwClear)\n", cpubasename);\r
-               fprintf(fp, "{\n");\r
-               fprintf(fp, "   UINT32 dwTemp = dwElapsedTicks;\n\n");\r
-               fprintf(fp, "   if (dwClear)\n");\r
-               fprintf(fp, "   {\n");\r
-               fprintf(fp, "           dwElapsedTicks = 0;\n");\r
-               fprintf(fp, "   }\n\n");\r
-               fprintf(fp, "   return(dwTemp);\n");\r
-               fprintf(fp, "}\n\n");\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-ReleaseTimesliceCode()\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               fprintf(fp, "           global  _%sReleaseTimeslice\n", cpubasename);\r
-               fprintf(fp, "           global  %sReleaseTimeslice_\n", cpubasename);\r
-               fprintf(fp, "           global  %sReleaseTimeslice\n", cpubasename);\r
-       \r
-               Alignment();\r
-               sprintf(procname, "%sReleaseTimeslice_", cpubasename);\r
-               ProcBegin(0xffffffff);\r
-               fprintf(fp, "_%sReleaseTimeslice:\n", cpubasename);\r
-               fprintf(fp, "%sReleaseTimeslice:\n", cpubasename);\r
-       \r
-               fprintf(fp, "           mov     eax, [cyclesRemaining]\n");\r
-               fprintf(fp, "           sub     [dwOriginalExec], eax\n");\r
-               fprintf(fp, "           mov     [cyclesRemaining], dword 0\n");\r
-       \r
-               fprintf(fp, "           ret\n\n");\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "/* Releases mz80 from its current timeslice */\n\n");\r
-               fprintf(fp, "void %sReleaseTimeslice(void)\n", cpubasename);\r
-               fprintf(fp, "{\n");\r
-               fprintf(fp, "   dwOriginalCycles -= sdwCyclesRemaining;\n");\r
-               fprintf(fp, "   sdwCyclesRemaining = 0;\n");\r
-               fprintf(fp, "}\n\n");\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-DataSegment()\r
-{\r
-       UINT32 dwLoop = 0;\r
-       UINT8 bUsed[256];\r
-\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               if (bOS2)\r
-                       fprintf(fp, "           section .DATA32 use32 flat class=data\n");\r
-               else\r
-                       fprintf(fp, "           section .data   use32 flat class=data\n");\r
-       \r
-               Alignment();\r
-               fprintf(fp, "           global  _%scontextBegin\n", cpubasename);\r
-               fprintf(fp, "_%scontextBegin:\n", cpubasename);\r
-\r
-               fprintf(fp, "           global  _z80pc\n");\r
-               fprintf(fp, "           global  z80pc_\n");\r
-\r
-               if (bPlain)\r
-                       fprintf(fp, "           global  z80pc\n");\r
-\r
-               fprintf(fp, "           global  _z80nmiAddr\n");\r
-               fprintf(fp, "           global  _z80intAddr\n");\r
-               fprintf(fp, "           global  z80intAddr\n");\r
-\r
-                       fprintf(fp, "\n");\r
-               fprintf(fp, "; DO NOT CHANGE THE ORDER OF AF, BC, DE, HL and THE PRIME REGISTERS!\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "_z80Base   dd      0       ; Base address for Z80 stuff\n");\r
-               fprintf(fp, "_z80MemRead        dd      0       ; Offset of memory read structure array\n");\r
-               fprintf(fp, "_z80MemWrite       dd      0       ; Offset of memory write structure array\n");\r
-               fprintf(fp, "_z80IoRead dd      0       ; Base address for I/O reads list\n");\r
-               fprintf(fp, "_z80IoWrite        dd      0       ; Base address for I/O write list\n");\r
-               fprintf(fp, "_z80clockticks     dd      0       ; # Of clock tips that have elapsed\n");\r
-               fprintf(fp, "_z80iff    dd      0       ; Non-zero if we're in an interrupt\n");\r
-               fprintf(fp, "_z80interruptMode dd       0       ; Interrupt mode\n");\r
-               fprintf(fp, "_z80halted dd      0       ; 0=Not halted, 1=Halted\n");\r
-#ifdef MZ80_TRAP\r
-               fprintf(fp, "_z80trapList       dd      0       ; pointer to trap list\n");\r
-               fprintf(fp, "_z80trapAddr       dw      0       ; PC where trap occurred\n");\r
-#endif\r
-               fprintf(fp, "_z80af             dd      0       ; A Flag & Flags\n");\r
-               fprintf(fp, "_z80bc             dd      0       ; BC\n");\r
-               fprintf(fp, "_z80de             dd      0       ; DE\n");\r
-               fprintf(fp, "_z80hl             dd      0       ; HL\n");\r
-               fprintf(fp, "_z80afprime        dd      0       ; A Flag & Flags prime\n");\r
-               fprintf(fp, "_z80bcprime        dd      0       ; BC prime\n");\r
-               fprintf(fp, "_z80deprime        dd      0       ; DE prime\n");\r
-               fprintf(fp, "_z80hlprime        dd      0       ; HL prime\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "; The order of the following registers can be changed without adverse\n");\r
-               fprintf(fp, "; effect. Keep the WORD and DWORDs on boundaries of two for faster access\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "_z80ix             dd      0       ; IX\n");\r
-               fprintf(fp, "_z80iy             dd      0       ; IY\n");\r
-               fprintf(fp, "_z80sp             dd      0       ; Stack pointer\n");\r
-               \r
-               if (bPlain)\r
-                       fprintf(fp,"z80pc:\n");\r
-       \r
-               fprintf(fp, "z80pc_:\n");\r
-               fprintf(fp, "_z80pc             dd      0       ; PC\n");\r
-               fprintf(fp, "_z80nmiAddr        dd      0       ; Address to jump to for NMI\n");\r
-               fprintf(fp, "z80intAddr:\n");\r
-               fprintf(fp, "_z80intAddr        dd      0       ; Address to jump to for INT\n");\r
-               fprintf(fp, "_z80rCounter       dd      0       ; R Register counter\n");\r
-               fprintf(fp, "_z80i              db      0       ; I register\n");\r
-               fprintf(fp, "_z80r              db      0       ; R register\n");\r
-               fprintf(fp, "_z80intPending     db      0       ; Non-zero if an interrupt is pending\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "_%scontextEnd:\n", cpubasename);\r
-               Alignment();\r
-               fprintf(fp, "dwElapsedTicks     dd      0       ; # Of ticks elapsed\n");\r
-               fprintf(fp, "cyclesRemaining    dd      0       ; # Of cycles remaining\n");\r
-               fprintf(fp, "dwOriginalExec     dd      0       ; # Of cycles originally executing\n");\r
-               fprintf(fp, "dwLastRSample      dd      0       ; Last sample for R computation\n");\r
-               fprintf(fp, "dwEITiming dd      0       ; Used when we cause an interrupt\n");\r
-               fprintf(fp, "_orgval    dw      0       ; Scratch area\n");\r
-               fprintf(fp, "_orgval2   dw      0       ; Scratch area\n");\r
-               fprintf(fp, "_wordval   dw      0       ; Scratch area\n");\r
-               fprintf(fp, "_intData   db      0       ; Interrupt data when an interrupt is pending\n");\r
-               fprintf(fp, "bEIExit    db      0       ; Are we exiting because of an EI instruction?\n");\r
-               fprintf(fp, "\n");\r
-\r
-               // Debugger junk\r
-\r
-               fprintf(fp, "RegTextPC  db      'PC',0\n");\r
-               fprintf(fp, "RegTextAF  db      'AF',0\n");\r
-               fprintf(fp, "RegTextBC  db      'BC',0\n");\r
-               fprintf(fp, "RegTextDE  db      'DE',0\n");\r
-               fprintf(fp, "RegTextHL  db      'HL',0\n");\r
-               fprintf(fp, "RegTextAFP db      'AF',27h,0\n");\r
-               fprintf(fp, "RegTextBCP db      'BC',27h,0\n");\r
-               fprintf(fp, "RegTextDEP db      'DE',27h,0\n");\r
-               fprintf(fp, "RegTextHLP db      'HL',27h,0\n");\r
-               fprintf(fp, "RegTextIX  db      'IX',0\n");\r
-               fprintf(fp, "RegTextIY  db      'IY',0\n");\r
-               fprintf(fp, "RegTextSP  db      'SP',0\n");\r
-               fprintf(fp, "RegTextI   db      'I',0\n");\r
-               fprintf(fp, "RegTextR   db      'R',0\n");\r
-\r
-               // 8 Byte textual info\r
-\r
-               fprintf(fp, "RegTextA   db      'A',0\n");\r
-               fprintf(fp, "RegTextB   db      'B',0\n");\r
-               fprintf(fp, "RegTextC   db      'C',0\n");\r
-               fprintf(fp, "RegTextD   db      'D',0\n");\r
-               fprintf(fp, "RegTextE   db      'E',0\n");\r
-               fprintf(fp, "RegTextH   db      'H',0\n");\r
-               fprintf(fp, "RegTextL   db      'L',0\n");\r
-               fprintf(fp, "RegTextF   db      'F',0\n");\r
-\r
-               // Individual flags\r
-\r
-               fprintf(fp, "RegTextCarry       db      'Carry',0\n");\r
-               fprintf(fp, "RegTextNegative    db      'Negative',0\n");\r
-               fprintf(fp, "RegTextParity      db      'Parity',0\n");\r
-               fprintf(fp, "RegTextOverflow    db      'Overflow',0\n");\r
-               fprintf(fp, "RegTextHalfCarry   db      'HalfCarry',0\n");\r
-               fprintf(fp, "RegTextZero        db      'Zero',0\n");\r
-               fprintf(fp, "RegTextSign        db      'Sign',0\n");\r
-               fprintf(fp, "RegTextIFF1        db      'IFF1',0\n");\r
-               fprintf(fp, "RegTextIFF2        db      'IFF2',0\n\n");\r
-\r
-               // Timing for interrupt modes\r
-\r
-               fprintf(fp, "intModeTStates:\n");\r
-               fprintf(fp, "           db      13      ; IM 0 - 13 T-States\n");\r
-               fprintf(fp, "           db      11      ; IM 1 - 11 T-States\n");\r
-               fprintf(fp, "           db      11      ; IM 2 - 11 T-States\n\n");\r
-\r
-               // Now the master reg/flag table\r
-\r
-               fprintf(fp, "\n;\n");\r
-               fprintf(fp, "; Info is in: pointer to text, address, shift value, mask value, size of data chunk\n");\r
-               fprintf(fp, ";\n\n");\r
-               fprintf(fp, "RegTable:\n");\r
-\r
-               // Pointer to text, address, shift value, mask, size\r
-\r
-               fprintf(fp, "           dd      RegTextPC, _z80pc - _%scontextBegin, 0, 0ffffh\n", cpubasename);\r
-               fprintf(fp, "           dd      RegTextSP, _z80sp - _%scontextBegin, 0, 0ffffh\n", cpubasename);\r
-               fprintf(fp, "           dd      RegTextAF, _z80af - _%scontextBegin, 0, 0ffffh\n", cpubasename);\r
-               fprintf(fp, "           dd      RegTextBC, _z80bc - _%scontextBegin, 0, 0ffffh\n", cpubasename);\r
-               fprintf(fp, "           dd      RegTextDE, _z80de - _%scontextBegin, 0, 0ffffh\n", cpubasename);\r
-               fprintf(fp, "           dd      RegTextHL, _z80hl - _%scontextBegin, 0, 0ffffh\n", cpubasename);\r
-               fprintf(fp, "           dd      RegTextAFP, _z80af - _%scontextBegin, 0, 0ffffh\n", cpubasename);\r
-               fprintf(fp, "           dd      RegTextBCP, _z80bc - _%scontextBegin, 0, 0ffffh\n", cpubasename);\r
-               fprintf(fp, "           dd      RegTextDEP, _z80de - _%scontextBegin, 0, 0ffffh\n", cpubasename);\r
-               fprintf(fp, "           dd      RegTextHLP, _z80hl - _%scontextBegin, 0, 0ffffh\n", cpubasename);\r
-               fprintf(fp, "           dd      RegTextIX, _z80ix - _%scontextBegin, 0, 0ffffh\n", cpubasename);\r
-               fprintf(fp, "           dd      RegTextIY, _z80iy - _%scontextBegin, 0, 0ffffh\n", cpubasename);\r
-               fprintf(fp, "           dd      RegTextI, _z80i - _%scontextBegin, 0, 0ffh\n", cpubasename);\r
-               fprintf(fp, "           dd      RegTextR, _z80r - _%scontextBegin, 0, 0ffh\n", cpubasename);\r
-\r
-               // Individual regs\r
-\r
-               fprintf(fp, "           dd      RegTextA, (_z80af + 1) - _%scontextBegin, 0, 0ffh\n", cpubasename);\r
-               fprintf(fp, "           dd      RegTextF, _z80af - _%scontextBegin, 0, 0ffh\n", cpubasename);\r
-               fprintf(fp, "           dd      RegTextB, (_z80bc + 1) - _%scontextBegin, 0, 0ffh\n", cpubasename);\r
-               fprintf(fp, "           dd      RegTextC, _z80bc - _%scontextBegin, 0, 0ffh\n", cpubasename);\r
-               fprintf(fp, "           dd      RegTextD, (_z80de + 1) - _%scontextBegin, 0, 0ffh\n", cpubasename);\r
-               fprintf(fp, "           dd      RegTextE, _z80de - _%scontextBegin, 0, 0ffh\n", cpubasename);\r
-               fprintf(fp, "           dd      RegTextH, (_z80hl + 1) - _%scontextBegin, 0, 0ffh\n", cpubasename);\r
-               fprintf(fp, "           dd      RegTextL, _z80hl - _%scontextBegin, 0, 0ffh\n", cpubasename);\r
-\r
-               // IFF register\r
-\r
-               fprintf(fp, "           dd      RegTextIFF1, _z80iff - _%scontextBegin, 0, 01h\n", cpubasename);\r
-               fprintf(fp, "           dd      RegTextIFF2, _z80iff - _%scontextBegin, 1, 01h\n", cpubasename);\r
-\r
-               // Individual flags\r
-\r
-               fprintf(fp, "           dd      RegTextCarry, _z80af - _%scontextBegin, 0, 01h\n", cpubasename);\r
-               fprintf(fp, "           dd      RegTextNegative, _z80af - _%scontextBegin, 1, 01h\n", cpubasename);\r
-               fprintf(fp, "           dd      RegTextParity, _z80af - _%scontextBegin, 2, 01h\n", cpubasename);\r
-               fprintf(fp, "           dd      RegTextOverflow, _z80af - _%scontextBegin, 2, 01h\n", cpubasename);\r
-               fprintf(fp, "           dd      RegTextHalfCarry, _z80af - _%scontextBegin, 4, 01h\n", cpubasename);\r
-               fprintf(fp, "           dd      RegTextZero, _z80af - _%scontextBegin, 6, 01h\n", cpubasename);\r
-               fprintf(fp, "           dd      RegTextSign, _z80af - _%scontextBegin, 7, 01h\n", cpubasename);\r
-\r
-               // Now we write out our tables\r
-       \r
-               Alignment();\r
-       \r
-               for (dwLoop = 0; dwLoop < 256; dwLoop++)\r
-                       bUsed[dwLoop] = 0;\r
-\r
-       // Now rip through and find out what is and isn't used\r
-       \r
-               dwLoop = 0;\r
-       \r
-               while (StandardOps[dwLoop].Emitter)\r
-               {\r
-                       assert(StandardOps[dwLoop].bOpCode < 0x100);\r
-                       if (bUsed[StandardOps[dwLoop].bOpCode])\r
-                       {\r
-                               fprintf(stderr, "Oops! %.2x\n", dwLoop);\r
-                               fclose(fp);\r
-                               exit(1);\r
-                       }\r
-                       bUsed[StandardOps[dwLoop].bOpCode] = 1;\r
-                       dwLoop++;\r
-               }\r
-       \r
-               // Now that that's taken care of, emit the table\r
-       \r
-               fprintf(fp, "z80regular:\n");\r
-       \r
-               dwLoop = 0;\r
-       \r
-               while (dwLoop < 0x100)\r
-               {\r
-                       fprintf(fp, "           dd      ");\r
-                       if (bUsed[dwLoop])\r
-                               fprintf(fp, "RegInst%.2x", dwLoop);\r
-                       else\r
-                               fprintf(fp, "invalidInsByte");\r
-                       fprintf(fp, "\n");\r
-                       dwLoop++;\r
-               }\r
-               fprintf(fp, "\n");\r
-       \r
-               // Now rip through and find out what is and isn't used (CB Ops)\r
-       \r
-               for (dwLoop = 0; dwLoop < 0x100; dwLoop++)\r
-                       bUsed[dwLoop] = 0;\r
-       \r
-               dwLoop = 0;\r
-       \r
-               while (CBOps[dwLoop].Emitter)\r
-               {\r
-                       assert(CBOps[dwLoop].bOpCode < 0x100);\r
-                       if (bUsed[CBOps[dwLoop].bOpCode])\r
-                       {\r
-                               fprintf(stderr, "Oops CB! %.2x\n", dwLoop);\r
-                               fclose(fp);\r
-                               exit(1);\r
-                       }\r
-                       bUsed[CBOps[dwLoop].bOpCode] = 1;\r
-                       dwLoop++;\r
-               }\r
-       \r
-               dwLoop = 0;\r
-       \r
-               // Let's emit the CB prefixes\r
-       \r
-               fprintf(fp, "z80PrefixCB:\n");\r
-       \r
-               while (dwLoop < 0x100)\r
-               {\r
-                       fprintf(fp, "           dd      ");\r
-                       if (bUsed[dwLoop])\r
-                               fprintf(fp, "CBInst%.2x", dwLoop);\r
-                       else\r
-                               fprintf(fp, "invalidInsWord");\r
-                       fprintf(fp, "\n");\r
-                       dwLoop++;\r
-               }\r
-               fprintf(fp, "\n");\r
-       \r
-               // Now rip through and find out what is and isn't used (ED Ops)\r
-       \r
-               for (dwLoop = 0; dwLoop < 0x100; dwLoop++)\r
-                       bUsed[dwLoop] = 0;\r
-       \r
-               dwLoop = 0;\r
-       \r
-               while (EDOps[dwLoop].Emitter)\r
-               {\r
-                       assert(EDOps[dwLoop].bOpCode < 0x100);\r
-                       if (bUsed[EDOps[dwLoop].bOpCode])\r
-                       {\r
-                               fprintf(stderr, "Oops ED! %.2x\n", dwLoop);\r
-                               fclose(fp);\r
-                               exit(1);\r
-                       }\r
-                       bUsed[EDOps[dwLoop].bOpCode] = 1;\r
-                       dwLoop++;\r
-               }\r
-       \r
-               dwLoop = 0;\r
-       \r
-               // Let's emit the ED prefixes\r
-       \r
-               fprintf(fp, "z80PrefixED:\n");\r
-       \r
-               while (dwLoop < 0x100)\r
-               {\r
-                       fprintf(fp, "           dd      ");\r
-                       if (bUsed[dwLoop])\r
-                               fprintf(fp, "EDInst%.2x", dwLoop);\r
-                       else\r
-                               fprintf(fp, "invalidInsWord");\r
-                       fprintf(fp, "\n");\r
-                       dwLoop++;\r
-               }\r
-               fprintf(fp, "\n");\r
-       \r
-               // Now rip through and find out what is and isn't used (DD Ops)\r
-       \r
-               for (dwLoop = 0; dwLoop < 0x100; dwLoop++)\r
-                       bUsed[dwLoop] = 0;\r
-       \r
-               dwLoop = 0;\r
-       \r
-               while (DDFDOps[dwLoop].Emitter)\r
-               {\r
-                       assert(DDFDOps[dwLoop].bOpCode < 0x100);\r
-                       if (bUsed[DDFDOps[dwLoop].bOpCode])\r
-                       {\r
-                               fprintf(stderr, "Oops DD! %.2x\n", bUsed[DDFDOps[dwLoop].bOpCode]);\r
-                               fclose(fp);\r
-                               exit(1);\r
-                       }\r
-                       bUsed[DDFDOps[dwLoop].bOpCode] = 1;\r
-                       dwLoop++;\r
-               }\r
-       \r
-               dwLoop = 0;\r
-       \r
-               // Let's emit the DD prefixes\r
-       \r
-               fprintf(fp, "z80PrefixDD:\n");\r
-       \r
-               while (dwLoop < 0x100)\r
-               {\r
-                       fprintf(fp, "           dd      ");\r
-                       if (bUsed[dwLoop])\r
-                               fprintf(fp, "DDInst%.2x", dwLoop);\r
-                       else\r
-                               fprintf(fp, "invalidInsWord");\r
-                       fprintf(fp, "\n");\r
-                       dwLoop++;\r
-               }\r
-               fprintf(fp, "\n");\r
-       \r
-               // Now rip through and find out what is and isn't used (FD Ops)\r
-       \r
-               for (dwLoop = 0; dwLoop < 0x100; dwLoop++)\r
-                       bUsed[dwLoop] = 0;\r
-       \r
-               dwLoop = 0;\r
-       \r
-               while (DDFDOps[dwLoop].Emitter)\r
-               {\r
-                       assert(DDFDOps[dwLoop].bOpCode < 0x100);\r
-                       if (bUsed[DDFDOps[dwLoop].bOpCode])\r
-                       {\r
-                               fprintf(stderr, "Oops FD! %.2x\n", dwLoop);\r
-                               fclose(fp);\r
-                               exit(1);\r
-                       }\r
-                       bUsed[DDFDOps[dwLoop].bOpCode] = 1;\r
-                       dwLoop++;\r
-               }\r
-       \r
-               for (dwLoop = 0; dwLoop < 0x100; dwLoop++)\r
-                       bUsed[dwLoop] = 0;\r
-       \r
-               // Let's emit the DDFD prefixes\r
-       \r
-               for (dwLoop = 0; dwLoop < 0x100; dwLoop++)\r
-                       bUsed[dwLoop] = 0;\r
-       \r
-               dwLoop = 0;\r
-       \r
-               while (DDFDOps[dwLoop].Emitter)\r
-               {\r
-                       assert(DDFDOps[dwLoop].bOpCode < 0x100);\r
-                       if (bUsed[DDFDOps[dwLoop].bOpCode])\r
-                       {\r
-                               fprintf(stderr, "Oops FD! %.2x\n", dwLoop);\r
-                               exit(1);\r
-                       }\r
-                       bUsed[DDFDOps[dwLoop].bOpCode] = 1;\r
-                       dwLoop++;\r
-               }\r
-       \r
-               dwLoop = 0;\r
-       \r
-               // Let's emit the DDFD prefixes\r
-       \r
-               fprintf(fp, "z80PrefixFD:\n");\r
-       \r
-               while (dwLoop < 0x100)\r
-               {\r
-                       fprintf(fp, "           dd      ");\r
-                       if (bUsed[dwLoop])\r
-                               fprintf(fp, "FDInst%.2x", dwLoop);\r
-                       else\r
-                               fprintf(fp, "invalidInsWord");\r
-                       fprintf(fp, "\n");\r
-                       dwLoop++;\r
-               }\r
-       \r
-               for (dwLoop = 0; dwLoop < 0x100; dwLoop++)\r
-                       bUsed[dwLoop] = 0;\r
-       \r
-               dwLoop = 0;\r
-       \r
-               while (DDFDCBOps[dwLoop].Emitter)\r
-               {\r
-                       assert(DDFDCBOps[dwLoop].bOpCode < 0x100);\r
-                       if (bUsed[DDFDCBOps[dwLoop].bOpCode])\r
-                       {\r
-                               fprintf(stderr, "Oops CBFDDD! %.2x\n", bUsed[DDFDCBOps[dwLoop].bOpCode]);\r
-                               fclose(fp);\r
-                               exit(1);\r
-                       }\r
-                       bUsed[DDFDCBOps[dwLoop].bOpCode] = 1;\r
-                       dwLoop++;\r
-               }\r
-       \r
-               // Let's emit the DDFD prefixes\r
-       \r
-               dwLoop = 0;\r
-       \r
-               fprintf(fp, "z80ddfdcbInstructions:\n");\r
-       \r
-               while (dwLoop < 0x100)\r
-               {\r
-                       fprintf(fp, "           dd      ");\r
-                       if (bUsed[dwLoop])\r
-                               fprintf(fp, "DDFDCBInst%.2x", dwLoop);\r
-                       else\r
-                               fprintf(fp, "invalidInsWord");\r
-                       fprintf(fp, "\n");\r
-                       dwLoop++;\r
-               }\r
-               fprintf(fp, "\n");\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "/* Modular global variables go here*/\n\n");\r
-               fprintf(fp, "static CONTEXTMZ80 cpu;    /* CPU Context */\n");\r
-               fprintf(fp, "static UINT8 *pbPC;                        /* Program counter normalized */\n");\r
-               fprintf(fp, "static UINT8 *pbSP;                        /* Stack pointer normalized */\n");\r
-               fprintf(fp, "static struct MemoryReadByte *psMemRead; /* Read memory structure */\n");\r
-               fprintf(fp, "static struct MemoryWriteByte *psMemWrite; /* Write memory structure */\n");\r
-               fprintf(fp, "static struct z80PortRead *psIoRead; /* Read I/O structure */\n");\r
-               fprintf(fp, "static struct z80PortWrite *psIoWrite; /* Write memory structure */\n");\r
-               fprintf(fp, "static INT32 sdwCyclesRemaining; /* Used as a countdown */\n");\r
-               fprintf(fp, "static UINT32 dwReturnCode; /* Return code from exec() */\n");\r
-               fprintf(fp, "static UINT32 dwOriginalCycles; /* How many cycles did we start with? */\n");\r
-               fprintf(fp, "static UINT32 dwElapsedTicks;      /* How many ticks did we elapse? */\n");\r
-               fprintf(fp, "static INT32 sdwAddr;              /* Temporary address storage */\n");\r
-               fprintf(fp, "static UINT32 dwAddr;              /* Temporary stack address */\n");\r
-               fprintf(fp, "static UINT8 *pbAddAdcTable;       /* Pointer to add/adc flag table */\n");\r
-               fprintf(fp, "static UINT8 *pbSubSbcTable;       /* Pointer to sub/sbc flag table */\n");\r
-               fprintf(fp, "static UINT32 dwTemp;                      /* Temporary value */\n\n");\r
-               fprintf(fp, "static UINT8 bTemp;                        /* Temporary value */\n\n");\r
-               fprintf(fp, "static UINT8 bTemp2;               /* Temporary value */\n\n");\r
-\r
-               fprintf(fp, "/* Precomputed flag tables */\n\n");\r
-\r
-               fprintf(fp, "static UINT8 bPostIncFlags[0x100] = \n");\r
-               fprintf(fp, "{\n");\r
-               fprintf(fp, "   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,\n");\r
-               fprintf(fp, "   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,\n");\r
-               fprintf(fp, "   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,\n");\r
-               fprintf(fp, "   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,\n");\r
-               fprintf(fp, "   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,\n");\r
-               fprintf(fp, "   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,\n");\r
-               fprintf(fp, "   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,\n");\r
-               fprintf(fp, "   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x94,\n");\r
-               fprintf(fp, "   0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x90,\n");\r
-               fprintf(fp, "   0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x90,\n");\r
-               fprintf(fp, "   0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x90,\n");\r
-               fprintf(fp, "   0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x90,\n");\r
-               fprintf(fp, "   0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x90,\n");\r
-               fprintf(fp, "   0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x90,\n");\r
-               fprintf(fp, "   0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x90,\n");\r
-               fprintf(fp, "   0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x50\n");\r
-               fprintf(fp, "};\n\n");\r
-\r
-               fprintf(fp, "static UINT8 bPostDecFlags[0x100] = \n");\r
-               fprintf(fp, "{\n");\r
-               fprintf(fp, "   0x92,0x42,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,\n");\r
-               fprintf(fp, "   0x12,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,\n");\r
-               fprintf(fp, "   0x12,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,\n");\r
-               fprintf(fp, "   0x12,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,\n");\r
-               fprintf(fp, "   0x12,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,\n");\r
-               fprintf(fp, "   0x12,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,\n");\r
-               fprintf(fp, "   0x12,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,\n");\r
-               fprintf(fp, "   0x12,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,\n");\r
-               fprintf(fp, "   0x16,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,\n");\r
-               fprintf(fp, "   0x92,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,\n");\r
-               fprintf(fp, "   0x92,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,\n");\r
-               fprintf(fp, "   0x92,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,\n");\r
-               fprintf(fp, "   0x92,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,\n");\r
-               fprintf(fp, "   0x92,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,\n");\r
-               fprintf(fp, "   0x92,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,\n");\r
-               fprintf(fp, "   0x92,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82\n");\r
-               fprintf(fp, "};\n\n");\r
-\r
-               fprintf(fp, "static UINT8 bPostORFlags[0x100] = \n");\r
-               fprintf(fp, "{\n");\r
-               fprintf(fp, "   0x44,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,\n");\r
-               fprintf(fp, "   0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,\n");\r
-               fprintf(fp, "   0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,\n");\r
-               fprintf(fp, "   0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,\n");\r
-               fprintf(fp, "   0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,\n");\r
-               fprintf(fp, "   0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,\n");\r
-               fprintf(fp, "   0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,\n");\r
-               fprintf(fp, "   0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,\n");\r
-               fprintf(fp, "   0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,\n");\r
-               fprintf(fp, "   0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,\n");\r
-               fprintf(fp, "   0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,\n");\r
-               fprintf(fp, "   0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,\n");\r
-               fprintf(fp, "   0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,\n");\r
-               fprintf(fp, "   0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,\n");\r
-               fprintf(fp, "   0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,\n");\r
-               fprintf(fp, "   0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84\n");\r
-               fprintf(fp, "};\n\n");\r
-\r
-               fprintf(fp, "static UINT8 bPostANDFlags[0x100] = \n");\r
-               fprintf(fp, "{\n");\r
-               fprintf(fp, "   0x54,0x10,0x10,0x14,0x10,0x14,0x14,0x10,0x10,0x14,0x14,0x10,0x14,0x10,0x10,0x14,\n");\r
-               fprintf(fp, "   0x10,0x14,0x14,0x10,0x14,0x10,0x10,0x14,0x14,0x10,0x10,0x14,0x10,0x14,0x14,0x10,\n");\r
-               fprintf(fp, "   0x10,0x14,0x14,0x10,0x14,0x10,0x10,0x14,0x14,0x10,0x10,0x14,0x10,0x14,0x14,0x10,\n");\r
-               fprintf(fp, "   0x14,0x10,0x10,0x14,0x10,0x14,0x14,0x10,0x10,0x14,0x14,0x10,0x14,0x10,0x10,0x14,\n");\r
-               fprintf(fp, "   0x10,0x14,0x14,0x10,0x14,0x10,0x10,0x14,0x14,0x10,0x10,0x14,0x10,0x14,0x14,0x10,\n");\r
-               fprintf(fp, "   0x14,0x10,0x10,0x14,0x10,0x14,0x14,0x10,0x10,0x14,0x14,0x10,0x14,0x10,0x10,0x14,\n");\r
-               fprintf(fp, "   0x14,0x10,0x10,0x14,0x10,0x14,0x14,0x10,0x10,0x14,0x14,0x10,0x14,0x10,0x10,0x14,\n");\r
-               fprintf(fp, "   0x10,0x14,0x14,0x10,0x14,0x10,0x10,0x14,0x14,0x10,0x10,0x14,0x10,0x14,0x14,0x10,\n");\r
-               fprintf(fp, "   0x90,0x94,0x94,0x90,0x94,0x90,0x90,0x94,0x94,0x90,0x90,0x94,0x90,0x94,0x94,0x90,\n");\r
-               fprintf(fp, "   0x94,0x90,0x90,0x94,0x90,0x94,0x94,0x90,0x90,0x94,0x94,0x90,0x94,0x90,0x90,0x94,\n");\r
-               fprintf(fp, "   0x94,0x90,0x90,0x94,0x90,0x94,0x94,0x90,0x90,0x94,0x94,0x90,0x94,0x90,0x90,0x94,\n");\r
-               fprintf(fp, "   0x90,0x94,0x94,0x90,0x94,0x90,0x90,0x94,0x94,0x90,0x90,0x94,0x90,0x94,0x94,0x90,\n");\r
-               fprintf(fp, "   0x94,0x90,0x90,0x94,0x90,0x94,0x94,0x90,0x90,0x94,0x94,0x90,0x94,0x90,0x90,0x94,\n");\r
-               fprintf(fp, "   0x90,0x94,0x94,0x90,0x94,0x90,0x90,0x94,0x94,0x90,0x90,0x94,0x90,0x94,0x94,0x90,\n");\r
-               fprintf(fp, "   0x90,0x94,0x94,0x90,0x94,0x90,0x90,0x94,0x94,0x90,0x90,0x94,0x90,0x94,0x94,0x90,\n");\r
-               fprintf(fp, "   0x94,0x90,0x90,0x94,0x90,0x94,0x94,0x90,0x90,0x94,0x94,0x90,0x94,0x90,0x90,0x94\n");\r
-               fprintf(fp, "};\n\n");\r
-\r
-               fprintf(fp, "static UINT16 wDAATable[0x800] = \n");\r
-               fprintf(fp, "{\n");\r
-               fprintf(fp, "   0x5400,0x1001,0x1002,0x1403,0x1004,0x1405,0x1406,0x1007,\n");\r
-               fprintf(fp, "   0x1008,0x1409,0x1010,0x1411,0x1412,0x1013,0x1414,0x1015,\n");\r
-               fprintf(fp, "   0x1010,0x1411,0x1412,0x1013,0x1414,0x1015,0x1016,0x1417,\n");\r
-               fprintf(fp, "   0x1418,0x1019,0x1020,0x1421,0x1422,0x1023,0x1424,0x1025,\n");\r
-               fprintf(fp, "   0x1020,0x1421,0x1422,0x1023,0x1424,0x1025,0x1026,0x1427,\n");\r
-               fprintf(fp, "   0x1428,0x1029,0x1430,0x1031,0x1032,0x1433,0x1034,0x1435,\n");\r
-               fprintf(fp, "   0x1430,0x1031,0x1032,0x1433,0x1034,0x1435,0x1436,0x1037,\n");\r
-               fprintf(fp, "   0x1038,0x1439,0x1040,0x1441,0x1442,0x1043,0x1444,0x1045,\n");\r
-               fprintf(fp, "   0x1040,0x1441,0x1442,0x1043,0x1444,0x1045,0x1046,0x1447,\n");\r
-               fprintf(fp, "   0x1448,0x1049,0x1450,0x1051,0x1052,0x1453,0x1054,0x1455,\n");\r
-               fprintf(fp, "   0x1450,0x1051,0x1052,0x1453,0x1054,0x1455,0x1456,0x1057,\n");\r
-               fprintf(fp, "   0x1058,0x1459,0x1460,0x1061,0x1062,0x1463,0x1064,0x1465,\n");\r
-               fprintf(fp, "   0x1460,0x1061,0x1062,0x1463,0x1064,0x1465,0x1466,0x1067,\n");\r
-               fprintf(fp, "   0x1068,0x1469,0x1070,0x1471,0x1472,0x1073,0x1474,0x1075,\n");\r
-               fprintf(fp, "   0x1070,0x1471,0x1472,0x1073,0x1474,0x1075,0x1076,0x1477,\n");\r
-               fprintf(fp, "   0x1478,0x1079,0x9080,0x9481,0x9482,0x9083,0x9484,0x9085,\n");\r
-               fprintf(fp, "   0x9080,0x9481,0x9482,0x9083,0x9484,0x9085,0x9086,0x9487,\n");\r
-               fprintf(fp, "   0x9488,0x9089,0x9490,0x9091,0x9092,0x9493,0x9094,0x9495,\n");\r
-               fprintf(fp, "   0x9490,0x9091,0x9092,0x9493,0x9094,0x9495,0x9496,0x9097,\n");\r
-               fprintf(fp, "   0x9098,0x9499,0x5500,0x1101,0x1102,0x1503,0x1104,0x1505,\n");\r
-               fprintf(fp, "   0x5500,0x1101,0x1102,0x1503,0x1104,0x1505,0x1506,0x1107,\n");\r
-               fprintf(fp, "   0x1108,0x1509,0x1110,0x1511,0x1512,0x1113,0x1514,0x1115,\n");\r
-               fprintf(fp, "   0x1110,0x1511,0x1512,0x1113,0x1514,0x1115,0x1116,0x1517,\n");\r
-               fprintf(fp, "   0x1518,0x1119,0x1120,0x1521,0x1522,0x1123,0x1524,0x1125,\n");\r
-               fprintf(fp, "   0x1120,0x1521,0x1522,0x1123,0x1524,0x1125,0x1126,0x1527,\n");\r
-               fprintf(fp, "   0x1528,0x1129,0x1530,0x1131,0x1132,0x1533,0x1134,0x1535,\n");\r
-               fprintf(fp, "   0x1530,0x1131,0x1132,0x1533,0x1134,0x1535,0x1536,0x1137,\n");\r
-               fprintf(fp, "   0x1138,0x1539,0x1140,0x1541,0x1542,0x1143,0x1544,0x1145,\n");\r
-               fprintf(fp, "   0x1140,0x1541,0x1542,0x1143,0x1544,0x1145,0x1146,0x1547,\n");\r
-               fprintf(fp, "   0x1548,0x1149,0x1550,0x1151,0x1152,0x1553,0x1154,0x1555,\n");\r
-               fprintf(fp, "   0x1550,0x1151,0x1152,0x1553,0x1154,0x1555,0x1556,0x1157,\n");\r
-               fprintf(fp, "   0x1158,0x1559,0x1560,0x1161,0x1162,0x1563,0x1164,0x1565,\n");\r
-               fprintf(fp, "   0x1560,0x1161,0x1162,0x1563,0x1164,0x1565,0x1566,0x1167,\n");\r
-               fprintf(fp, "   0x1168,0x1569,0x1170,0x1571,0x1572,0x1173,0x1574,0x1175,\n");\r
-               fprintf(fp, "   0x1170,0x1571,0x1572,0x1173,0x1574,0x1175,0x1176,0x1577,\n");\r
-               fprintf(fp, "   0x1578,0x1179,0x9180,0x9581,0x9582,0x9183,0x9584,0x9185,\n");\r
-               fprintf(fp, "   0x9180,0x9581,0x9582,0x9183,0x9584,0x9185,0x9186,0x9587,\n");\r
-               fprintf(fp, "   0x9588,0x9189,0x9590,0x9191,0x9192,0x9593,0x9194,0x9595,\n");\r
-               fprintf(fp, "   0x9590,0x9191,0x9192,0x9593,0x9194,0x9595,0x9596,0x9197,\n");\r
-               fprintf(fp, "   0x9198,0x9599,0x95a0,0x91a1,0x91a2,0x95a3,0x91a4,0x95a5,\n");\r
-               fprintf(fp, "   0x95a0,0x91a1,0x91a2,0x95a3,0x91a4,0x95a5,0x95a6,0x91a7,\n");\r
-               fprintf(fp, "   0x91a8,0x95a9,0x91b0,0x95b1,0x95b2,0x91b3,0x95b4,0x91b5,\n");\r
-               fprintf(fp, "   0x91b0,0x95b1,0x95b2,0x91b3,0x95b4,0x91b5,0x91b6,0x95b7,\n");\r
-               fprintf(fp, "   0x95b8,0x91b9,0x95c0,0x91c1,0x91c2,0x95c3,0x91c4,0x95c5,\n");\r
-               fprintf(fp, "   0x95c0,0x91c1,0x91c2,0x95c3,0x91c4,0x95c5,0x95c6,0x91c7,\n");\r
-               fprintf(fp, "   0x91c8,0x95c9,0x91d0,0x95d1,0x95d2,0x91d3,0x95d4,0x91d5,\n");\r
-               fprintf(fp, "   0x91d0,0x95d1,0x95d2,0x91d3,0x95d4,0x91d5,0x91d6,0x95d7,\n");\r
-               fprintf(fp, "   0x95d8,0x91d9,0x91e0,0x95e1,0x95e2,0x91e3,0x95e4,0x91e5,\n");\r
-               fprintf(fp, "   0x91e0,0x95e1,0x95e2,0x91e3,0x95e4,0x91e5,0x91e6,0x95e7,\n");\r
-               fprintf(fp, "   0x95e8,0x91e9,0x95f0,0x91f1,0x91f2,0x95f3,0x91f4,0x95f5,\n");\r
-               fprintf(fp, "   0x95f0,0x91f1,0x91f2,0x95f3,0x91f4,0x95f5,0x95f6,0x91f7,\n");\r
-               fprintf(fp, "   0x91f8,0x95f9,0x5500,0x1101,0x1102,0x1503,0x1104,0x1505,\n");\r
-               fprintf(fp, "   0x5500,0x1101,0x1102,0x1503,0x1104,0x1505,0x1506,0x1107,\n");\r
-               fprintf(fp, "   0x1108,0x1509,0x1110,0x1511,0x1512,0x1113,0x1514,0x1115,\n");\r
-               fprintf(fp, "   0x1110,0x1511,0x1512,0x1113,0x1514,0x1115,0x1116,0x1517,\n");\r
-               fprintf(fp, "   0x1518,0x1119,0x1120,0x1521,0x1522,0x1123,0x1524,0x1125,\n");\r
-               fprintf(fp, "   0x1120,0x1521,0x1522,0x1123,0x1524,0x1125,0x1126,0x1527,\n");\r
-               fprintf(fp, "   0x1528,0x1129,0x1530,0x1131,0x1132,0x1533,0x1134,0x1535,\n");\r
-               fprintf(fp, "   0x1530,0x1131,0x1132,0x1533,0x1134,0x1535,0x1536,0x1137,\n");\r
-               fprintf(fp, "   0x1138,0x1539,0x1140,0x1541,0x1542,0x1143,0x1544,0x1145,\n");\r
-               fprintf(fp, "   0x1140,0x1541,0x1542,0x1143,0x1544,0x1145,0x1146,0x1547,\n");\r
-               fprintf(fp, "   0x1548,0x1149,0x1550,0x1151,0x1152,0x1553,0x1154,0x1555,\n");\r
-               fprintf(fp, "   0x1550,0x1151,0x1152,0x1553,0x1154,0x1555,0x1556,0x1157,\n");\r
-               fprintf(fp, "   0x1158,0x1559,0x1560,0x1161,0x1162,0x1563,0x1164,0x1565,\n");\r
-               fprintf(fp, "   0x1406,0x1007,0x1008,0x1409,0x140a,0x100b,0x140c,0x100d,\n");\r
-               fprintf(fp, "   0x100e,0x140f,0x1010,0x1411,0x1412,0x1013,0x1414,0x1015,\n");\r
-               fprintf(fp, "   0x1016,0x1417,0x1418,0x1019,0x101a,0x141b,0x101c,0x141d,\n");\r
-               fprintf(fp, "   0x141e,0x101f,0x1020,0x1421,0x1422,0x1023,0x1424,0x1025,\n");\r
-               fprintf(fp, "   0x1026,0x1427,0x1428,0x1029,0x102a,0x142b,0x102c,0x142d,\n");\r
-               fprintf(fp, "   0x142e,0x102f,0x1430,0x1031,0x1032,0x1433,0x1034,0x1435,\n");\r
-               fprintf(fp, "   0x1436,0x1037,0x1038,0x1439,0x143a,0x103b,0x143c,0x103d,\n");\r
-               fprintf(fp, "   0x103e,0x143f,0x1040,0x1441,0x1442,0x1043,0x1444,0x1045,\n");\r
-               fprintf(fp, "   0x1046,0x1447,0x1448,0x1049,0x104a,0x144b,0x104c,0x144d,\n");\r
-               fprintf(fp, "   0x144e,0x104f,0x1450,0x1051,0x1052,0x1453,0x1054,0x1455,\n");\r
-               fprintf(fp, "   0x1456,0x1057,0x1058,0x1459,0x145a,0x105b,0x145c,0x105d,\n");\r
-               fprintf(fp, "   0x105e,0x145f,0x1460,0x1061,0x1062,0x1463,0x1064,0x1465,\n");\r
-               fprintf(fp, "   0x1466,0x1067,0x1068,0x1469,0x146a,0x106b,0x146c,0x106d,\n");\r
-               fprintf(fp, "   0x106e,0x146f,0x1070,0x1471,0x1472,0x1073,0x1474,0x1075,\n");\r
-               fprintf(fp, "   0x1076,0x1477,0x1478,0x1079,0x107a,0x147b,0x107c,0x147d,\n");\r
-               fprintf(fp, "   0x147e,0x107f,0x9080,0x9481,0x9482,0x9083,0x9484,0x9085,\n");\r
-               fprintf(fp, "   0x9086,0x9487,0x9488,0x9089,0x908a,0x948b,0x908c,0x948d,\n");\r
-               fprintf(fp, "   0x948e,0x908f,0x9490,0x9091,0x9092,0x9493,0x9094,0x9495,\n");\r
-               fprintf(fp, "   0x9496,0x9097,0x9098,0x9499,0x949a,0x909b,0x949c,0x909d,\n");\r
-               fprintf(fp, "   0x909e,0x949f,0x5500,0x1101,0x1102,0x1503,0x1104,0x1505,\n");\r
-               fprintf(fp, "   0x1506,0x1107,0x1108,0x1509,0x150a,0x110b,0x150c,0x110d,\n");\r
-               fprintf(fp, "   0x110e,0x150f,0x1110,0x1511,0x1512,0x1113,0x1514,0x1115,\n");\r
-               fprintf(fp, "   0x1116,0x1517,0x1518,0x1119,0x111a,0x151b,0x111c,0x151d,\n");\r
-               fprintf(fp, "   0x151e,0x111f,0x1120,0x1521,0x1522,0x1123,0x1524,0x1125,\n");\r
-               fprintf(fp, "   0x1126,0x1527,0x1528,0x1129,0x112a,0x152b,0x112c,0x152d,\n");\r
-               fprintf(fp, "   0x152e,0x112f,0x1530,0x1131,0x1132,0x1533,0x1134,0x1535,\n");\r
-               fprintf(fp, "   0x1536,0x1137,0x1138,0x1539,0x153a,0x113b,0x153c,0x113d,\n");\r
-               fprintf(fp, "   0x113e,0x153f,0x1140,0x1541,0x1542,0x1143,0x1544,0x1145,\n");\r
-               fprintf(fp, "   0x1146,0x1547,0x1548,0x1149,0x114a,0x154b,0x114c,0x154d,\n");\r
-               fprintf(fp, "   0x154e,0x114f,0x1550,0x1151,0x1152,0x1553,0x1154,0x1555,\n");\r
-               fprintf(fp, "   0x1556,0x1157,0x1158,0x1559,0x155a,0x115b,0x155c,0x115d,\n");\r
-               fprintf(fp, "   0x115e,0x155f,0x1560,0x1161,0x1162,0x1563,0x1164,0x1565,\n");\r
-               fprintf(fp, "   0x1566,0x1167,0x1168,0x1569,0x156a,0x116b,0x156c,0x116d,\n");\r
-               fprintf(fp, "   0x116e,0x156f,0x1170,0x1571,0x1572,0x1173,0x1574,0x1175,\n");\r
-               fprintf(fp, "   0x1176,0x1577,0x1578,0x1179,0x117a,0x157b,0x117c,0x157d,\n");\r
-               fprintf(fp, "   0x157e,0x117f,0x9180,0x9581,0x9582,0x9183,0x9584,0x9185,\n");\r
-               fprintf(fp, "   0x9186,0x9587,0x9588,0x9189,0x918a,0x958b,0x918c,0x958d,\n");\r
-               fprintf(fp, "   0x958e,0x918f,0x9590,0x9191,0x9192,0x9593,0x9194,0x9595,\n");\r
-               fprintf(fp, "   0x9596,0x9197,0x9198,0x9599,0x959a,0x919b,0x959c,0x919d,\n");\r
-               fprintf(fp, "   0x919e,0x959f,0x95a0,0x91a1,0x91a2,0x95a3,0x91a4,0x95a5,\n");\r
-               fprintf(fp, "   0x95a6,0x91a7,0x91a8,0x95a9,0x95aa,0x91ab,0x95ac,0x91ad,\n");\r
-               fprintf(fp, "   0x91ae,0x95af,0x91b0,0x95b1,0x95b2,0x91b3,0x95b4,0x91b5,\n");\r
-               fprintf(fp, "   0x91b6,0x95b7,0x95b8,0x91b9,0x91ba,0x95bb,0x91bc,0x95bd,\n");\r
-               fprintf(fp, "   0x95be,0x91bf,0x95c0,0x91c1,0x91c2,0x95c3,0x91c4,0x95c5,\n");\r
-               fprintf(fp, "   0x95c6,0x91c7,0x91c8,0x95c9,0x95ca,0x91cb,0x95cc,0x91cd,\n");\r
-               fprintf(fp, "   0x91ce,0x95cf,0x91d0,0x95d1,0x95d2,0x91d3,0x95d4,0x91d5,\n");\r
-               fprintf(fp, "   0x91d6,0x95d7,0x95d8,0x91d9,0x91da,0x95db,0x91dc,0x95dd,\n");\r
-               fprintf(fp, "   0x95de,0x91df,0x91e0,0x95e1,0x95e2,0x91e3,0x95e4,0x91e5,\n");\r
-               fprintf(fp, "   0x91e6,0x95e7,0x95e8,0x91e9,0x91ea,0x95eb,0x91ec,0x95ed,\n");\r
-               fprintf(fp, "   0x95ee,0x91ef,0x95f0,0x91f1,0x91f2,0x95f3,0x91f4,0x95f5,\n");\r
-               fprintf(fp, "   0x95f6,0x91f7,0x91f8,0x95f9,0x95fa,0x91fb,0x95fc,0x91fd,\n");\r
-               fprintf(fp, "   0x91fe,0x95ff,0x5500,0x1101,0x1102,0x1503,0x1104,0x1505,\n");\r
-               fprintf(fp, "   0x1506,0x1107,0x1108,0x1509,0x150a,0x110b,0x150c,0x110d,\n");\r
-               fprintf(fp, "   0x110e,0x150f,0x1110,0x1511,0x1512,0x1113,0x1514,0x1115,\n");\r
-               fprintf(fp, "   0x1116,0x1517,0x1518,0x1119,0x111a,0x151b,0x111c,0x151d,\n");\r
-               fprintf(fp, "   0x151e,0x111f,0x1120,0x1521,0x1522,0x1123,0x1524,0x1125,\n");\r
-               fprintf(fp, "   0x1126,0x1527,0x1528,0x1129,0x112a,0x152b,0x112c,0x152d,\n");\r
-               fprintf(fp, "   0x152e,0x112f,0x1530,0x1131,0x1132,0x1533,0x1134,0x1535,\n");\r
-               fprintf(fp, "   0x1536,0x1137,0x1138,0x1539,0x153a,0x113b,0x153c,0x113d,\n");\r
-               fprintf(fp, "   0x113e,0x153f,0x1140,0x1541,0x1542,0x1143,0x1544,0x1145,\n");\r
-               fprintf(fp, "   0x1146,0x1547,0x1548,0x1149,0x114a,0x154b,0x114c,0x154d,\n");\r
-               fprintf(fp, "   0x154e,0x114f,0x1550,0x1151,0x1152,0x1553,0x1154,0x1555,\n");\r
-               fprintf(fp, "   0x1556,0x1157,0x1158,0x1559,0x155a,0x115b,0x155c,0x115d,\n");\r
-               fprintf(fp, "   0x115e,0x155f,0x1560,0x1161,0x1162,0x1563,0x1164,0x1565,\n");\r
-               fprintf(fp, "   0x5600,0x1201,0x1202,0x1603,0x1204,0x1605,0x1606,0x1207,\n");\r
-               fprintf(fp, "   0x1208,0x1609,0x1204,0x1605,0x1606,0x1207,0x1208,0x1609,\n");\r
-               fprintf(fp, "   0x1210,0x1611,0x1612,0x1213,0x1614,0x1215,0x1216,0x1617,\n");\r
-               fprintf(fp, "   0x1618,0x1219,0x1614,0x1215,0x1216,0x1617,0x1618,0x1219,\n");\r
-               fprintf(fp, "   0x1220,0x1621,0x1622,0x1223,0x1624,0x1225,0x1226,0x1627,\n");\r
-               fprintf(fp, "   0x1628,0x1229,0x1624,0x1225,0x1226,0x1627,0x1628,0x1229,\n");\r
-               fprintf(fp, "   0x1630,0x1231,0x1232,0x1633,0x1234,0x1635,0x1636,0x1237,\n");\r
-               fprintf(fp, "   0x1238,0x1639,0x1234,0x1635,0x1636,0x1237,0x1238,0x1639,\n");\r
-               fprintf(fp, "   0x1240,0x1641,0x1642,0x1243,0x1644,0x1245,0x1246,0x1647,\n");\r
-               fprintf(fp, "   0x1648,0x1249,0x1644,0x1245,0x1246,0x1647,0x1648,0x1249,\n");\r
-               fprintf(fp, "   0x1650,0x1251,0x1252,0x1653,0x1254,0x1655,0x1656,0x1257,\n");\r
-               fprintf(fp, "   0x1258,0x1659,0x1254,0x1655,0x1656,0x1257,0x1258,0x1659,\n");\r
-               fprintf(fp, "   0x1660,0x1261,0x1262,0x1663,0x1264,0x1665,0x1666,0x1267,\n");\r
-               fprintf(fp, "   0x1268,0x1669,0x1264,0x1665,0x1666,0x1267,0x1268,0x1669,\n");\r
-               fprintf(fp, "   0x1270,0x1671,0x1672,0x1273,0x1674,0x1275,0x1276,0x1677,\n");\r
-               fprintf(fp, "   0x1678,0x1279,0x1674,0x1275,0x1276,0x1677,0x1678,0x1279,\n");\r
-               fprintf(fp, "   0x9280,0x9681,0x9682,0x9283,0x9684,0x9285,0x9286,0x9687,\n");\r
-               fprintf(fp, "   0x9688,0x9289,0x9684,0x9285,0x9286,0x9687,0x9688,0x9289,\n");\r
-               fprintf(fp, "   0x9690,0x9291,0x9292,0x9693,0x9294,0x9695,0x9696,0x9297,\n");\r
-               fprintf(fp, "   0x9298,0x9699,0x1334,0x1735,0x1736,0x1337,0x1338,0x1739,\n");\r
-               fprintf(fp, "   0x1340,0x1741,0x1742,0x1343,0x1744,0x1345,0x1346,0x1747,\n");\r
-               fprintf(fp, "   0x1748,0x1349,0x1744,0x1345,0x1346,0x1747,0x1748,0x1349,\n");\r
-               fprintf(fp, "   0x1750,0x1351,0x1352,0x1753,0x1354,0x1755,0x1756,0x1357,\n");\r
-               fprintf(fp, "   0x1358,0x1759,0x1354,0x1755,0x1756,0x1357,0x1358,0x1759,\n");\r
-               fprintf(fp, "   0x1760,0x1361,0x1362,0x1763,0x1364,0x1765,0x1766,0x1367,\n");\r
-               fprintf(fp, "   0x1368,0x1769,0x1364,0x1765,0x1766,0x1367,0x1368,0x1769,\n");\r
-               fprintf(fp, "   0x1370,0x1771,0x1772,0x1373,0x1774,0x1375,0x1376,0x1777,\n");\r
-               fprintf(fp, "   0x1778,0x1379,0x1774,0x1375,0x1376,0x1777,0x1778,0x1379,\n");\r
-               fprintf(fp, "   0x9380,0x9781,0x9782,0x9383,0x9784,0x9385,0x9386,0x9787,\n");\r
-               fprintf(fp, "   0x9788,0x9389,0x9784,0x9385,0x9386,0x9787,0x9788,0x9389,\n");\r
-               fprintf(fp, "   0x9790,0x9391,0x9392,0x9793,0x9394,0x9795,0x9796,0x9397,\n");\r
-               fprintf(fp, "   0x9398,0x9799,0x9394,0x9795,0x9796,0x9397,0x9398,0x9799,\n");\r
-               fprintf(fp, "   0x97a0,0x93a1,0x93a2,0x97a3,0x93a4,0x97a5,0x97a6,0x93a7,\n");\r
-               fprintf(fp, "   0x93a8,0x97a9,0x93a4,0x97a5,0x97a6,0x93a7,0x93a8,0x97a9,\n");\r
-               fprintf(fp, "   0x93b0,0x97b1,0x97b2,0x93b3,0x97b4,0x93b5,0x93b6,0x97b7,\n");\r
-               fprintf(fp, "   0x97b8,0x93b9,0x97b4,0x93b5,0x93b6,0x97b7,0x97b8,0x93b9,\n");\r
-               fprintf(fp, "   0x97c0,0x93c1,0x93c2,0x97c3,0x93c4,0x97c5,0x97c6,0x93c7,\n");\r
-               fprintf(fp, "   0x93c8,0x97c9,0x93c4,0x97c5,0x97c6,0x93c7,0x93c8,0x97c9,\n");\r
-               fprintf(fp, "   0x93d0,0x97d1,0x97d2,0x93d3,0x97d4,0x93d5,0x93d6,0x97d7,\n");\r
-               fprintf(fp, "   0x97d8,0x93d9,0x97d4,0x93d5,0x93d6,0x97d7,0x97d8,0x93d9,\n");\r
-               fprintf(fp, "   0x93e0,0x97e1,0x97e2,0x93e3,0x97e4,0x93e5,0x93e6,0x97e7,\n");\r
-               fprintf(fp, "   0x97e8,0x93e9,0x97e4,0x93e5,0x93e6,0x97e7,0x97e8,0x93e9,\n");\r
-               fprintf(fp, "   0x97f0,0x93f1,0x93f2,0x97f3,0x93f4,0x97f5,0x97f6,0x93f7,\n");\r
-               fprintf(fp, "   0x93f8,0x97f9,0x93f4,0x97f5,0x97f6,0x93f7,0x93f8,0x97f9,\n");\r
-               fprintf(fp, "   0x5700,0x1301,0x1302,0x1703,0x1304,0x1705,0x1706,0x1307,\n");\r
-               fprintf(fp, "   0x1308,0x1709,0x1304,0x1705,0x1706,0x1307,0x1308,0x1709,\n");\r
-               fprintf(fp, "   0x1310,0x1711,0x1712,0x1313,0x1714,0x1315,0x1316,0x1717,\n");\r
-               fprintf(fp, "   0x1718,0x1319,0x1714,0x1315,0x1316,0x1717,0x1718,0x1319,\n");\r
-               fprintf(fp, "   0x1320,0x1721,0x1722,0x1323,0x1724,0x1325,0x1326,0x1727,\n");\r
-               fprintf(fp, "   0x1728,0x1329,0x1724,0x1325,0x1326,0x1727,0x1728,0x1329,\n");\r
-               fprintf(fp, "   0x1730,0x1331,0x1332,0x1733,0x1334,0x1735,0x1736,0x1337,\n");\r
-               fprintf(fp, "   0x1338,0x1739,0x1334,0x1735,0x1736,0x1337,0x1338,0x1739,\n");\r
-               fprintf(fp, "   0x1340,0x1741,0x1742,0x1343,0x1744,0x1345,0x1346,0x1747,\n");\r
-               fprintf(fp, "   0x1748,0x1349,0x1744,0x1345,0x1346,0x1747,0x1748,0x1349,\n");\r
-               fprintf(fp, "   0x1750,0x1351,0x1352,0x1753,0x1354,0x1755,0x1756,0x1357,\n");\r
-               fprintf(fp, "   0x1358,0x1759,0x1354,0x1755,0x1756,0x1357,0x1358,0x1759,\n");\r
-               fprintf(fp, "   0x1760,0x1361,0x1362,0x1763,0x1364,0x1765,0x1766,0x1367,\n");\r
-               fprintf(fp, "   0x1368,0x1769,0x1364,0x1765,0x1766,0x1367,0x1368,0x1769,\n");\r
-               fprintf(fp, "   0x1370,0x1771,0x1772,0x1373,0x1774,0x1375,0x1376,0x1777,\n");\r
-               fprintf(fp, "   0x1778,0x1379,0x1774,0x1375,0x1376,0x1777,0x1778,0x1379,\n");\r
-               fprintf(fp, "   0x9380,0x9781,0x9782,0x9383,0x9784,0x9385,0x9386,0x9787,\n");\r
-               fprintf(fp, "   0x9788,0x9389,0x9784,0x9385,0x9386,0x9787,0x9788,0x9389,\n");\r
-               fprintf(fp, "   0x9790,0x9391,0x9392,0x9793,0x9394,0x9795,0x9796,0x9397,\n");\r
-               fprintf(fp, "   0x9398,0x9799,0x9394,0x9795,0x9796,0x9397,0x9398,0x9799,\n");\r
-               fprintf(fp, "   0x97fa,0x93fb,0x97fc,0x93fd,0x93fe,0x97ff,0x5600,0x1201,\n");\r
-               fprintf(fp, "   0x1202,0x1603,0x1204,0x1605,0x1606,0x1207,0x1208,0x1609,\n");\r
-               fprintf(fp, "   0x160a,0x120b,0x160c,0x120d,0x120e,0x160f,0x1210,0x1611,\n");\r
-               fprintf(fp, "   0x1612,0x1213,0x1614,0x1215,0x1216,0x1617,0x1618,0x1219,\n");\r
-               fprintf(fp, "   0x121a,0x161b,0x121c,0x161d,0x161e,0x121f,0x1220,0x1621,\n");\r
-               fprintf(fp, "   0x1622,0x1223,0x1624,0x1225,0x1226,0x1627,0x1628,0x1229,\n");\r
-               fprintf(fp, "   0x122a,0x162b,0x122c,0x162d,0x162e,0x122f,0x1630,0x1231,\n");\r
-               fprintf(fp, "   0x1232,0x1633,0x1234,0x1635,0x1636,0x1237,0x1238,0x1639,\n");\r
-               fprintf(fp, "   0x163a,0x123b,0x163c,0x123d,0x123e,0x163f,0x1240,0x1641,\n");\r
-               fprintf(fp, "   0x1642,0x1243,0x1644,0x1245,0x1246,0x1647,0x1648,0x1249,\n");\r
-               fprintf(fp, "   0x124a,0x164b,0x124c,0x164d,0x164e,0x124f,0x1650,0x1251,\n");\r
-               fprintf(fp, "   0x1252,0x1653,0x1254,0x1655,0x1656,0x1257,0x1258,0x1659,\n");\r
-               fprintf(fp, "   0x165a,0x125b,0x165c,0x125d,0x125e,0x165f,0x1660,0x1261,\n");\r
-               fprintf(fp, "   0x1262,0x1663,0x1264,0x1665,0x1666,0x1267,0x1268,0x1669,\n");\r
-               fprintf(fp, "   0x166a,0x126b,0x166c,0x126d,0x126e,0x166f,0x1270,0x1671,\n");\r
-               fprintf(fp, "   0x1672,0x1273,0x1674,0x1275,0x1276,0x1677,0x1678,0x1279,\n");\r
-               fprintf(fp, "   0x127a,0x167b,0x127c,0x167d,0x167e,0x127f,0x9280,0x9681,\n");\r
-               fprintf(fp, "   0x9682,0x9283,0x9684,0x9285,0x9286,0x9687,0x9688,0x9289,\n");\r
-               fprintf(fp, "   0x928a,0x968b,0x928c,0x968d,0x968e,0x928f,0x9690,0x9291,\n");\r
-               fprintf(fp, "   0x9292,0x9693,0x1334,0x1735,0x1736,0x1337,0x1338,0x1739,\n");\r
-               fprintf(fp, "   0x173a,0x133b,0x173c,0x133d,0x133e,0x173f,0x1340,0x1741,\n");\r
-               fprintf(fp, "   0x1742,0x1343,0x1744,0x1345,0x1346,0x1747,0x1748,0x1349,\n");\r
-               fprintf(fp, "   0x134a,0x174b,0x134c,0x174d,0x174e,0x134f,0x1750,0x1351,\n");\r
-               fprintf(fp, "   0x1352,0x1753,0x1354,0x1755,0x1756,0x1357,0x1358,0x1759,\n");\r
-               fprintf(fp, "   0x175a,0x135b,0x175c,0x135d,0x135e,0x175f,0x1760,0x1361,\n");\r
-               fprintf(fp, "   0x1362,0x1763,0x1364,0x1765,0x1766,0x1367,0x1368,0x1769,\n");\r
-               fprintf(fp, "   0x176a,0x136b,0x176c,0x136d,0x136e,0x176f,0x1370,0x1771,\n");\r
-               fprintf(fp, "   0x1772,0x1373,0x1774,0x1375,0x1376,0x1777,0x1778,0x1379,\n");\r
-               fprintf(fp, "   0x137a,0x177b,0x137c,0x177d,0x177e,0x137f,0x9380,0x9781,\n");\r
-               fprintf(fp, "   0x9782,0x9383,0x9784,0x9385,0x9386,0x9787,0x9788,0x9389,\n");\r
-               fprintf(fp, "   0x938a,0x978b,0x938c,0x978d,0x978e,0x938f,0x9790,0x9391,\n");\r
-               fprintf(fp, "   0x9392,0x9793,0x9394,0x9795,0x9796,0x9397,0x9398,0x9799,\n");\r
-               fprintf(fp, "   0x979a,0x939b,0x979c,0x939d,0x939e,0x979f,0x97a0,0x93a1,\n");\r
-               fprintf(fp, "   0x93a2,0x97a3,0x93a4,0x97a5,0x97a6,0x93a7,0x93a8,0x97a9,\n");\r
-               fprintf(fp, "   0x97aa,0x93ab,0x97ac,0x93ad,0x93ae,0x97af,0x93b0,0x97b1,\n");\r
-               fprintf(fp, "   0x97b2,0x93b3,0x97b4,0x93b5,0x93b6,0x97b7,0x97b8,0x93b9,\n");\r
-               fprintf(fp, "   0x93ba,0x97bb,0x93bc,0x97bd,0x97be,0x93bf,0x97c0,0x93c1,\n");\r
-               fprintf(fp, "   0x93c2,0x97c3,0x93c4,0x97c5,0x97c6,0x93c7,0x93c8,0x97c9,\n");\r
-               fprintf(fp, "   0x97ca,0x93cb,0x97cc,0x93cd,0x93ce,0x97cf,0x93d0,0x97d1,\n");\r
-               fprintf(fp, "   0x97d2,0x93d3,0x97d4,0x93d5,0x93d6,0x97d7,0x97d8,0x93d9,\n");\r
-               fprintf(fp, "   0x93da,0x97db,0x93dc,0x97dd,0x97de,0x93df,0x93e0,0x97e1,\n");\r
-               fprintf(fp, "   0x97e2,0x93e3,0x97e4,0x93e5,0x93e6,0x97e7,0x97e8,0x93e9,\n");\r
-               fprintf(fp, "   0x93ea,0x97eb,0x93ec,0x97ed,0x97ee,0x93ef,0x97f0,0x93f1,\n");\r
-               fprintf(fp, "   0x93f2,0x97f3,0x93f4,0x97f5,0x97f6,0x93f7,0x93f8,0x97f9,\n");\r
-               fprintf(fp, "   0x97fa,0x93fb,0x97fc,0x93fd,0x93fe,0x97ff,0x5700,0x1301,\n");\r
-               fprintf(fp, "   0x1302,0x1703,0x1304,0x1705,0x1706,0x1307,0x1308,0x1709,\n");\r
-               fprintf(fp, "   0x170a,0x130b,0x170c,0x130d,0x130e,0x170f,0x1310,0x1711,\n");\r
-               fprintf(fp, "   0x1712,0x1313,0x1714,0x1315,0x1316,0x1717,0x1718,0x1319,\n");\r
-               fprintf(fp, "   0x131a,0x171b,0x131c,0x171d,0x171e,0x131f,0x1320,0x1721,\n");\r
-               fprintf(fp, "   0x1722,0x1323,0x1724,0x1325,0x1326,0x1727,0x1728,0x1329,\n");\r
-               fprintf(fp, "   0x132a,0x172b,0x132c,0x172d,0x172e,0x132f,0x1730,0x1331,\n");\r
-               fprintf(fp, "   0x1332,0x1733,0x1334,0x1735,0x1736,0x1337,0x1338,0x1739,\n");\r
-               fprintf(fp, "   0x173a,0x133b,0x173c,0x133d,0x133e,0x173f,0x1340,0x1741,\n");\r
-               fprintf(fp, "   0x1742,0x1343,0x1744,0x1345,0x1346,0x1747,0x1748,0x1349,\n");\r
-               fprintf(fp, "   0x134a,0x174b,0x134c,0x174d,0x174e,0x134f,0x1750,0x1351,\n");\r
-               fprintf(fp, "   0x1352,0x1753,0x1354,0x1755,0x1756,0x1357,0x1358,0x1759,\n");\r
-               fprintf(fp, "   0x175a,0x135b,0x175c,0x135d,0x135e,0x175f,0x1760,0x1361,\n");\r
-               fprintf(fp, "   0x1362,0x1763,0x1364,0x1765,0x1766,0x1367,0x1368,0x1769,\n");\r
-               fprintf(fp, "   0x176a,0x136b,0x176c,0x136d,0x136e,0x176f,0x1370,0x1771,\n");\r
-               fprintf(fp, "   0x1772,0x1373,0x1774,0x1375,0x1376,0x1777,0x1778,0x1379,\n");\r
-               fprintf(fp, "   0x137a,0x177b,0x137c,0x177d,0x177e,0x137f,0x9380,0x9781,\n");\r
-               fprintf(fp, "   0x9782,0x9383,0x9784,0x9385,0x9386,0x9787,0x9788,0x9389,\n");\r
-               fprintf(fp, "   0x938a,0x978b,0x938c,0x978d,0x978e,0x938f,0x9790,0x9391,\n");\r
-               fprintf(fp, "   0x9392,0x9793,0x9394,0x9795,0x9796,0x9397,0x9398,0x9799 \n");\r
-               fprintf(fp, "};\n\n");\r
-\r
-               fprintf(fp, "void DDFDCBHandler(UINT32 dwWhich);\n\n");\r
-\r
-               fprintf(fp, "\n");\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-       \r
-CodeSegmentBegin()\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               fprintf(fp, "           section .text use32 flat class=code\n");\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "static void InvalidInstruction(UINT32 dwCount)\n");\r
-               fprintf(fp, "{\n");\r
-\r
-               fprintf(fp, "   pbPC -= dwCount; /* Invalid instruction - back up */\n");\r
-               fprintf(fp, "   dwReturnCode = (UINT32) pbPC - (UINT32) cpu.z80Base;\n");\r
-               fprintf(fp, "   dwOriginalCycles -= sdwCyclesRemaining;\n");\r
-               fprintf(fp, "   sdwCyclesRemaining = 0;\n");\r
-\r
-               fprintf(fp, "}\n\n");\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-CodeSegmentEnd()\r
-{\r
-}\r
-\r
-ProgramEnd()\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               fprintf(fp, "           end\n");\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-EmitRegularInstructions()\r
-{\r
-       UINT32 dwLoop = 0;\r
-       UINT32 dwLoop2 = 0;\r
-\r
-       bCurrentMode = TIMING_REGULAR;\r
-\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               while (dwLoop < 0x100)\r
-               {\r
-                       dwLoop2 = 0;\r
-                       sprintf(procname, "RegInst%.2x", dwLoop);\r
-\r
-                       while (StandardOps[dwLoop2].bOpCode != dwLoop && StandardOps[dwLoop2].bOpCode != 0xffffffff)\r
-                               dwLoop2++;\r
-\r
-                       assert(dwLoop2 < 0x100);\r
-                       if (StandardOps[dwLoop2].Emitter\r
-                               && StandardOps[dwLoop2].bOpCode != 0xffffffff)\r
-                               StandardOps[dwLoop2].Emitter((UINT32) dwLoop);\r
-\r
-                       dwLoop++;\r
-               }\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "/* Main execution entry point */\n\n");\r
-\r
-               fprintf(fp, "UINT32 %sexec(UINT32 dwCycles)\n", cpubasename);\r
-               fprintf(fp, "{\n");\r
-               fprintf(fp, "   UINT8 bOpcode;\n\n");\r
-\r
-               fprintf(fp, "   dwReturnCode = 0x80000000; /* Assume it'll work */\n");\r
-\r
-               fprintf(fp, "   sdwCyclesRemaining = dwCycles;\n");\r
-               fprintf(fp, "   dwOriginalCycles = dwCycles;\n");\r
-\r
-               fprintf(fp, "           if (cpu.z80halted)\n");\r
-               fprintf(fp, "           {\n");\r
-\r
-               fprintf(fp, "           dwElapsedTicks += dwCycles;\n");\r
-               fprintf(fp, "           return(0x80000000);\n");\r
-\r
-               fprintf(fp, "           }\n\n");\r
-               \r
-\r
-               fprintf(fp, "   pbPC = cpu.z80Base + cpu.z80pc;\n\n");\r
-\r
-               fprintf(fp, "   while (sdwCyclesRemaining > 0)\n");\r
-\r
-               fprintf(fp, "   {\n");\r
-               fprintf(fp, "           bOpcode = *pbPC++;\n");\r
-               fprintf(fp, "           switch (bOpcode)\n");\r
-               fprintf(fp, "           {\n");\r
-\r
-               while (dwLoop < 0x100)\r
-               {\r
-                       dwLoop2 = 0;\r
-\r
-                       fprintf(fp, "                   case 0x%.2x:\n", dwLoop);\r
-                       fprintf(fp, "                   {\n");\r
-\r
-                       while (StandardOps[dwLoop2].bOpCode != dwLoop && StandardOps[dwLoop2].bOpCode != 0xffffffff)\r
-                               dwLoop2++;\r
-\r
-                       if (bTimingRegular[dwLoop])\r
-                       {\r
-                               fprintf(fp, "                           sdwCyclesRemaining -= %ld;\n", bTimingRegular[dwLoop]);\r
-                       }\r
-\r
-                       if (StandardOps[dwLoop2].Emitter)\r
-                       {\r
-                               StandardOps[dwLoop2].Emitter(dwLoop);\r
-                       }\r
-\r
-                       fprintf(fp, "                           break;\n");\r
-                       fprintf(fp, "                   }\n");\r
-                       ++dwLoop;\r
-               }\r
-\r
-               fprintf(fp, "           }\n");\r
-               fprintf(fp, "   }\n\n");\r
-\r
-               fprintf(fp, "   dwElapsedTicks += (dwOriginalCycles - sdwCyclesRemaining);\n\n");\r
-\r
-               fprintf(fp, "   cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;\n");\r
-\r
-               fprintf(fp, "   return(dwReturnCode); /* Indicate success */\n");\r
-               fprintf(fp, "}\n\n");\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-EmitCBInstructions()\r
-{\r
-       UINT32 dwLoop = 0;\r
-       UINT32 dwLoop2 = 0;\r
-\r
-       bCurrentMode = TIMING_CB;\r
-\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               while (dwLoop < 0x100)\r
-               {\r
-                       sprintf(procname, "CBInst%.2x", dwLoop);\r
-                       dwLoop2 = 0;\r
-\r
-                       while (CBOps[dwLoop2].bOpCode != dwLoop && CBOps[dwLoop2].bOpCode != 0xffffffff)\r
-                               dwLoop2++;\r
-\r
-                       assert(dwLoop2 < 0x100);\r
-                       if (CBOps[dwLoop2].Emitter && CBOps[dwLoop2].bOpCode != 0xffffffff)\r
-                               CBOps[dwLoop2].Emitter((UINT32) dwLoop);\r
-\r
-                       dwLoop++;\r
-               }\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "void CBHandler(void)\n");\r
-               fprintf(fp, "{\n");\r
-               fprintf(fp, "   switch (*pbPC++)\n");\r
-               fprintf(fp, "   {\n");\r
-\r
-               while (dwLoop < 0x100)\r
-               {\r
-                       dwLoop2 = 0;\r
-\r
-                       fprintf(fp, "           case 0x%.2x:\n", dwLoop);\r
-                       fprintf(fp, "           {\n");\r
-\r
-                       while (CBOps[dwLoop2].bOpCode != dwLoop && CBOps[dwLoop2].bOpCode != 0xffffffff)\r
-                               dwLoop2++;\r
-\r
-                       if (bTimingCB[dwLoop])\r
-                       {\r
-                               fprintf(fp, "                   sdwCyclesRemaining -= %ld;\n", bTimingCB[dwLoop]);\r
-                       }\r
-\r
-                       if (CBOps[dwLoop2].Emitter)\r
-                       {\r
-                               CBOps[dwLoop2].Emitter(dwLoop);\r
-                       }\r
-                       else\r
-                       {\r
-                               InvalidInstructionC(2);\r
-                       }\r
-\r
-                       fprintf(fp, "                   break;\n");\r
-                       fprintf(fp, "           }\n");\r
-                       ++dwLoop;\r
-               }\r
-\r
-               fprintf(fp, "   }\n");\r
-               fprintf(fp, "}\n");\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-EmitEDInstructions()\r
-{\r
-       UINT32 dwLoop = 0;\r
-       UINT32 dwLoop2 = 0;\r
-\r
-       bCurrentMode = TIMING_ED;\r
-\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               while (dwLoop < 0x100)\r
-               {\r
-                       sprintf(procname, "EDInst%.2x", dwLoop);\r
-                       dwLoop2 = 0;\r
-\r
-                       while (EDOps[dwLoop2].bOpCode != dwLoop && EDOps[dwLoop2].bOpCode != 0xffffffff)\r
-                               dwLoop2++;\r
-\r
-                       assert(dwLoop2 < 0x100);\r
-                       if (EDOps[dwLoop2].Emitter && EDOps[dwLoop2].bOpCode != 0xffffffff)\r
-                               EDOps[dwLoop2].Emitter((UINT32) dwLoop);\r
-\r
-                       dwLoop++;\r
-               }\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "void EDHandler(void)\n");\r
-               fprintf(fp, "{\n");\r
-               fprintf(fp, "   switch (*pbPC++)\n");\r
-               fprintf(fp, "   {\n");\r
-\r
-               while (dwLoop < 0x100)\r
-               {\r
-                       dwLoop2 = 0;\r
-\r
-                       fprintf(fp, "           case 0x%.2x:\n", dwLoop);\r
-                       fprintf(fp, "           {\n");\r
-\r
-                       while (EDOps[dwLoop2].bOpCode != dwLoop && EDOps[dwLoop2].bOpCode != 0xffffffff)\r
-                               dwLoop2++;\r
-\r
-                       if (bTimingED[dwLoop])\r
-                       {\r
-                               fprintf(fp, "                   sdwCyclesRemaining -= %ld;\n", bTimingED[dwLoop]);\r
-                       }\r
-\r
-                       if (EDOps[dwLoop2].Emitter)\r
-                       {\r
-                               EDOps[dwLoop2].Emitter(dwLoop);\r
-                       }\r
-                       else\r
-                       {\r
-                               InvalidInstructionC(2);\r
-                       }\r
-\r
-                       fprintf(fp, "                   break;\n");\r
-                       fprintf(fp, "           }\n");\r
-                       ++dwLoop;\r
-               }\r
-\r
-               fprintf(fp, "   }\n");\r
-               fprintf(fp, "}\n");\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-\r
-       fprintf(fp, "\n");\r
-}\r
-\r
-EmitDDInstructions()\r
-{\r
-       UINT32 dwLoop = 0;\r
-       UINT32 dwLoop2 = 0;\r
-\r
-       bCurrentMode = TIMING_DDFD;\r
-\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               while (dwLoop < 0x100)\r
-               {\r
-                       sprintf(procname, "DDInst%.2x", dwLoop);\r
-                       dwLoop2 = 0;\r
-       \r
-                       while (DDFDOps[dwLoop2].bOpCode != dwLoop && DDFDOps[dwLoop2].bOpCode != 0xffffffff)\r
-                               dwLoop2++;\r
-       \r
-                       assert(dwLoop2 < 0x100);\r
-                       if (DDFDOps[dwLoop2].Emitter && DDFDOps[dwLoop2].bOpCode != 0xffffffff)\r
-                               DDFDOps[dwLoop2].Emitter((UINT32) dwLoop);\r
-       \r
-                       dwLoop++;\r
-               }\r
-\r
-               bCurrentMode = TIMING_XXCB;\r
-\r
-               dwLoop = 0;\r
-\r
-               while (dwLoop < 0x100)\r
-               {\r
-                       sprintf(procname, "DDFDCBInst%.2x", dwLoop);\r
-                       dwLoop2 = 0;\r
-\r
-                       while (DDFDCBOps[dwLoop2].bOpCode != dwLoop && DDFDCBOps[dwLoop2].bOpCode != 0xffffffff)\r
-                               dwLoop2++;\r
-\r
-                       assert(dwLoop2 < 0x100);\r
-                       if (DDFDCBOps[dwLoop2].Emitter && DDFDCBOps[dwLoop2].bOpCode != 0xffffffff)\r
-                               DDFDCBOps[dwLoop2].Emitter((UINT32) dwLoop);\r
-\r
-                       dwLoop++;\r
-               }\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "void DDHandler(void)\n");\r
-               fprintf(fp, "{\n");\r
-               fprintf(fp, "   switch (*pbPC++)\n");\r
-               fprintf(fp, "   {\n");\r
-\r
-               while (dwLoop < 0x100)\r
-               {\r
-                       dwLoop2 = 0;\r
-\r
-                       fprintf(fp, "           case 0x%.2x:\n", dwLoop);\r
-                       fprintf(fp, "           {\n");\r
-\r
-                       while (DDFDOps[dwLoop2].bOpCode != dwLoop && DDFDOps[dwLoop2].bOpCode != 0xffffffff)\r
-                               dwLoop2++;\r
-\r
-                       if (bTimingDDFD[dwLoop])\r
-                       {\r
-                               fprintf(fp, "                   sdwCyclesRemaining -= %ld;\n", bTimingDDFD[dwLoop]);\r
-                       }\r
-\r
-                       if (DDFDOps[dwLoop2].Emitter)\r
-                       {\r
-                               DDFDOps[dwLoop2].Emitter(dwLoop);\r
-                       }\r
-                       else\r
-                       {\r
-                               InvalidInstructionC(2);\r
-                       }\r
-\r
-                       fprintf(fp, "                   break;\n");\r
-                       fprintf(fp, "           }\n");\r
-                       ++dwLoop;\r
-               }\r
-\r
-               fprintf(fp, "   }\n");\r
-               fprintf(fp, "}\n");\r
-\r
-               // DDFD Handler\r
-\r
-               bCurrentMode = TIMING_XXCB;\r
-\r
-               dwLoop = 0;\r
-\r
-               fprintf(fp, "void DDFDCBHandler(UINT32 dwWhich)\n");\r
-               fprintf(fp, "{\n");\r
-               fprintf(fp, "   if (dwWhich)\n");\r
-               fprintf(fp, "   {\n");\r
-               fprintf(fp, "           dwAddr = (UINT32) ((INT32) cpu.z80IY + ((INT32) *pbPC++)) & 0xffff;\n");\r
-               fprintf(fp, "   }\n");\r
-               fprintf(fp, "   else\n");\r
-               fprintf(fp, "   {\n");\r
-               fprintf(fp, "           dwAddr = (UINT32) ((INT32) cpu.z80IX + ((INT32) *pbPC++)) & 0xffff;\n");\r
-               fprintf(fp, "   }\n\n");\r
-\r
-               ReadValueFromMemory("dwAddr", "bTemp");\r
-\r
-               fprintf(fp, "   switch (*pbPC++)\n");\r
-               fprintf(fp, "   {\n");\r
-\r
-               while (dwLoop < 0x100)\r
-               {\r
-                       dwLoop2 = 0;\r
-\r
-                       fprintf(fp, "           case 0x%.2x:\n", dwLoop);\r
-                       fprintf(fp, "           {\n");\r
-\r
-                       while (DDFDCBOps[dwLoop2].bOpCode != dwLoop && DDFDCBOps[dwLoop2].bOpCode != 0xffffffff)\r
-                               dwLoop2++;\r
-\r
-                       if (bTimingXXCB[dwLoop])\r
-                       {\r
-                               fprintf(fp, "                   sdwCyclesRemaining -= %ld;\n", bTimingXXCB[dwLoop]);\r
-                       }\r
-\r
-                       if (DDFDCBOps[dwLoop2].Emitter)\r
-                       {\r
-                               DDFDCBOps[dwLoop2].Emitter(dwLoop);\r
-                       }\r
-                       else\r
-                       {\r
-                               InvalidInstructionC(4);\r
-                       }\r
-\r
-                       fprintf(fp, "                   break;\n");\r
-                       fprintf(fp, "           }\n");\r
-                       ++dwLoop;\r
-               }\r
-\r
-               fprintf(fp, "   }\n");\r
-               fprintf(fp, "}\n");\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-EmitFDInstructions()\r
-{\r
-       UINT32 dwLoop = 0;\r
-       UINT32 dwLoop2 = 0;\r
-\r
-       bCurrentMode = TIMING_DDFD;\r
-\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               while (dwLoop < 0x100)\r
-               {\r
-                       sprintf(procname, "FDInst%.2x", dwLoop);\r
-                       dwLoop2 = 0;\r
-\r
-                       while (DDFDOps[dwLoop2].bOpCode != dwLoop && DDFDOps[dwLoop2].bOpCode != 0xffffffff)\r
-                               dwLoop2++;\r
-\r
-                       assert(dwLoop2 < 0x100);\r
-                       if (DDFDOps[dwLoop2].Emitter && DDFDOps[dwLoop2].bOpCode != 0xffffffff)\r
-                               DDFDOps[dwLoop2].Emitter((UINT32) dwLoop);\r
-\r
-                       dwLoop++;\r
-               }\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "void FDHandler(void)\n");\r
-               fprintf(fp, "{\n");\r
-               fprintf(fp, "   switch (*pbPC++)\n");\r
-               fprintf(fp, "   {\n");\r
-\r
-               while (dwLoop < 0x100)\r
-               {\r
-                       dwLoop2 = 0;\r
-\r
-                       fprintf(fp, "           case 0x%.2x:\n", dwLoop);\r
-                       fprintf(fp, "           {\n");\r
-\r
-                       while (DDFDOps[dwLoop2].bOpCode != dwLoop && DDFDOps[dwLoop2].bOpCode != 0xffffffff)\r
-                               dwLoop2++;\r
-\r
-                       if (bTimingDDFD[dwLoop])\r
-                       {\r
-                               fprintf(fp, "                   sdwCyclesRemaining -= %ld;\n", bTimingDDFD[dwLoop]);\r
-                       }\r
-\r
-                       if (DDFDOps[dwLoop2].Emitter)\r
-                       {\r
-                               DDFDOps[dwLoop2].Emitter(dwLoop);\r
-                       }\r
-                       else\r
-                       {\r
-                               InvalidInstructionC(2);\r
-                       }\r
-\r
-                       fprintf(fp, "                   break;\n");\r
-                       fprintf(fp, "           }\n");\r
-                       ++dwLoop;\r
-               }\r
-\r
-               fprintf(fp, "   }\n");\r
-               fprintf(fp, "}\n");\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-/* These are the meta routines */\r
-\r
-void ReadMemoryByteHandler()\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               Alignment();\r
-               fprintf(fp, "; This is a generic read memory byte handler when a foreign\n");\r
-               fprintf(fp, "; handler is to be called\n\n");\r
-               fprintf(fp, "; EDI=Handler address, EDX=Address\n");\r
-               fprintf(fp, "; On return, EDX & EDI are undisturbed and AL=Byte read\n\n");\r
-               fprintf(fp, "ReadMemoryByte:\n");\r
-       \r
-               fprintf(fp, "           mov     [_z80af], ax    ; Save AF\n");\r
-               fprintf(fp, "           cmp     [edi+8], dword 0 ; Null handler?\n");\r
-               fprintf(fp, "           je      directReadHandler       ; Yep! It's a direct read!\n\n");\r
-\r
-               fprintf(fp, "           mov     [_z80hl], bx    ; Save HL\n");\r
-               fprintf(fp, "           mov     [_z80bc], cx    ; Save BC\n");\r
-\r
-               fprintf(fp, "           sub     esi, ebp        ; Our program counter\n", cpubasename);\r
-               fprintf(fp, "           mov     [_z80pc], si    ; Save our program counter\n", cpubasename);\r
-\r
-               // Now adjust the proper timing\r
-\r
-               fprintf(fp, "           mov     esi, [dwOriginalExec]   \n");\r
-               fprintf(fp, "           sub     esi, [cyclesRemaining]\n");\r
-               fprintf(fp, "           add     [dwElapsedTicks], esi\n");\r
-               fprintf(fp, "           add     [_z80rCounter], esi\n");\r
-               fprintf(fp, "           sub     [dwOriginalExec], esi\n");\r
-       \r
-               fprintf(fp, "           push    edi     ; Save our structure address\n");\r
-               fprintf(fp, "           push    edx     ; And our desired address\n");\r
-\r
-               if (FALSE == bUseStack)\r
-               {\r
-                       fprintf(fp, "           mov     eax, edx        ; Get our desired address reg\n");\r
-                       fprintf(fp, "           mov     edx, edi        ; Pointer to the structure\n");\r
-               }\r
-       \r
-               fprintf(fp, "           call    dword [edi + 8] ; Go call our handler\n");\r
-       \r
-               fprintf(fp, "           pop     edx     ; Restore our address\n");\r
-               fprintf(fp, "           pop     edi     ; Restore our handler's address\n");\r
-       \r
-               fprintf(fp, "           xor     ebx, ebx        ; Zero our future HL\n");\r
-               fprintf(fp, "           xor     esi, esi        ; Zero it!\n");\r
-               fprintf(fp, "           mov     ebp, [_z80Base] ; Base pointer comes back\n", cpubasename);\r
-               fprintf(fp, "           mov     si, [_z80pc]    ; Get our program counter back\n", cpubasename);\r
-               fprintf(fp, "           xor     ecx, ecx        ; Zero our future BC\n");\r
-               fprintf(fp, "           add     esi, ebp        ; Rebase it properly\n");\r
-       \r
-               fprintf(fp, "           mov     bx, [_z80hl]    ; Get HL back\n");\r
-               fprintf(fp, "           mov     cx, [_z80bc]    ; Get BC back\n");\r
-       \r
-       // Note: the callee must restore AF!\r
-\r
-               fprintf(fp, "           ret\n\n");\r
-               fprintf(fp, "directReadHandler:\n");\r
-               fprintf(fp, "           mov     eax, [edi+12]   ; Get our base address\n");\r
-               fprintf(fp, "           sub     edx, [edi]      ; Subtract our base (low) address\n");\r
-               fprintf(fp, "           mov     al, [edx+eax]   ; Get our data byte\n");\r
-               fprintf(fp, "           and     eax, 0ffh       ; Only the lower byte matters!\n");\r
-               fprintf(fp, "           add     edx, [edi]      ; Add our base back\n");\r
-               fprintf(fp, "           ret             ; Return to caller!\n\n");\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-void WriteMemoryByteHandler()\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               Alignment();\r
-               fprintf(fp, "; This is a generic read memory byte handler when a foreign\n");\r
-               fprintf(fp, "; handler is to be called.\n");\r
-               fprintf(fp, "; EDI=Handler address, AL=Byte to write, EDX=Address\n");\r
-               fprintf(fp, "; EDI and EDX Are undisturbed on exit\n\n");\r
-               fprintf(fp, "WriteMemoryByte:\n");\r
-\r
-               fprintf(fp, "           cmp     [edi+8], dword 0        ; Null handler?\n");\r
-               fprintf(fp, "           je      directWriteHandler\n\n");\r
-               \r
-               \r
-               fprintf(fp, "           mov     [_z80hl], bx    ; Save HL\n");\r
-               fprintf(fp, "           mov     [_z80bc], cx    ; Save BX\n");\r
-       \r
-               fprintf(fp, "           sub     esi, ebp        ; Our program counter\n", cpubasename);\r
-               fprintf(fp, "           mov     [_z80pc], si    ; Save our program counter\n", cpubasename);\r
-       \r
-               // Now adjust the proper timing\r
-       \r
-               fprintf(fp, "           mov     esi, [dwOriginalExec]   \n");\r
-               fprintf(fp, "           sub     esi, [cyclesRemaining]\n");\r
-               fprintf(fp, "           add     [dwElapsedTicks], esi\n");\r
-               fprintf(fp, "           add     [_z80rCounter], esi\n");\r
-               fprintf(fp, "           sub     [dwOriginalExec], esi\n");\r
-       \r
-               fprintf(fp, "           push    edi     ; Save our structure address\n");\r
-       \r
-               if (bUseStack)\r
-                       fprintf(fp, "           push    eax     ; Data to write\n");\r
-       \r
-               fprintf(fp, "           push    edx     ; And our desired address\n");\r
-       \r
-               if (FALSE == bUseStack)\r
-               {\r
-                       fprintf(fp, "           xchg    eax, edx ; Swap address/data around\n");\r
-                       fprintf(fp, "           mov     ebx, edi        ; Our MemoryWriteByte structure address\n");\r
-               }\r
-       \r
-               fprintf(fp, "           call    dword [edi + 8] ; Go call our handler\n");\r
-       \r
-               fprintf(fp, "           pop     edx     ; Restore our address\n");\r
-               \r
-               if (bUseStack)\r
-                       fprintf(fp, "           pop     eax     ; Restore our data written\n");\r
-               \r
-               fprintf(fp, "           pop     edi     ; Save our structure address\n");\r
-       \r
-               fprintf(fp, "           xor     ebx, ebx        ; Zero our future HL\n");\r
-               fprintf(fp, "           xor     ecx, ecx        ; Zero our future BC\n");\r
-               fprintf(fp, "           mov     bx, [_z80hl]    ; Get HL back\n");\r
-               fprintf(fp, "           mov     cx, [_z80bc]    ; Get BC back\n");\r
-               fprintf(fp, "           mov     ax, [_z80af]    ; Get AF back\n");\r
-               fprintf(fp, "           xor     esi, esi        ; Zero it!\n");\r
-               fprintf(fp, "           mov     si, [_z80pc]    ; Get our program counter back\n", cpubasename);\r
-               fprintf(fp, "           mov     ebp, [_z80Base] ; Base pointer comes back\n", cpubasename);\r
-               fprintf(fp, "           add     esi, ebp        ; Rebase it properly\n");\r
-\r
-               fprintf(fp, "           ret\n\n");\r
-\r
-               fprintf(fp, "directWriteHandler:\n");\r
-               fprintf(fp, "           sub     edx, [edi]      ; Subtract our offset\n");\r
-               fprintf(fp, "           add     edx, [edi+12]   ; Add in the base address\n");\r
-               fprintf(fp, "           mov     [edx], al       ; Store our byte\n");\r
-               fprintf(fp, "           sub     edx, [edi+12]   ; Restore our base address\n");\r
-               fprintf(fp, "           add     edx, [edi]      ; And put our offset back\n");\r
-               fprintf(fp, "           ret\n\n");\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-void PushWordHandler()\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               Alignment();\r
-       \r
-               fprintf(fp, ";\n");\r
-               fprintf(fp, "; DX=Top of SP, [_wordval]=word value to push\n");\r
-               fprintf(fp, ";\n\n");\r
-               fprintf(fp, "PushWord:\n");\r
-               fprintf(fp, "           mov     dx, [_z80sp]\n");\r
-               fprintf(fp, "           dec     dx\n");\r
-               WriteValueToMemory("dx", "byte [_wordval+1]");\r
-               fprintf(fp, "           dec     dx\n");\r
-               WriteValueToMemory("dx", "byte [_wordval]");\r
-               fprintf(fp, "           sub     [_z80sp], word 2\n");\r
-               fprintf(fp, "           xor     edx, edx\n");\r
-               fprintf(fp, "           ret\n\n");\r
-       }\r
-}\r
-\r
-void PopWordHandler()\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               Alignment();\r
-               \r
-               fprintf(fp, ";\n");\r
-               fprintf(fp, "; [_z80sp]=Top of SP, DX=Word value read\n");\r
-               fprintf(fp, ";\n\n");\r
-               fprintf(fp, "PopWord:\n");\r
-               fprintf(fp, "           mov     dx, [_z80sp]\n");\r
-               \r
-               ReadWordFromMemory("dx", "dx");\r
-               fprintf(fp, "           ret\n\n");\r
-       }\r
-}\r
-\r
-void ReadIoHandler()\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               Alignment();\r
-\r
-               fprintf(fp, "; This is a generic I/O read byte handler for when a foreign\n");\r
-               fprintf(fp, "; handler is to be called\n");\r
-\r
-               fprintf(fp, "; EDI=Handler address, EDX=I/O Address\n");\r
-               fprintf(fp, "; On return, EDX & EDI are undisturbed and AL=Byte read\n\n");\r
-               fprintf(fp, "ReadIOByte:\n");\r
-       \r
-               fprintf(fp, "           mov     [_z80af], ax    ; Save AF\n");\r
-               fprintf(fp, "           mov     [_z80hl], bx    ; Save HL\n");\r
-               fprintf(fp, "           mov     [_z80bc], cx    ; Save BC\n");\r
-\r
-               fprintf(fp, "           sub     esi, ebp        ; Our program counter\n", cpubasename);\r
-               fprintf(fp, "           mov     [_z80pc], si    ; Save our program counter\n", cpubasename);\r
-\r
-               // Now adjust the proper timing\r
-\r
-               fprintf(fp, "           mov     esi, [dwOriginalExec]   \n");\r
-               fprintf(fp, "           sub     esi, [cyclesRemaining]\n");\r
-               fprintf(fp, "           add     [dwElapsedTicks], esi\n");\r
-               fprintf(fp, "           add     [_z80rCounter], esi\n");\r
-               fprintf(fp, "           sub     [dwOriginalExec], esi\n");\r
-\r
-               fprintf(fp, "           push    edi     ; Save our structure address\n");\r
-               fprintf(fp, "           push    edx     ; And our desired I/O port\n");\r
-\r
-               if (FALSE == bUseStack)\r
-               {\r
-                       fprintf(fp, "           mov     eax, edx        ; Get our desired address reg\n");\r
-                       fprintf(fp, "           mov     edx, edi        ; Pointer to the structure\n");\r
-               }\r
-\r
-               fprintf(fp, "           call    dword [edi + 4] ; Go call our handler\n");\r
-\r
-               fprintf(fp, "           pop     edx     ; Restore our address\n");\r
-               fprintf(fp, "           pop     edi     ; Restore our handler's address\n");\r
-\r
-               fprintf(fp, "           xor     ebx, ebx        ; Zero our future HL\n");\r
-               fprintf(fp, "           xor     ecx, ecx        ; Zero our future BC\n");\r
-               fprintf(fp, "           xor     esi, esi        ; Zero it!\n");\r
-               fprintf(fp, "           mov     si, [_z80pc]    ; Get our program counter back\n", cpubasename);\r
-               fprintf(fp, "           mov     ebp, [_z80Base] ; Base pointer comes back\n", cpubasename);\r
-               fprintf(fp, "           add     esi, ebp        ; Rebase it properly\n");\r
-\r
-               fprintf(fp, "           mov     bx, [_z80hl]    ; Get HL back\n");\r
-               fprintf(fp, "           mov     cx, [_z80bc]    ; Get BC back\n");\r
-\r
-       // Note: the callee must restore AF!\r
-\r
-               fprintf(fp, "           ret\n\n");\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-void WriteIoHandler()\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               Alignment();\r
-\r
-               fprintf(fp, "; This is a generic write I/O byte handler when a foreign handler is to\n");\r
-               fprintf(fp, "; be called\n");\r
-               fprintf(fp, "; EDI=Handler address, AL=Byte to write, EDX=I/O Address\n");\r
-               fprintf(fp, "; EDI and EDX Are undisturbed on exit\n\n");\r
-               fprintf(fp, "WriteIOByte:\n");\r
-       \r
-               fprintf(fp, "           mov     [_z80hl], bx    ; Save HL\n");\r
-               fprintf(fp, "           mov     [_z80bc], cx    ; Save BX\n");\r
-\r
-               fprintf(fp, "           sub     esi, ebp        ; Our program counter\n", cpubasename);\r
-               fprintf(fp, "           mov     [_z80pc], si    ; Save our program counter\n", cpubasename);\r
-\r
-               // Now adjust the proper timing\r
-\r
-               fprintf(fp, "           mov     esi, [dwOriginalExec]   \n");\r
-               fprintf(fp, "           sub     esi, [cyclesRemaining]\n");\r
-               fprintf(fp, "           add     [dwElapsedTicks], esi\n");\r
-               fprintf(fp, "           add     [_z80rCounter], esi\n");\r
-               fprintf(fp, "           sub     [dwOriginalExec], esi\n");\r
-\r
-               fprintf(fp, "           push    edi     ; Save our structure address\n");\r
-\r
-               if (bUseStack)\r
-                       fprintf(fp, "           push    eax     ; Data to write\n");\r
-\r
-               fprintf(fp, "           push    edx     ; And our desired I/O address\n");\r
-\r
-               if (FALSE == bUseStack)\r
-               {\r
-                       fprintf(fp, "           xchg    eax, edx ; Swap address/data around\n");\r
-                       fprintf(fp, "           mov     ebx, edi        ; Our z80IoWrite structure address\n");\r
-               }\r
-\r
-               fprintf(fp, "           call    dword [edi + 4] ; Go call our handler\n");\r
-\r
-               fprintf(fp, "           pop     edx     ; Restore our address\n");\r
-       \r
-               if (bUseStack)\r
-                       fprintf(fp, "           pop     eax     ; Restore our data written\n");\r
-               \r
-               fprintf(fp, "           pop     edi     ; Save our structure address\n");\r
-\r
-               fprintf(fp, "           xor     ebx, ebx        ; Zero our future HL\n");\r
-               fprintf(fp, "           xor     ecx, ecx        ; Zero our future BC\n");\r
-               fprintf(fp, "           mov     bx, [_z80hl]    ; Get HL back\n");\r
-               fprintf(fp, "           mov     cx, [_z80bc]    ; Get BC back\n");\r
-               fprintf(fp, "           mov     ax, [_z80af]    ; Get AF back\n");\r
-               fprintf(fp, "           xor     esi, esi        ; Zero it!\n");\r
-               fprintf(fp, "           mov     si, [_z80pc]    ; Get our program counter back\n", cpubasename);\r
-               fprintf(fp, "           mov     ebp, [_z80Base] ; Base pointer comes back\n", cpubasename);\r
-               fprintf(fp, "           add     esi, ebp        ; Rebase it properly\n");\r
-\r
-               fprintf(fp, "           ret\n\n");\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-ExecCode()\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               fprintf(fp, "           global  _%sexec\n", cpubasename);\r
-               fprintf(fp, "           global  %sexec_\n", cpubasename);\r
-       \r
-               if (bPlain)\r
-                       fprintf(fp, "           global  %sexec\n", cpubasename);\r
-       \r
-               sprintf(procname, "%sexec_", cpubasename);\r
-               ProcBegin(0xffffffff);\r
-       \r
-               fprintf(fp, "_%sexec:\n", cpubasename);\r
-       \r
-               if (bPlain)\r
-                       fprintf(fp, "%sexec:\n", cpubasename);\r
-       \r
-               if (bUseStack)\r
-                       fprintf(fp, "           mov     eax, [esp+4]    ; Get our execution cycle count\n");\r
-       \r
-               fprintf(fp, "           push    ebx                     ; Save all registers we use\n");\r
-               fprintf(fp, "           push    ecx\n");\r
-               fprintf(fp, "           push    edx\n");\r
-               fprintf(fp, "           push    ebp\n");\r
-               fprintf(fp, "           push    esi\n");\r
-               fprintf(fp, "           push    edi\n");\r
-               fprintf(fp, "\n");\r
-\r
-               fprintf(fp, "           mov     edi, eax\n");   \r
-               fprintf(fp, "           mov     dword [cyclesRemaining], eax    ; Store # of instructions to\n");\r
-               fprintf(fp, "           mov     [dwLastRSample], eax\n");\r
-               fprintf(fp, "           mov     [dwOriginalExec], eax   ; Store this!\n");\r
-\r
-               fprintf(fp, "           cmp     dword [_z80halted], 0\n");\r
-               fprintf(fp, "           je      goCpu\n");\r
-               fprintf(fp, "           add     [_z80rCounter], eax\n");\r
-       \r
-               if (FALSE == bNoTiming)\r
-               {\r
-                       fprintf(fp, "           add     dword [dwElapsedTicks], eax\n");\r
-               }\r
-       \r
-               fprintf(fp, "           mov     dword [cyclesRemaining], 0      ; Nothing left!\n");\r
-               fprintf(fp, "           mov     eax, 80000000h  ; Successful exection\n");\r
-               fprintf(fp, "           jmp     popReg\n");\r
-               fprintf(fp, "goCpu:\n");\r
-               fprintf(fp, "           cld                             ; Go forward!\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "           xor     eax, eax                ; Zero EAX 'cause we use it!\n");\r
-               fprintf(fp, "           xor     ebx, ebx                ; Zero EBX, too\n");\r
-               fprintf(fp, "           xor     ecx, ecx                ; Zero ECX\n");\r
-               fprintf(fp, "           xor     edx, edx                ; And EDX\n");\r
-               fprintf(fp, "           xor     esi, esi                ; Zero our source address\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "           mov     ax, [_z80af]            ; Accumulator & flags\n");\r
-               fprintf(fp, "           xchg    ah, al          ; Swap these for later\n");\r
-               fprintf(fp, "           mov     bx, [_z80hl]            ; Get our HL value\n");\r
-               fprintf(fp, "           mov     cx, [_z80bc]            ; And our BC value\n");\r
-               fprintf(fp, "           mov     ebp, [_z80Base]         ; Get the base address\n");\r
-               fprintf(fp, "           mov     si, [_z80pc]            ; Get our program counter\n");\r
-               fprintf(fp, "           add     esi, ebp                ; Add in our base address\n");\r
-\r
-               fprintf(fp, "           cmp     [_z80intPending], byte 0        ; Interrupt pending?\n");\r
-               fprintf(fp, "           jz              masterExecTarget\n\n");\r
-               fprintf(fp, "           call    causeInternalInterrupt\n\n");\r
-               fprintf(fp, "masterExecTarget:\n");\r
-               fprintf(fp, "           mov     dl, [esi]\n");\r
-               fprintf(fp, "           inc     esi\n");\r
-               fprintf(fp, "           jmp     dword [z80regular+edx*4]\n\n");\r
-               fprintf(fp, "; We get to invalidInsWord if it's a double byte invalid opcode\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "invalidInsWord:\n");\r
-       \r
-               fprintf(fp, "           dec     esi\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "; We get to invalidInsByte if it's a single byte invalid opcode\n");\r
-               fprintf(fp, "\n");\r
-       \r
-               fprintf(fp, "invalidInsByte:\n");\r
-               fprintf(fp, "           xchg    ah, al          ; Swap them back so they look good\n");\r
-               fprintf(fp, "           mov     [_z80af], ax            ; Store A & flags\n");\r
-               fprintf(fp, "           dec     esi                     ; Back up one instruction...\n");\r
-               fprintf(fp, "           mov     edx, esi                ; Get our address in EAX\n");\r
-               fprintf(fp, "           sub     edx, ebp                ; And subtract our base for\n");\r
-               fprintf(fp, "                                           ; an invalid instruction\n");\r
-               fprintf(fp, "           jmp     short emulateEnd\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "noMoreExec:\n");\r
-               fprintf(fp, "           cmp     [bEIExit], byte 0       ; Are we exiting because of an EI?\n");\r
-               fprintf(fp, "           jne     checkEI\n");\r
-               fprintf(fp, "noMoreExecNoEI:\n");\r
-               fprintf(fp, "           xchg    ah, al          ; Swap these for later\n");\r
-               fprintf(fp, "           mov     [_z80af], ax            ; Store A & flags\n");\r
-       \r
-               fprintf(fp, "           mov     edx, [dwOriginalExec]   ; Original exec time\n");\r
-               fprintf(fp, "           sub     edx, edi                ; Subtract # of cycles remaining\n");\r
-               fprintf(fp, "           add     [_z80rCounter], edx\n");\r
-               fprintf(fp, "           add     [dwElapsedTicks], edx   ; Add our executed time\n");\r
-       \r
-               fprintf(fp, "           mov     edx, 80000000h          ; Indicate successful exec\n");\r
-               fprintf(fp, "           jmp     short emulateEnd        ; All finished!\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "; Now let's tuck away the virtual registers for next time\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "storeFlags:\n");\r
-               fprintf(fp, "           xchg    ah, al          ; Swap these for later\n");\r
-               fprintf(fp, "           mov     [_z80af], ax            ; Store A & flags\n");\r
-               fprintf(fp, "emulateEnd:\n");\r
-               fprintf(fp, "           mov     [_z80hl], bx            ; Store HL\n");\r
-               fprintf(fp, "           mov     [_z80bc], cx            ; Store BC\n");\r
-               fprintf(fp, "           sub     esi, [_z80Base]         ; Knock off physical address\n");\r
-               fprintf(fp, "           mov     [_z80pc], si            ; And store virtual address\n");\r
-               fprintf(fp, "           mov     eax, edx                ; Result code return\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "popReg:\n");\r
-               fprintf(fp, "           pop     edi                     ; Restore registers\n");\r
-               fprintf(fp, "           pop     esi\n");\r
-               fprintf(fp, "           pop     ebp\n");\r
-               fprintf(fp, "           pop     edx\n");\r
-               fprintf(fp, "           pop     ecx\n");\r
-               fprintf(fp, "           pop     ebx\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "           ret\n");\r
-               fprintf(fp, "\n");\r
-               Alignment();\r
-               fprintf(fp, "checkEI:\n");\r
-               fprintf(fp, "           xor     edx, edx\n");\r
-               fprintf(fp, "           mov     [bEIExit], byte 0\n");\r
-               fprintf(fp, "           sub     edx, edi        ; Find out how much time has passed\n");\r
-               fprintf(fp, "           mov     edi, [dwEITiming]\n");\r
-               fprintf(fp, "           sub     edi, edx\n");\r
-               fprintf(fp, "           js              noMoreExecNoEI\n");\r
-               fprintf(fp, "           xor     edx, edx\n");\r
-\r
-               fprintf(fp, "           cmp     [_z80intPending], byte 0\n");\r
-               fprintf(fp, "           je      near masterExecTarget\n");\r
-               fprintf(fp, "           call    causeInternalInterrupt\n");\r
-               fprintf(fp, "           jmp     masterExecTarget\n\n");\r
-\r
-               Alignment();\r
-               fprintf(fp, "causeInternalInterrupt:\n");\r
-               fprintf(fp, "           mov     dword [_z80halted], 0   ; We're not halted anymore!\n");\r
-               fprintf(fp, "           test    [_z80iff], byte IFF1    ; Interrupt enabled yet?\n");\r
-               fprintf(fp, "           jz              near internalInterruptsDisabled\n");\r
-\r
-               fprintf(fp, "\n; Interrupts enabled. Clear IFF1 and IFF2\n\n");\r
-\r
-               fprintf(fp, "           mov     [_z80intPending], byte 0\n");\r
-\r
-               fprintf(fp, "\n; Save off our active register sets\n\n");\r
-\r
-               fprintf(fp, "           xchg    ah, al          ; Swap these for later\n");\r
-               fprintf(fp, "           mov     [_z80af], ax            ; Store A & flags\n");\r
-               fprintf(fp, "           mov     [_z80hl], bx            ; Store HL\n");\r
-               fprintf(fp, "           mov     [_z80bc], cx            ; Store BC\n");\r
-               fprintf(fp, "           sub     esi, ebp                        ; Knock off physical address\n");\r
-               fprintf(fp, "           mov     [_z80pc], si            ; And store virtual address\n");\r
-\r
-               fprintf(fp, "           xor     eax, eax\n");\r
-               fprintf(fp, "           mov     al, [_intData]\n\n");\r
-\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "           push    edi\n");\r
-               fprintf(fp, "\n");\r
-       \r
-               if (bThroughCallHandler)\r
-               {\r
-                       fprintf(fp, "       pushad\n" );\r
-                       fprintf(fp, "           xor edx, edx\n" );\r
-                       fprintf(fp, "           mov     ax, [_z80pc]\n");\r
-                       fprintf(fp, "           mov     [_wordval], ax\n");\r
-                       fprintf(fp, "           push    ecx\n");\r
-                       fprintf(fp, "           push    ebx\n");\r
-                       fprintf(fp, "           push    esi\n");\r
-       \r
-                       fprintf(fp, "       mov ax, [_z80af]\n");       // Get AF\r
-                       fprintf(fp, "       mov bx, [_z80hl]\n");       // Get HL\r
-                       fprintf(fp, "       mov cx, [_z80bc]\n");       // Get BC\r
-                       fprintf(fp, "           call    PushWord\n");\r
-       \r
-                       fprintf(fp, "           pop     esi\n");\r
-                       fprintf(fp, "           pop     ebx\n");\r
-                       fprintf(fp, "           pop     ecx\n");\r
-                       fprintf(fp, "       popad\n" );\r
-               }\r
-               else\r
-               {\r
-                       fprintf(fp, "           mov     dx, [_z80pc]\n");\r
-                       fprintf(fp, "           xor     edi, edi\n");\r
-                       fprintf(fp, "           mov     di, word [_z80sp]\n");\r
-                       fprintf(fp, "           sub     di, 2\n");\r
-                       fprintf(fp, "           mov     word [_z80sp], di\n");\r
-                       fprintf(fp, "           mov     [ebp+edi], dx\n");\r
-               }\r
-       \r
-               fprintf(fp, "           cmp     dword [_z80interruptMode], 2 ; Are we lower than mode 2?\n");\r
-               fprintf(fp, "           jb              internalJustModeTwo\n");\r
-               fprintf(fp, "           mov     ah, [_z80i]     ; Get our high address here\n");\r
-               fprintf(fp, "           and     eax, 0ffffh ; Only the lower part\n");\r
-               fprintf(fp, "           mov     ax, [eax+ebp] ; Get our vector\n");\r
-               fprintf(fp, "           jmp     short internalSetNewVector ; Go set it!\n");\r
-               fprintf(fp, "internalJustModeTwo:\n");\r
-               fprintf(fp, "           mov     ax, word [_z80intAddr]\n");\r
-               fprintf(fp, "internalSetNewVector:\n");\r
-               fprintf(fp, "           mov     [_z80pc], ax\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "           pop     edi\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "           xor     eax, eax        ; Zero this so we can use it as an index\n");\r
-\r
-               fprintf(fp, "           mov     al, [_z80interruptMode]\n");\r
-               fprintf(fp, "           mov     al, [intModeTStates+eax]\n");\r
-               fprintf(fp, "           sub     edi, eax\n");\r
-               fprintf(fp, "           add     [_z80rCounter], eax\n");\r
-\r
-               fprintf(fp, "\n; Restore all the registers and whatnot\n\n");\r
-\r
-               fprintf(fp, "           mov     ax, [_z80af]            ; Accumulator & flags\n");\r
-               fprintf(fp, "           xchg    ah, al          ; Swap these for later\n");\r
-               fprintf(fp, "           mov     bx, [_z80hl]            ; Get our HL value\n");\r
-               fprintf(fp, "           mov     cx, [_z80bc]            ; And our BC value\n");\r
-               fprintf(fp, "           mov     ebp, [_z80Base]         ; Get the base address\n");\r
-               fprintf(fp, "           mov     si, [_z80pc]            ; Get our program counter\n");\r
-               fprintf(fp, "           add     esi, ebp                ; Add in our base address\n");\r
-\r
-               fprintf(fp, "internalInterruptsDisabled:\n");\r
-               fprintf(fp, "           xor     edx, edx\n");\r
-               fprintf(fp, "           ret\n");\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-NmiCode()\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               fprintf(fp, "           global  _%snmi\n", cpubasename);\r
-               fprintf(fp, "           global  %snmi_\n", cpubasename);\r
-\r
-               if (bPlain)\r
-                       fprintf(fp, "           global  %snmi\n", cpubasename);\r
-       \r
-               sprintf(procname, "%snmi_", cpubasename);\r
-               ProcBegin(0xffffffff);\r
-               fprintf(fp, "_%snmi:\n", cpubasename);\r
-       \r
-               if (bPlain)\r
-                       fprintf(fp, "%snmi:\n", cpubasename);\r
-\r
-               fprintf(fp, "           mov     dword [_z80halted], 0   ; We're not halted anymore!\n");\r
-               fprintf(fp, "           mov     al, [_z80iff]   ; Get our IFF setting\n");\r
-               fprintf(fp, "           and     al, IFF1        ; Just IFF 1\n");\r
-               fprintf(fp, "           shl     al, 1   ; Makes IFF1->IFF2 and zeros IFF1\n");\r
-               fprintf(fp, "           mov     [_z80iff], al   ; Store it back to the interrupt state!\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "           push    ebp\n");\r
-               fprintf(fp, "           push    edi\n");\r
-               fprintf(fp, "           mov     ebp, [_z80Base]\n");\r
-               fprintf(fp, "\n");\r
-\r
-               fprintf(fp, "           xor     eax, eax\n");\r
-               fprintf(fp, "           mov     ax, [_z80pc]\n");\r
-\r
-               if (bThroughCallHandler)\r
-               {\r
-                       fprintf(fp, "           push    esi\n");\r
-                       fprintf(fp, "           push    ebx\n");\r
-                       fprintf(fp, "           push    ecx\n");\r
-\r
-                       fprintf(fp, "           mov     [_wordval], ax\n");\r
-                       fprintf(fp, "           mov     esi, ebp\n");\r
-                       fprintf(fp, "           add     esi, eax\n");\r
-                       fprintf(fp, "       mov ax, [_z80af]\n");       // Get AF\r
-                       fprintf(fp, "       mov bx, [_z80hl]\n");       // Get HL\r
-                       fprintf(fp, "       mov cx, [_z80bc]\n");       // Get BC\r
-                       fprintf(fp, "           push    ebx\n");\r
-                       fprintf(fp, "           push    ecx\n");\r
-                       fprintf(fp, "           push    edx\n");\r
-                       fprintf(fp, "           push    esi\n");\r
-                       fprintf(fp, "           push    eax\n");\r
-                       fprintf(fp, "           call    PushWord\n");\r
-                       fprintf(fp, "           pop     eax\n");\r
-                       fprintf(fp, "           pop     esi\n");\r
-                       fprintf(fp, "           pop     edx\n");\r
-                       fprintf(fp, "           pop     ecx\n");\r
-                       fprintf(fp,     "               pop     ebx\n");\r
-\r
-                       fprintf(fp, "           pop     ecx\n");\r
-                       fprintf(fp, "           pop     ebx\n");\r
-                       fprintf(fp, "           pop     esi\n");\r
-               }         \r
-               else   \r
-               { \r
-                       fprintf(fp, "           xor     edi, edi\n");\r
-                       fprintf(fp, "           mov     di, word [_z80sp]\n");\r
-                       fprintf(fp, "           sub     di, 2\n");\r
-                       fprintf(fp, "           mov     word [_z80sp], di\n");\r
-                       fprintf(fp, "           mov     [ebp+edi], ax\n");\r
-               }\r
-\r
-               fprintf(fp, "           mov     ax, [_z80nmiAddr]\n");\r
-               fprintf(fp, "           mov     [_z80pc], ax\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "           add     [dwElapsedTicks], dword 11      ; 11 T-States for NMI\n");\r
-               fprintf(fp, "           add     [_z80rCounter], dword 11\n");\r
-               fprintf(fp, "           pop     edi\n");\r
-               fprintf(fp, "           pop     ebp\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "           xor     eax, eax        ; Indicate we took the interrupt\n");\r
-               fprintf(fp, "           ret\n");\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "/* NMI Handler */\n\n");\r
-               fprintf(fp, "UINT32 %snmi(void)\n", cpubasename);\r
-               fprintf(fp, "{\n");\r
-\r
-               fprintf(fp, "   cpu.z80halted = 0;\n");\r
-               fprintf(fp, "   pbSP = (cpu.z80Base + cpu.z80sp - 1);   /* Normalize the stack pointer */\n");\r
-               fprintf(fp, "   *pbSP-- = cpu.z80pc >> 8;       /* LSB */\n");\r
-               fprintf(fp, "   *pbSP = (UINT8) cpu.z80pc;      /* MSB */\n");\r
-               fprintf(fp, "   cpu.z80sp -= 2; /* Back our stack up */\n");\r
-               fprintf(fp, "   cpu.z80pc = cpu.z80nmiAddr;     /* Our NMI */\n");\r
-\r
-               fprintf(fp, "   return(0);\n");\r
-               fprintf(fp, "}\n\n");\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-IntCode()\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               fprintf(fp, "           global  _%sint\n", cpubasename);\r
-               fprintf(fp, "           global  %sint_\n", cpubasename);\r
-\r
-               if (bPlain)\r
-                       fprintf(fp, "           global  %sint\n", cpubasename);\r
-\r
-               sprintf(procname, "%sint_", cpubasename);\r
-               ProcBegin(0xffffffff);\r
-               fprintf(fp, "_%sint:\n", cpubasename);\r
-\r
-               if (bPlain)\r
-                       fprintf(fp, "%sint:\n", cpubasename);\r
-\r
-               if (bUseStack)\r
-                       fprintf(fp, "           mov     eax, [esp+4]    ; Get our (potential) lower interrupt address\n");\r
-       \r
-               fprintf(fp, "           mov     dword [_z80halted], 0   ; We're not halted anymore!\n");\r
-\r
-               fprintf(fp, "           mov     ah, IFF1        ; Is IFF1 enabled?\n");\r
-               fprintf(fp, "           and     ah, [_z80iff]   ; Well, is it?\n");\r
-               fprintf(fp, "           jz              near interruptsDisabled\n");\r
-\r
-               fprintf(fp, "\n; Interrupts enabled. Clear IFF1 and IFF2\n\n");\r
-\r
-               fprintf(fp, "           and     dword [_z80iff], ~(IFF1 | IFF2);\n\n");\r
-               fprintf(fp, "           mov     [_z80intPending], byte 0\n");\r
-\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "           push    ebp\n");\r
-               fprintf(fp, "           push    edi\n");\r
-               fprintf(fp, "           push    edx\n");\r
-               fprintf(fp, "           mov     ebp, [_z80Base]\n");\r
-               fprintf(fp, "\n");\r
-       \r
-       \r
-               if (bThroughCallHandler)\r
-               {\r
-                       fprintf(fp, "       pushad\n" );\r
-                       fprintf(fp, "           xor edx, edx\n" );\r
-                       fprintf(fp, "           mov     ax, [_z80pc]\n");\r
-                       fprintf(fp, "           mov     [_wordval], ax\n");\r
-                       fprintf(fp, "           push    ecx\n");\r
-                       fprintf(fp, "           push    ebx\n");\r
-                       fprintf(fp, "           push    esi\n");\r
-       \r
-                       fprintf(fp, "       mov ax, [_z80af]\n");       // Get AF\r
-                       fprintf(fp, "       mov bx, [_z80hl]\n");       // Get HL\r
-                       fprintf(fp, "       mov cx, [_z80bc]\n");       // Get BC\r
-                       fprintf(fp, "           call    PushWord\n");\r
-       \r
-                       fprintf(fp, "           pop     esi\n");\r
-                       fprintf(fp, "           pop     ebx\n");\r
-                       fprintf(fp, "           pop     ecx\n");\r
-                       fprintf(fp, "       popad\n" );\r
-               }\r
-               else\r
-               {\r
-                       fprintf(fp, "           mov     dx, [_z80pc]\n");\r
-                       fprintf(fp, "           xor     edi, edi\n");\r
-                       fprintf(fp, "           mov     di, word [_z80sp]\n");\r
-                       fprintf(fp, "           sub     di, 2\n");\r
-                       fprintf(fp, "           mov     word [_z80sp], di\n");\r
-                       fprintf(fp, "           mov     [ebp+edi], dx\n");\r
-               }\r
-       \r
-               fprintf(fp, "           cmp     dword [_z80interruptMode], 2 ; Are we lower than mode 2?\n");\r
-               fprintf(fp, "           jb              justModeTwo\n");\r
-               fprintf(fp, "           mov     ah, [_z80i]     ; Get our high address here\n");\r
-               fprintf(fp, "           and     eax, 0ffffh ; Only the lower part\n");\r
-               fprintf(fp, "           mov     ax, [eax+ebp] ; Get our vector\n");\r
-               fprintf(fp, "           jmp     short setNewVector ; Go set it!\n");\r
-               fprintf(fp, "justModeTwo:\n");\r
-               fprintf(fp, "           mov     ax, word [_z80intAddr]\n");\r
-               fprintf(fp, "setNewVector:\n");\r
-               fprintf(fp, "           mov     [_z80pc], ax\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "           pop     edx\n");\r
-               fprintf(fp, "           pop     edi\n");\r
-               fprintf(fp, "           pop     ebp\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "           xor     eax, eax        ; Zero this so we can use it as an index\n");\r
-\r
-               fprintf(fp, "           mov     al, [_z80interruptMode]\n");\r
-               fprintf(fp, "           mov     al, [intModeTStates+eax]\n");\r
-               fprintf(fp, "           add     [dwElapsedTicks], eax\n");\r
-               fprintf(fp, "           add     [_z80rCounter], eax\n");\r
-               fprintf(fp, "           xor     eax, eax        ; Indicate we took the interrupt\n");\r
-\r
-               fprintf(fp, "           jmp     short z80intExit\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "interruptsDisabled:\n");\r
-               fprintf(fp, "           mov     [_z80intPending], byte 1\n");\r
-               fprintf(fp, "           mov     [_intData], al  ; Save this info for later\n");\r
-               fprintf(fp, "           mov     eax, 0ffffffffh         ; Indicate we didn't take it\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "z80intExit:\n");\r
-               fprintf(fp, "           ret\n\n");\r
-\r
-\r
-               fprintf(fp, "           global  _%sClearPendingInterrupt\n", cpubasename);\r
-               fprintf(fp, "           global  %sClearPendingInterrupt_\n", cpubasename);\r
-\r
-               if (bPlain)\r
-                       fprintf(fp, "           global  %sClearPendingInterrupt\n", cpubasename);\r
-\r
-               sprintf(procname, "%sClearPendingInterrupt_", cpubasename);\r
-               ProcBegin(0xffffffff);\r
-               fprintf(fp, "_%sClearPendingInterrupt:\n", cpubasename);\r
-\r
-               if (bPlain)\r
-                       fprintf(fp, "%sClearPendingInterrupt:\n", cpubasename);\r
-\r
-               fprintf(fp, "           mov     [_z80intPending], byte 0\n");\r
-               fprintf(fp, "           ret\n\n");\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "/* Interrupt handler */\n\n");\r
-               fprintf(fp, "UINT32 %sint(UINT32 dwLowAddr)\n", cpubasename);\r
-               fprintf(fp, "{\n");\r
-               fprintf(fp, "   cpu.z80halted = 0;\n");\r
-\r
-               fprintf(fp, "   if (0 == (cpu.z80iff & IFF1))\n");\r
-               fprintf(fp, "           return(0xffffffff);\n");\r
-\r
-               fprintf(fp, "   cpu.z80iff &= ~(IFF1 | IFF2);\n");\r
-               fprintf(fp, "   pbSP = (cpu.z80Base + cpu.z80sp - 1);   /* Normalize the stack pointer */\n");\r
-               fprintf(fp, "   *pbSP-- = cpu.z80pc >> 8;       /* LSB */\n");\r
-               fprintf(fp, "   *pbSP = (UINT8) cpu.z80pc;      /* MSB */\n");\r
-               fprintf(fp, "   cpu.z80sp -= 2; /* Back our stack up */\n");\r
-\r
-               fprintf(fp, "   if (2 == cpu.z80interruptMode)\n");\r
-               fprintf(fp, "   {\n");\r
-               fprintf(fp, "           cpu.z80pc = ((UINT16) cpu.z80i << 8) | (dwLowAddr & 0xff);\n");\r
-               fprintf(fp, "           cpu.z80pc = ((UINT16) cpu.z80Base[cpu.z80pc + 1] << 8) | (cpu.z80Base[cpu.z80pc]);\n");\r
-               fprintf(fp, "   }\n");\r
-               fprintf(fp, "   else\n");\r
-               fprintf(fp, "   {\n");\r
-               fprintf(fp, "           cpu.z80pc = cpu.z80intAddr;\n");\r
-               fprintf(fp, "   }\n");\r
-\r
-               fprintf(fp, "   pbPC = cpu.z80Base + cpu.z80pc; /* Normalize the address */\n");\r
-\r
-               fprintf(fp, "   return(0);\n");\r
-               fprintf(fp, "}\n\n");\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-ResetCode()\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               fprintf(fp, "           global  _%sreset\n", cpubasename);\r
-               fprintf(fp, "           global  %sreset_\n", cpubasename);\r
-\r
-               if (bPlain)\r
-                       fprintf(fp, "           global  %sreset\n", cpubasename);\r
-               sprintf(procname, "%sreset_", cpubasename);\r
-               ProcBegin(0xffffffff);\r
-\r
-               fprintf(fp, "_%sreset:\n", cpubasename);\r
-\r
-               if (bPlain)\r
-                       fprintf(fp, "%sreset:\n", cpubasename);\r
-\r
-               fprintf(fp, "           xor     eax, eax        ; Zero AX\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "           mov     dword [_z80halted], eax ; We're not halted anymore!\n");\r
-               fprintf(fp, "           mov     word [_z80af], 0040h    ; Zero A & flags - zero flag set\n");\r
-               fprintf(fp, "           mov     word [_z80bc], ax       ; Zero BC\n");\r
-               fprintf(fp, "           mov     word [_z80de],  ax      ; Zero DE\n");\r
-               fprintf(fp, "           mov     word [_z80hl], ax       ; Zero HL\n");\r
-               fprintf(fp, "           mov     word [_z80afprime], ax  ; Zero AF Prime\n");\r
-               fprintf(fp, "           mov     word [_z80bcprime], ax  ; Zero BC prime\n");\r
-               fprintf(fp, "           mov     word [_z80deprime], ax ; Zero DE prime\n");\r
-               fprintf(fp, "           mov     word [_z80hlprime], ax ; Zero HL prime\n");\r
-               fprintf(fp, "           mov     byte [_z80i], al        ; Zero Interrupt register\n");\r
-               fprintf(fp, "           mov     byte [_z80r], al        ; Zero refresh register\n");\r
-               fprintf(fp, "           mov     word [_z80ix], 0ffffh   ; Default mz80Index register\n");\r
-               fprintf(fp, "           mov     word [_z80iy], 0ffffh   ; Default mz80Index register\n");\r
-               fprintf(fp, "           mov     word [_z80pc], ax       ; Zero program counter\n");\r
-               fprintf(fp, "           mov     word [_z80sp], ax       ; And the stack pointer\n");\r
-               fprintf(fp, "           mov     dword [_z80iff], eax ; IFF1/IFF2 disabled!\n");\r
-               fprintf(fp, "           mov     dword [_z80interruptMode], eax ; Clear our interrupt mode (0)\n");\r
-               fprintf(fp, "           mov     word [_z80intAddr], 38h ; Set default interrupt address\n");\r
-               fprintf(fp, "           mov     word [_z80nmiAddr], 66h ; Set default nmi addr\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "           ret\n");\r
-               fprintf(fp, "\n");\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "/* This routine is mz80's reset handler */\n\n");\r
-               fprintf(fp, "void %sreset(void)\n", cpubasename);\r
-               fprintf(fp, "{\n");\r
-               fprintf(fp, "   cpu.z80halted = 0;\n");\r
-               fprintf(fp, "   cpu.z80AF = 0;\n");\r
-               fprintf(fp, "   cpu.z80F = Z80_FLAG_ZERO;\n");\r
-               fprintf(fp, "   cpu.z80BC = 0;\n");\r
-               fprintf(fp, "   cpu.z80DE = 0;\n");\r
-               fprintf(fp, "   cpu.z80HL = 0;\n");\r
-               fprintf(fp, "   cpu.z80afprime = 0;\n");\r
-               fprintf(fp, "   cpu.z80bcprime = 0;\n");\r
-               fprintf(fp, "   cpu.z80deprime = 0;\n");\r
-               fprintf(fp, "   cpu.z80hlprime = 0;\n");\r
-               fprintf(fp, "   cpu.z80i = 0;\n");\r
-               fprintf(fp, "   cpu.z80r = 0;\n");\r
-               fprintf(fp, "   cpu.z80IX = 0xffff; /* Yes, this is intentional */\n");\r
-               fprintf(fp, "   cpu.z80IY = 0xffff; /* Yes, this is intentional */\n");\r
-               fprintf(fp, "   cpu.z80pc = 0;\n");\r
-               fprintf(fp, "   cpu.z80sp = 0;\n");\r
-               fprintf(fp, "   cpu.z80interruptMode = 0;\n");\r
-               fprintf(fp, "   cpu.z80intAddr = 0x38;\n");\r
-               fprintf(fp, "   cpu.z80nmiAddr = 0x66;\n");\r
-               fprintf(fp, "}\n\n");\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-SetContextCode()\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               fprintf(fp, "           global  _%sSetContext\n", cpubasename);\r
-               fprintf(fp, "           global  %sSetContext_\n", cpubasename);\r
-       \r
-               if (bPlain)\r
-                       fprintf(fp, "           global  %sSetContext\n", cpubasename);\r
-       \r
-               sprintf(procname, "%sSetContext_", cpubasename);\r
-               ProcBegin(0xffffffff);\r
-               fprintf(fp, "_%sSetContext:\n", cpubasename);\r
-       \r
-               if (bPlain)\r
-                       fprintf(fp, "%sSetContext:\n", cpubasename);\r
-       \r
-               if (bUseStack)\r
-                       fprintf(fp, "           mov     eax, [esp+4]    ; Get our context address\n");\r
-       \r
-               fprintf(fp, "           push    esi             ; Save registers we use\n");\r
-               fprintf(fp, "           push    edi\n");\r
-               fprintf(fp, "           push    ecx\n");\r
-               fprintf(fp, "           push    es\n");\r
-               fprintf(fp, "           mov     di, ds\n");\r
-               fprintf(fp, "           mov     es, di\n");\r
-               fprintf(fp, "           mov     edi, _%scontextBegin\n", cpubasename);\r
-               fprintf(fp, "           mov     esi, eax        ; Source address in ESI\n");\r
-               fprintf(fp, "           mov     ecx, (_%scontextEnd - _%scontextBegin) >> 2\n", cpubasename, cpubasename);\r
-               fprintf(fp, "           rep     movsd\n");\r
-               fprintf(fp, "           mov     ecx, (_%scontextEnd - _%scontextBegin) & 0x03\n", cpubasename, cpubasename);\r
-               fprintf(fp, "           rep     movsb\n");\r
-               fprintf(fp, "           pop     es\n");\r
-               fprintf(fp, "           pop     ecx\n");\r
-               fprintf(fp, "           pop     edi\n");\r
-               fprintf(fp, "           pop     esi\n");\r
-               fprintf(fp, "           ret                     ; No return code\n");\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "/* Set mz80's context */\n\n");\r
-               fprintf(fp, "void %sSetContext(void *pData)\n", cpubasename);\r
-               fprintf(fp, "{\n");\r
-               fprintf(fp, "   memcpy(&cpu, pData, sizeof(CONTEXTMZ80));\n");\r
-               fprintf(fp, "}\n\n");\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-GetContextCode()\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               fprintf(fp, "           global  _%sGetContext\n", cpubasename);\r
-               fprintf(fp, "           global  %sGetContext_\n", cpubasename);\r
-\r
-               if (bPlain)\r
-                       fprintf(fp, "           global  %sGetContext\n", cpubasename);\r
-       \r
-               sprintf(procname, "%sGetContext_", cpubasename);\r
-               ProcBegin(0xffffffff);\r
-               fprintf(fp, "_%sGetContext:\n", cpubasename);\r
-\r
-               if (bPlain)\r
-                       fprintf(fp, "%sGetContext:\n", cpubasename);\r
-\r
-               if (bUseStack)\r
-                       fprintf(fp, "           mov     eax, [esp+4]    ; Get our context address\n");\r
-\r
-               fprintf(fp, "           push    esi             ; Save registers we use\n");\r
-               fprintf(fp, "           push    edi\n");\r
-               fprintf(fp, "           push    ecx\n");\r
-               fprintf(fp, "           push    es\n");\r
-               fprintf(fp, "           mov     di, ds\n");\r
-               fprintf(fp, "           mov     es, di\n");\r
-\r
-               fprintf(fp, "           mov     esi, _%scontextBegin\n", cpubasename);\r
-               fprintf(fp, "           mov     edi, eax        ; Source address in ESI\n");\r
-\r
-               fprintf(fp, "           mov     ecx, (_%scontextEnd - _%scontextBegin) >> 2\n", cpubasename, cpubasename);\r
-               fprintf(fp, "           rep     movsd\n");\r
-               fprintf(fp, "           mov     ecx, (_%scontextEnd - _%scontextBegin) & 0x03\n", cpubasename, cpubasename);\r
-               fprintf(fp, "           rep     movsb\n");\r
-\r
-               fprintf(fp, "           pop     es\n");\r
-               fprintf(fp, "           pop     ecx\n");\r
-               fprintf(fp, "           pop     edi\n");\r
-               fprintf(fp, "           pop     esi\n");\r
-               fprintf(fp, "           ret                     ; No return code\n");\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "/* Get mz80's context */\n\n");\r
-               fprintf(fp, "void %sGetContext(void *pData)\n", cpubasename);\r
-               fprintf(fp, "{\n");\r
-               fprintf(fp, "   memcpy(pData, &cpu, sizeof(CONTEXTMZ80));\n");\r
-               fprintf(fp, "}\n\n");\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-GetContextSizeCode()\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               fprintf(fp, "           global  _%sGetContextSize\n", cpubasename);\r
-               fprintf(fp, "           global  %sGetContextSize_\n", cpubasename);\r
-\r
-               if (bPlain)\r
-                       fprintf(fp, "           global  %sGetContextSize\n", cpubasename);\r
-\r
-               sprintf(procname, "%sGetContextSize_", cpubasename);\r
-               ProcBegin(0xffffffff);\r
-\r
-               fprintf(fp, "_%sGetContextSize:\n", cpubasename);\r
-               \r
-               if (bPlain)\r
-                       fprintf(fp, "%sGetContextSize:\n", cpubasename);\r
-\r
-               fprintf(fp, "           mov     eax, _%scontextEnd - _%scontextBegin\n", cpubasename, cpubasename);\r
-               fprintf(fp, "           ret\n\n");\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "/* Get mz80's context size */\n\n");\r
-               fprintf(fp, "UINT32 %sGetContextSize(void)\n", cpubasename);\r
-               fprintf(fp, "{\n");\r
-               fprintf(fp, "   return(sizeof(CONTEXTMZ80));\n");\r
-               fprintf(fp, "}\n\n");\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-void InitCode(void)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               fprintf(fp, "           global  _%sinit\n", cpubasename);\r
-               fprintf(fp, "           global  %sinit_\n", cpubasename);\r
-\r
-               if (bPlain)\r
-                       fprintf(fp, "           global  %sinit\n", cpubasename);\r
-\r
-               sprintf(procname, "%sinit_", cpubasename);\r
-               ProcBegin(0xffffffff);\r
-\r
-               fprintf(fp, "_%sinit:\n", cpubasename);\r
-               \r
-               if (bPlain)\r
-                       fprintf(fp, "%sinit:\n", cpubasename);\r
-\r
-               fprintf(fp, "           ret\n\n");\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "/* Initialize MZ80 for action */\n\n");\r
-               fprintf(fp, "void %sinit(void)\n", cpubasename);\r
-               fprintf(fp, "{\n");\r
-\r
-               fprintf(fp, "   UINT32 dwLoop;\n");\r
-               fprintf(fp, "   UINT8 *pbTempPtr;\n");\r
-               fprintf(fp, "   UINT8 *pbTempPtr2;\n");\r
-               fprintf(fp, "   UINT8 bNewAdd;\n");\r
-               fprintf(fp, "   UINT8 bNewSub;\n");\r
-               fprintf(fp, "   UINT8 bFlag;\n");\r
-               fprintf(fp, "   UINT8 bLow;\n");\r
-               fprintf(fp, "   UINT8 bHigh;\n");\r
-               fprintf(fp, "   UINT8 bCarry;\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "   if (NULL == pbAddAdcTable)\n");\r
-               fprintf(fp, "   {\n");\r
-               fprintf(fp, "           pbAddAdcTable = malloc(256*256*2);\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "           if (NULL == pbAddAdcTable)\n");\r
-               fprintf(fp, "           {\n");\r
-               fprintf(fp, "                   return;\n");\r
-               fprintf(fp, "           }\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "           pbTempPtr = pbAddAdcTable;\n\n");\r
-               fprintf(fp, "           pbSubSbcTable = malloc(256*256*2);\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "           if (NULL == pbSubSbcTable)\n");\r
-               fprintf(fp, "           {\n");\r
-               fprintf(fp, "                   return;\n");\r
-               fprintf(fp, "           }\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "           pbTempPtr2 = pbSubSbcTable;\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "           for (dwLoop = 0; dwLoop < (256*256*2); dwLoop++)\n");\r
-               fprintf(fp, "           {\n");\r
-               fprintf(fp, "                   bLow = dwLoop & 0xff;\n");\r
-               fprintf(fp, "                   bHigh = (dwLoop >> 8) & 0xff;\n");\r
-               fprintf(fp, "                   bCarry = (dwLoop >> 16);\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "                   bFlag = 0;\n");\r
-               fprintf(fp, "                   bNewAdd = bHigh + bLow + bCarry;\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "                   if (0 == bNewAdd)\n");\r
-               fprintf(fp, "                   {\n");\r
-               fprintf(fp, "                           bFlag |= Z80_FLAG_ZERO;\n");\r
-               fprintf(fp, "                   }\n");\r
-               fprintf(fp, "                   else\n");\r
-               fprintf(fp, "                   {\n");\r
-               fprintf(fp, "                           bFlag = bNewAdd & 0x80; /* Sign flag */\n");\r
-               fprintf(fp, "                   }\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "                   if (((UINT32) bLow + (UINT32) bHigh + (UINT32) bCarry) >= 0x100)\n");\r
-               fprintf(fp, "                   {\n");\r
-               fprintf(fp, "                           bFlag |= Z80_FLAG_CARRY;\n");\r
-               fprintf(fp, "                   }\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "                   if ( ((bLow ^ bHigh ^ 0x80) & (bLow ^ (bNewAdd & 0x80))) & 0x80)\n");\r
-               fprintf(fp, "                   {\n");\r
-               fprintf(fp, "                           bFlag |= Z80_FLAG_OVERFLOW_PARITY;\n");\r
-               fprintf(fp, "                   }\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "                   if (((bLow & 0x0f) + (bHigh & 0x0f) + bCarry) >= 0x10)\n");\r
-               fprintf(fp, "                   {\n");\r
-               fprintf(fp, "                           bFlag |= Z80_FLAG_HALF_CARRY;\n");\r
-               fprintf(fp, "                   }\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "                   *pbTempPtr++ = bFlag;   /* Store our new flag */\n\n");\r
-\r
-               fprintf(fp, "                   // Now do subtract - Zero\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "                   bFlag = Z80_FLAG_NEGATIVE;\n");\r
-               fprintf(fp, "                   bNewSub = bHigh - bLow - bCarry;\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "                   if (0 == bNewSub)\n");\r
-               fprintf(fp, "                   {\n");\r
-               fprintf(fp, "                           bFlag |= Z80_FLAG_ZERO;\n");\r
-               fprintf(fp, "                   }\n");\r
-               fprintf(fp, "                   else\n");\r
-               fprintf(fp, "                   {\n");\r
-               fprintf(fp, "                           bFlag |= bNewSub & 0x80; /* Sign flag */\n");\r
-               fprintf(fp, "                   }\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "                   if ( ((INT32) bHigh - (INT32) bLow - (INT32) bCarry) < 0)\n");\r
-               fprintf(fp, "                   {\n");\r
-               fprintf(fp, "                           bFlag |= Z80_FLAG_CARRY;\n");\r
-               fprintf(fp, "                   }\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "                   if ( ((INT32) (bHigh & 0xf) - (INT32) (bLow & 0x0f) - (INT32) bCarry) < 0)\n");\r
-               fprintf(fp, "                   {\n");\r
-               fprintf(fp, "                           bFlag |= Z80_FLAG_HALF_CARRY;\n");\r
-               fprintf(fp, "                   }\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "                   if ( ((bLow ^ bHigh) & (bHigh ^ bNewSub) & 0x80) )\n");\r
-               fprintf(fp, "                   {\n");\r
-               fprintf(fp, "                           bFlag |= Z80_FLAG_OVERFLOW_PARITY;\n");\r
-               fprintf(fp, "                   }\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "                   *pbTempPtr2++ = bFlag;  /* Store our sub flag */\n");\r
-               fprintf(fp, "\n");\r
-               fprintf(fp, "           }\n");\r
-               fprintf(fp, "   }\n");\r
-               fprintf(fp, "}\n");\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-void ShutdownCode(void)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               fprintf(fp, "           global  _%sshutdown\n", cpubasename);\r
-               fprintf(fp, "           global  %sshutdown_\n", cpubasename);\r
-\r
-               if (bPlain)\r
-                       fprintf(fp, "           global  %sshutdown\n", cpubasename);\r
-\r
-               sprintf(procname, "%sshutdown_", cpubasename);\r
-               ProcBegin(0xffffffff);\r
-\r
-               fprintf(fp, "_%sshutdown:\n", cpubasename);\r
-               \r
-               if (bPlain)\r
-                       fprintf(fp, "%sshutdown:\n", cpubasename);\r
-\r
-               fprintf(fp, "           ret\n\n");\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-               fprintf(fp, "/* Shut down MZ80 */\n\n");\r
-               fprintf(fp, "void %sshutdown(void)\n", cpubasename);\r
-               fprintf(fp, "{\n");\r
-\r
-               fprintf(fp, "}\n\n");\r
-       }\r
-       else\r
-       {\r
-               assert(0);\r
-       }\r
-}\r
-\r
-void DebuggerCode(void)\r
-{\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-       {\r
-               Alignment();\r
-\r
-               fprintf(fp, ";\n");\r
-               fprintf(fp, "; In : EAX=Reg #, ESI=Context address\n");\r
-               fprintf(fp, "; Out: EAX=Value of register\n");\r
-               fprintf(fp, ";\n");\r
-\r
-               fprintf(fp, "getRegValueInternal:\n");\r
-\r
-               fprintf(fp, "           push    ecx\n");\r
-               fprintf(fp, "           push    edx\n\n");\r
-\r
-               fprintf(fp, "           cmp     eax, CPUREG_MAXINDEX\n");\r
-               fprintf(fp, "           jae     badIndex2\n\n");\r
-\r
-               fprintf(fp, "           shl     eax, 4  ; Times 16 for table entry size\n");\r
-               fprintf(fp, "           add     eax, RegTable   ; Now it's the memory location\n");\r
-\r
-               fprintf(fp, "           mov     edx, [eax+4]    ; Get the offset of the register\n");\r
-               fprintf(fp, "           mov     edx, [edx + esi]        ; Get our value\n");\r
-\r
-               fprintf(fp, "           mov     ecx, [eax+8]    ; Get our shift value\n");\r
-               fprintf(fp, "           shr     edx, cl                 ; Shift it right by a value\n");\r
-\r
-               fprintf(fp, "           and     edx, [eax+12]   ; Mask off any unneeded bits\n");\r
-               fprintf(fp, "           mov     eax, edx                        ; Put our value in EAX\n");\r
-               fprintf(fp, "           jmp     short indexExit ; Index's exit!\n");\r
-\r
-               fprintf(fp, "badIndex2:\n");\r
-               fprintf(fp, "           mov     eax, 0ffffffffh\n\n");\r
-               fprintf(fp, "indexExit:\n");\r
-               fprintf(fp, "           pop     edx\n");\r
-               fprintf(fp, "           pop     ecx\n");\r
-               fprintf(fp, "           ret\n\n");\r
-\r
-               Alignment();\r
-\r
-               fprintf(fp, ";\n");\r
-               fprintf(fp, "; In : EAX=Value, EDX=Reg #, ESI=Context address\n");\r
-               fprintf(fp, "; Out: EAX=Value of register\n");\r
-               fprintf(fp, ";\n");\r
-\r
-               fprintf(fp, "convertValueToText:\n");\r
-\r
-               fprintf(fp, "           push    ecx\n");\r
-               fprintf(fp, "           push    edx\n\n");\r
-\r
-               fprintf(fp, "           cmp     edx, CPUREG_MAXINDEX\n");\r
-               fprintf(fp, "           jae     badIndex3\n\n");\r
-\r
-               fprintf(fp, "           shl     edx, 4  ; Times 16 for table entry size\n");\r
-               fprintf(fp, "           add     edx, RegTable   ; Now it's the memory location\n");\r
-               fprintf(fp, "           mov     edx, [edx + 12] ; Shift mask\n");\r
-               fprintf(fp, "           xor     ecx, ecx        ; Zero our shift\n");\r
-\r
-               fprintf(fp, "shiftLoop:\n");\r
-               fprintf(fp, "           test    edx, 0f0000000h ; High nibble nonzero yet?\n");\r
-               fprintf(fp, "           jnz     convertLoop             ; Yup!\n");\r
-               fprintf(fp, "           shl     edx, 4                  ; Move over, bacon\n");\r
-               fprintf(fp, "           shl     eax, 4          ; Move the value over, too\n");\r
-               fprintf(fp, "           jmp     short shiftLoop ; Keep shiftin'\n\n");\r
-\r
-               fprintf(fp, "convertLoop:\n");\r
-               fprintf(fp, "           mov     ecx, eax                        ; Get our value\n");\r
-               fprintf(fp, "           shr     ecx, 28                 ; Only the top nibble\n");\r
-               fprintf(fp, "           add     cl, '0'                 ; Convert to ASCII\n");\r
-               fprintf(fp, "           cmp     cl, '9'                 ; Greater than 9?\n");\r
-               fprintf(fp, "           jbe     noAdd                           ; Nope! Don't add it\n");\r
-               fprintf(fp, "           add     cl, 32+7                        ; Convert from lowercase a-f\n");\r
-               fprintf(fp, "noAdd:\n");\r
-               fprintf(fp, "           mov     [edi], cl               ; New value storage\n");\r
-               fprintf(fp, "           inc     edi                     ; Next byte, please\n");\r
-               fprintf(fp, "           shl     eax, 4                  ; Move the mask over\n");\r
-               fprintf(fp, "           shl     edx, 4                  ; Move the mask over\n");\r
-               fprintf(fp, "           jnz     convertLoop             ; Keep convertin'\n\n");\r
-\r
-\r
-               fprintf(fp, "badIndex3:\n");\r
-               fprintf(fp, "           mov     [edi], byte 0   ; Null terminate the sucker!\n");\r
-               fprintf(fp, "           pop     edx\n");\r
-               fprintf(fp, "           pop     ecx\n");\r
-               fprintf(fp, "           ret\n\n");\r
-\r
-               fprintf(fp, "           global  _%sSetRegisterValue\n", cpubasename);\r
-               fprintf(fp, "           global  %sSetRegisterValue_\n", cpubasename);\r
-\r
-               if (bPlain)\r
-                       fprintf(fp, "           global  %sSetRegisterValue\n", cpubasename);\r
-\r
-               sprintf(procname, "%sSetRegisterValue_", cpubasename);\r
-               ProcBegin(0xffffffff);\r
-\r
-               fprintf(fp, "_%sSetRegisterValue:\n", cpubasename);\r
-               if (bPlain)\r
-                       fprintf(fp, "%sSetRegisterValue:\n", cpubasename);\r
-\r
-               fprintf(fp, "           push    esi\n");\r
-               fprintf(fp, "           push    edi\n");\r
-               fprintf(fp, "           push    edx\n");\r
-               fprintf(fp, "           push    ecx\n");\r
-\r
-               if (bUseStack)\r
-               {\r
-                       fprintf(fp, "           mov     eax, [esp+20]   ; Get our register #\n");\r
-                       fprintf(fp, "           mov     esi, [esp+24]   ; Get our context address\n");\r
-                       fprintf(fp, "           mov     edi, [esp+28]   ; Value to assign\n");\r
-               }\r
-               else\r
-               {\r
-                       fprintf(fp, "           mov     esi, eax        ; Get context\n");\r
-                       fprintf(fp, "           mov     eax, edx        ; Get register # in EAX\n");\r
-                       fprintf(fp, "           mov     edi, ebx        ; Get value to assign\n");\r
-               }\r
-\r
-               fprintf(fp, "           or      esi, esi        ; Are we NULL?\n");\r
-               fprintf(fp, "           jnz     userDefined\n");\r
-\r
-               fprintf(fp, "           mov     esi, _%scontextBegin\n", cpubasename);\r
-               fprintf(fp, "userDefined:\n\n");\r
-               fprintf(fp, "           shl     eax, 4  ; Times 16 for reg entry size\n");\r
-               fprintf(fp, "           add     eax, RegTable\n");\r
-               fprintf(fp, "           mov     edx, [eax+12] ; Our mask\n");\r
-               fprintf(fp, "           not     edx     ; Invert EDX!\n");\r
-               fprintf(fp, "           test    edi, edx        ; Did we set any invalid bits?\n");\r
-               fprintf(fp, "           jnz     rangeViolation\n\n");\r
-\r
-               fprintf(fp, "           not     edx     ; Toggle it back to normal\n");\r
-               fprintf(fp, "           mov     ecx, [eax+8]    ; Get our shift value\n");\r
-               fprintf(fp, "           shl     edx, cl ; Shift our mask\n");\r
-               fprintf(fp, "           shl     eax, cl ; And our value to OR in\n");\r
-       \r
-               fprintf(fp, "           not     edx     ; Make it the inverse of what we want\n");\r
-               fprintf(fp, "           mov     eax, [eax+4]    ; Get our offset into the context\n");\r
-               fprintf(fp, "           and     [esi+eax], edx  ; Mask off the bits we're changin\n");\r
-               fprintf(fp, "           or      [esi+eax], edi  ; Or in our new value\n\n");\r
-               fprintf(fp, "           xor     eax, eax\n");\r
-               fprintf(fp, "           jmp     short  setExit\n\n");\r
-\r
-               fprintf(fp, "rangeViolation:\n");\r
-               fprintf(fp, "           mov     eax, 0ffffffffh\n\n");\r
-\r
-               fprintf(fp, "setExit:\n");\r
-               fprintf(fp, "           pop     ecx\n");\r
-               fprintf(fp, "           pop     edx\n");\r
-               fprintf(fp, "           pop     edi\n");\r
-               fprintf(fp, "           pop     esi\n\n");\r
-\r
-               fprintf(fp, "           ret\n\n");\r
-\r
-               Alignment();\r
-\r
-               fprintf(fp, "           global  _%sGetRegisterValue\n", cpubasename);\r
-               fprintf(fp, "           global  %sGetRegisterValue_\n", cpubasename);\r
-\r
-               if (bPlain)\r
-                       fprintf(fp, "           global  %sGetRegisterValue\n", cpubasename);\r
-\r
-               sprintf(procname, "%sGetRegisterValue_", cpubasename);\r
-               ProcBegin(0xffffffff);\r
-\r
-               fprintf(fp, "_%sGetRegisterValue:\n", cpubasename);\r
-               if (bPlain)\r
-                       fprintf(fp, "%sGetRegisterValue:\n", cpubasename);\r
-\r
-               fprintf(fp, "           push    esi\n");\r
-\r
-               if (bUseStack)\r
-               {\r
-                       fprintf(fp, "           mov     eax, [esp+8]    ; Get our register #\n");\r
-                       fprintf(fp, "           mov     esi, [esp+12]   ; Get our context address\n");\r
-               }\r
-               else\r
-               {\r
-                       fprintf(fp, "           mov     esi, eax        ; Get context\n");\r
-                       fprintf(fp, "           mov     eax, edx        ; Get register # in EAX\n");\r
-               }\r
-\r
-               fprintf(fp, "           or      esi, esi        ; Is context NULL?\n");\r
-               fprintf(fp, "           jnz     getVal  ; Nope - use it!\n");\r
-               fprintf(fp, "           mov     esi, _%scontextBegin\n\n", cpubasename);\r
-\r
-               fprintf(fp, "getVal:\n");\r
-               fprintf(fp, "           call    getRegValueInternal\n\n");\r
-\r
-               fprintf(fp, "           pop     esi\n");\r
-\r
-               fprintf(fp, "           ret\n\n");\r
-\r
-               Alignment();\r
-\r
-               fprintf(fp, "           global  _%sGetRegisterName\n", cpubasename);\r
-               fprintf(fp, "           global  %sGetRegisterName_\n", cpubasename);\r
-\r
-               if (bPlain)\r
-                       fprintf(fp, "           global  %sGetRegisterName\n", cpubasename);\r
-\r
-               sprintf(procname, "%sGetRegisterName_", cpubasename);\r
-               ProcBegin(0xffffffff);\r
-\r
-               fprintf(fp, "_%sGetRegisterName:\n", cpubasename);\r
-               if (bPlain)\r
-                       fprintf(fp, "%sGetRegisterName:\n", cpubasename);\r
-\r
-               if (bUseStack)\r
-               {\r
-                       fprintf(fp, "           mov     eax, [esp+4]    ; Get our register #\n");\r
-               }\r
-\r
-               fprintf(fp, "           cmp     eax, CPUREG_MAXINDEX\n");\r
-               fprintf(fp, "           jae     badIndex\n");\r
-\r
-               fprintf(fp, "           shl     eax, 4  ; Times 16 bytes for each entry\n");\r
-               fprintf(fp, "           mov     eax, [eax+RegTable]\n");\r
-               fprintf(fp, "           jmp     nameExit\n\n");\r
-\r
-               fprintf(fp, "badIndex:\n");\r
-               fprintf(fp, "           xor     eax, eax\n\n");\r
-\r
-               fprintf(fp, "nameExit:\n");\r
-               fprintf(fp, "           ret\n\n");\r
-\r
-               Alignment();\r
-\r
-               fprintf(fp, "           global  _%sGetRegisterTextValue\n", cpubasename);\r
-               fprintf(fp, "           global  %sGetRegisterTextValue_\n", cpubasename);\r
-\r
-               if (bPlain)\r
-                       fprintf(fp, "           global  %sGetRegisterTextValue\n", cpubasename);\r
-\r
-               sprintf(procname, "%sGetRegisterTextValue_", cpubasename);\r
-               ProcBegin(0xffffffff);\r
-\r
-               fprintf(fp, "_%sGetRegisterTextValue:\n", cpubasename);\r
-               if (bPlain)\r
-                       fprintf(fp, "%sGetRegisterTextValue:\n", cpubasename);\r
-\r
-               fprintf(fp, "           push    esi\n");\r
-               fprintf(fp, "           push    edi\n");\r
-               fprintf(fp, "           push    edx\n");\r
-\r
-               if (bUseStack)\r
-               {\r
-                       fprintf(fp, "           mov     eax, [esp+16]   ; Get our register #\n");\r
-                       fprintf(fp, "           mov     esi, [esp+20]   ; Get our context address\n");\r
-                       fprintf(fp, "           mov     edi, [esp+24]   ; Address to place text\n");\r
-               }\r
-               else\r
-               {\r
-                       fprintf(fp, "           mov     esi, eax        ; Get context\n");\r
-                       fprintf(fp, "           mov     eax, edx        ; Get register # in EAX\n");\r
-                       fprintf(fp, "           mov     edi, ebx        ; Address to place text\n");\r
-               }\r
-\r
-               fprintf(fp, "           or      esi, esi        ; Is context NULL?\n");\r
-               fprintf(fp, "           jnz     getVal2 ; Nope - use it!\n");\r
-               fprintf(fp, "           mov     esi, _%scontextBegin\n\n", cpubasename);\r
-\r
-               fprintf(fp, "getVal2:\n");\r
-               fprintf(fp, "           mov     edx, eax        ; Save off our index for later\n");\r
-               fprintf(fp, "           call    getRegValueInternal\n\n");\r
-\r
-               fprintf(fp, "; EAX Holds the value, EDX=Register #, and EDI=Destination!\n\n");\r
-\r
-               fprintf(fp, "           call    convertValueToText\n\n");\r
-\r
-               fprintf(fp, "           pop     edx\n");\r
-               fprintf(fp, "           pop     esi\n");\r
-               fprintf(fp, "           pop     edi\n");\r
-\r
-               fprintf(fp, "           ret\n\n");\r
-\r
-               Alignment();\r
-\r
-               fprintf(fp, "           global  _%sWriteValue\n", cpubasename);\r
-               fprintf(fp, "           global  %sWriteValue_\n", cpubasename);\r
-\r
-               if (bPlain)\r
-                       fprintf(fp, "           global  %sWriteValue\n", cpubasename);\r
-\r
-               sprintf(procname, "%sWriteValue_", cpubasename);\r
-               ProcBegin(0xffffffff);\r
-\r
-               fprintf(fp, "_%sWriteValue:\n", cpubasename);\r
-               if (bPlain)\r
-                       fprintf(fp, "%sWriteValue:\n", cpubasename);\r
-\r
-               fprintf(fp, "           push    esi\n");\r
-               fprintf(fp, "           push    edi\n");\r
-               fprintf(fp, "           push    edx\n");\r
-               fprintf(fp, "           push    ebx\n");\r
-               fprintf(fp, "           push    ecx\n");\r
-               fprintf(fp, "           push    ebp\n");\r
-\r
-               if (bUseStack)\r
-               {\r
-                       fprintf(fp, "           mov     eax, [esp+28]   ; What kind of write is this?\n");\r
-                       fprintf(fp, "           mov     ebx, [esp+32]   ; Address\n");\r
-                       fprintf(fp, "           mov     edx, [esp+36]   ; Value\n");\r
-               }\r
-               else\r
-               {\r
-                       fprintf(fp, "           xchg    edx, ebx        ; Addr=EBX, value=EDX\n");\r
-               }\r
-\r
-               fprintf(fp, "           cmp     eax, 1  ; Is it a word write?\n");\r
-               fprintf(fp, "           je      near invalidWrite       ; Yep - it's not valid\n");\r
-               fprintf(fp, "           cmp     eax, 2  ; Is it a dword write?\n");\r
-               fprintf(fp, "           je      near invalidWrite       ; Yep - it's not valid\n\n");\r
-               fprintf(fp, "           or      eax, eax        ; Is it a byte write?\n");\r
-               fprintf(fp, "           jnz     itsIoDummy      ; Nope... it's an I/O write\n\n");\r
-\r
-               // Here we do a write memory byte\r
-\r
-               fprintf(fp, "           mov     ebp, [_z80Base] ; Base pointer comes back\n");\r
-               fprintf(fp, "           mov     edi, [_z80MemWrite]     ; Point to the write array\n");\r
-\r
-               fprintf(fp, "checkLoop:\n");\r
-               fprintf(fp, "           cmp     [edi], word 0ffffh ; End of our list?\n");\r
-               fprintf(fp, "           je      memoryWrite     ; Yes - go write it!\n");\r
-               fprintf(fp, "           cmp     bx, [edi]       ; Are we smaller?\n");\r
-               fprintf(fp, "           jb      nextAddr        ; Yes... go to the next addr\n");\r
-               fprintf(fp, "           cmp     bx, [edi+4]     ; Are we smaller?\n");\r
-               fprintf(fp, "           jbe     callRoutine     ; If not, go call it!\n");\r
-\r
-               fprintf(fp, "nextAddr:\n");\r
-               fprintf(fp, "           add     edi, 10h                ; Next structure, please\n");\r
-               fprintf(fp, "           jmp     short checkLoop\n");\r
-\r
-               fprintf(fp, "callRoutine:\n");\r
-\r
-               fprintf(fp, "\n;\n; EBX=Address to target, DL=Byte to write \n;\n\n");\r
-\r
-               fprintf(fp, "           cmp     [edi+8], dword 0        ; Null handler?\n");\r
-               fprintf(fp, "           je      directWriteHandler2\n\n");\r
-               \r
-               if (FALSE == bUseStack)\r
-               {\r
-                       fprintf(fp, "           mov     eax, ebx        ; Address\n");\r
-                       fprintf(fp, "           mov     ebx, edi        ; Pointer to struct (EDX Already has the byte to write)\n");\r
-               }\r
-               else\r
-               {\r
-                       fprintf(fp, "           push    edi     ; Handler\n");\r
-                       fprintf(fp, "           push    edx     ; Byte\n");\r
-                       fprintf(fp, "           push    ebx     ; Address\n");\r
-               }\r
-       \r
-               fprintf(fp, "           call    dword [edi + 8] ; Go call our handler\n");\r
-\r
-               if (bUseStack)\r
-               {\r
-                       fprintf(fp, "           add     esp, 12\n");\r
-               }\r
-\r
-               fprintf(fp, "           jmp     short itsGood\n");\r
-\r
-               fprintf(fp, "directWriteHandler2:\n");\r
-               fprintf(fp, "           sub     ebx, [edi]      ; Subtract our offset\n");\r
-               fprintf(fp, "           add     ebx, [edi+12]   ; Add in the base address\n");\r
-               fprintf(fp, "           mov     [ebx], dl       ; Store our byte\n");\r
-               fprintf(fp, "           jmp     short itsGood\n");\r
-               fprintf(fp, "memoryWrite:\n");\r
-               fprintf(fp, "           mov     [ebp + ebx], dl\n\n");\r
-               fprintf(fp, "           jmp     short itsGood\n");\r
-\r
-               // Here we do an "out"\r
-\r
-               fprintf(fp, "itsIoDummy:\n");\r
-\r
-               fprintf(fp, "           mov     edi, [_z80IoWrite]      ; Point to the I/O write array\n");\r
-\r
-               fprintf(fp, "IOCheck:\n");\r
-               fprintf(fp, "           cmp     [edi], word 0ffffh ; End of our list?\n");\r
-               fprintf(fp, "           je      itsGood ; Yes - ignore it!\n");\r
-               fprintf(fp, "           cmp     bx, [edi]       ; Are we smaller?\n");\r
-               fprintf(fp, "           jb      nextIOAddr      ; Yes... go to the next addr\n");\r
-               fprintf(fp, "           cmp     bx, [edi+2]     ; Are we bigger?\n");\r
-               fprintf(fp, "           jbe     callIOHandler   ; If not, go call it!\n");\r
-\r
-               fprintf(fp, "nextIOAddr:\n");\r
-               fprintf(fp, "           add     edi, 0ch                ; Next structure, please\n");\r
-               fprintf(fp, "           jmp     short IOCheck\n");\r
-\r
-               fprintf(fp, "callIOHandler:\n");\r
-\r
-               if (FALSE == bUseStack)\r
-               {\r
-                       fprintf(fp, "           mov     eax, ebx        ; Address\n");\r
-                       fprintf(fp, "           mov     ebx, edi        ; Pointer to struct (EDX Already has the byte to write)\n");\r
-               }\r
-               else\r
-               {\r
-                       fprintf(fp, "           push    edi     ; Handler\n");\r
-                       fprintf(fp, "           push    edx     ; Byte\n");\r
-                       fprintf(fp, "           push    ebx     ; Address\n");\r
-               }\r
-\r
-               fprintf(fp, "           call    dword [edi+4]   ; Call the handler!\n");\r
-\r
-               if (bUseStack)\r
-                       fprintf(fp, "           add     esp, 12\n");\r
-\r
-               fprintf(fp, "           jmp     short itsGood\n\n");\r
-\r
-               // Errors and whatnot\r
-\r
-               fprintf(fp, "invalidWrite:\n");\r
-               fprintf(fp, "           mov     eax, 0ffffffffh\n");\r
-               fprintf(fp, "           jmp     short writeValueExit\n\n");\r
-\r
-               fprintf(fp, "itsGood:\n");\r
-               fprintf(fp, "           xor     eax, eax\n\n");\r
-\r
-               fprintf(fp, "writeValueExit:\n");\r
-\r
-               fprintf(fp, "           pop     ebp\n");\r
-               fprintf(fp, "           pop     ecx\n");\r
-               fprintf(fp, "           pop     ebx\n");\r
-               fprintf(fp, "           pop     edx\n");\r
-               fprintf(fp, "           pop     esi\n");\r
-               fprintf(fp, "           pop     edi\n");\r
-\r
-               fprintf(fp, "           ret\n\n");\r
-\r
-               Alignment();\r
-\r
-               fprintf(fp, "           global  _%sReadValue\n", cpubasename);\r
-               fprintf(fp, "           global  %sReadValue_\n", cpubasename);\r
-\r
-               if (bPlain)\r
-                       fprintf(fp, "           global  %sReadValue\n", cpubasename);\r
-\r
-               sprintf(procname, "%sReadValue_", cpubasename);\r
-               ProcBegin(0xffffffff);\r
-\r
-               fprintf(fp, "_%sReadValue:\n", cpubasename);\r
-               if (bPlain)\r
-                       fprintf(fp, "%sReadValue:\n", cpubasename);\r
-\r
-               fprintf(fp, "           push    esi\n");\r
-               fprintf(fp, "           push    edi\n");\r
-               fprintf(fp, "           push    edx\n");\r
-               fprintf(fp, "           push    ebx\n");\r
-               fprintf(fp, "           push    ecx\n");\r
-               fprintf(fp, "           push    ebp\n");\r
-\r
-               if (bUseStack)\r
-               {\r
-                       fprintf(fp, "           mov     eax, [esp+28]   ; What kind of read is this?\n");\r
-                       fprintf(fp, "           mov     ebx, [esp+32]   ; Address\n");\r
-               }\r
-               else\r
-               {\r
-                       fprintf(fp, "           xchg    edx, ebx        ; Addr=EBX\n");\r
-               }\r
-\r
-               fprintf(fp, "           cmp     eax, 1  ; Is it a word read?\n");\r
-               fprintf(fp, "           je      near invalidRead        ; Yep - it's not valid\n");\r
-               fprintf(fp, "           cmp     eax, 2  ; Is it a dword read?\n");\r
-               fprintf(fp, "           je      near invalidRead        ; Yep - it's not valid\n\n");\r
-               fprintf(fp, "           or      eax, eax        ; Is it a byte read?\n");\r
-               fprintf(fp, "           jnz     itsIoDummyRead  ; Nope... it's an I/O read\n\n");\r
-\r
-               // Here we do a read memory byte\r
-\r
-               fprintf(fp, "           mov     ebp, [_z80Base] ; Base pointer comes back\n");\r
-               fprintf(fp, "           mov     edi, [_z80MemRead]      ; Point to the read array\n");\r
-\r
-               fprintf(fp, "checkLoopRead:\n");\r
-               fprintf(fp, "           cmp     [edi], word 0ffffh ; End of our list?\n");\r
-               fprintf(fp, "           je      memoryRead      ; Yes - go read it!\n");\r
-               fprintf(fp, "           cmp     bx, [edi]       ; Are we smaller?\n");\r
-               fprintf(fp, "           jb      nextAddrRead    ; Yes... go to the next addr\n");\r
-               fprintf(fp, "           cmp     bx, [edi+4]     ; Are we smaller?\n");\r
-               fprintf(fp, "           jbe     callRoutineRead ; If not, go call it!\n");\r
-\r
-               fprintf(fp, "nextAddrRead:\n");\r
-               fprintf(fp, "           add     edi, 10h                ; Next structure, please\n");\r
-               fprintf(fp, "           jmp     short checkLoopRead\n");\r
-\r
-               fprintf(fp, "callRoutineRead:\n");\r
-\r
-               fprintf(fp, "\n;\n; EBX=Address to target\n;\n\n");\r
-\r
-               fprintf(fp, "           cmp     [edi+8], dword 0 ; NULL HAndler?\n");\r
-               fprintf(fp, "           je      handleSharedRead\n\n");\r
-\r
-               if (FALSE == bUseStack)\r
-               {\r
-                       fprintf(fp, "           mov     eax, ebx        ; Address\n");\r
-                       fprintf(fp, "           mov     edx, edi        ; Pointer to struct\n");\r
-               }\r
-               else\r
-               {\r
-                       fprintf(fp, "           push    edi     ; Handler\n");\r
-                       fprintf(fp, "           push    ebx     ; Address\n");\r
-               }\r
-       \r
-               fprintf(fp, "           call    dword [edi + 8] ; Go call our handler\n");\r
-               fprintf(fp, "           mov     dl, al  ; Get our byte read\n");\r
-\r
-               if (bUseStack)\r
-               {\r
-                       fprintf(fp, "           add     esp, 8\n");\r
-               }\r
-\r
-               fprintf(fp, "           jmp     short itsGoodRead\n\n");\r
-\r
-               fprintf(fp, "memoryRead:\n");\r
-               fprintf(fp, "           mov     dl, [ebp+ebx]\n\n");\r
-               fprintf(fp, "           jmp     short itsGoodRead\n\n");\r
-\r
-               fprintf(fp, "handleSharedRead:\n");\r
-               fprintf(fp, "           sub     ebx, [edi]\n");\r
-               fprintf(fp, "           add     ebx, [edi+12]\n");\r
-               fprintf(fp, "           mov     dl, [ebx]\n");\r
-               fprintf(fp, "           jmp     short itsGoodRead\n\n");\r
-\r
-               // Here we do an "out"\r
-\r
-               fprintf(fp, "itsIoDummyRead:\n");\r
-\r
-               fprintf(fp, "           mov     edi, [_z80IoRead]       ; Point to the I/O read array\n");\r
-               fprintf(fp, "           mov     dl, 0ffh        ; Assume no handler\n");\r
-\r
-               fprintf(fp, "IOCheckRead:\n");\r
-               fprintf(fp, "           cmp     [edi], word 0ffffh ; End of our list?\n");\r
-               fprintf(fp, "           je      itsGoodRead     ; Yes - ignore it!\n");\r
-               fprintf(fp, "           cmp     bx, [edi]       ; Are we smaller?\n");\r
-               fprintf(fp, "           jb      nextIOAddrRead  ; Yes... go to the next addr\n");\r
-               fprintf(fp, "           cmp     bx, [edi+2]     ; Are we bigger?\n");\r
-               fprintf(fp, "           jbe     callIOHandlerRead       ; If not, go call it!\n");\r
-\r
-               fprintf(fp, "nextIOAddrRead:\n");\r
-               fprintf(fp, "           add     edi, 0ch                ; Next structure, please\n");\r
-               fprintf(fp, "           jmp     short IOCheckRead\n");\r
-\r
-               fprintf(fp, "callIOHandlerRead:\n");\r
-\r
-               if (FALSE == bUseStack)\r
-               {\r
-                       fprintf(fp, "           mov     eax, ebx        ; Address\n");\r
-                       fprintf(fp, "           mov     edx, edi        ; Pointer to struct (EDX Already has the byte to write)\n");\r
-               }\r
-               else\r
-               {\r
-                       fprintf(fp, "           push    edi     ; Handler\n");\r
-                       fprintf(fp, "           push    ebx     ; Address\n");\r
-               }\r
-\r
-               fprintf(fp, "           call    dword [edi+4]   ; Call the handler!\n");\r
-               fprintf(fp, "           mov     dl, al  ; Get our byte read\n");\r
-\r
-               if (bUseStack)\r
-                       fprintf(fp, "           add     esp, 8\n");\r
-\r
-               fprintf(fp, "           jmp     short itsGoodRead\n\n");\r
-\r
-               // Errors and whatnot\r
-\r
-               fprintf(fp, "invalidRead:\n");\r
-               fprintf(fp, "           mov     eax, 0ffffffffh\n");\r
-               fprintf(fp, "           jmp     short ReadValueExit\n\n");\r
-\r
-               fprintf(fp, "itsGoodRead:\n");\r
-               fprintf(fp, "           xor     eax, eax\n");\r
-               fprintf(fp, "           mov     al, dl\n\n");\r
-\r
-               fprintf(fp, "ReadValueExit:\n");\r
-\r
-               fprintf(fp, "           pop     ebp\n");\r
-               fprintf(fp, "           pop     ecx\n");\r
-               fprintf(fp, "           pop     ebx\n");\r
-               fprintf(fp, "           pop     edx\n");\r
-               fprintf(fp, "           pop     esi\n");\r
-               fprintf(fp, "           pop     edi\n");\r
-\r
-               fprintf(fp, "           ret\n\n");\r
-\r
-\r
-\r
-       }\r
-       else\r
-       if (MZ80_C == bWhat)\r
-       {\r
-       }\r
-}\r
-\r
-\r
-EmitCode()\r
-{\r
-       CodeSegmentBegin();\r
-       EmitCBInstructions();\r
-       EmitEDInstructions();\r
-\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-               strcpy(mz80Index, "ix");\r
-               \r
-       else\r
-       {\r
-               strcpy(mz80Index, "cpu.z80IX");\r
-               strcpy(mz80IndexHalfHigh, "cpu.z80XH");\r
-               strcpy(mz80IndexHalfLow, "cpu.z80XL");\r
-       }\r
-\r
-       strcpy(majorOp, "DD");\r
-       EmitDDInstructions();\r
-\r
-       if (MZ80_ASSEMBLY_X86 == bWhat)\r
-               strcpy(mz80Index, "iy");\r
-       else\r
-       {\r
-               strcpy(mz80Index, "cpu.z80IY");\r
-               strcpy(mz80IndexHalfHigh, "cpu.z80YH");\r
-               strcpy(mz80IndexHalfLow, "cpu.z80YL");\r
-       }\r
-\r
-       strcpy(majorOp, "FD");\r
-       EmitFDInstructions();\r
-       majorOp[0] = '\0';\r
-       EmitRegularInstructions();\r
-       ReadMemoryByteHandler();\r
-       WriteMemoryByteHandler();\r
-\r
-       if (bThroughCallHandler)\r
-       {\r
-               PushWordHandler();\r
-               PopWordHandler();\r
-       }\r
-\r
-       ReadIoHandler();\r
-       WriteIoHandler();\r
-       GetContextCode();\r
-       SetContextCode();\r
-       GetContextSizeCode();\r
-       GetTicksCode();\r
-       ReleaseTimesliceCode();\r
-       ResetCode();\r
-       IntCode();\r
-       NmiCode();\r
-       ExecCode();\r
-       InitCode();\r
-       ShutdownCode();\r
-       DebuggerCode();\r
-       CodeSegmentEnd();\r
-}\r
-\r
-main(int argc, char **argv)\r
-{\r
-       UINT32 dwLoop = 0;\r
-\r
-       printf("MakeZ80 - V%s - Copyright 1996-2000 Neil Bradley (neil@synthcom.com)\n", VERSION);\r
-\r
-       if (argc < 2)\r
-       {\r
-               printf("Usage: %s outfile [option1] [option2] ....\n", argv[0]);\r
-               printf("\n   -s   - Stack calling conventions (DJGPP, MSVC, Borland)\n");\r
-               printf("   -x86 - Emit an assembly version of mz80\n");\r
-               printf("   -c   - Emit a C version of mz80\n");\r
-               printf("   -cs  - All stack operations go through handlers\n");\r
-               printf("   -16  - Treat all I/O input and output as 16 bit (BC) instead of (C)\n");\r
-               printf("   -l   - Create 'plain' labels - ones without leading or trailing _'s\n");\r
-               printf("   -nt  - No timing additions occur\n");\r
-               printf("   -os2 - Emit OS/2 compatible segmentation pragmas\n");\r
-               exit(1);\r
-       }\r
-\r
-       dwLoop = 1;\r
-\r
-       while (dwLoop < argc)\r
-       {\r
-               if (strcmp("-x86", argv[dwLoop]) == 0 || strcmp("-X86", argv[dwLoop]) == 0)\r
-                       bWhat = MZ80_ASSEMBLY_X86;\r
-               if (strcmp("-c", argv[dwLoop]) == 0 || strcmp("-C", argv[dwLoop]) == 0)\r
-                       bWhat = MZ80_C;\r
-               if (strcmp("-cs", argv[dwLoop]) == 0 || strcmp("-cs", argv[dwLoop]) == 0)\r
-                       bThroughCallHandler = TRUE;\r
-               if (strcmp("-s", argv[dwLoop]) == 0 || strcmp("-S", argv[dwLoop]) == 0)\r
-                       bUseStack = 1;\r
-               if (strcmp("-l", argv[dwLoop]) == 0 || strcmp("-L", argv[dwLoop]) == 0)\r
-                       bPlain = TRUE;\r
-               if (strcmp("-16", argv[dwLoop]) == 0)\r
-                       b16BitIo = TRUE;\r
-               if (strcmp("-os2", argv[dwLoop]) == 0 || strcmp("-OS2", argv[dwLoop]) == 0)\r
-                       bOS2 = TRUE;\r
-               if (strcmp("-nt", argv[dwLoop]) == 0)\r
-               {\r
-                       bNoTiming = TRUE;\r
-               }\r
-\r
-               dwLoop++;\r
-       }\r
-\r
-       if (bWhat == MZ80_UNKNOWN)\r
-       {\r
-               fprintf(stderr, "Need emitted type qualifier\n");\r
-               exit(1);\r
-       }\r
-\r
-       for (dwLoop = 1; dwLoop < argc; dwLoop++)\r
-               if (argv[dwLoop][0] != '-')\r
-               {\r
-                       fp = fopen(argv[dwLoop], "w");\r
-                       break;\r
-               }\r
-\r
-       if (NULL == fp)\r
-       {\r
-               fprintf(stderr, "Can't open %s for writing\n", argv[1]);\r
-               exit(1);\r
-       }\r
-\r
-       strcpy(cpubasename, "mz80");\r
-\r
-       StandardHeader();\r
-       DataSegment();\r
-       EmitCode();\r
-       ProgramEnd();\r
-\r
-       fclose(fp);\r
-}\r
diff --git a/cpu/mz80/mz80.c b/cpu/mz80/mz80.c
deleted file mode 100644 (file)
index b7733fd..0000000
+++ /dev/null
@@ -1,17053 +0,0 @@
-#include "driver.h"
-
-/* Multi-Z80 32 Bit emulator */
-
-/* Copyright 1996-2000 Neil Bradley, All rights reserved
- *
- * License agreement:
- *
- * (MZ80 Refers to both the assembly code emitted by makeZ80.c and makeZ80.c
- * itself)
- *
- * MZ80 May be distributed in unmodified form to any medium.
- *
- * MZ80 May not be sold, or sold as a part of a commercial package without
- * the express written permission of Neil Bradley (neil@synthcom.com). This
- * includes shareware.
- *
- * Modified versions of MZ80 may not be publicly redistributed without author
- * approval (neil@synthcom.com). This includes distributing via a publicly
- * accessible LAN. You may make your own source modifications and distribute
- * MZ80 in source or object form, but if you make modifications to MZ80
- * then it should be noted in the top as a comment in makeZ80.c.
- *
- * MZ80 Licensing for commercial applications is available. Please email
- * neil@synthcom.com for details.
- *
- * Synthcom Systems, Inc, and Neil Bradley will not be held responsible for
- * any damage done by the use of MZ80. It is purely "as-is".
- *
- * If you use MZ80 in a freeware application, credit in the following text:
- *
- * "Multi-Z80 CPU emulator by Neil Bradley (neil@synthcom.com)"
- *
- * must accompany the freeware application within the application itself or
- * in the documentation.
- *
- * Legal stuff aside:
- *
- * If you find problems with MZ80, please email the author so they can get
- * resolved. If you find a bug and fix it, please also email the author so
- * that those bug fixes can be propogated to the installed base of MZ80
- * users. If you find performance improvements or problems with MZ80, please
- * email the author with your changes/suggestions and they will be rolled in
- * with subsequent releases of MZ80.
- *
- * The whole idea of this emulator is to have the fastest available 32 bit
- * Multi-Z80 emulator for the PC, giving maximum performance. 
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "mz80.h"
-UINT32 z80intAddr;
-UINT32 z80pc;
-
-
-/* Modular global variables go here*/
-
-static CONTEXTMZ80 cpu;        /* CPU Context */
-static UINT8 *pbPC;                    /* Program counter normalized */
-static UINT8 *pbSP;                    /* Stack pointer normalized */
-static struct MemoryReadByte *psMemRead; /* Read memory structure */
-static struct MemoryWriteByte *psMemWrite; /* Write memory structure */
-static struct z80PortRead *psIoRead; /* Read I/O structure */
-static struct z80PortWrite *psIoWrite; /* Write memory structure */
-static INT32 sdwCyclesRemaining; /* Used as a countdown */
-static UINT32 dwReturnCode; /* Return code from exec() */
-static UINT32 dwOriginalCycles; /* How many cycles did we start with? */
-static UINT32 dwElapsedTicks;  /* How many ticks did we elapse? */
-static INT32 sdwAddr;          /* Temporary address storage */
-static UINT32 dwAddr;          /* Temporary stack address */
-static UINT8 *pbAddAdcTable;   /* Pointer to add/adc flag table */
-static UINT8 *pbSubSbcTable;   /* Pointer to sub/sbc flag table */
-static UINT32 dwTemp;                  /* Temporary value */
-
-static UINT8 bTemp;                    /* Temporary value */
-
-static UINT8 bTemp2;           /* Temporary value */
-
-/* Precomputed flag tables */
-
-static UINT8 bPostIncFlags[0x100] = 
-{
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,
-       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x94,
-       0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x90,
-       0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x90,
-       0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x90,
-       0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x90,
-       0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x90,
-       0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x90,
-       0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x90,
-       0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x50
-};
-
-static UINT8 bPostDecFlags[0x100] = 
-{
-       0x92,0x42,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,
-       0x12,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,
-       0x12,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,
-       0x12,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,
-       0x12,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,
-       0x12,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,
-       0x12,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,
-       0x12,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,
-       0x16,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,
-       0x92,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,
-       0x92,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,
-       0x92,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,
-       0x92,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,
-       0x92,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,
-       0x92,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,
-       0x92,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82
-};
-
-static UINT8 bPostORFlags[0x100] = 
-{
-       0x44,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
-       0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
-       0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
-       0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
-       0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
-       0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
-       0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
-       0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
-       0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
-       0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
-       0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
-       0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
-       0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
-       0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
-       0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
-       0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84
-};
-
-static UINT8 bPostANDFlags[0x100] = 
-{
-       0x54,0x10,0x10,0x14,0x10,0x14,0x14,0x10,0x10,0x14,0x14,0x10,0x14,0x10,0x10,0x14,
-       0x10,0x14,0x14,0x10,0x14,0x10,0x10,0x14,0x14,0x10,0x10,0x14,0x10,0x14,0x14,0x10,
-       0x10,0x14,0x14,0x10,0x14,0x10,0x10,0x14,0x14,0x10,0x10,0x14,0x10,0x14,0x14,0x10,
-       0x14,0x10,0x10,0x14,0x10,0x14,0x14,0x10,0x10,0x14,0x14,0x10,0x14,0x10,0x10,0x14,
-       0x10,0x14,0x14,0x10,0x14,0x10,0x10,0x14,0x14,0x10,0x10,0x14,0x10,0x14,0x14,0x10,
-       0x14,0x10,0x10,0x14,0x10,0x14,0x14,0x10,0x10,0x14,0x14,0x10,0x14,0x10,0x10,0x14,
-       0x14,0x10,0x10,0x14,0x10,0x14,0x14,0x10,0x10,0x14,0x14,0x10,0x14,0x10,0x10,0x14,
-       0x10,0x14,0x14,0x10,0x14,0x10,0x10,0x14,0x14,0x10,0x10,0x14,0x10,0x14,0x14,0x10,
-       0x90,0x94,0x94,0x90,0x94,0x90,0x90,0x94,0x94,0x90,0x90,0x94,0x90,0x94,0x94,0x90,
-       0x94,0x90,0x90,0x94,0x90,0x94,0x94,0x90,0x90,0x94,0x94,0x90,0x94,0x90,0x90,0x94,
-       0x94,0x90,0x90,0x94,0x90,0x94,0x94,0x90,0x90,0x94,0x94,0x90,0x94,0x90,0x90,0x94,
-       0x90,0x94,0x94,0x90,0x94,0x90,0x90,0x94,0x94,0x90,0x90,0x94,0x90,0x94,0x94,0x90,
-       0x94,0x90,0x90,0x94,0x90,0x94,0x94,0x90,0x90,0x94,0x94,0x90,0x94,0x90,0x90,0x94,
-       0x90,0x94,0x94,0x90,0x94,0x90,0x90,0x94,0x94,0x90,0x90,0x94,0x90,0x94,0x94,0x90,
-       0x90,0x94,0x94,0x90,0x94,0x90,0x90,0x94,0x94,0x90,0x90,0x94,0x90,0x94,0x94,0x90,
-       0x94,0x90,0x90,0x94,0x90,0x94,0x94,0x90,0x90,0x94,0x94,0x90,0x94,0x90,0x90,0x94
-};
-
-static UINT16 wDAATable[0x800] = 
-{
-       0x5400,0x1001,0x1002,0x1403,0x1004,0x1405,0x1406,0x1007,
-       0x1008,0x1409,0x1010,0x1411,0x1412,0x1013,0x1414,0x1015,
-       0x1010,0x1411,0x1412,0x1013,0x1414,0x1015,0x1016,0x1417,
-       0x1418,0x1019,0x1020,0x1421,0x1422,0x1023,0x1424,0x1025,
-       0x1020,0x1421,0x1422,0x1023,0x1424,0x1025,0x1026,0x1427,
-       0x1428,0x1029,0x1430,0x1031,0x1032,0x1433,0x1034,0x1435,
-       0x1430,0x1031,0x1032,0x1433,0x1034,0x1435,0x1436,0x1037,
-       0x1038,0x1439,0x1040,0x1441,0x1442,0x1043,0x1444,0x1045,
-       0x1040,0x1441,0x1442,0x1043,0x1444,0x1045,0x1046,0x1447,
-       0x1448,0x1049,0x1450,0x1051,0x1052,0x1453,0x1054,0x1455,
-       0x1450,0x1051,0x1052,0x1453,0x1054,0x1455,0x1456,0x1057,
-       0x1058,0x1459,0x1460,0x1061,0x1062,0x1463,0x1064,0x1465,
-       0x1460,0x1061,0x1062,0x1463,0x1064,0x1465,0x1466,0x1067,
-       0x1068,0x1469,0x1070,0x1471,0x1472,0x1073,0x1474,0x1075,
-       0x1070,0x1471,0x1472,0x1073,0x1474,0x1075,0x1076,0x1477,
-       0x1478,0x1079,0x9080,0x9481,0x9482,0x9083,0x9484,0x9085,
-       0x9080,0x9481,0x9482,0x9083,0x9484,0x9085,0x9086,0x9487,
-       0x9488,0x9089,0x9490,0x9091,0x9092,0x9493,0x9094,0x9495,
-       0x9490,0x9091,0x9092,0x9493,0x9094,0x9495,0x9496,0x9097,
-       0x9098,0x9499,0x5500,0x1101,0x1102,0x1503,0x1104,0x1505,
-       0x5500,0x1101,0x1102,0x1503,0x1104,0x1505,0x1506,0x1107,
-       0x1108,0x1509,0x1110,0x1511,0x1512,0x1113,0x1514,0x1115,
-       0x1110,0x1511,0x1512,0x1113,0x1514,0x1115,0x1116,0x1517,
-       0x1518,0x1119,0x1120,0x1521,0x1522,0x1123,0x1524,0x1125,
-       0x1120,0x1521,0x1522,0x1123,0x1524,0x1125,0x1126,0x1527,
-       0x1528,0x1129,0x1530,0x1131,0x1132,0x1533,0x1134,0x1535,
-       0x1530,0x1131,0x1132,0x1533,0x1134,0x1535,0x1536,0x1137,
-       0x1138,0x1539,0x1140,0x1541,0x1542,0x1143,0x1544,0x1145,
-       0x1140,0x1541,0x1542,0x1143,0x1544,0x1145,0x1146,0x1547,
-       0x1548,0x1149,0x1550,0x1151,0x1152,0x1553,0x1154,0x1555,
-       0x1550,0x1151,0x1152,0x1553,0x1154,0x1555,0x1556,0x1157,
-       0x1158,0x1559,0x1560,0x1161,0x1162,0x1563,0x1164,0x1565,
-       0x1560,0x1161,0x1162,0x1563,0x1164,0x1565,0x1566,0x1167,
-       0x1168,0x1569,0x1170,0x1571,0x1572,0x1173,0x1574,0x1175,
-       0x1170,0x1571,0x1572,0x1173,0x1574,0x1175,0x1176,0x1577,
-       0x1578,0x1179,0x9180,0x9581,0x9582,0x9183,0x9584,0x9185,
-       0x9180,0x9581,0x9582,0x9183,0x9584,0x9185,0x9186,0x9587,
-       0x9588,0x9189,0x9590,0x9191,0x9192,0x9593,0x9194,0x9595,
-       0x9590,0x9191,0x9192,0x9593,0x9194,0x9595,0x9596,0x9197,
-       0x9198,0x9599,0x95a0,0x91a1,0x91a2,0x95a3,0x91a4,0x95a5,
-       0x95a0,0x91a1,0x91a2,0x95a3,0x91a4,0x95a5,0x95a6,0x91a7,
-       0x91a8,0x95a9,0x91b0,0x95b1,0x95b2,0x91b3,0x95b4,0x91b5,
-       0x91b0,0x95b1,0x95b2,0x91b3,0x95b4,0x91b5,0x91b6,0x95b7,
-       0x95b8,0x91b9,0x95c0,0x91c1,0x91c2,0x95c3,0x91c4,0x95c5,
-       0x95c0,0x91c1,0x91c2,0x95c3,0x91c4,0x95c5,0x95c6,0x91c7,
-       0x91c8,0x95c9,0x91d0,0x95d1,0x95d2,0x91d3,0x95d4,0x91d5,
-       0x91d0,0x95d1,0x95d2,0x91d3,0x95d4,0x91d5,0x91d6,0x95d7,
-       0x95d8,0x91d9,0x91e0,0x95e1,0x95e2,0x91e3,0x95e4,0x91e5,
-       0x91e0,0x95e1,0x95e2,0x91e3,0x95e4,0x91e5,0x91e6,0x95e7,
-       0x95e8,0x91e9,0x95f0,0x91f1,0x91f2,0x95f3,0x91f4,0x95f5,
-       0x95f0,0x91f1,0x91f2,0x95f3,0x91f4,0x95f5,0x95f6,0x91f7,
-       0x91f8,0x95f9,0x5500,0x1101,0x1102,0x1503,0x1104,0x1505,
-       0x5500,0x1101,0x1102,0x1503,0x1104,0x1505,0x1506,0x1107,
-       0x1108,0x1509,0x1110,0x1511,0x1512,0x1113,0x1514,0x1115,
-       0x1110,0x1511,0x1512,0x1113,0x1514,0x1115,0x1116,0x1517,
-       0x1518,0x1119,0x1120,0x1521,0x1522,0x1123,0x1524,0x1125,
-       0x1120,0x1521,0x1522,0x1123,0x1524,0x1125,0x1126,0x1527,
-       0x1528,0x1129,0x1530,0x1131,0x1132,0x1533,0x1134,0x1535,
-       0x1530,0x1131,0x1132,0x1533,0x1134,0x1535,0x1536,0x1137,
-       0x1138,0x1539,0x1140,0x1541,0x1542,0x1143,0x1544,0x1145,
-       0x1140,0x1541,0x1542,0x1143,0x1544,0x1145,0x1146,0x1547,
-       0x1548,0x1149,0x1550,0x1151,0x1152,0x1553,0x1154,0x1555,
-       0x1550,0x1151,0x1152,0x1553,0x1154,0x1555,0x1556,0x1157,
-       0x1158,0x1559,0x1560,0x1161,0x1162,0x1563,0x1164,0x1565,
-       0x1406,0x1007,0x1008,0x1409,0x140a,0x100b,0x140c,0x100d,
-       0x100e,0x140f,0x1010,0x1411,0x1412,0x1013,0x1414,0x1015,
-       0x1016,0x1417,0x1418,0x1019,0x101a,0x141b,0x101c,0x141d,
-       0x141e,0x101f,0x1020,0x1421,0x1422,0x1023,0x1424,0x1025,
-       0x1026,0x1427,0x1428,0x1029,0x102a,0x142b,0x102c,0x142d,
-       0x142e,0x102f,0x1430,0x1031,0x1032,0x1433,0x1034,0x1435,
-       0x1436,0x1037,0x1038,0x1439,0x143a,0x103b,0x143c,0x103d,
-       0x103e,0x143f,0x1040,0x1441,0x1442,0x1043,0x1444,0x1045,
-       0x1046,0x1447,0x1448,0x1049,0x104a,0x144b,0x104c,0x144d,
-       0x144e,0x104f,0x1450,0x1051,0x1052,0x1453,0x1054,0x1455,
-       0x1456,0x1057,0x1058,0x1459,0x145a,0x105b,0x145c,0x105d,
-       0x105e,0x145f,0x1460,0x1061,0x1062,0x1463,0x1064,0x1465,
-       0x1466,0x1067,0x1068,0x1469,0x146a,0x106b,0x146c,0x106d,
-       0x106e,0x146f,0x1070,0x1471,0x1472,0x1073,0x1474,0x1075,
-       0x1076,0x1477,0x1478,0x1079,0x107a,0x147b,0x107c,0x147d,
-       0x147e,0x107f,0x9080,0x9481,0x9482,0x9083,0x9484,0x9085,
-       0x9086,0x9487,0x9488,0x9089,0x908a,0x948b,0x908c,0x948d,
-       0x948e,0x908f,0x9490,0x9091,0x9092,0x9493,0x9094,0x9495,
-       0x9496,0x9097,0x9098,0x9499,0x949a,0x909b,0x949c,0x909d,
-       0x909e,0x949f,0x5500,0x1101,0x1102,0x1503,0x1104,0x1505,
-       0x1506,0x1107,0x1108,0x1509,0x150a,0x110b,0x150c,0x110d,
-       0x110e,0x150f,0x1110,0x1511,0x1512,0x1113,0x1514,0x1115,
-       0x1116,0x1517,0x1518,0x1119,0x111a,0x151b,0x111c,0x151d,
-       0x151e,0x111f,0x1120,0x1521,0x1522,0x1123,0x1524,0x1125,
-       0x1126,0x1527,0x1528,0x1129,0x112a,0x152b,0x112c,0x152d,
-       0x152e,0x112f,0x1530,0x1131,0x1132,0x1533,0x1134,0x1535,
-       0x1536,0x1137,0x1138,0x1539,0x153a,0x113b,0x153c,0x113d,
-       0x113e,0x153f,0x1140,0x1541,0x1542,0x1143,0x1544,0x1145,
-       0x1146,0x1547,0x1548,0x1149,0x114a,0x154b,0x114c,0x154d,
-       0x154e,0x114f,0x1550,0x1151,0x1152,0x1553,0x1154,0x1555,
-       0x1556,0x1157,0x1158,0x1559,0x155a,0x115b,0x155c,0x115d,
-       0x115e,0x155f,0x1560,0x1161,0x1162,0x1563,0x1164,0x1565,
-       0x1566,0x1167,0x1168,0x1569,0x156a,0x116b,0x156c,0x116d,
-       0x116e,0x156f,0x1170,0x1571,0x1572,0x1173,0x1574,0x1175,
-       0x1176,0x1577,0x1578,0x1179,0x117a,0x157b,0x117c,0x157d,
-       0x157e,0x117f,0x9180,0x9581,0x9582,0x9183,0x9584,0x9185,
-       0x9186,0x9587,0x9588,0x9189,0x918a,0x958b,0x918c,0x958d,
-       0x958e,0x918f,0x9590,0x9191,0x9192,0x9593,0x9194,0x9595,
-       0x9596,0x9197,0x9198,0x9599,0x959a,0x919b,0x959c,0x919d,
-       0x919e,0x959f,0x95a0,0x91a1,0x91a2,0x95a3,0x91a4,0x95a5,
-       0x95a6,0x91a7,0x91a8,0x95a9,0x95aa,0x91ab,0x95ac,0x91ad,
-       0x91ae,0x95af,0x91b0,0x95b1,0x95b2,0x91b3,0x95b4,0x91b5,
-       0x91b6,0x95b7,0x95b8,0x91b9,0x91ba,0x95bb,0x91bc,0x95bd,
-       0x95be,0x91bf,0x95c0,0x91c1,0x91c2,0x95c3,0x91c4,0x95c5,
-       0x95c6,0x91c7,0x91c8,0x95c9,0x95ca,0x91cb,0x95cc,0x91cd,
-       0x91ce,0x95cf,0x91d0,0x95d1,0x95d2,0x91d3,0x95d4,0x91d5,
-       0x91d6,0x95d7,0x95d8,0x91d9,0x91da,0x95db,0x91dc,0x95dd,
-       0x95de,0x91df,0x91e0,0x95e1,0x95e2,0x91e3,0x95e4,0x91e5,
-       0x91e6,0x95e7,0x95e8,0x91e9,0x91ea,0x95eb,0x91ec,0x95ed,
-       0x95ee,0x91ef,0x95f0,0x91f1,0x91f2,0x95f3,0x91f4,0x95f5,
-       0x95f6,0x91f7,0x91f8,0x95f9,0x95fa,0x91fb,0x95fc,0x91fd,
-       0x91fe,0x95ff,0x5500,0x1101,0x1102,0x1503,0x1104,0x1505,
-       0x1506,0x1107,0x1108,0x1509,0x150a,0x110b,0x150c,0x110d,
-       0x110e,0x150f,0x1110,0x1511,0x1512,0x1113,0x1514,0x1115,
-       0x1116,0x1517,0x1518,0x1119,0x111a,0x151b,0x111c,0x151d,
-       0x151e,0x111f,0x1120,0x1521,0x1522,0x1123,0x1524,0x1125,
-       0x1126,0x1527,0x1528,0x1129,0x112a,0x152b,0x112c,0x152d,
-       0x152e,0x112f,0x1530,0x1131,0x1132,0x1533,0x1134,0x1535,
-       0x1536,0x1137,0x1138,0x1539,0x153a,0x113b,0x153c,0x113d,
-       0x113e,0x153f,0x1140,0x1541,0x1542,0x1143,0x1544,0x1145,
-       0x1146,0x1547,0x1548,0x1149,0x114a,0x154b,0x114c,0x154d,
-       0x154e,0x114f,0x1550,0x1151,0x1152,0x1553,0x1154,0x1555,
-       0x1556,0x1157,0x1158,0x1559,0x155a,0x115b,0x155c,0x115d,
-       0x115e,0x155f,0x1560,0x1161,0x1162,0x1563,0x1164,0x1565,
-       0x5600,0x1201,0x1202,0x1603,0x1204,0x1605,0x1606,0x1207,
-       0x1208,0x1609,0x1204,0x1605,0x1606,0x1207,0x1208,0x1609,
-       0x1210,0x1611,0x1612,0x1213,0x1614,0x1215,0x1216,0x1617,
-       0x1618,0x1219,0x1614,0x1215,0x1216,0x1617,0x1618,0x1219,
-       0x1220,0x1621,0x1622,0x1223,0x1624,0x1225,0x1226,0x1627,
-       0x1628,0x1229,0x1624,0x1225,0x1226,0x1627,0x1628,0x1229,
-       0x1630,0x1231,0x1232,0x1633,0x1234,0x1635,0x1636,0x1237,
-       0x1238,0x1639,0x1234,0x1635,0x1636,0x1237,0x1238,0x1639,
-       0x1240,0x1641,0x1642,0x1243,0x1644,0x1245,0x1246,0x1647,
-       0x1648,0x1249,0x1644,0x1245,0x1246,0x1647,0x1648,0x1249,
-       0x1650,0x1251,0x1252,0x1653,0x1254,0x1655,0x1656,0x1257,
-       0x1258,0x1659,0x1254,0x1655,0x1656,0x1257,0x1258,0x1659,
-       0x1660,0x1261,0x1262,0x1663,0x1264,0x1665,0x1666,0x1267,
-       0x1268,0x1669,0x1264,0x1665,0x1666,0x1267,0x1268,0x1669,
-       0x1270,0x1671,0x1672,0x1273,0x1674,0x1275,0x1276,0x1677,
-       0x1678,0x1279,0x1674,0x1275,0x1276,0x1677,0x1678,0x1279,
-       0x9280,0x9681,0x9682,0x9283,0x9684,0x9285,0x9286,0x9687,
-       0x9688,0x9289,0x9684,0x9285,0x9286,0x9687,0x9688,0x9289,
-       0x9690,0x9291,0x9292,0x9693,0x9294,0x9695,0x9696,0x9297,
-       0x9298,0x9699,0x1334,0x1735,0x1736,0x1337,0x1338,0x1739,
-       0x1340,0x1741,0x1742,0x1343,0x1744,0x1345,0x1346,0x1747,
-       0x1748,0x1349,0x1744,0x1345,0x1346,0x1747,0x1748,0x1349,
-       0x1750,0x1351,0x1352,0x1753,0x1354,0x1755,0x1756,0x1357,
-       0x1358,0x1759,0x1354,0x1755,0x1756,0x1357,0x1358,0x1759,
-       0x1760,0x1361,0x1362,0x1763,0x1364,0x1765,0x1766,0x1367,
-       0x1368,0x1769,0x1364,0x1765,0x1766,0x1367,0x1368,0x1769,
-       0x1370,0x1771,0x1772,0x1373,0x1774,0x1375,0x1376,0x1777,
-       0x1778,0x1379,0x1774,0x1375,0x1376,0x1777,0x1778,0x1379,
-       0x9380,0x9781,0x9782,0x9383,0x9784,0x9385,0x9386,0x9787,
-       0x9788,0x9389,0x9784,0x9385,0x9386,0x9787,0x9788,0x9389,
-       0x9790,0x9391,0x9392,0x9793,0x9394,0x9795,0x9796,0x9397,
-       0x9398,0x9799,0x9394,0x9795,0x9796,0x9397,0x9398,0x9799,
-       0x97a0,0x93a1,0x93a2,0x97a3,0x93a4,0x97a5,0x97a6,0x93a7,
-       0x93a8,0x97a9,0x93a4,0x97a5,0x97a6,0x93a7,0x93a8,0x97a9,
-       0x93b0,0x97b1,0x97b2,0x93b3,0x97b4,0x93b5,0x93b6,0x97b7,
-       0x97b8,0x93b9,0x97b4,0x93b5,0x93b6,0x97b7,0x97b8,0x93b9,
-       0x97c0,0x93c1,0x93c2,0x97c3,0x93c4,0x97c5,0x97c6,0x93c7,
-       0x93c8,0x97c9,0x93c4,0x97c5,0x97c6,0x93c7,0x93c8,0x97c9,
-       0x93d0,0x97d1,0x97d2,0x93d3,0x97d4,0x93d5,0x93d6,0x97d7,
-       0x97d8,0x93d9,0x97d4,0x93d5,0x93d6,0x97d7,0x97d8,0x93d9,
-       0x93e0,0x97e1,0x97e2,0x93e3,0x97e4,0x93e5,0x93e6,0x97e7,
-       0x97e8,0x93e9,0x97e4,0x93e5,0x93e6,0x97e7,0x97e8,0x93e9,
-       0x97f0,0x93f1,0x93f2,0x97f3,0x93f4,0x97f5,0x97f6,0x93f7,
-       0x93f8,0x97f9,0x93f4,0x97f5,0x97f6,0x93f7,0x93f8,0x97f9,
-       0x5700,0x1301,0x1302,0x1703,0x1304,0x1705,0x1706,0x1307,
-       0x1308,0x1709,0x1304,0x1705,0x1706,0x1307,0x1308,0x1709,
-       0x1310,0x1711,0x1712,0x1313,0x1714,0x1315,0x1316,0x1717,
-       0x1718,0x1319,0x1714,0x1315,0x1316,0x1717,0x1718,0x1319,
-       0x1320,0x1721,0x1722,0x1323,0x1724,0x1325,0x1326,0x1727,
-       0x1728,0x1329,0x1724,0x1325,0x1326,0x1727,0x1728,0x1329,
-       0x1730,0x1331,0x1332,0x1733,0x1334,0x1735,0x1736,0x1337,
-       0x1338,0x1739,0x1334,0x1735,0x1736,0x1337,0x1338,0x1739,
-       0x1340,0x1741,0x1742,0x1343,0x1744,0x1345,0x1346,0x1747,
-       0x1748,0x1349,0x1744,0x1345,0x1346,0x1747,0x1748,0x1349,
-       0x1750,0x1351,0x1352,0x1753,0x1354,0x1755,0x1756,0x1357,
-       0x1358,0x1759,0x1354,0x1755,0x1756,0x1357,0x1358,0x1759,
-       0x1760,0x1361,0x1362,0x1763,0x1364,0x1765,0x1766,0x1367,
-       0x1368,0x1769,0x1364,0x1765,0x1766,0x1367,0x1368,0x1769,
-       0x1370,0x1771,0x1772,0x1373,0x1774,0x1375,0x1376,0x1777,
-       0x1778,0x1379,0x1774,0x1375,0x1376,0x1777,0x1778,0x1379,
-       0x9380,0x9781,0x9782,0x9383,0x9784,0x9385,0x9386,0x9787,
-       0x9788,0x9389,0x9784,0x9385,0x9386,0x9787,0x9788,0x9389,
-       0x9790,0x9391,0x9392,0x9793,0x9394,0x9795,0x9796,0x9397,
-       0x9398,0x9799,0x9394,0x9795,0x9796,0x9397,0x9398,0x9799,
-       0x97fa,0x93fb,0x97fc,0x93fd,0x93fe,0x97ff,0x5600,0x1201,
-       0x1202,0x1603,0x1204,0x1605,0x1606,0x1207,0x1208,0x1609,
-       0x160a,0x120b,0x160c,0x120d,0x120e,0x160f,0x1210,0x1611,
-       0x1612,0x1213,0x1614,0x1215,0x1216,0x1617,0x1618,0x1219,
-       0x121a,0x161b,0x121c,0x161d,0x161e,0x121f,0x1220,0x1621,
-       0x1622,0x1223,0x1624,0x1225,0x1226,0x1627,0x1628,0x1229,
-       0x122a,0x162b,0x122c,0x162d,0x162e,0x122f,0x1630,0x1231,
-       0x1232,0x1633,0x1234,0x1635,0x1636,0x1237,0x1238,0x1639,
-       0x163a,0x123b,0x163c,0x123d,0x123e,0x163f,0x1240,0x1641,
-       0x1642,0x1243,0x1644,0x1245,0x1246,0x1647,0x1648,0x1249,
-       0x124a,0x164b,0x124c,0x164d,0x164e,0x124f,0x1650,0x1251,
-       0x1252,0x1653,0x1254,0x1655,0x1656,0x1257,0x1258,0x1659,
-       0x165a,0x125b,0x165c,0x125d,0x125e,0x165f,0x1660,0x1261,
-       0x1262,0x1663,0x1264,0x1665,0x1666,0x1267,0x1268,0x1669,
-       0x166a,0x126b,0x166c,0x126d,0x126e,0x166f,0x1270,0x1671,
-       0x1672,0x1273,0x1674,0x1275,0x1276,0x1677,0x1678,0x1279,
-       0x127a,0x167b,0x127c,0x167d,0x167e,0x127f,0x9280,0x9681,
-       0x9682,0x9283,0x9684,0x9285,0x9286,0x9687,0x9688,0x9289,
-       0x928a,0x968b,0x928c,0x968d,0x968e,0x928f,0x9690,0x9291,
-       0x9292,0x9693,0x1334,0x1735,0x1736,0x1337,0x1338,0x1739,
-       0x173a,0x133b,0x173c,0x133d,0x133e,0x173f,0x1340,0x1741,
-       0x1742,0x1343,0x1744,0x1345,0x1346,0x1747,0x1748,0x1349,
-       0x134a,0x174b,0x134c,0x174d,0x174e,0x134f,0x1750,0x1351,
-       0x1352,0x1753,0x1354,0x1755,0x1756,0x1357,0x1358,0x1759,
-       0x175a,0x135b,0x175c,0x135d,0x135e,0x175f,0x1760,0x1361,
-       0x1362,0x1763,0x1364,0x1765,0x1766,0x1367,0x1368,0x1769,
-       0x176a,0x136b,0x176c,0x136d,0x136e,0x176f,0x1370,0x1771,
-       0x1772,0x1373,0x1774,0x1375,0x1376,0x1777,0x1778,0x1379,
-       0x137a,0x177b,0x137c,0x177d,0x177e,0x137f,0x9380,0x9781,
-       0x9782,0x9383,0x9784,0x9385,0x9386,0x9787,0x9788,0x9389,
-       0x938a,0x978b,0x938c,0x978d,0x978e,0x938f,0x9790,0x9391,
-       0x9392,0x9793,0x9394,0x9795,0x9796,0x9397,0x9398,0x9799,
-       0x979a,0x939b,0x979c,0x939d,0x939e,0x979f,0x97a0,0x93a1,
-       0x93a2,0x97a3,0x93a4,0x97a5,0x97a6,0x93a7,0x93a8,0x97a9,
-       0x97aa,0x93ab,0x97ac,0x93ad,0x93ae,0x97af,0x93b0,0x97b1,
-       0x97b2,0x93b3,0x97b4,0x93b5,0x93b6,0x97b7,0x97b8,0x93b9,
-       0x93ba,0x97bb,0x93bc,0x97bd,0x97be,0x93bf,0x97c0,0x93c1,
-       0x93c2,0x97c3,0x93c4,0x97c5,0x97c6,0x93c7,0x93c8,0x97c9,
-       0x97ca,0x93cb,0x97cc,0x93cd,0x93ce,0x97cf,0x93d0,0x97d1,
-       0x97d2,0x93d3,0x97d4,0x93d5,0x93d6,0x97d7,0x97d8,0x93d9,
-       0x93da,0x97db,0x93dc,0x97dd,0x97de,0x93df,0x93e0,0x97e1,
-       0x97e2,0x93e3,0x97e4,0x93e5,0x93e6,0x97e7,0x97e8,0x93e9,
-       0x93ea,0x97eb,0x93ec,0x97ed,0x97ee,0x93ef,0x97f0,0x93f1,
-       0x93f2,0x97f3,0x93f4,0x97f5,0x97f6,0x93f7,0x93f8,0x97f9,
-       0x97fa,0x93fb,0x97fc,0x93fd,0x93fe,0x97ff,0x5700,0x1301,
-       0x1302,0x1703,0x1304,0x1705,0x1706,0x1307,0x1308,0x1709,
-       0x170a,0x130b,0x170c,0x130d,0x130e,0x170f,0x1310,0x1711,
-       0x1712,0x1313,0x1714,0x1315,0x1316,0x1717,0x1718,0x1319,
-       0x131a,0x171b,0x131c,0x171d,0x171e,0x131f,0x1320,0x1721,
-       0x1722,0x1323,0x1724,0x1325,0x1326,0x1727,0x1728,0x1329,
-       0x132a,0x172b,0x132c,0x172d,0x172e,0x132f,0x1730,0x1331,
-       0x1332,0x1733,0x1334,0x1735,0x1736,0x1337,0x1338,0x1739,
-       0x173a,0x133b,0x173c,0x133d,0x133e,0x173f,0x1340,0x1741,
-       0x1742,0x1343,0x1744,0x1345,0x1346,0x1747,0x1748,0x1349,
-       0x134a,0x174b,0x134c,0x174d,0x174e,0x134f,0x1750,0x1351,
-       0x1352,0x1753,0x1354,0x1755,0x1756,0x1357,0x1358,0x1759,
-       0x175a,0x135b,0x175c,0x135d,0x135e,0x175f,0x1760,0x1361,
-       0x1362,0x1763,0x1364,0x1765,0x1766,0x1367,0x1368,0x1769,
-       0x176a,0x136b,0x176c,0x136d,0x136e,0x176f,0x1370,0x1771,
-       0x1772,0x1373,0x1774,0x1375,0x1376,0x1777,0x1778,0x1379,
-       0x137a,0x177b,0x137c,0x177d,0x177e,0x137f,0x9380,0x9781,
-       0x9782,0x9383,0x9784,0x9385,0x9386,0x9787,0x9788,0x9389,
-       0x938a,0x978b,0x938c,0x978d,0x978e,0x938f,0x9790,0x9391,
-       0x9392,0x9793,0x9394,0x9795,0x9796,0x9397,0x9398,0x9799 
-};
-
-void DDFDCBHandler(UINT32 dwWhich);
-
-
-static void InvalidInstruction(UINT32 dwCount)
-{
-       pbPC -= dwCount; /* Invalid instruction - back up */
-       dwReturnCode = (UINT32) pbPC - (UINT32) cpu.z80Base;
-       dwOriginalCycles -= sdwCyclesRemaining;
-       sdwCyclesRemaining = 0;
-}
-
-void CBHandler(void)
-{
-       switch (*pbPC++)
-       {
-               case 0x00:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               bTemp2 = (cpu.z80B >> 7);
-                               cpu.z80B = (cpu.z80B << 1) | bTemp2;
-                               cpu.z80F |= bTemp2 | bPostORFlags[cpu.z80B];
-                       break;
-               }
-               case 0x01:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               bTemp2 = (cpu.z80C >> 7);
-                               cpu.z80C = (cpu.z80C << 1) | bTemp2;
-                               cpu.z80F |= bTemp2 | bPostORFlags[cpu.z80C];
-                       break;
-               }
-               case 0x02:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               bTemp2 = (cpu.z80D >> 7);
-                               cpu.z80D = (cpu.z80D << 1) | bTemp2;
-                               cpu.z80F |= bTemp2 | bPostORFlags[cpu.z80D];
-                       break;
-               }
-               case 0x03:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               bTemp2 = (cpu.z80E >> 7);
-                               cpu.z80E = (cpu.z80E << 1) | bTemp2;
-                               cpu.z80F |= bTemp2 | bPostORFlags[cpu.z80E];
-                       break;
-               }
-               case 0x04:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               bTemp2 = (cpu.z80H >> 7);
-                               cpu.z80H = (cpu.z80H << 1) | bTemp2;
-                               cpu.z80F |= bTemp2 | bPostORFlags[cpu.z80H];
-                       break;
-               }
-               case 0x05:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               bTemp2 = (cpu.z80L >> 7);
-                               cpu.z80L = (cpu.z80L << 1) | bTemp2;
-                               cpu.z80F |= bTemp2 | bPostORFlags[cpu.z80L];
-                       break;
-               }
-               case 0x06:
-               {
-                       sdwCyclesRemaining -= 15;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               bTemp2 = (bTemp >> 7);
-                               bTemp = (bTemp << 1) | bTemp2;
-                               cpu.z80F |= bTemp2 | bPostORFlags[bTemp];
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0x07:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               bTemp2 = (cpu.z80A >> 7);
-                               cpu.z80A = (cpu.z80A << 1) | bTemp2;
-                               cpu.z80F |= bTemp2 | bPostORFlags[cpu.z80A];
-                       break;
-               }
-               case 0x08:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80B & Z80_FLAG_CARRY);
-                               cpu.z80B = (cpu.z80B >> 1) | (cpu.z80B << 7);
-                               cpu.z80F |= bPostORFlags[cpu.z80B];
-                       break;
-               }
-               case 0x09:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80C & Z80_FLAG_CARRY);
-                               cpu.z80C = (cpu.z80C >> 1) | (cpu.z80C << 7);
-                               cpu.z80F |= bPostORFlags[cpu.z80C];
-                       break;
-               }
-               case 0x0a:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80D & Z80_FLAG_CARRY);
-                               cpu.z80D = (cpu.z80D >> 1) | (cpu.z80D << 7);
-                               cpu.z80F |= bPostORFlags[cpu.z80D];
-                       break;
-               }
-               case 0x0b:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80E & Z80_FLAG_CARRY);
-                               cpu.z80E = (cpu.z80E >> 1) | (cpu.z80E << 7);
-                               cpu.z80F |= bPostORFlags[cpu.z80E];
-                       break;
-               }
-               case 0x0c:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80H & Z80_FLAG_CARRY);
-                               cpu.z80H = (cpu.z80H >> 1) | (cpu.z80H << 7);
-                               cpu.z80F |= bPostORFlags[cpu.z80H];
-                       break;
-               }
-               case 0x0d:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80L & Z80_FLAG_CARRY);
-                               cpu.z80L = (cpu.z80L >> 1) | (cpu.z80L << 7);
-                               cpu.z80F |= bPostORFlags[cpu.z80L];
-                       break;
-               }
-               case 0x0e:
-               {
-                       sdwCyclesRemaining -= 15;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (bTemp & Z80_FLAG_CARRY);
-                               bTemp = (bTemp >> 1) | (bTemp << 7);
-                               cpu.z80F |= bPostORFlags[bTemp];
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0x0f:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80A & Z80_FLAG_CARRY);
-                               cpu.z80A = (cpu.z80A >> 1) | (cpu.z80A << 7);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-                       break;
-               }
-               case 0x10:
-               {
-                       sdwCyclesRemaining -= 8;
-                               bTemp2 = cpu.z80F & Z80_FLAG_CARRY;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80B >> 7);
-                               cpu.z80B = (cpu.z80B << 1) | bTemp2;
-                               cpu.z80F |= bPostORFlags[cpu.z80B];
-                       break;
-               }
-               case 0x11:
-               {
-                       sdwCyclesRemaining -= 8;
-                               bTemp2 = cpu.z80F & Z80_FLAG_CARRY;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80C >> 7);
-                               cpu.z80C = (cpu.z80C << 1) | bTemp2;
-                               cpu.z80F |= bPostORFlags[cpu.z80C];
-                       break;
-               }
-               case 0x12:
-               {
-                       sdwCyclesRemaining -= 8;
-                               bTemp2 = cpu.z80F & Z80_FLAG_CARRY;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80D >> 7);
-                               cpu.z80D = (cpu.z80D << 1) | bTemp2;
-                               cpu.z80F |= bPostORFlags[cpu.z80D];
-                       break;
-               }
-               case 0x13:
-               {
-                       sdwCyclesRemaining -= 8;
-                               bTemp2 = cpu.z80F & Z80_FLAG_CARRY;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80E >> 7);
-                               cpu.z80E = (cpu.z80E << 1) | bTemp2;
-                               cpu.z80F |= bPostORFlags[cpu.z80E];
-                       break;
-               }
-               case 0x14:
-               {
-                       sdwCyclesRemaining -= 8;
-                               bTemp2 = cpu.z80F & Z80_FLAG_CARRY;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80H >> 7);
-                               cpu.z80H = (cpu.z80H << 1) | bTemp2;
-                               cpu.z80F |= bPostORFlags[cpu.z80H];
-                       break;
-               }
-               case 0x15:
-               {
-                       sdwCyclesRemaining -= 8;
-                               bTemp2 = cpu.z80F & Z80_FLAG_CARRY;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80L >> 7);
-                               cpu.z80L = (cpu.z80L << 1) | bTemp2;
-                               cpu.z80F |= bPostORFlags[cpu.z80L];
-                       break;
-               }
-               case 0x16:
-               {
-                       sdwCyclesRemaining -= 15;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               bTemp2 = cpu.z80F & Z80_FLAG_CARRY;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (bTemp >> 7);
-                               bTemp = (bTemp << 1) | bTemp2;
-                               cpu.z80F |= bPostORFlags[bTemp];
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0x17:
-               {
-                       sdwCyclesRemaining -= 8;
-                               bTemp2 = cpu.z80F & Z80_FLAG_CARRY;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80A >> 7);
-                               cpu.z80A = (cpu.z80A << 1) | bTemp2;
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-                       break;
-               }
-               case 0x18:
-               {
-                       sdwCyclesRemaining -= 8;
-                               bTemp2 = (cpu.z80F & Z80_FLAG_CARRY) << 7;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80B & Z80_FLAG_CARRY);
-                               cpu.z80B = (cpu.z80B >> 1) | bTemp2;
-                               cpu.z80F |= bPostORFlags[cpu.z80B];
-                       break;
-               }
-               case 0x19:
-               {
-                       sdwCyclesRemaining -= 8;
-                               bTemp2 = (cpu.z80F & Z80_FLAG_CARRY) << 7;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80C & Z80_FLAG_CARRY);
-                               cpu.z80C = (cpu.z80C >> 1) | bTemp2;
-                               cpu.z80F |= bPostORFlags[cpu.z80C];
-                       break;
-               }
-               case 0x1a:
-               {
-                       sdwCyclesRemaining -= 8;
-                               bTemp2 = (cpu.z80F & Z80_FLAG_CARRY) << 7;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80D & Z80_FLAG_CARRY);
-                               cpu.z80D = (cpu.z80D >> 1) | bTemp2;
-                               cpu.z80F |= bPostORFlags[cpu.z80D];
-                       break;
-               }
-               case 0x1b:
-               {
-                       sdwCyclesRemaining -= 8;
-                               bTemp2 = (cpu.z80F & Z80_FLAG_CARRY) << 7;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80E & Z80_FLAG_CARRY);
-                               cpu.z80E = (cpu.z80E >> 1) | bTemp2;
-                               cpu.z80F |= bPostORFlags[cpu.z80E];
-                       break;
-               }
-               case 0x1c:
-               {
-                       sdwCyclesRemaining -= 8;
-                               bTemp2 = (cpu.z80F & Z80_FLAG_CARRY) << 7;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80H & Z80_FLAG_CARRY);
-                               cpu.z80H = (cpu.z80H >> 1) | bTemp2;
-                               cpu.z80F |= bPostORFlags[cpu.z80H];
-                       break;
-               }
-               case 0x1d:
-               {
-                       sdwCyclesRemaining -= 8;
-                               bTemp2 = (cpu.z80F & Z80_FLAG_CARRY) << 7;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80L & Z80_FLAG_CARRY);
-                               cpu.z80L = (cpu.z80L >> 1) | bTemp2;
-                               cpu.z80F |= bPostORFlags[cpu.z80L];
-                       break;
-               }
-               case 0x1e:
-               {
-                       sdwCyclesRemaining -= 15;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               bTemp2 = (cpu.z80F & Z80_FLAG_CARRY) << 7;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (bTemp & Z80_FLAG_CARRY);
-                               bTemp = (bTemp >> 1) | bTemp2;
-                               cpu.z80F |= bPostORFlags[bTemp];
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0x1f:
-               {
-                       sdwCyclesRemaining -= 8;
-                               bTemp2 = (cpu.z80F & Z80_FLAG_CARRY) << 7;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80A & Z80_FLAG_CARRY);
-                               cpu.z80A = (cpu.z80A >> 1) | bTemp2;
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-                       break;
-               }
-               case 0x20:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80B >> 7);
-                               cpu.z80B = (cpu.z80B << 1);
-                               cpu.z80F |= bPostORFlags[cpu.z80B];
-                       break;
-               }
-               case 0x21:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80C >> 7);
-                               cpu.z80C = (cpu.z80C << 1);
-                               cpu.z80F |= bPostORFlags[cpu.z80C];
-                       break;
-               }
-               case 0x22:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80D >> 7);
-                               cpu.z80D = (cpu.z80D << 1);
-                               cpu.z80F |= bPostORFlags[cpu.z80D];
-                       break;
-               }
-               case 0x23:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80E >> 7);
-                               cpu.z80E = (cpu.z80E << 1);
-                               cpu.z80F |= bPostORFlags[cpu.z80E];
-                       break;
-               }
-               case 0x24:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80H >> 7);
-                               cpu.z80H = (cpu.z80H << 1);
-                               cpu.z80F |= bPostORFlags[cpu.z80H];
-                       break;
-               }
-               case 0x25:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80L >> 7);
-                               cpu.z80L = (cpu.z80L << 1);
-                               cpu.z80F |= bPostORFlags[cpu.z80L];
-                       break;
-               }
-               case 0x26:
-               {
-                       sdwCyclesRemaining -= 15;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (bTemp >> 7);
-                               bTemp = (bTemp << 1);
-                               cpu.z80F |= bPostORFlags[bTemp];
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0x27:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80A >> 7);
-                               cpu.z80A = (cpu.z80A << 1);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-                       break;
-               }
-               case 0x28:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80B & Z80_FLAG_CARRY);
-                               cpu.z80B = (cpu.z80B >> 1) | (cpu.z80B & 0x80);
-                               cpu.z80F |= bPostORFlags[cpu.z80B];
-                       break;
-               }
-               case 0x29:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80C & Z80_FLAG_CARRY);
-                               cpu.z80C = (cpu.z80C >> 1) | (cpu.z80C & 0x80);
-                               cpu.z80F |= bPostORFlags[cpu.z80C];
-                       break;
-               }
-               case 0x2a:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80D & Z80_FLAG_CARRY);
-                               cpu.z80D = (cpu.z80D >> 1) | (cpu.z80D & 0x80);
-                               cpu.z80F |= bPostORFlags[cpu.z80D];
-                       break;
-               }
-               case 0x2b:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80E & Z80_FLAG_CARRY);
-                               cpu.z80E = (cpu.z80E >> 1) | (cpu.z80E & 0x80);
-                               cpu.z80F |= bPostORFlags[cpu.z80E];
-                       break;
-               }
-               case 0x2c:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80H & Z80_FLAG_CARRY);
-                               cpu.z80H = (cpu.z80H >> 1) | (cpu.z80H & 0x80);
-                               cpu.z80F |= bPostORFlags[cpu.z80H];
-                       break;
-               }
-               case 0x2d:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80L & Z80_FLAG_CARRY);
-                               cpu.z80L = (cpu.z80L >> 1) | (cpu.z80L & 0x80);
-                               cpu.z80F |= bPostORFlags[cpu.z80L];
-                       break;
-               }
-               case 0x2e:
-               {
-                       sdwCyclesRemaining -= 15;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (bTemp & Z80_FLAG_CARRY);
-                               bTemp = (bTemp >> 1) | (bTemp & 0x80);
-                               cpu.z80F |= bPostORFlags[bTemp];
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0x2f:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80A & Z80_FLAG_CARRY);
-                               cpu.z80A = (cpu.z80A >> 1) | (cpu.z80A & 0x80);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-                       break;
-               }
-               case 0x30:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80B >> 7);
-                               cpu.z80B = (cpu.z80B << 1);
-                               cpu.z80F |= bPostORFlags[cpu.z80B];
-                       break;
-               }
-               case 0x31:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80C >> 7);
-                               cpu.z80C = (cpu.z80C << 1);
-                               cpu.z80F |= bPostORFlags[cpu.z80C];
-                       break;
-               }
-               case 0x32:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80D >> 7);
-                               cpu.z80D = (cpu.z80D << 1);
-                               cpu.z80F |= bPostORFlags[cpu.z80D];
-                       break;
-               }
-               case 0x33:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80E >> 7);
-                               cpu.z80E = (cpu.z80E << 1);
-                               cpu.z80F |= bPostORFlags[cpu.z80E];
-                       break;
-               }
-               case 0x34:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80H >> 7);
-                               cpu.z80H = (cpu.z80H << 1);
-                               cpu.z80F |= bPostORFlags[cpu.z80H];
-                       break;
-               }
-               case 0x35:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80L >> 7);
-                               cpu.z80L = (cpu.z80L << 1);
-                               cpu.z80F |= bPostORFlags[cpu.z80L];
-                       break;
-               }
-               case 0x36:
-               {
-                       sdwCyclesRemaining -= 15;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (bTemp >> 7);
-                               bTemp = (bTemp << 1);
-                               cpu.z80F |= bPostORFlags[bTemp];
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0x37:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80A >> 7);
-                               cpu.z80A = (cpu.z80A << 1);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-                       break;
-               }
-               case 0x38:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80B & Z80_FLAG_CARRY);
-                               cpu.z80B = (cpu.z80B >> 1);
-                               cpu.z80F |= bPostORFlags[cpu.z80B];
-                       break;
-               }
-               case 0x39:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80C & Z80_FLAG_CARRY);
-                               cpu.z80C = (cpu.z80C >> 1);
-                               cpu.z80F |= bPostORFlags[cpu.z80C];
-                       break;
-               }
-               case 0x3a:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80D & Z80_FLAG_CARRY);
-                               cpu.z80D = (cpu.z80D >> 1);
-                               cpu.z80F |= bPostORFlags[cpu.z80D];
-                       break;
-               }
-               case 0x3b:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80E & Z80_FLAG_CARRY);
-                               cpu.z80E = (cpu.z80E >> 1);
-                               cpu.z80F |= bPostORFlags[cpu.z80E];
-                       break;
-               }
-               case 0x3c:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80H & Z80_FLAG_CARRY);
-                               cpu.z80H = (cpu.z80H >> 1);
-                               cpu.z80F |= bPostORFlags[cpu.z80H];
-                       break;
-               }
-               case 0x3d:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80L & Z80_FLAG_CARRY);
-                               cpu.z80L = (cpu.z80L >> 1);
-                               cpu.z80F |= bPostORFlags[cpu.z80L];
-                       break;
-               }
-               case 0x3e:
-               {
-                       sdwCyclesRemaining -= 15;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (bTemp & Z80_FLAG_CARRY);
-                               bTemp = (bTemp >> 1);
-                               cpu.z80F |= bPostORFlags[bTemp];
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0x3f:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (cpu.z80A & Z80_FLAG_CARRY);
-                               cpu.z80A = (cpu.z80A >> 1);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-                       break;
-               }
-               case 0x40:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80B & 0x01))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x41:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80C & 0x01))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x42:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80D & 0x01))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x43:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80E & 0x01))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x44:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80H & 0x01))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x45:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80L & 0x01))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x46:
-               {
-                       sdwCyclesRemaining -= 12;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(bTemp & 0x01))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x47:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80A & 0x01))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x48:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80B & 0x02))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x49:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80C & 0x02))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x4a:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80D & 0x02))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x4b:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80E & 0x02))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x4c:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80H & 0x02))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x4d:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80L & 0x02))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x4e:
-               {
-                       sdwCyclesRemaining -= 12;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(bTemp & 0x02))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x4f:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80A & 0x02))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x50:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80B & 0x04))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x51:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80C & 0x04))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x52:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80D & 0x04))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x53:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80E & 0x04))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x54:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80H & 0x04))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x55:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80L & 0x04))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x56:
-               {
-                       sdwCyclesRemaining -= 12;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(bTemp & 0x04))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x57:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80A & 0x04))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x58:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80B & 0x08))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x59:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80C & 0x08))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x5a:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80D & 0x08))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x5b:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80E & 0x08))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x5c:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80H & 0x08))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x5d:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80L & 0x08))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x5e:
-               {
-                       sdwCyclesRemaining -= 12;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(bTemp & 0x08))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x5f:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80A & 0x08))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x60:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80B & 0x10))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x61:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80C & 0x10))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x62:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80D & 0x10))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x63:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80E & 0x10))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x64:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80H & 0x10))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x65:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80L & 0x10))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x66:
-               {
-                       sdwCyclesRemaining -= 12;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(bTemp & 0x10))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x67:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80A & 0x10))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x68:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80B & 0x20))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x69:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80C & 0x20))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x6a:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80D & 0x20))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x6b:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80E & 0x20))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x6c:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80H & 0x20))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x6d:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80L & 0x20))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x6e:
-               {
-                       sdwCyclesRemaining -= 12;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(bTemp & 0x20))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x6f:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80A & 0x20))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x70:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80B & 0x40))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x71:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80C & 0x40))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x72:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80D & 0x40))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x73:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80E & 0x40))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x74:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80H & 0x40))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x75:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80L & 0x40))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x76:
-               {
-                       sdwCyclesRemaining -= 12;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(bTemp & 0x40))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x77:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80A & 0x40))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x78:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80B & 0x80))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x79:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80C & 0x80))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x7a:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80D & 0x80))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x7b:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80E & 0x80))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x7c:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80H & 0x80))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x7d:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80L & 0x80))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x7e:
-               {
-                       sdwCyclesRemaining -= 12;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(bTemp & 0x80))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x7f:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);
-                               cpu.z80F |= (Z80_FLAG_HALF_CARRY);
-                               if (!(cpu.z80A & 0x80))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x80:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80B &= 0xfe;
-                       break;
-               }
-               case 0x81:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80C &= 0xfe;
-                       break;
-               }
-               case 0x82:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80D &= 0xfe;
-                       break;
-               }
-               case 0x83:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80E &= 0xfe;
-                       break;
-               }
-               case 0x84:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80H &= 0xfe;
-                       break;
-               }
-               case 0x85:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80L &= 0xfe;
-                       break;
-               }
-               case 0x86:
-               {
-                       sdwCyclesRemaining -= 15;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               bTemp &= 0xfe;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0x87:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80A &= 0xfe;
-                       break;
-               }
-               case 0x88:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80B &= 0xfd;
-                       break;
-               }
-               case 0x89:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80C &= 0xfd;
-                       break;
-               }
-               case 0x8a:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80D &= 0xfd;
-                       break;
-               }
-               case 0x8b:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80E &= 0xfd;
-                       break;
-               }
-               case 0x8c:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80H &= 0xfd;
-                       break;
-               }
-               case 0x8d:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80L &= 0xfd;
-                       break;
-               }
-               case 0x8e:
-               {
-                       sdwCyclesRemaining -= 15;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               bTemp &= 0xfd;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0x8f:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80A &= 0xfd;
-                       break;
-               }
-               case 0x90:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80B &= 0xfb;
-                       break;
-               }
-               case 0x91:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80C &= 0xfb;
-                       break;
-               }
-               case 0x92:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80D &= 0xfb;
-                       break;
-               }
-               case 0x93:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80E &= 0xfb;
-                       break;
-               }
-               case 0x94:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80H &= 0xfb;
-                       break;
-               }
-               case 0x95:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80L &= 0xfb;
-                       break;
-               }
-               case 0x96:
-               {
-                       sdwCyclesRemaining -= 15;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               bTemp &= 0xfb;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0x97:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80A &= 0xfb;
-                       break;
-               }
-               case 0x98:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80B &= 0xf7;
-                       break;
-               }
-               case 0x99:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80C &= 0xf7;
-                       break;
-               }
-               case 0x9a:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80D &= 0xf7;
-                       break;
-               }
-               case 0x9b:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80E &= 0xf7;
-                       break;
-               }
-               case 0x9c:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80H &= 0xf7;
-                       break;
-               }
-               case 0x9d:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80L &= 0xf7;
-                       break;
-               }
-               case 0x9e:
-               {
-                       sdwCyclesRemaining -= 15;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               bTemp &= 0xf7;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0x9f:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80A &= 0xf7;
-                       break;
-               }
-               case 0xa0:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80B &= 0xef;
-                       break;
-               }
-               case 0xa1:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80C &= 0xef;
-                       break;
-               }
-               case 0xa2:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80D &= 0xef;
-                       break;
-               }
-               case 0xa3:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80E &= 0xef;
-                       break;
-               }
-               case 0xa4:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80H &= 0xef;
-                       break;
-               }
-               case 0xa5:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80L &= 0xef;
-                       break;
-               }
-               case 0xa6:
-               {
-                       sdwCyclesRemaining -= 15;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               bTemp &= 0xef;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0xa7:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80A &= 0xef;
-                       break;
-               }
-               case 0xa8:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80B &= 0xdf;
-                       break;
-               }
-               case 0xa9:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80C &= 0xdf;
-                       break;
-               }
-               case 0xaa:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80D &= 0xdf;
-                       break;
-               }
-               case 0xab:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80E &= 0xdf;
-                       break;
-               }
-               case 0xac:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80H &= 0xdf;
-                       break;
-               }
-               case 0xad:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80L &= 0xdf;
-                       break;
-               }
-               case 0xae:
-               {
-                       sdwCyclesRemaining -= 15;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               bTemp &= 0xdf;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0xaf:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80A &= 0xdf;
-                       break;
-               }
-               case 0xb0:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80B &= 0xbf;
-                       break;
-               }
-               case 0xb1:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80C &= 0xbf;
-                       break;
-               }
-               case 0xb2:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80D &= 0xbf;
-                       break;
-               }
-               case 0xb3:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80E &= 0xbf;
-                       break;
-               }
-               case 0xb4:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80H &= 0xbf;
-                       break;
-               }
-               case 0xb5:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80L &= 0xbf;
-                       break;
-               }
-               case 0xb6:
-               {
-                       sdwCyclesRemaining -= 15;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               bTemp &= 0xbf;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0xb7:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80A &= 0xbf;
-                       break;
-               }
-               case 0xb8:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80B &= 0x7f;
-                       break;
-               }
-               case 0xb9:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80C &= 0x7f;
-                       break;
-               }
-               case 0xba:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80D &= 0x7f;
-                       break;
-               }
-               case 0xbb:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80E &= 0x7f;
-                       break;
-               }
-               case 0xbc:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80H &= 0x7f;
-                       break;
-               }
-               case 0xbd:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80L &= 0x7f;
-                       break;
-               }
-               case 0xbe:
-               {
-                       sdwCyclesRemaining -= 15;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               bTemp &= 0x7f;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0xbf:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80A &= 0x7f;
-                       break;
-               }
-               case 0xc0:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80B |= 0x01;
-                       break;
-               }
-               case 0xc1:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80C |= 0x01;
-                       break;
-               }
-               case 0xc2:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80D |= 0x01;
-                       break;
-               }
-               case 0xc3:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80E |= 0x01;
-                       break;
-               }
-               case 0xc4:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80H |= 0x01;
-                       break;
-               }
-               case 0xc5:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80L |= 0x01;
-                       break;
-               }
-               case 0xc6:
-               {
-                       sdwCyclesRemaining -= 15;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               bTemp |= 0x01;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0xc7:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80A |= 0x01;
-                       break;
-               }
-               case 0xc8:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80B |= 0x02;
-                       break;
-               }
-               case 0xc9:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80C |= 0x02;
-                       break;
-               }
-               case 0xca:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80D |= 0x02;
-                       break;
-               }
-               case 0xcb:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80E |= 0x02;
-                       break;
-               }
-               case 0xcc:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80H |= 0x02;
-                       break;
-               }
-               case 0xcd:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80L |= 0x02;
-                       break;
-               }
-               case 0xce:
-               {
-                       sdwCyclesRemaining -= 15;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               bTemp |= 0x02;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0xcf:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80A |= 0x02;
-                       break;
-               }
-               case 0xd0:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80B |= 0x04;
-                       break;
-               }
-               case 0xd1:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80C |= 0x04;
-                       break;
-               }
-               case 0xd2:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80D |= 0x04;
-                       break;
-               }
-               case 0xd3:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80E |= 0x04;
-                       break;
-               }
-               case 0xd4:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80H |= 0x04;
-                       break;
-               }
-               case 0xd5:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80L |= 0x04;
-                       break;
-               }
-               case 0xd6:
-               {
-                       sdwCyclesRemaining -= 15;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               bTemp |= 0x04;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0xd7:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80A |= 0x04;
-                       break;
-               }
-               case 0xd8:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80B |= 0x08;
-                       break;
-               }
-               case 0xd9:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80C |= 0x08;
-                       break;
-               }
-               case 0xda:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80D |= 0x08;
-                       break;
-               }
-               case 0xdb:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80E |= 0x08;
-                       break;
-               }
-               case 0xdc:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80H |= 0x08;
-                       break;
-               }
-               case 0xdd:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80L |= 0x08;
-                       break;
-               }
-               case 0xde:
-               {
-                       sdwCyclesRemaining -= 15;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               bTemp |= 0x08;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0xdf:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80A |= 0x08;
-                       break;
-               }
-               case 0xe0:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80B |= 0x10;
-                       break;
-               }
-               case 0xe1:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80C |= 0x10;
-                       break;
-               }
-               case 0xe2:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80D |= 0x10;
-                       break;
-               }
-               case 0xe3:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80E |= 0x10;
-                       break;
-               }
-               case 0xe4:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80H |= 0x10;
-                       break;
-               }
-               case 0xe5:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80L |= 0x10;
-                       break;
-               }
-               case 0xe6:
-               {
-                       sdwCyclesRemaining -= 15;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               bTemp |= 0x10;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0xe7:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80A |= 0x10;
-                       break;
-               }
-               case 0xe8:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80B |= 0x20;
-                       break;
-               }
-               case 0xe9:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80C |= 0x20;
-                       break;
-               }
-               case 0xea:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80D |= 0x20;
-                       break;
-               }
-               case 0xeb:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80E |= 0x20;
-                       break;
-               }
-               case 0xec:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80H |= 0x20;
-                       break;
-               }
-               case 0xed:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80L |= 0x20;
-                       break;
-               }
-               case 0xee:
-               {
-                       sdwCyclesRemaining -= 15;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               bTemp |= 0x20;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0xef:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80A |= 0x20;
-                       break;
-               }
-               case 0xf0:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80B |= 0x40;
-                       break;
-               }
-               case 0xf1:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80C |= 0x40;
-                       break;
-               }
-               case 0xf2:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80D |= 0x40;
-                       break;
-               }
-               case 0xf3:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80E |= 0x40;
-                       break;
-               }
-               case 0xf4:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80H |= 0x40;
-                       break;
-               }
-               case 0xf5:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80L |= 0x40;
-                       break;
-               }
-               case 0xf6:
-               {
-                       sdwCyclesRemaining -= 15;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               bTemp |= 0x40;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0xf7:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80A |= 0x40;
-                       break;
-               }
-               case 0xf8:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80B |= 0x80;
-                       break;
-               }
-               case 0xf9:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80C |= 0x80;
-                       break;
-               }
-               case 0xfa:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80D |= 0x80;
-                       break;
-               }
-               case 0xfb:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80E |= 0x80;
-                       break;
-               }
-               case 0xfc:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80H |= 0x80;
-                       break;
-               }
-               case 0xfd:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80L |= 0x80;
-                       break;
-               }
-               case 0xfe:
-               {
-                       sdwCyclesRemaining -= 15;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               bTemp |= 0x80;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0xff:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80A |= 0x80;
-                       break;
-               }
-       }
-}
-void EDHandler(void)
-{
-       switch (*pbPC++)
-       {
-               case 0x00:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x01:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x02:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x03:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x04:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x05:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x06:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x07:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x08:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x09:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x0a:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x0b:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x0c:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x0d:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x0e:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x0f:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x10:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x11:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x12:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x13:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x14:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x15:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x16:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x17:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x18:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x19:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x1a:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x1b:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x1c:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x1d:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x1e:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x1f:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x20:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x21:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x22:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x23:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x24:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x25:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x26:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x27:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x28:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x29:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x2a:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x2b:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x2c:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x2d:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x2e:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x2f:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x30:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x31:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x32:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x33:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x34:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x35:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x36:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x37:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x38:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x39:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x3a:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x3b:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x3c:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x3d:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x3e:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x3f:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x40:
-               {
-                       sdwCyclesRemaining -= 12;
-                               dwAddr = cpu.z80C;
-                               psIoRead = cpu.z80IoRead;       /* Beginning of our handler */
-                               while (psIoRead->lowIoAddr != 0xffff)
-                               {
-                                       if ((dwAddr >= psIoRead->lowIoAddr) && (dwAddr <= psIoRead->highIoAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               cpu.z80B = psIoRead->IOCall(dwAddr, psIoRead);
-                                               psIoRead = NULL;
-                                               break;
-                                       }
-                                       ++psIoRead;
-                               }
-
-                               if (psIoRead)
-                               {
-                                       cpu.z80B = 0xff; /* Unclaimed I/O read */
-                               }
-
-                               cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= bPostORFlags[cpu.z80B];
-                       break;
-               }
-               case 0x41:
-               {
-                       sdwCyclesRemaining -= 12;
-                               dwAddr = cpu.z80C;
-                               psIoWrite = cpu.z80IoWrite;     /* Beginning of our handler */
-                               while (psIoWrite->lowIoAddr != 0xffff)
-                               {
-                                       if ((dwAddr >= psIoWrite->lowIoAddr) && (dwAddr <= psIoWrite->highIoAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               psIoWrite->IOCall(dwAddr, cpu.z80B, psIoWrite);
-                                               psIoWrite = NULL;
-                                               break;
-                                       }
-                                       ++psIoWrite;
-                               }
-
-                       break;
-               }
-               case 0x42:
-               {
-                       sdwCyclesRemaining -= 15;
-                               dwTemp = cpu.z80HL - cpu.z80BC - (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= ((dwTemp >> 8) & Z80_FLAG_SIGN);
-                               if (0 == (dwTemp & 0xffff))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                               cpu.z80F |= (((cpu.z80HL ^ dwTemp ^ cpu.z80BC) >> 8) & Z80_FLAG_HALF_CARRY);
-                               cpu.z80F |= ((((cpu.z80BC ^ cpu.z80HL) & (cpu.z80BC ^ dwTemp)) >> 13) & Z80_FLAG_OVERFLOW_PARITY);
-                               cpu.z80F |= ((dwTemp >> 16) & Z80_FLAG_CARRY);
-                               cpu.z80HL = dwTemp & 0xffff;
-                       break;
-               }
-               case 0x43:
-               {
-                       sdwCyclesRemaining -= 20;
-               dwTemp = *pbPC++;
-               dwTemp |= ((UINT32) *pbPC++ << 8);
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwTemp >= psMemWrite->lowAddr) && (dwTemp <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(dwTemp, (cpu.z80BC & 0xff), psMemWrite);
-                                                       psMemWrite->memoryCall(dwTemp + 1, (cpu.z80BC >> 8), psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwTemp - psMemWrite->lowAddr)) = cpu.z80BC;
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwTemp - psMemWrite->lowAddr) + 1) = cpu.z80BC >> 8;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[dwTemp] = (UINT8) cpu.z80BC;
-                                       cpu.z80Base[dwTemp + 1] = (UINT8) ((UINT32) cpu.z80BC >> 8);
-                               }
-
-                       break;
-               }
-               case 0x44:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) 0 << 8) | cpu.z80A];
-                               cpu.z80A = 0 - cpu.z80A;
-                       break;
-               }
-               case 0x45:
-               {
-                       sdwCyclesRemaining -= 14;
-                               pbSP = cpu.z80Base + cpu.z80sp; /* Normalize our stack PTR */
-                               dwAddr = *pbSP++;       /* Pop LSB */
-                               dwAddr |= ((UINT32) *pbSP << 8);        /* Pop MSB */
-                               cpu.z80sp += 2; /* Pop the word off */
-                               pbPC = (cpu.z80Base + dwAddr);  /* Point PC to our return address */
-                               cpu.z80iff &= ~(IFF1);  /* Keep IFF2 around */
-                               cpu.z80iff |= ((cpu.z80iff >> 1) & IFF1);       /* IFF2->IFF1 */
-                       break;
-               }
-               case 0x46:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80interruptMode = 0;
-                       break;
-               }
-               case 0x47:
-               {
-                       sdwCyclesRemaining -= 9;
-                               cpu.z80i = cpu.z80A;
-                       break;
-               }
-               case 0x48:
-               {
-                       sdwCyclesRemaining -= 12;
-                               dwAddr = cpu.z80C;
-                               psIoRead = cpu.z80IoRead;       /* Beginning of our handler */
-                               while (psIoRead->lowIoAddr != 0xffff)
-                               {
-                                       if ((dwAddr >= psIoRead->lowIoAddr) && (dwAddr <= psIoRead->highIoAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               cpu.z80C = psIoRead->IOCall(dwAddr, psIoRead);
-                                               psIoRead = NULL;
-                                               break;
-                                       }
-                                       ++psIoRead;
-                               }
-
-                               if (psIoRead)
-                               {
-                                       cpu.z80C = 0xff; /* Unclaimed I/O read */
-                               }
-
-                               cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= bPostORFlags[cpu.z80C];
-                       break;
-               }
-               case 0x49:
-               {
-                       sdwCyclesRemaining -= 12;
-                               dwAddr = cpu.z80C;
-                               psIoWrite = cpu.z80IoWrite;     /* Beginning of our handler */
-                               while (psIoWrite->lowIoAddr != 0xffff)
-                               {
-                                       if ((dwAddr >= psIoWrite->lowIoAddr) && (dwAddr <= psIoWrite->highIoAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               psIoWrite->IOCall(dwAddr, cpu.z80C, psIoWrite);
-                                               psIoWrite = NULL;
-                                               break;
-                                       }
-                                       ++psIoWrite;
-                               }
-
-                       break;
-               }
-               case 0x4a:
-               {
-                       sdwCyclesRemaining -= 15;
-                               dwTemp = cpu.z80HL + cpu.z80BC + (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= ((dwTemp >> 8) & Z80_FLAG_SIGN);
-                               if (0 == (dwTemp & 0xffff))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                               cpu.z80F |= (((cpu.z80HL ^ dwTemp ^ cpu.z80BC) >> 8) & Z80_FLAG_HALF_CARRY);
-                               cpu.z80F |= ((((cpu.z80BC ^ cpu.z80HL ^ 0x8000) & (cpu.z80BC ^ dwTemp)) >> 13) & Z80_FLAG_OVERFLOW_PARITY);
-                               cpu.z80F |= ((dwTemp >> 16) & Z80_FLAG_CARRY);
-                               cpu.z80HL = dwTemp & 0xffff;
-                       break;
-               }
-               case 0x4b:
-               {
-                       sdwCyclesRemaining -= 20;
-               dwTemp = *pbPC++;
-               dwTemp |= ((UINT32) *pbPC++ << 8);
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwTemp >= psMemRead->lowAddr) && (dwTemp <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       cpu.z80BC = psMemRead->memoryCall(dwTemp, psMemRead);
-                                                       cpu.z80BC |= (UINT32) ((UINT32) psMemRead->memoryCall(dwTemp + 1, psMemRead) << 8);
-                                               }
-                                               else
-                                               {
-                                                       cpu.z80BC = *((UINT8 *) psMemRead->pUserArea + (dwTemp - psMemRead->lowAddr));
-                                                       cpu.z80BC |= (UINT32) ((UINT32) *((UINT8 *) psMemRead->pUserArea + (dwTemp - psMemRead->lowAddr + 1)) << 8);
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       cpu.z80BC = cpu.z80Base[dwTemp];
-                                       cpu.z80BC |= (UINT32) ((UINT32) cpu.z80Base[dwTemp + 1] << 8);
-                               }
-
-                       break;
-               }
-               case 0x4c:
-               {
-                       sdwCyclesRemaining -= 8;
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x4d:
-               {
-                       sdwCyclesRemaining -= 14;
-                               pbSP = cpu.z80Base + cpu.z80sp; /* Normalize our stack PTR */
-                               dwAddr = *pbSP++;       /* Pop LSB */
-                               dwAddr |= ((UINT32) *pbSP << 8);        /* Pop MSB */
-                               cpu.z80sp += 2; /* Pop the word off */
-                               pbPC = (cpu.z80Base + dwAddr);  /* Point PC to our return address */
-                       break;
-               }
-               case 0x4e:
-               {
-                       sdwCyclesRemaining -= 8;
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x4f:
-               {
-                       sdwCyclesRemaining -= 9;
-                               cpu.z80r = cpu.z80A;
-                       break;
-               }
-               case 0x50:
-               {
-                       sdwCyclesRemaining -= 12;
-                               dwAddr = cpu.z80C;
-                               psIoRead = cpu.z80IoRead;       /* Beginning of our handler */
-                               while (psIoRead->lowIoAddr != 0xffff)
-                               {
-                                       if ((dwAddr >= psIoRead->lowIoAddr) && (dwAddr <= psIoRead->highIoAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               cpu.z80D = psIoRead->IOCall(dwAddr, psIoRead);
-                                               psIoRead = NULL;
-                                               break;
-                                       }
-                                       ++psIoRead;
-                               }
-
-                               if (psIoRead)
-                               {
-                                       cpu.z80D = 0xff; /* Unclaimed I/O read */
-                               }
-
-                               cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= bPostORFlags[cpu.z80D];
-                       break;
-               }
-               case 0x51:
-               {
-                       sdwCyclesRemaining -= 12;
-                               dwAddr = cpu.z80C;
-                               psIoWrite = cpu.z80IoWrite;     /* Beginning of our handler */
-                               while (psIoWrite->lowIoAddr != 0xffff)
-                               {
-                                       if ((dwAddr >= psIoWrite->lowIoAddr) && (dwAddr <= psIoWrite->highIoAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               psIoWrite->IOCall(dwAddr, cpu.z80D, psIoWrite);
-                                               psIoWrite = NULL;
-                                               break;
-                                       }
-                                       ++psIoWrite;
-                               }
-
-                       break;
-               }
-               case 0x52:
-               {
-                       sdwCyclesRemaining -= 15;
-                               dwTemp = cpu.z80HL - cpu.z80DE - (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= ((dwTemp >> 8) & Z80_FLAG_SIGN);
-                               if (0 == (dwTemp & 0xffff))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                               cpu.z80F |= (((cpu.z80HL ^ dwTemp ^ cpu.z80DE) >> 8) & Z80_FLAG_HALF_CARRY);
-                               cpu.z80F |= ((((cpu.z80DE ^ cpu.z80HL) & (cpu.z80DE ^ dwTemp)) >> 13) & Z80_FLAG_OVERFLOW_PARITY);
-                               cpu.z80F |= ((dwTemp >> 16) & Z80_FLAG_CARRY);
-                               cpu.z80HL = dwTemp & 0xffff;
-                       break;
-               }
-               case 0x53:
-               {
-                       sdwCyclesRemaining -= 20;
-               dwTemp = *pbPC++;
-               dwTemp |= ((UINT32) *pbPC++ << 8);
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwTemp >= psMemWrite->lowAddr) && (dwTemp <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(dwTemp, (cpu.z80DE & 0xff), psMemWrite);
-                                                       psMemWrite->memoryCall(dwTemp + 1, (cpu.z80DE >> 8), psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwTemp - psMemWrite->lowAddr)) = cpu.z80DE;
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwTemp - psMemWrite->lowAddr) + 1) = cpu.z80DE >> 8;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[dwTemp] = (UINT8) cpu.z80DE;
-                                       cpu.z80Base[dwTemp + 1] = (UINT8) ((UINT32) cpu.z80DE >> 8);
-                               }
-
-                       break;
-               }
-               case 0x54:
-               {
-                       sdwCyclesRemaining -= 8;
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x55:
-               {
-                       sdwCyclesRemaining -= 8;
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x56:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80interruptMode = 1;
-                               cpu.z80intAddr = 0x38;
-                       break;
-               }
-               case 0x57:
-               {
-                       sdwCyclesRemaining -= 9;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= ((cpu.z80iff & IFF2) << 1);
-                               cpu.z80A = cpu.z80i;
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-                       break;
-               }
-               case 0x58:
-               {
-                       sdwCyclesRemaining -= 12;
-                               dwAddr = cpu.z80C;
-                               psIoRead = cpu.z80IoRead;       /* Beginning of our handler */
-                               while (psIoRead->lowIoAddr != 0xffff)
-                               {
-                                       if ((dwAddr >= psIoRead->lowIoAddr) && (dwAddr <= psIoRead->highIoAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               cpu.z80E = psIoRead->IOCall(dwAddr, psIoRead);
-                                               psIoRead = NULL;
-                                               break;
-                                       }
-                                       ++psIoRead;
-                               }
-
-                               if (psIoRead)
-                               {
-                                       cpu.z80E = 0xff; /* Unclaimed I/O read */
-                               }
-
-                               cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= bPostORFlags[cpu.z80E];
-                       break;
-               }
-               case 0x59:
-               {
-                       sdwCyclesRemaining -= 12;
-                               dwAddr = cpu.z80C;
-                               psIoWrite = cpu.z80IoWrite;     /* Beginning of our handler */
-                               while (psIoWrite->lowIoAddr != 0xffff)
-                               {
-                                       if ((dwAddr >= psIoWrite->lowIoAddr) && (dwAddr <= psIoWrite->highIoAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               psIoWrite->IOCall(dwAddr, cpu.z80E, psIoWrite);
-                                               psIoWrite = NULL;
-                                               break;
-                                       }
-                                       ++psIoWrite;
-                               }
-
-                       break;
-               }
-               case 0x5a:
-               {
-                       sdwCyclesRemaining -= 15;
-                               dwTemp = cpu.z80HL + cpu.z80DE + (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= ((dwTemp >> 8) & Z80_FLAG_SIGN);
-                               if (0 == (dwTemp & 0xffff))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                               cpu.z80F |= (((cpu.z80HL ^ dwTemp ^ cpu.z80DE) >> 8) & Z80_FLAG_HALF_CARRY);
-                               cpu.z80F |= ((((cpu.z80DE ^ cpu.z80HL ^ 0x8000) & (cpu.z80DE ^ dwTemp)) >> 13) & Z80_FLAG_OVERFLOW_PARITY);
-                               cpu.z80F |= ((dwTemp >> 16) & Z80_FLAG_CARRY);
-                               cpu.z80HL = dwTemp & 0xffff;
-                       break;
-               }
-               case 0x5b:
-               {
-                       sdwCyclesRemaining -= 20;
-               dwTemp = *pbPC++;
-               dwTemp |= ((UINT32) *pbPC++ << 8);
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwTemp >= psMemRead->lowAddr) && (dwTemp <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       cpu.z80DE = psMemRead->memoryCall(dwTemp, psMemRead);
-                                                       cpu.z80DE |= (UINT32) ((UINT32) psMemRead->memoryCall(dwTemp + 1, psMemRead) << 8);
-                                               }
-                                               else
-                                               {
-                                                       cpu.z80DE = *((UINT8 *) psMemRead->pUserArea + (dwTemp - psMemRead->lowAddr));
-                                                       cpu.z80DE |= (UINT32) ((UINT32) *((UINT8 *) psMemRead->pUserArea + (dwTemp - psMemRead->lowAddr + 1)) << 8);
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       cpu.z80DE = cpu.z80Base[dwTemp];
-                                       cpu.z80DE |= (UINT32) ((UINT32) cpu.z80Base[dwTemp + 1] << 8);
-                               }
-
-                       break;
-               }
-               case 0x5c:
-               {
-                       sdwCyclesRemaining -= 8;
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x5d:
-               {
-                       sdwCyclesRemaining -= 8;
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x5e:
-               {
-                       sdwCyclesRemaining -= 8;
-                               cpu.z80interruptMode = 2;
-                       break;
-               }
-               case 0x5f:
-               {
-                       sdwCyclesRemaining -= 9;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= bPostORFlags[cpu.z80r];
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_OVERFLOW_PARITY)) | ((cpu.z80iff & IFF2) << 1);
-                               cpu.z80A = cpu.z80r;
-                               bTemp = (cpu.z80r + (cpu.z80B + sdwCyclesRemaining + 1 + cpu.z80H)) ^ cpu.z80A;
-                               cpu.z80r = (cpu.z80r & 0x80) | (bTemp & 0x7f);
-                       break;
-               }
-               case 0x60:
-               {
-                       sdwCyclesRemaining -= 12;
-                               dwAddr = cpu.z80C;
-                               psIoRead = cpu.z80IoRead;       /* Beginning of our handler */
-                               while (psIoRead->lowIoAddr != 0xffff)
-                               {
-                                       if ((dwAddr >= psIoRead->lowIoAddr) && (dwAddr <= psIoRead->highIoAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               cpu.z80H = psIoRead->IOCall(dwAddr, psIoRead);
-                                               psIoRead = NULL;
-                                               break;
-                                       }
-                                       ++psIoRead;
-                               }
-
-                               if (psIoRead)
-                               {
-                                       cpu.z80H = 0xff; /* Unclaimed I/O read */
-                               }
-
-                               cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= bPostORFlags[cpu.z80H];
-                       break;
-               }
-               case 0x61:
-               {
-                       sdwCyclesRemaining -= 12;
-                               dwAddr = cpu.z80C;
-                               psIoWrite = cpu.z80IoWrite;     /* Beginning of our handler */
-                               while (psIoWrite->lowIoAddr != 0xffff)
-                               {
-                                       if ((dwAddr >= psIoWrite->lowIoAddr) && (dwAddr <= psIoWrite->highIoAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               psIoWrite->IOCall(dwAddr, cpu.z80H, psIoWrite);
-                                               psIoWrite = NULL;
-                                               break;
-                                       }
-                                       ++psIoWrite;
-                               }
-
-                       break;
-               }
-               case 0x62:
-               {
-                       sdwCyclesRemaining -= 15;
-                               dwTemp = cpu.z80HL - cpu.z80HL - (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= ((dwTemp >> 8) & Z80_FLAG_SIGN);
-                               if (0 == (dwTemp & 0xffff))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                               cpu.z80F |= (((cpu.z80HL ^ dwTemp ^ cpu.z80HL) >> 8) & Z80_FLAG_HALF_CARRY);
-                               cpu.z80F |= ((((cpu.z80HL ^ cpu.z80HL) & (cpu.z80HL ^ dwTemp)) >> 13) & Z80_FLAG_OVERFLOW_PARITY);
-                               cpu.z80F |= ((dwTemp >> 16) & Z80_FLAG_CARRY);
-                               cpu.z80HL = dwTemp & 0xffff;
-                       break;
-               }
-               case 0x63:
-               {
-                       sdwCyclesRemaining -= 20;
-               dwTemp = *pbPC++;
-               dwTemp |= ((UINT32) *pbPC++ << 8);
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwTemp >= psMemWrite->lowAddr) && (dwTemp <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(dwTemp, (cpu.z80HL & 0xff), psMemWrite);
-                                                       psMemWrite->memoryCall(dwTemp + 1, (cpu.z80HL >> 8), psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwTemp - psMemWrite->lowAddr)) = cpu.z80HL;
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwTemp - psMemWrite->lowAddr) + 1) = cpu.z80HL >> 8;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[dwTemp] = (UINT8) cpu.z80HL;
-                                       cpu.z80Base[dwTemp + 1] = (UINT8) ((UINT32) cpu.z80HL >> 8);
-                               }
-
-                       break;
-               }
-               case 0x64:
-               {
-                       sdwCyclesRemaining -= 8;
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x65:
-               {
-                       sdwCyclesRemaining -= 8;
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x66:
-               {
-                       sdwCyclesRemaining -= 8;
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x67:
-               {
-                       sdwCyclesRemaining -= 18;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               bTemp2 = (cpu.z80A & 0x0f) << 4;
-                               cpu.z80A = (cpu.z80A & 0xf0) | (bTemp & 0x0f);
-                               bTemp = (bTemp >> 4) | bTemp2;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) bTemp;
-                               }
-
-                               cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-                       break;
-               }
-               case 0x68:
-               {
-                       sdwCyclesRemaining -= 12;
-                               dwAddr = cpu.z80C;
-                               psIoRead = cpu.z80IoRead;       /* Beginning of our handler */
-                               while (psIoRead->lowIoAddr != 0xffff)
-                               {
-                                       if ((dwAddr >= psIoRead->lowIoAddr) && (dwAddr <= psIoRead->highIoAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               cpu.z80L = psIoRead->IOCall(dwAddr, psIoRead);
-                                               psIoRead = NULL;
-                                               break;
-                                       }
-                                       ++psIoRead;
-                               }
-
-                               if (psIoRead)
-                               {
-                                       cpu.z80L = 0xff; /* Unclaimed I/O read */
-                               }
-
-                               cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= bPostORFlags[cpu.z80L];
-                       break;
-               }
-               case 0x69:
-               {
-                       sdwCyclesRemaining -= 12;
-                               dwAddr = cpu.z80C;
-                               psIoWrite = cpu.z80IoWrite;     /* Beginning of our handler */
-                               while (psIoWrite->lowIoAddr != 0xffff)
-                               {
-                                       if ((dwAddr >= psIoWrite->lowIoAddr) && (dwAddr <= psIoWrite->highIoAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               psIoWrite->IOCall(dwAddr, cpu.z80L, psIoWrite);
-                                               psIoWrite = NULL;
-                                               break;
-                                       }
-                                       ++psIoWrite;
-                               }
-
-                       break;
-               }
-               case 0x6a:
-               {
-                       sdwCyclesRemaining -= 15;
-                               dwTemp = cpu.z80HL + cpu.z80HL + (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= ((dwTemp >> 8) & Z80_FLAG_SIGN);
-                               if (0 == (dwTemp & 0xffff))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                               cpu.z80F |= (((cpu.z80HL ^ dwTemp ^ cpu.z80HL) >> 8) & Z80_FLAG_HALF_CARRY);
-                               cpu.z80F |= ((((cpu.z80HL ^ cpu.z80HL ^ 0x8000) & (cpu.z80HL ^ dwTemp)) >> 13) & Z80_FLAG_OVERFLOW_PARITY);
-                               cpu.z80F |= ((dwTemp >> 16) & Z80_FLAG_CARRY);
-                               cpu.z80HL = dwTemp & 0xffff;
-                       break;
-               }
-               case 0x6b:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x6c:
-               {
-                       sdwCyclesRemaining -= 8;
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x6d:
-               {
-                       sdwCyclesRemaining -= 8;
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x6e:
-               {
-                       sdwCyclesRemaining -= 8;
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x6f:
-               {
-                       sdwCyclesRemaining -= 18;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               bTemp2 = (cpu.z80A & 0x0f);
-                               cpu.z80A = (cpu.z80A & 0xf0) | (bTemp >> 4);
-                               bTemp = (bTemp << 4) | bTemp2;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) bTemp;
-                               }
-
-                               cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-                       break;
-               }
-               case 0x70:
-               {
-                       sdwCyclesRemaining -= 12;
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x71:
-               {
-                       sdwCyclesRemaining -= 12;
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x72:
-               {
-                       sdwCyclesRemaining -= 15;
-                               dwTemp = cpu.z80HL - cpu.z80sp - (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= ((dwTemp >> 8) & Z80_FLAG_SIGN);
-                               if (0 == (dwTemp & 0xffff))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                               cpu.z80F |= (((cpu.z80HL ^ dwTemp ^ cpu.z80sp) >> 8) & Z80_FLAG_HALF_CARRY);
-                               cpu.z80F |= ((((cpu.z80sp ^ cpu.z80HL) & (cpu.z80sp ^ dwTemp)) >> 13) & Z80_FLAG_OVERFLOW_PARITY);
-                               cpu.z80F |= ((dwTemp >> 16) & Z80_FLAG_CARRY);
-                               cpu.z80HL = dwTemp & 0xffff;
-                       break;
-               }
-               case 0x73:
-               {
-                       sdwCyclesRemaining -= 20;
-               dwTemp = *pbPC++;
-               dwTemp |= ((UINT32) *pbPC++ << 8);
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwTemp >= psMemWrite->lowAddr) && (dwTemp <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(dwTemp, (cpu.z80sp & 0xff), psMemWrite);
-                                                       psMemWrite->memoryCall(dwTemp + 1, (cpu.z80sp >> 8), psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwTemp - psMemWrite->lowAddr)) = cpu.z80sp;
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwTemp - psMemWrite->lowAddr) + 1) = cpu.z80sp >> 8;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[dwTemp] = (UINT8) cpu.z80sp;
-                                       cpu.z80Base[dwTemp + 1] = (UINT8) ((UINT32) cpu.z80sp >> 8);
-                               }
-
-                       break;
-               }
-               case 0x74:
-               {
-                       sdwCyclesRemaining -= 8;
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x75:
-               {
-                       sdwCyclesRemaining -= 8;
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x76:
-               {
-                       sdwCyclesRemaining -= 8;
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x77:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x78:
-               {
-                       sdwCyclesRemaining -= 12;
-                               dwAddr = cpu.z80C;
-                               psIoRead = cpu.z80IoRead;       /* Beginning of our handler */
-                               while (psIoRead->lowIoAddr != 0xffff)
-                               {
-                                       if ((dwAddr >= psIoRead->lowIoAddr) && (dwAddr <= psIoRead->highIoAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               cpu.z80A = psIoRead->IOCall(dwAddr, psIoRead);
-                                               psIoRead = NULL;
-                                               break;
-                                       }
-                                       ++psIoRead;
-                               }
-
-                               if (psIoRead)
-                               {
-                                       cpu.z80A = 0xff; /* Unclaimed I/O read */
-                               }
-
-                               cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-                       break;
-               }
-               case 0x79:
-               {
-                       sdwCyclesRemaining -= 12;
-                               dwAddr = cpu.z80C;
-                               psIoWrite = cpu.z80IoWrite;     /* Beginning of our handler */
-                               while (psIoWrite->lowIoAddr != 0xffff)
-                               {
-                                       if ((dwAddr >= psIoWrite->lowIoAddr) && (dwAddr <= psIoWrite->highIoAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               psIoWrite->IOCall(dwAddr, cpu.z80A, psIoWrite);
-                                               psIoWrite = NULL;
-                                               break;
-                                       }
-                                       ++psIoWrite;
-                               }
-
-                       break;
-               }
-               case 0x7a:
-               {
-                       sdwCyclesRemaining -= 15;
-                               dwTemp = cpu.z80HL + cpu.z80sp + (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= ((dwTemp >> 8) & Z80_FLAG_SIGN);
-                               if (0 == (dwTemp & 0xffff))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                               cpu.z80F |= (((cpu.z80HL ^ dwTemp ^ cpu.z80sp) >> 8) & Z80_FLAG_HALF_CARRY);
-                               cpu.z80F |= ((((cpu.z80sp ^ cpu.z80HL ^ 0x8000) & (cpu.z80sp ^ dwTemp)) >> 13) & Z80_FLAG_OVERFLOW_PARITY);
-                               cpu.z80F |= ((dwTemp >> 16) & Z80_FLAG_CARRY);
-                               cpu.z80HL = dwTemp & 0xffff;
-                       break;
-               }
-               case 0x7b:
-               {
-                       sdwCyclesRemaining -= 20;
-               dwTemp = *pbPC++;
-               dwTemp |= ((UINT32) *pbPC++ << 8);
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwTemp >= psMemRead->lowAddr) && (dwTemp <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       cpu.z80sp = psMemRead->memoryCall(dwTemp, psMemRead);
-                                                       cpu.z80sp |= (UINT32) ((UINT32) psMemRead->memoryCall(dwTemp + 1, psMemRead) << 8);
-                                               }
-                                               else
-                                               {
-                                                       cpu.z80sp = *((UINT8 *) psMemRead->pUserArea + (dwTemp - psMemRead->lowAddr));
-                                                       cpu.z80sp |= (UINT32) ((UINT32) *((UINT8 *) psMemRead->pUserArea + (dwTemp - psMemRead->lowAddr + 1)) << 8);
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       cpu.z80sp = cpu.z80Base[dwTemp];
-                                       cpu.z80sp |= (UINT32) ((UINT32) cpu.z80Base[dwTemp + 1] << 8);
-                               }
-
-                       break;
-               }
-               case 0x7c:
-               {
-                       sdwCyclesRemaining -= 8;
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x7d:
-               {
-                       sdwCyclesRemaining -= 8;
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x7e:
-               {
-                       sdwCyclesRemaining -= 8;
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x7f:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x80:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x81:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x82:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x83:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x84:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x85:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x86:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x87:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x88:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x89:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x8a:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x8b:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x8c:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x8d:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x8e:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x8f:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x90:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x91:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x92:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x93:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x94:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x95:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x96:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x97:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x98:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x99:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x9a:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x9b:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x9c:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x9d:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x9e:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x9f:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xa0:
-               {
-                       sdwCyclesRemaining -= 16;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80DE >= psMemWrite->lowAddr) && (cpu.z80DE <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80DE, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80DE - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80DE] = (UINT8) bTemp;
-                               }
-
-                                       ++cpu.z80HL;
-                                       ++cpu.z80DE;
-                               --cpu.z80BC;
-                               cpu.z80HL &= 0xffff;
-                               cpu.z80DE &= 0xffff;
-                               cpu.z80BC &= 0xffff;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY);
-                               if (cpu.z80BC)
-                               {
-                                       cpu.z80F |= Z80_FLAG_OVERFLOW_PARITY;
-                               }
-                       break;
-               }
-               case 0xa1:
-               {
-                       sdwCyclesRemaining -= 16;
-                               {
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               cpu.z80HL++;
-                               cpu.z80HL &= 0xffff;
-                               cpu.z80BC--;
-                               cpu.z80BC &= 0xffff;
-                               }
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= (pbSubSbcTable[((UINT32) cpu.z80A << 8) | bTemp] & (Z80_FLAG_SIGN | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO));
-                               if (cpu.z80BC)
-                               {
-                                       cpu.z80F |= Z80_FLAG_OVERFLOW_PARITY;
-                               }
-                       break;
-               }
-               case 0xa2:
-               {
-                       sdwCyclesRemaining -= 16;
-                               {
-                               psIoRead = cpu.z80IoRead;       /* Beginning of our handler */
-                               while (psIoRead->lowIoAddr != 0xffff)
-                               {
-                                       if ((cpu.z80B >= psIoRead->lowIoAddr) && (cpu.z80B <= psIoRead->highIoAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               bTemp = psIoRead->IOCall(cpu.z80B, psIoRead);
-                                               psIoRead = NULL;
-                                               break;
-                                       }
-                                       ++psIoRead;
-                               }
-
-                               if (psIoRead)
-                               {
-                                       bTemp = 0xff; /* Unclaimed I/O read */
-                               }
-
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) bTemp;
-                               }
-
-                               cpu.z80HL++;
-                               cpu.z80HL &= 0xffff;
-                               sdwCyclesRemaining -= 16;
-                               cpu.z80B--;
-                               }
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= (bPostORFlags[bTemp] & (Z80_FLAG_SIGN | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY));
-                               if (cpu.z80B)
-                               {
-                                       cpu.z80F |= Z80_FLAG_OVERFLOW_PARITY;
-                                       pbPC -= 2;
-                               }
-                       break;
-               }
-               case 0xa3:
-               {
-                       sdwCyclesRemaining -= 16;
-                               {
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               psIoWrite = cpu.z80IoWrite;     /* Beginning of our handler */
-                               while (psIoWrite->lowIoAddr != 0xffff)
-                               {
-                                       if ((cpu.z80BC >= psIoWrite->lowIoAddr) && (cpu.z80BC <= psIoWrite->highIoAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               psIoWrite->IOCall(cpu.z80BC, bTemp, psIoWrite);
-                                               psIoWrite = NULL;
-                                               break;
-                                       }
-                                       ++psIoWrite;
-                               }
-
-                               cpu.z80HL++;
-                               cpu.z80HL &= 0xffff;
-                               sdwCyclesRemaining -= 16;
-                               cpu.z80B--;
-                               }
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= (bPostORFlags[bTemp] & (Z80_FLAG_SIGN | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY));
-                               if (cpu.z80B)
-                               {
-                                       cpu.z80F |= Z80_FLAG_OVERFLOW_PARITY;
-                               }
-                       break;
-               }
-               case 0xa4:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xa5:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xa6:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xa7:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xa8:
-               {
-                       sdwCyclesRemaining -= 16;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80DE >= psMemWrite->lowAddr) && (cpu.z80DE <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80DE, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80DE - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80DE] = (UINT8) bTemp;
-                               }
-
-                                       --cpu.z80HL;
-                                       --cpu.z80DE;
-                               --cpu.z80BC;
-                               cpu.z80HL &= 0xffff;
-                               cpu.z80DE &= 0xffff;
-                               cpu.z80BC &= 0xffff;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY);
-                               if (cpu.z80BC)
-                               {
-                                       cpu.z80F |= Z80_FLAG_OVERFLOW_PARITY;
-                               }
-                       break;
-               }
-               case 0xa9:
-               {
-                       sdwCyclesRemaining -= 16;
-                               {
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               cpu.z80HL--;
-                               cpu.z80HL &= 0xffff;
-                               cpu.z80BC--;
-                               cpu.z80BC &= 0xffff;
-                               }
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= (pbSubSbcTable[((UINT32) cpu.z80A << 8) | bTemp] & (Z80_FLAG_SIGN | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO));
-                               if (cpu.z80BC)
-                               {
-                                       cpu.z80F |= Z80_FLAG_OVERFLOW_PARITY;
-                               }
-                       break;
-               }
-               case 0xaa:
-               {
-                       sdwCyclesRemaining -= 16;
-                               {
-                               psIoRead = cpu.z80IoRead;       /* Beginning of our handler */
-                               while (psIoRead->lowIoAddr != 0xffff)
-                               {
-                                       if ((cpu.z80B >= psIoRead->lowIoAddr) && (cpu.z80B <= psIoRead->highIoAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               bTemp = psIoRead->IOCall(cpu.z80B, psIoRead);
-                                               psIoRead = NULL;
-                                               break;
-                                       }
-                                       ++psIoRead;
-                               }
-
-                               if (psIoRead)
-                               {
-                                       bTemp = 0xff; /* Unclaimed I/O read */
-                               }
-
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) bTemp;
-                               }
-
-                               cpu.z80HL--;
-                               cpu.z80HL &= 0xffff;
-                               sdwCyclesRemaining -= 16;
-                               cpu.z80B--;
-                               }
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= (bPostORFlags[bTemp] & (Z80_FLAG_SIGN | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY));
-                               if (cpu.z80B)
-                               {
-                                       cpu.z80F |= Z80_FLAG_OVERFLOW_PARITY;
-                                       pbPC -= 2;
-                               }
-                       break;
-               }
-               case 0xab:
-               {
-                       sdwCyclesRemaining -= 16;
-                               {
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               psIoWrite = cpu.z80IoWrite;     /* Beginning of our handler */
-                               while (psIoWrite->lowIoAddr != 0xffff)
-                               {
-                                       if ((cpu.z80BC >= psIoWrite->lowIoAddr) && (cpu.z80BC <= psIoWrite->highIoAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               psIoWrite->IOCall(cpu.z80BC, bTemp, psIoWrite);
-                                               psIoWrite = NULL;
-                                               break;
-                                       }
-                                       ++psIoWrite;
-                               }
-
-                               cpu.z80HL--;
-                               cpu.z80HL &= 0xffff;
-                               sdwCyclesRemaining -= 16;
-                               cpu.z80B--;
-                               }
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= (bPostORFlags[bTemp] & (Z80_FLAG_SIGN | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY));
-                               if (cpu.z80B)
-                               {
-                                       cpu.z80F |= Z80_FLAG_OVERFLOW_PARITY;
-                               }
-                       break;
-               }
-               case 0xac:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xad:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xae:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xaf:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xb0:
-               {
-                       sdwCyclesRemaining -= 16;
-                               while ((sdwCyclesRemaining > 0) && (cpu.z80BC))
-                               {
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80DE >= psMemWrite->lowAddr) && (cpu.z80DE <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80DE, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80DE - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80DE] = (UINT8) bTemp;
-                               }
-
-                                       ++cpu.z80HL;
-                                       ++cpu.z80DE;
-                               --cpu.z80BC;
-                               cpu.z80HL &= 0xffff;
-                               cpu.z80DE &= 0xffff;
-                               cpu.z80BC &= 0xffff;
-                               sdwCyclesRemaining -= 21;
-                               }
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY);
-                               if (cpu.z80BC)
-                               {
-                                       pbPC -= 2;      /* Back up so we hit this instruction again */
-                                       cpu.z80F |= Z80_FLAG_OVERFLOW_PARITY;
-                               }
-                               sdwCyclesRemaining -= 16;
-                       break;
-               }
-               case 0xb1:
-               {
-                       sdwCyclesRemaining -= 16;
-                               while ((sdwCyclesRemaining >= 0) && (cpu.z80BC))
-                               {
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               cpu.z80HL++;
-                               cpu.z80HL &= 0xffff;
-                               cpu.z80BC--;
-                               cpu.z80BC &= 0xffff;
-                               sdwCyclesRemaining -= 16;
-                               if (cpu.z80A == bTemp)
-                               {
-                                       break;
-                               }
-                               }
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= (pbSubSbcTable[((UINT32) cpu.z80A << 8) | bTemp] & (Z80_FLAG_SIGN | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO));
-                               if (cpu.z80BC)
-                               {
-                                       cpu.z80F |= Z80_FLAG_OVERFLOW_PARITY;
-                               }
-                       break;
-               }
-               case 0xb2:
-               {
-                       sdwCyclesRemaining -= 16;
-                               while ((sdwCyclesRemaining > 0) && (cpu.z80B))
-                               {
-                               psIoRead = cpu.z80IoRead;       /* Beginning of our handler */
-                               while (psIoRead->lowIoAddr != 0xffff)
-                               {
-                                       if ((cpu.z80B >= psIoRead->lowIoAddr) && (cpu.z80B <= psIoRead->highIoAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               bTemp = psIoRead->IOCall(cpu.z80B, psIoRead);
-                                               psIoRead = NULL;
-                                               break;
-                                       }
-                                       ++psIoRead;
-                               }
-
-                               if (psIoRead)
-                               {
-                                       bTemp = 0xff; /* Unclaimed I/O read */
-                               }
-
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) bTemp;
-                               }
-
-                               cpu.z80HL++;
-                               cpu.z80HL &= 0xffff;
-                               sdwCyclesRemaining -= 16;
-                               cpu.z80B--;
-                               }
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= (bPostORFlags[bTemp] & (Z80_FLAG_SIGN | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY));
-                               if (cpu.z80B)
-                               {
-                                       cpu.z80F |= Z80_FLAG_OVERFLOW_PARITY;
-                                       pbPC -= 2;
-                               }
-                       break;
-               }
-               case 0xb3:
-               {
-                       sdwCyclesRemaining -= 16;
-                               while ((sdwCyclesRemaining > 0) && (cpu.z80B))
-                               {
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               psIoWrite = cpu.z80IoWrite;     /* Beginning of our handler */
-                               while (psIoWrite->lowIoAddr != 0xffff)
-                               {
-                                       if ((cpu.z80BC >= psIoWrite->lowIoAddr) && (cpu.z80BC <= psIoWrite->highIoAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               psIoWrite->IOCall(cpu.z80BC, bTemp, psIoWrite);
-                                               psIoWrite = NULL;
-                                               break;
-                                       }
-                                       ++psIoWrite;
-                               }
-
-                               cpu.z80HL++;
-                               cpu.z80HL &= 0xffff;
-                               sdwCyclesRemaining -= 16;
-                               cpu.z80B--;
-                               }
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= (bPostORFlags[bTemp] & (Z80_FLAG_SIGN | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY));
-                               if (cpu.z80B)
-                               {
-                                       cpu.z80F |= Z80_FLAG_OVERFLOW_PARITY;
-                               }
-                       break;
-               }
-               case 0xb4:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xb5:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xb6:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xb7:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xb8:
-               {
-                       sdwCyclesRemaining -= 16;
-                               while ((sdwCyclesRemaining > 0) && (cpu.z80BC))
-                               {
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80DE >= psMemWrite->lowAddr) && (cpu.z80DE <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80DE, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80DE - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80DE] = (UINT8) bTemp;
-                               }
-
-                                       --cpu.z80HL;
-                                       --cpu.z80DE;
-                               --cpu.z80BC;
-                               cpu.z80HL &= 0xffff;
-                               cpu.z80DE &= 0xffff;
-                               cpu.z80BC &= 0xffff;
-                               sdwCyclesRemaining -= 21;
-                               }
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY);
-                               if (cpu.z80BC)
-                               {
-                                       pbPC -= 2;      /* Back up so we hit this instruction again */
-                                       cpu.z80F |= Z80_FLAG_OVERFLOW_PARITY;
-                               }
-                               sdwCyclesRemaining -= 16;
-                       break;
-               }
-               case 0xb9:
-               {
-                       sdwCyclesRemaining -= 16;
-                               while ((sdwCyclesRemaining >= 0) && (cpu.z80BC))
-                               {
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               cpu.z80HL--;
-                               cpu.z80HL &= 0xffff;
-                               cpu.z80BC--;
-                               cpu.z80BC &= 0xffff;
-                               sdwCyclesRemaining -= 16;
-                               if (cpu.z80A == bTemp)
-                               {
-                                       break;
-                               }
-                               }
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= (pbSubSbcTable[((UINT32) cpu.z80A << 8) | bTemp] & (Z80_FLAG_SIGN | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO));
-                               if (cpu.z80BC)
-                               {
-                                       cpu.z80F |= Z80_FLAG_OVERFLOW_PARITY;
-                               }
-                       break;
-               }
-               case 0xba:
-               {
-                       sdwCyclesRemaining -= 16;
-                               while ((sdwCyclesRemaining > 0) && (cpu.z80B))
-                               {
-                               psIoRead = cpu.z80IoRead;       /* Beginning of our handler */
-                               while (psIoRead->lowIoAddr != 0xffff)
-                               {
-                                       if ((cpu.z80B >= psIoRead->lowIoAddr) && (cpu.z80B <= psIoRead->highIoAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               bTemp = psIoRead->IOCall(cpu.z80B, psIoRead);
-                                               psIoRead = NULL;
-                                               break;
-                                       }
-                                       ++psIoRead;
-                               }
-
-                               if (psIoRead)
-                               {
-                                       bTemp = 0xff; /* Unclaimed I/O read */
-                               }
-
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) bTemp;
-                               }
-
-                               cpu.z80HL--;
-                               cpu.z80HL &= 0xffff;
-                               sdwCyclesRemaining -= 16;
-                               cpu.z80B--;
-                               }
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= (bPostORFlags[bTemp] & (Z80_FLAG_SIGN | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY));
-                               if (cpu.z80B)
-                               {
-                                       cpu.z80F |= Z80_FLAG_OVERFLOW_PARITY;
-                                       pbPC -= 2;
-                               }
-                       break;
-               }
-               case 0xbb:
-               {
-                       sdwCyclesRemaining -= 16;
-                               while ((sdwCyclesRemaining > 0) && (cpu.z80B))
-                               {
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               psIoWrite = cpu.z80IoWrite;     /* Beginning of our handler */
-                               while (psIoWrite->lowIoAddr != 0xffff)
-                               {
-                                       if ((cpu.z80BC >= psIoWrite->lowIoAddr) && (cpu.z80BC <= psIoWrite->highIoAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               psIoWrite->IOCall(cpu.z80BC, bTemp, psIoWrite);
-                                               psIoWrite = NULL;
-                                               break;
-                                       }
-                                       ++psIoWrite;
-                               }
-
-                               cpu.z80HL--;
-                               cpu.z80HL &= 0xffff;
-                               sdwCyclesRemaining -= 16;
-                               cpu.z80B--;
-                               }
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= (bPostORFlags[bTemp] & (Z80_FLAG_SIGN | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY));
-                               if (cpu.z80B)
-                               {
-                                       cpu.z80F |= Z80_FLAG_OVERFLOW_PARITY;
-                               }
-                       break;
-               }
-               case 0xbc:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xbd:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xbe:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xbf:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xc0:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xc1:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xc2:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xc3:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xc4:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xc5:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xc6:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xc7:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xc8:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xc9:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xca:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xcb:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xcc:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xcd:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xce:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xcf:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xd0:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xd1:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xd2:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xd3:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xd4:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xd5:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xd6:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xd7:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xd8:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xd9:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xda:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xdb:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xdc:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xdd:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xde:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xdf:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xe0:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xe1:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xe2:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xe3:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xe4:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xe5:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xe6:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xe7:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xe8:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xe9:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xea:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xeb:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xec:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xed:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xee:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xef:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xf0:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xf1:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xf2:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xf3:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xf4:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xf5:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xf6:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xf7:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xf8:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xf9:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xfa:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xfb:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xfc:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xfd:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xfe:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xff:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-       }
-}
-
-void DDHandler(void)
-{
-       switch (*pbPC++)
-       {
-               case 0x00:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x01:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x02:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x03:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x04:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x05:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x06:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x07:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x08:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x09:
-               {
-                       sdwCyclesRemaining -= 15;
-                       cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY);
-                       dwTemp = cpu.z80IX + cpu.z80BC;
-                       cpu.z80F |= ((dwTemp >> 16) & Z80_FLAG_CARRY) | (((cpu.z80IX ^ dwTemp ^ cpu.z80BC) >> 8) & Z80_FLAG_HALF_CARRY);
-                       cpu.z80IX = dwTemp & 0xffff;
-                       break;
-               }
-               case 0x0a:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x0b:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x0c:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x0d:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x0e:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x0f:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x10:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x11:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x12:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x13:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x14:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x15:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x16:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x17:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x18:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x19:
-               {
-                       sdwCyclesRemaining -= 15;
-                       cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY);
-                       dwTemp = cpu.z80IX + cpu.z80DE;
-                       cpu.z80F |= ((dwTemp >> 16) & Z80_FLAG_CARRY) | (((cpu.z80IX ^ dwTemp ^ cpu.z80DE) >> 8) & Z80_FLAG_HALF_CARRY);
-                       cpu.z80IX = dwTemp & 0xffff;
-                       break;
-               }
-               case 0x1a:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x1b:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x1c:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x1d:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x1e:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x1f:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x20:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x21:
-               {
-                       sdwCyclesRemaining -= 14;
-               cpu.z80IX = *pbPC++;
-               cpu.z80IX |= ((UINT32) *pbPC++ << 8);
-                       break;
-               }
-               case 0x22:
-               {
-                       sdwCyclesRemaining -= 20;
-                               dwAddr = *pbPC++;
-                               dwAddr |= ((UINT32) *pbPC++ << 8);
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemWrite->lowAddr) && (dwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(dwAddr, (cpu.z80IX & 0xff), psMemWrite);
-                                                       psMemWrite->memoryCall(dwAddr + 1, (cpu.z80IX >> 8), psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwAddr - psMemWrite->lowAddr)) = cpu.z80IX;
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwAddr - psMemWrite->lowAddr) + 1) = cpu.z80IX >> 8;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[dwAddr] = (UINT8) cpu.z80IX;
-                                       cpu.z80Base[dwAddr + 1] = (UINT8) ((UINT32) cpu.z80IX >> 8);
-                               }
-
-                       break;
-               }
-               case 0x23:
-               {
-                       sdwCyclesRemaining -= 10;
-                               cpu.z80IX++;
-                               cpu.z80IX &= 0xffff;
-                       break;
-               }
-               case 0x24:
-               {
-                       sdwCyclesRemaining -= 9;
-                               cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= bPostIncFlags[cpu.z80XH++];
-                       break;
-               }
-               case 0x25:
-               {
-                       sdwCyclesRemaining -= 9;
-                               cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= bPostDecFlags[cpu.z80XH--];
-                       break;
-               }
-               case 0x26:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80XH = *pbPC++;
-                       break;
-               }
-               case 0x27:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x28:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x29:
-               {
-                       sdwCyclesRemaining -= 15;
-                       cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY);
-                       dwTemp = cpu.z80IX + cpu.z80IX;
-                       cpu.z80F |= ((dwTemp >> 16) & Z80_FLAG_CARRY) | (((cpu.z80IX ^ dwTemp ^ cpu.z80HL) >> 8) & Z80_FLAG_HALF_CARRY);
-                       cpu.z80IX = dwTemp & 0xffff;
-                       break;
-               }
-               case 0x2a:
-               {
-                       sdwCyclesRemaining -= 20;
-                               dwAddr = *pbPC++;
-                               dwAddr |= ((UINT32) *pbPC++ << 8);
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemRead->lowAddr) && (dwAddr <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       cpu.z80IX = psMemRead->memoryCall(dwAddr, psMemRead);
-                                                       cpu.z80IX |= (UINT32) ((UINT32) psMemRead->memoryCall(dwAddr + 1, psMemRead) << 8);
-                                               }
-                                               else
-                                               {
-                                                       cpu.z80IX = *((UINT8 *) psMemRead->pUserArea + (dwAddr - psMemRead->lowAddr));
-                                                       cpu.z80IX |= (UINT32) ((UINT32) *((UINT8 *) psMemRead->pUserArea + (dwAddr - psMemRead->lowAddr + 1)) << 8);
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       cpu.z80IX = cpu.z80Base[dwAddr];
-                                       cpu.z80IX |= (UINT32) ((UINT32) cpu.z80Base[dwAddr + 1] << 8);
-                               }
-
-                       break;
-               }
-               case 0x2b:
-               {
-                       sdwCyclesRemaining -= 10;
-                               cpu.z80IX--;
-                               cpu.z80IX &= 0xffff;
-                       break;
-               }
-               case 0x2c:
-               {
-                       sdwCyclesRemaining -= 9;
-                               cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= bPostIncFlags[cpu.z80XL++];
-                       break;
-               }
-               case 0x2d:
-               {
-                       sdwCyclesRemaining -= 9;
-                               cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= bPostDecFlags[cpu.z80XL--];
-                       break;
-               }
-               case 0x2e:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80XL = *pbPC++;
-                       break;
-               }
-               case 0x2f:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x30:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x31:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x32:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x33:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x34:
-               {
-                       sdwCyclesRemaining -= 23;
-                               sdwAddr = (INT8) *pbPC++;       /* Get LSB first */
-                               dwAddr = (sdwAddr + (INT32) cpu.z80IX) & 0xffff;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemRead->lowAddr) && (dwAddr <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(dwAddr, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (dwAddr - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[dwAddr];
-                               }
-
-                               cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= bPostIncFlags[bTemp++];
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemWrite->lowAddr) && (dwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(dwAddr, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwAddr - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[dwAddr] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0x35:
-               {
-                       sdwCyclesRemaining -= 23;
-                               sdwAddr = (INT8) *pbPC++;       /* Get LSB first */
-                               dwAddr = (sdwAddr + (INT32) cpu.z80IX) & 0xffff;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemRead->lowAddr) && (dwAddr <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(dwAddr, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (dwAddr - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[dwAddr];
-                               }
-
-                               cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= bPostDecFlags[bTemp--];
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemWrite->lowAddr) && (dwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(dwAddr, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwAddr - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[dwAddr] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0x36:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       // Get the offset
-                               sdwAddr = ((INT32) cpu.z80IX + sdwAddr) & 0xffff;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((sdwAddr >= psMemWrite->lowAddr) && (sdwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(sdwAddr, *pbPC++, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (sdwAddr - psMemWrite->lowAddr)) = *pbPC++;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[sdwAddr] = (UINT8) *pbPC++;
-                               }
-
-                       break;
-               }
-               case 0x37:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x38:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x39:
-               {
-                       sdwCyclesRemaining -= 15;
-                       cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY);
-                       dwTemp = cpu.z80IX + cpu.z80sp;
-                       cpu.z80F |= ((dwTemp >> 16) & Z80_FLAG_CARRY) | (((cpu.z80IX ^ dwTemp ^ cpu.z80sp) >> 8) & Z80_FLAG_HALF_CARRY);
-                       cpu.z80IX = dwTemp & 0xffff;
-                       break;
-               }
-               case 0x3a:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x3b:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x3c:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x3d:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x3e:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x3f:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x40:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x41:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x42:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x43:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x44:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80B = cpu.z80XH;
-                       break;
-               }
-               case 0x45:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80B = cpu.z80XL;
-                       break;
-               }
-               case 0x46:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       // Get the offset
-                               sdwAddr = ((INT32) cpu.z80IX + sdwAddr) & 0xffff;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((sdwAddr >= psMemRead->lowAddr) && (sdwAddr <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       cpu.z80B = psMemRead->memoryCall(sdwAddr, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       cpu.z80B = *((UINT8 *) psMemRead->pUserArea + (sdwAddr - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       cpu.z80B = cpu.z80Base[sdwAddr];
-                               }
-
-                       break;
-               }
-               case 0x47:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x48:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x49:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x4a:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x4b:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x4c:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80C = cpu.z80XH;
-                       break;
-               }
-               case 0x4d:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80C = cpu.z80XL;
-                       break;
-               }
-               case 0x4e:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       // Get the offset
-                               sdwAddr = ((INT32) cpu.z80IX + sdwAddr) & 0xffff;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((sdwAddr >= psMemRead->lowAddr) && (sdwAddr <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       cpu.z80C = psMemRead->memoryCall(sdwAddr, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       cpu.z80C = *((UINT8 *) psMemRead->pUserArea + (sdwAddr - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       cpu.z80C = cpu.z80Base[sdwAddr];
-                               }
-
-                       break;
-               }
-               case 0x4f:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x50:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x51:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x52:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x53:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x54:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80D = cpu.z80XH;
-                       break;
-               }
-               case 0x55:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80D = cpu.z80XL;
-                       break;
-               }
-               case 0x56:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       // Get the offset
-                               sdwAddr = ((INT32) cpu.z80IX + sdwAddr) & 0xffff;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((sdwAddr >= psMemRead->lowAddr) && (sdwAddr <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       cpu.z80D = psMemRead->memoryCall(sdwAddr, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       cpu.z80D = *((UINT8 *) psMemRead->pUserArea + (sdwAddr - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       cpu.z80D = cpu.z80Base[sdwAddr];
-                               }
-
-                       break;
-               }
-               case 0x57:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x58:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x59:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x5a:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x5b:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x5c:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80E = cpu.z80XH;
-                       break;
-               }
-               case 0x5d:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80E = cpu.z80XL;
-                       break;
-               }
-               case 0x5e:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       // Get the offset
-                               sdwAddr = ((INT32) cpu.z80IX + sdwAddr) & 0xffff;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((sdwAddr >= psMemRead->lowAddr) && (sdwAddr <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       cpu.z80E = psMemRead->memoryCall(sdwAddr, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       cpu.z80E = *((UINT8 *) psMemRead->pUserArea + (sdwAddr - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       cpu.z80E = cpu.z80Base[sdwAddr];
-                               }
-
-                       break;
-               }
-               case 0x5f:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x60:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80XH = cpu.z80B;
-                       break;
-               }
-               case 0x61:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80XH = cpu.z80C;
-                       break;
-               }
-               case 0x62:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80XH = cpu.z80D;
-                       break;
-               }
-               case 0x63:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80XH = cpu.z80E;
-                       break;
-               }
-               case 0x64:
-               {
-                       sdwCyclesRemaining -= 9;
-                       break;
-               }
-               case 0x65:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80XH = cpu.z80XL;
-                       break;
-               }
-               case 0x66:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       // Get the offset
-                               sdwAddr = ((INT32) cpu.z80IX + sdwAddr) & 0xffff;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((sdwAddr >= psMemRead->lowAddr) && (sdwAddr <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       cpu.z80H = psMemRead->memoryCall(sdwAddr, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       cpu.z80H = *((UINT8 *) psMemRead->pUserArea + (sdwAddr - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       cpu.z80H = cpu.z80Base[sdwAddr];
-                               }
-
-                       break;
-               }
-               case 0x67:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80XH = cpu.z80A;
-                       break;
-               }
-               case 0x68:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80XL = cpu.z80B;
-                       break;
-               }
-               case 0x69:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80XL = cpu.z80C;
-                       break;
-               }
-               case 0x6a:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80XL = cpu.z80D;
-                       break;
-               }
-               case 0x6b:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80XL = cpu.z80E;
-                       break;
-               }
-               case 0x6c:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80XL = cpu.z80XH;
-                       break;
-               }
-               case 0x6d:
-               {
-                       sdwCyclesRemaining -= 9;
-                       break;
-               }
-               case 0x6e:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       // Get the offset
-                               sdwAddr = ((INT32) cpu.z80IX + sdwAddr) & 0xffff;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((sdwAddr >= psMemRead->lowAddr) && (sdwAddr <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       cpu.z80L = psMemRead->memoryCall(sdwAddr, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       cpu.z80L = *((UINT8 *) psMemRead->pUserArea + (sdwAddr - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       cpu.z80L = cpu.z80Base[sdwAddr];
-                               }
-
-                       break;
-               }
-               case 0x6f:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80XL = cpu.z80A;
-                       break;
-               }
-               case 0x70:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       // Get the offset
-                               sdwAddr = ((INT32) cpu.z80IX + sdwAddr) & 0xffff;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((sdwAddr >= psMemWrite->lowAddr) && (sdwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(sdwAddr, cpu.z80B, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (sdwAddr - psMemWrite->lowAddr)) = cpu.z80B;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[sdwAddr] = (UINT8) cpu.z80B;
-                               }
-
-                       break;
-               }
-               case 0x71:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       // Get the offset
-                               sdwAddr = ((INT32) cpu.z80IX + sdwAddr) & 0xffff;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((sdwAddr >= psMemWrite->lowAddr) && (sdwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(sdwAddr, cpu.z80C, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (sdwAddr - psMemWrite->lowAddr)) = cpu.z80C;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[sdwAddr] = (UINT8) cpu.z80C;
-                               }
-
-                       break;
-               }
-               case 0x72:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       // Get the offset
-                               sdwAddr = ((INT32) cpu.z80IX + sdwAddr) & 0xffff;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((sdwAddr >= psMemWrite->lowAddr) && (sdwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(sdwAddr, cpu.z80D, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (sdwAddr - psMemWrite->lowAddr)) = cpu.z80D;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[sdwAddr] = (UINT8) cpu.z80D;
-                               }
-
-                       break;
-               }
-               case 0x73:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       // Get the offset
-                               sdwAddr = ((INT32) cpu.z80IX + sdwAddr) & 0xffff;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((sdwAddr >= psMemWrite->lowAddr) && (sdwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(sdwAddr, cpu.z80E, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (sdwAddr - psMemWrite->lowAddr)) = cpu.z80E;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[sdwAddr] = (UINT8) cpu.z80E;
-                               }
-
-                       break;
-               }
-               case 0x74:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       // Get the offset
-                               sdwAddr = ((INT32) cpu.z80IX + sdwAddr) & 0xffff;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((sdwAddr >= psMemWrite->lowAddr) && (sdwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(sdwAddr, cpu.z80H, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (sdwAddr - psMemWrite->lowAddr)) = cpu.z80H;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[sdwAddr] = (UINT8) cpu.z80H;
-                               }
-
-                       break;
-               }
-               case 0x75:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       // Get the offset
-                               sdwAddr = ((INT32) cpu.z80IX + sdwAddr) & 0xffff;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((sdwAddr >= psMemWrite->lowAddr) && (sdwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(sdwAddr, cpu.z80L, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (sdwAddr - psMemWrite->lowAddr)) = cpu.z80L;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[sdwAddr] = (UINT8) cpu.z80L;
-                               }
-
-                       break;
-               }
-               case 0x76:
-               {
-                       sdwCyclesRemaining -= 19;
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x77:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       // Get the offset
-                               sdwAddr = ((INT32) cpu.z80IX + sdwAddr) & 0xffff;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((sdwAddr >= psMemWrite->lowAddr) && (sdwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(sdwAddr, cpu.z80A, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (sdwAddr - psMemWrite->lowAddr)) = cpu.z80A;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[sdwAddr] = (UINT8) cpu.z80A;
-                               }
-
-                       break;
-               }
-               case 0x78:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x79:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x7a:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x7b:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x7c:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80A = cpu.z80XH;
-                       break;
-               }
-               case 0x7d:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80A = cpu.z80XL;
-                       break;
-               }
-               case 0x7e:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       // Get the offset
-                               sdwAddr = ((INT32) cpu.z80IX + sdwAddr) & 0xffff;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((sdwAddr >= psMemRead->lowAddr) && (sdwAddr <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       cpu.z80A = psMemRead->memoryCall(sdwAddr, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       cpu.z80A = *((UINT8 *) psMemRead->pUserArea + (sdwAddr - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       cpu.z80A = cpu.z80Base[sdwAddr];
-                               }
-
-                       break;
-               }
-               case 0x7f:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x80:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x81:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x82:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x83:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x84:
-               {
-                       sdwCyclesRemaining -= 9;
-                               bTemp2 = cpu.z80A + cpu.z80XH;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbAddAdcTable[((UINT32) cpu.z80A << 8) | cpu.z80XH];
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x85:
-               {
-                       sdwCyclesRemaining -= 9;
-                               bTemp2 = cpu.z80A + cpu.z80XL;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbAddAdcTable[((UINT32) cpu.z80A << 8) | cpu.z80XL];
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x86:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       /* Get LSB first */
-                               dwAddr = (sdwAddr + (INT32) cpu.z80IX) & 0xffff;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemRead->lowAddr) && (dwAddr <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(dwAddr, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (dwAddr - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[dwAddr];
-                               }
-
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbAddAdcTable[((UINT32) cpu.z80A << 8) | bTemp];
-                               cpu.z80A += bTemp;
-                       break;
-               }
-               case 0x87:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x88:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x89:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x8a:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x8b:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x8c:
-               {
-                       sdwCyclesRemaining -= 9;
-                               bTemp2 = cpu.z80A + cpu.z80XH + (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbAddAdcTable[((UINT32) cpu.z80A << 8) | cpu.z80XH | (((UINT32) cpu.z80F & Z80_FLAG_CARRY) << 16)];
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x8d:
-               {
-                       sdwCyclesRemaining -= 9;
-                               bTemp2 = cpu.z80A + cpu.z80XL + (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbAddAdcTable[((UINT32) cpu.z80A << 8) | cpu.z80XL | (((UINT32) cpu.z80F & Z80_FLAG_CARRY) << 16)];
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x8e:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       /* Get LSB first */
-                               dwAddr = (sdwAddr + (INT32) cpu.z80IX) & 0xffff;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemRead->lowAddr) && (dwAddr <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(dwAddr, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (dwAddr - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[dwAddr];
-                               }
-
-                               bTemp2 = (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbAddAdcTable[((UINT32) cpu.z80A << 8) | bTemp | (((UINT32) cpu.z80F & Z80_FLAG_CARRY) << 16)];
-                               cpu.z80A += bTemp + bTemp2;
-                       break;
-               }
-               case 0x8f:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x90:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x91:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x92:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x93:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x94:
-               {
-                       sdwCyclesRemaining -= 9;
-                               bTemp2 = cpu.z80A - cpu.z80XH;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | cpu.z80XH];
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x95:
-               {
-                       sdwCyclesRemaining -= 9;
-                               bTemp2 = cpu.z80A - cpu.z80XL;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | cpu.z80XL];
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x96:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       /* Get LSB first */
-                               dwAddr = (sdwAddr + (INT32) cpu.z80IX) & 0xffff;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemRead->lowAddr) && (dwAddr <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(dwAddr, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (dwAddr - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[dwAddr];
-                               }
-
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | bTemp];
-                               cpu.z80A -= bTemp;
-                       break;
-               }
-               case 0x97:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x98:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x99:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x9a:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x9b:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x9c:
-               {
-                       sdwCyclesRemaining -= 9;
-                               bTemp2 = cpu.z80A - cpu.z80XH - (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | cpu.z80XH | (((UINT32) cpu.z80F & Z80_FLAG_CARRY) << 16)];
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x9d:
-               {
-                       sdwCyclesRemaining -= 9;
-                               bTemp2 = cpu.z80A - cpu.z80XL - (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | cpu.z80XL | (((UINT32) cpu.z80F & Z80_FLAG_CARRY) << 16)];
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x9e:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       /* Get LSB first */
-                               dwAddr = (sdwAddr + (INT32) cpu.z80IX) & 0xffff;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemRead->lowAddr) && (dwAddr <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(dwAddr, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (dwAddr - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[dwAddr];
-                               }
-
-                               bTemp2 = cpu.z80A;
-                               cpu.z80A = cpu.z80A - bTemp - (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) bTemp2 << 8) | bTemp | (((UINT32) cpu.z80F & Z80_FLAG_CARRY) << 16)];
-                       break;
-               }
-               case 0x9f:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xa0:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xa1:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xa2:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xa3:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xa4:
-               {
-                       sdwCyclesRemaining -= 9;
-                               cpu.z80A &= cpu.z80XH;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostANDFlags[cpu.z80A];
-
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xa5:
-               {
-                       sdwCyclesRemaining -= 9;
-                               cpu.z80A &= cpu.z80XL;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostANDFlags[cpu.z80A];
-
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xa6:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       /* Get LSB first */
-                               dwAddr = (sdwAddr + (INT32) cpu.z80IX) & 0xffff;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemRead->lowAddr) && (dwAddr <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(dwAddr, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (dwAddr - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[dwAddr];
-                               }
-
-                               cpu.z80A &= bTemp;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostANDFlags[cpu.z80A];
-
-                       break;
-               }
-               case 0xa7:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xa8:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xa9:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xaa:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xab:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xac:
-               {
-                       sdwCyclesRemaining -= 9;
-                               cpu.z80A ^= cpu.z80XH;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xad:
-               {
-                       sdwCyclesRemaining -= 9;
-                               cpu.z80A ^= cpu.z80XL;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xae:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       /* Get LSB first */
-                               dwAddr = (sdwAddr + (INT32) cpu.z80IX) & 0xffff;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemRead->lowAddr) && (dwAddr <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(dwAddr, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (dwAddr - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[dwAddr];
-                               }
-
-                               cpu.z80A ^= bTemp;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-
-                       break;
-               }
-               case 0xaf:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xb0:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xb1:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xb2:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xb3:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xb4:
-               {
-                       sdwCyclesRemaining -= 9;
-                               cpu.z80A |= cpu.z80XH;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xb5:
-               {
-                       sdwCyclesRemaining -= 9;
-                               cpu.z80A |= cpu.z80XL;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xb6:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       /* Get LSB first */
-                               dwAddr = (sdwAddr + (INT32) cpu.z80IX) & 0xffff;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemRead->lowAddr) && (dwAddr <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(dwAddr, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (dwAddr - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[dwAddr];
-                               }
-
-                               cpu.z80A |= bTemp;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-
-                       break;
-               }
-               case 0xb7:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xb8:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xb9:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xba:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xbb:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xbc:
-               {
-                       sdwCyclesRemaining -= 9;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xbd:
-               {
-                       sdwCyclesRemaining -= 9;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xbe:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       /* Get LSB first */
-                               dwAddr = (sdwAddr + (INT32) cpu.z80IX) & 0xffff;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemRead->lowAddr) && (dwAddr <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(dwAddr, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (dwAddr - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[dwAddr];
-                               }
-
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | bTemp];
-                       break;
-               }
-               case 0xbf:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xc0:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xc1:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xc2:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xc3:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xc4:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xc5:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xc6:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xc7:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xc8:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xc9:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xca:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xcb:
-               {
-                               DDFDCBHandler(0);
-                       break;
-               }
-               case 0xcc:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xcd:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xce:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xcf:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xd0:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xd1:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xd2:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xd3:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xd4:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xd5:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xd6:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xd7:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xd8:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xd9:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xda:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xdb:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xdc:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xdd:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xde:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xdf:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xe0:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xe1:
-               {
-                       sdwCyclesRemaining -= 14;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80sp >= psMemRead->lowAddr) && (cpu.z80sp <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       cpu.z80IX = psMemRead->memoryCall(cpu.z80sp, psMemRead);
-                                                       cpu.z80IX |= (UINT32) ((UINT32) psMemRead->memoryCall(cpu.z80sp + 1, psMemRead) << 8);
-                                               }
-                                               else
-                                               {
-                                                       cpu.z80IX = *((UINT8 *) psMemRead->pUserArea + (cpu.z80sp - psMemRead->lowAddr));
-                                                       cpu.z80IX |= (UINT32) ((UINT32) *((UINT8 *) psMemRead->pUserArea + (cpu.z80sp - psMemRead->lowAddr + 1)) << 8);
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       cpu.z80IX = cpu.z80Base[cpu.z80sp];
-                                       cpu.z80IX |= (UINT32) ((UINT32) cpu.z80Base[cpu.z80sp + 1] << 8);
-                               }
-
-                                       cpu.z80sp += 2;
-                                       pbSP = (cpu.z80Base + cpu.z80sp);       /* Normalize the stack pointer */
-                       break;
-               }
-               case 0xe2:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xe3:
-               {
-                       sdwCyclesRemaining -= 23;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80sp >= psMemRead->lowAddr) && (cpu.z80sp <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       dwAddr = psMemRead->memoryCall(cpu.z80sp, psMemRead);
-                                                       dwAddr |= (UINT32) ((UINT32) psMemRead->memoryCall(cpu.z80sp + 1, psMemRead) << 8);
-                                               }
-                                               else
-                                               {
-                                                       dwAddr = *((UINT8 *) psMemRead->pUserArea + (cpu.z80sp - psMemRead->lowAddr));
-                                                       dwAddr |= (UINT32) ((UINT32) *((UINT8 *) psMemRead->pUserArea + (cpu.z80sp - psMemRead->lowAddr + 1)) << 8);
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       dwAddr = cpu.z80Base[cpu.z80sp];
-                                       dwAddr |= (UINT32) ((UINT32) cpu.z80Base[cpu.z80sp + 1] << 8);
-                               }
-
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80sp >= psMemWrite->lowAddr) && (cpu.z80sp <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80sp, (cpu.z80IX & 0xff), psMemWrite);
-                                                       psMemWrite->memoryCall(cpu.z80sp + 1, (cpu.z80IX >> 8), psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80sp - psMemWrite->lowAddr)) = cpu.z80IX;
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80sp - psMemWrite->lowAddr) + 1) = cpu.z80IX >> 8;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80sp] = (UINT8) cpu.z80IX;
-                                       cpu.z80Base[cpu.z80sp + 1] = (UINT8) ((UINT32) cpu.z80IX >> 8);
-                               }
-
-                               cpu.z80IX = dwAddr;
-                       break;
-               }
-               case 0xe4:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xe5:
-               {
-                       sdwCyclesRemaining -= 15;
-                                       cpu.z80sp -= 2;
-                                       pbSP = (cpu.z80Base + cpu.z80sp);       /* Normalize the stack pointer */
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80sp >= psMemWrite->lowAddr) && (cpu.z80sp <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80sp, (cpu.z80IX & 0xff), psMemWrite);
-                                                       psMemWrite->memoryCall(cpu.z80sp + 1, (cpu.z80IX >> 8), psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80sp - psMemWrite->lowAddr)) = cpu.z80IX;
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80sp - psMemWrite->lowAddr) + 1) = cpu.z80IX >> 8;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80sp] = (UINT8) cpu.z80IX;
-                                       cpu.z80Base[cpu.z80sp + 1] = (UINT8) ((UINT32) cpu.z80IX >> 8);
-                               }
-
-                       break;
-               }
-               case 0xe6:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xe7:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xe8:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xe9:
-               {
-                       sdwCyclesRemaining -= 8;
-                               pbPC = cpu.z80Base + cpu.z80IX;
-                       break;
-               }
-               case 0xea:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xeb:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xec:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xed:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xee:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xef:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xf0:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xf1:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xf2:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xf3:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xf4:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xf5:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xf6:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xf7:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xf8:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xf9:
-               {
-                       sdwCyclesRemaining -= 10;
-                               cpu.z80sp = cpu.z80IX;
-                       break;
-               }
-               case 0xfa:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xfb:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xfc:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xfd:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xfe:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xff:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-       }
-}
-void DDFDCBHandler(UINT32 dwWhich)
-{
-       if (dwWhich)
-       {
-               dwAddr = (UINT32) ((INT32) cpu.z80IY + ((INT32) *pbPC++)) & 0xffff;
-       }
-       else
-       {
-               dwAddr = (UINT32) ((INT32) cpu.z80IX + ((INT32) *pbPC++)) & 0xffff;
-       }
-
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemRead->lowAddr) && (dwAddr <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(dwAddr, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (dwAddr - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[dwAddr];
-                               }
-
-       switch (*pbPC++)
-       {
-               case 0x00:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x01:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x02:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x03:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x04:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x05:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x06:
-               {
-                       sdwCyclesRemaining -= 23;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               bTemp2 = (bTemp >> 7);
-                               bTemp = (bTemp << 1) | bTemp2;
-                               cpu.z80F |= bTemp2 | bPostORFlags[bTemp];
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemWrite->lowAddr) && (dwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(dwAddr, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwAddr - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[dwAddr] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0x07:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x08:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x09:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x0a:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x0b:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x0c:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x0d:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x0e:
-               {
-                       sdwCyclesRemaining -= 23;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (bTemp & Z80_FLAG_CARRY);
-                               bTemp = (bTemp >> 1) | (bTemp << 7);
-                               cpu.z80F |= bPostORFlags[bTemp];
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemWrite->lowAddr) && (dwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(dwAddr, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwAddr - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[dwAddr] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0x0f:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x10:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x11:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x12:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x13:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x14:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x15:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x16:
-               {
-                       sdwCyclesRemaining -= 23;
-                               bTemp2 = cpu.z80F & Z80_FLAG_CARRY;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (bTemp >> 7);
-                               bTemp = (bTemp << 1) | bTemp2;
-                               cpu.z80F |= bPostORFlags[bTemp];
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemWrite->lowAddr) && (dwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(dwAddr, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwAddr - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[dwAddr] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0x17:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x18:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x19:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x1a:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x1b:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x1c:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x1d:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x1e:
-               {
-                       sdwCyclesRemaining -= 23;
-                               bTemp2 = (cpu.z80F & Z80_FLAG_CARRY) << 7;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (bTemp & Z80_FLAG_CARRY);
-                               bTemp = (bTemp >> 1) | bTemp2;
-                               cpu.z80F |= bPostORFlags[bTemp];
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemWrite->lowAddr) && (dwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(dwAddr, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwAddr - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[dwAddr] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0x1f:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x20:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x21:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x22:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x23:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x24:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x25:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x26:
-               {
-                       sdwCyclesRemaining -= 23;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (bTemp >> 7);
-                               bTemp = (bTemp << 1);
-                               cpu.z80F |= bPostORFlags[bTemp];
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemWrite->lowAddr) && (dwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(dwAddr, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwAddr - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[dwAddr] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0x27:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x28:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x29:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x2a:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x2b:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x2c:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x2d:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x2e:
-               {
-                       sdwCyclesRemaining -= 23;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (bTemp & Z80_FLAG_CARRY);
-                               bTemp = (bTemp >> 1) | (bTemp & 0x80);
-                               cpu.z80F |= bPostORFlags[bTemp];
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemWrite->lowAddr) && (dwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(dwAddr, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwAddr - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[dwAddr] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0x2f:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x30:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x31:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x32:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x33:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x34:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x35:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x36:
-               {
-                       sdwCyclesRemaining -= 23;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x37:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x38:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x39:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x3a:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x3b:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x3c:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x3d:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x3e:
-               {
-                       sdwCyclesRemaining -= 23;
-                               cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_CARRY);
-                               cpu.z80F |= (bTemp & Z80_FLAG_CARRY);
-                               bTemp = (bTemp >> 1);
-                               cpu.z80F |= bPostORFlags[bTemp];
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemWrite->lowAddr) && (dwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(dwAddr, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwAddr - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[dwAddr] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0x3f:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x40:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x41:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x42:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x43:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x44:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x45:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x46:
-               {
-                       sdwCyclesRemaining -= 20;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_ZERO | Z80_FLAG_NEGATIVE)) | Z80_FLAG_HALF_CARRY;
-                               if (!(bTemp & 0x01))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x47:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x48:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x49:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x4a:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x4b:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x4c:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x4d:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x4e:
-               {
-                       sdwCyclesRemaining -= 20;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_ZERO | Z80_FLAG_NEGATIVE)) | Z80_FLAG_HALF_CARRY;
-                               if (!(bTemp & 0x02))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x4f:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x50:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x51:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x52:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x53:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x54:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x55:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x56:
-               {
-                       sdwCyclesRemaining -= 20;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_ZERO | Z80_FLAG_NEGATIVE)) | Z80_FLAG_HALF_CARRY;
-                               if (!(bTemp & 0x04))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x57:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x58:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x59:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x5a:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x5b:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x5c:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x5d:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x5e:
-               {
-                       sdwCyclesRemaining -= 20;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_ZERO | Z80_FLAG_NEGATIVE)) | Z80_FLAG_HALF_CARRY;
-                               if (!(bTemp & 0x08))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x5f:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x60:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x61:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x62:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x63:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x64:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x65:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x66:
-               {
-                       sdwCyclesRemaining -= 20;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_ZERO | Z80_FLAG_NEGATIVE)) | Z80_FLAG_HALF_CARRY;
-                               if (!(bTemp & 0x10))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x67:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x68:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x69:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x6a:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x6b:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x6c:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x6d:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x6e:
-               {
-                       sdwCyclesRemaining -= 20;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_ZERO | Z80_FLAG_NEGATIVE)) | Z80_FLAG_HALF_CARRY;
-                               if (!(bTemp & 0x20))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x6f:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x70:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x71:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x72:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x73:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x74:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x75:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x76:
-               {
-                       sdwCyclesRemaining -= 20;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_ZERO | Z80_FLAG_NEGATIVE)) | Z80_FLAG_HALF_CARRY;
-                               if (!(bTemp & 0x40))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x77:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x78:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x79:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x7a:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x7b:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x7c:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x7d:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x7e:
-               {
-                       sdwCyclesRemaining -= 20;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_ZERO | Z80_FLAG_NEGATIVE)) | Z80_FLAG_HALF_CARRY;
-                               if (!(bTemp & 0x80))
-                               {
-                                       cpu.z80F |= Z80_FLAG_ZERO;
-                               }
-                       break;
-               }
-               case 0x7f:
-               {
-                       sdwCyclesRemaining -= 20;
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x80:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x81:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x82:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x83:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x84:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x85:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x86:
-               {
-                       sdwCyclesRemaining -= 23;
-                               bTemp &= 0xfe;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemWrite->lowAddr) && (dwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(dwAddr, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwAddr - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[dwAddr] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0x87:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x88:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x89:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x8a:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x8b:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x8c:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x8d:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x8e:
-               {
-                       sdwCyclesRemaining -= 23;
-                               bTemp &= 0xfd;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemWrite->lowAddr) && (dwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(dwAddr, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwAddr - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[dwAddr] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0x8f:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x90:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x91:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x92:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x93:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x94:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x95:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x96:
-               {
-                       sdwCyclesRemaining -= 23;
-                               bTemp &= 0xfb;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemWrite->lowAddr) && (dwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(dwAddr, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwAddr - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[dwAddr] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0x97:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x98:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x99:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x9a:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x9b:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x9c:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x9d:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0x9e:
-               {
-                       sdwCyclesRemaining -= 23;
-                               bTemp &= 0xf7;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemWrite->lowAddr) && (dwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(dwAddr, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwAddr - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[dwAddr] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0x9f:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xa0:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xa1:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xa2:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xa3:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xa4:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xa5:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xa6:
-               {
-                       sdwCyclesRemaining -= 23;
-                               bTemp &= 0xef;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemWrite->lowAddr) && (dwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(dwAddr, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwAddr - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[dwAddr] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0xa7:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xa8:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xa9:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xaa:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xab:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xac:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xad:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xae:
-               {
-                       sdwCyclesRemaining -= 23;
-                               bTemp &= 0xdf;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemWrite->lowAddr) && (dwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(dwAddr, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwAddr - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[dwAddr] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0xaf:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xb0:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xb1:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xb2:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xb3:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xb4:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xb5:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xb6:
-               {
-                       sdwCyclesRemaining -= 23;
-                               bTemp &= 0xbf;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemWrite->lowAddr) && (dwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(dwAddr, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwAddr - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[dwAddr] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0xb7:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xb8:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xb9:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xba:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xbb:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xbc:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xbd:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xbe:
-               {
-                       sdwCyclesRemaining -= 23;
-                               bTemp &= 0x7f;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemWrite->lowAddr) && (dwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(dwAddr, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwAddr - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[dwAddr] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0xbf:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xc0:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xc1:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xc2:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xc3:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xc4:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xc5:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xc6:
-               {
-                       sdwCyclesRemaining -= 23;
-                               bTemp |= 0x01;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemWrite->lowAddr) && (dwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(dwAddr, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwAddr - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[dwAddr] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0xc7:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xc8:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xc9:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xca:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xcb:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xcc:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xcd:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xce:
-               {
-                       sdwCyclesRemaining -= 23;
-                               bTemp |= 0x02;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemWrite->lowAddr) && (dwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(dwAddr, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwAddr - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[dwAddr] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0xcf:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xd0:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xd1:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xd2:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xd3:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xd4:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xd5:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xd6:
-               {
-                       sdwCyclesRemaining -= 23;
-                               bTemp |= 0x04;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemWrite->lowAddr) && (dwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(dwAddr, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwAddr - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[dwAddr] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0xd7:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xd8:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xd9:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xda:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xdb:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xdc:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xdd:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xde:
-               {
-                       sdwCyclesRemaining -= 23;
-                               bTemp |= 0x08;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemWrite->lowAddr) && (dwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(dwAddr, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwAddr - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[dwAddr] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0xdf:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xe0:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xe1:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xe2:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xe3:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xe4:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xe5:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xe6:
-               {
-                       sdwCyclesRemaining -= 23;
-                               bTemp |= 0x10;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemWrite->lowAddr) && (dwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(dwAddr, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwAddr - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[dwAddr] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0xe7:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xe8:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xe9:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xea:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xeb:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xec:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xed:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xee:
-               {
-                       sdwCyclesRemaining -= 23;
-                               bTemp |= 0x20;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemWrite->lowAddr) && (dwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(dwAddr, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwAddr - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[dwAddr] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0xef:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xf0:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xf1:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xf2:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xf3:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xf4:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xf5:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xf6:
-               {
-                       sdwCyclesRemaining -= 23;
-                               bTemp |= 0x40;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemWrite->lowAddr) && (dwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(dwAddr, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwAddr - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[dwAddr] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0xf7:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xf8:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xf9:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xfa:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xfb:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xfc:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xfd:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-               case 0xfe:
-               {
-                       sdwCyclesRemaining -= 23;
-                               bTemp |= 0x80;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemWrite->lowAddr) && (dwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(dwAddr, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwAddr - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[dwAddr] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0xff:
-               {
-                               InvalidInstruction(4);
-                       break;
-               }
-       }
-}
-void FDHandler(void)
-{
-       switch (*pbPC++)
-       {
-               case 0x00:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x01:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x02:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x03:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x04:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x05:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x06:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x07:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x08:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x09:
-               {
-                       sdwCyclesRemaining -= 15;
-                       cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY);
-                       dwTemp = cpu.z80IY + cpu.z80BC;
-                       cpu.z80F |= ((dwTemp >> 16) & Z80_FLAG_CARRY) | (((cpu.z80IY ^ dwTemp ^ cpu.z80BC) >> 8) & Z80_FLAG_HALF_CARRY);
-                       cpu.z80IY = dwTemp & 0xffff;
-                       break;
-               }
-               case 0x0a:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x0b:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x0c:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x0d:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x0e:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x0f:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x10:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x11:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x12:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x13:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x14:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x15:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x16:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x17:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x18:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x19:
-               {
-                       sdwCyclesRemaining -= 15;
-                       cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY);
-                       dwTemp = cpu.z80IY + cpu.z80DE;
-                       cpu.z80F |= ((dwTemp >> 16) & Z80_FLAG_CARRY) | (((cpu.z80IY ^ dwTemp ^ cpu.z80DE) >> 8) & Z80_FLAG_HALF_CARRY);
-                       cpu.z80IY = dwTemp & 0xffff;
-                       break;
-               }
-               case 0x1a:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x1b:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x1c:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x1d:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x1e:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x1f:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x20:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x21:
-               {
-                       sdwCyclesRemaining -= 14;
-               cpu.z80IY = *pbPC++;
-               cpu.z80IY |= ((UINT32) *pbPC++ << 8);
-                       break;
-               }
-               case 0x22:
-               {
-                       sdwCyclesRemaining -= 20;
-                               dwAddr = *pbPC++;
-                               dwAddr |= ((UINT32) *pbPC++ << 8);
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemWrite->lowAddr) && (dwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(dwAddr, (cpu.z80IY & 0xff), psMemWrite);
-                                                       psMemWrite->memoryCall(dwAddr + 1, (cpu.z80IY >> 8), psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwAddr - psMemWrite->lowAddr)) = cpu.z80IY;
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwAddr - psMemWrite->lowAddr) + 1) = cpu.z80IY >> 8;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[dwAddr] = (UINT8) cpu.z80IY;
-                                       cpu.z80Base[dwAddr + 1] = (UINT8) ((UINT32) cpu.z80IY >> 8);
-                               }
-
-                       break;
-               }
-               case 0x23:
-               {
-                       sdwCyclesRemaining -= 10;
-                               cpu.z80IY++;
-                               cpu.z80IY &= 0xffff;
-                       break;
-               }
-               case 0x24:
-               {
-                       sdwCyclesRemaining -= 9;
-                               cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= bPostIncFlags[cpu.z80YH++];
-                       break;
-               }
-               case 0x25:
-               {
-                       sdwCyclesRemaining -= 9;
-                               cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= bPostDecFlags[cpu.z80YH--];
-                       break;
-               }
-               case 0x26:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80YH = *pbPC++;
-                       break;
-               }
-               case 0x27:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x28:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x29:
-               {
-                       sdwCyclesRemaining -= 15;
-                       cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY);
-                       dwTemp = cpu.z80IY + cpu.z80IY;
-                       cpu.z80F |= ((dwTemp >> 16) & Z80_FLAG_CARRY) | (((cpu.z80IY ^ dwTemp ^ cpu.z80HL) >> 8) & Z80_FLAG_HALF_CARRY);
-                       cpu.z80IY = dwTemp & 0xffff;
-                       break;
-               }
-               case 0x2a:
-               {
-                       sdwCyclesRemaining -= 20;
-                               dwAddr = *pbPC++;
-                               dwAddr |= ((UINT32) *pbPC++ << 8);
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemRead->lowAddr) && (dwAddr <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       cpu.z80IY = psMemRead->memoryCall(dwAddr, psMemRead);
-                                                       cpu.z80IY |= (UINT32) ((UINT32) psMemRead->memoryCall(dwAddr + 1, psMemRead) << 8);
-                                               }
-                                               else
-                                               {
-                                                       cpu.z80IY = *((UINT8 *) psMemRead->pUserArea + (dwAddr - psMemRead->lowAddr));
-                                                       cpu.z80IY |= (UINT32) ((UINT32) *((UINT8 *) psMemRead->pUserArea + (dwAddr - psMemRead->lowAddr + 1)) << 8);
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       cpu.z80IY = cpu.z80Base[dwAddr];
-                                       cpu.z80IY |= (UINT32) ((UINT32) cpu.z80Base[dwAddr + 1] << 8);
-                               }
-
-                       break;
-               }
-               case 0x2b:
-               {
-                       sdwCyclesRemaining -= 10;
-                               cpu.z80IY--;
-                               cpu.z80IY &= 0xffff;
-                       break;
-               }
-               case 0x2c:
-               {
-                       sdwCyclesRemaining -= 9;
-                               cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= bPostIncFlags[cpu.z80YL++];
-                       break;
-               }
-               case 0x2d:
-               {
-                       sdwCyclesRemaining -= 9;
-                               cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= bPostDecFlags[cpu.z80YL--];
-                       break;
-               }
-               case 0x2e:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80YL = *pbPC++;
-                       break;
-               }
-               case 0x2f:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x30:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x31:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x32:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x33:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x34:
-               {
-                       sdwCyclesRemaining -= 23;
-                               sdwAddr = (INT8) *pbPC++;       /* Get LSB first */
-                               dwAddr = (sdwAddr + (INT32) cpu.z80IY) & 0xffff;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemRead->lowAddr) && (dwAddr <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(dwAddr, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (dwAddr - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[dwAddr];
-                               }
-
-                               cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= bPostIncFlags[bTemp++];
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemWrite->lowAddr) && (dwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(dwAddr, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwAddr - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[dwAddr] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0x35:
-               {
-                       sdwCyclesRemaining -= 23;
-                               sdwAddr = (INT8) *pbPC++;       /* Get LSB first */
-                               dwAddr = (sdwAddr + (INT32) cpu.z80IY) & 0xffff;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemRead->lowAddr) && (dwAddr <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(dwAddr, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (dwAddr - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[dwAddr];
-                               }
-
-                               cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= bPostDecFlags[bTemp--];
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemWrite->lowAddr) && (dwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(dwAddr, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwAddr - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[dwAddr] = (UINT8) bTemp;
-                               }
-
-                       break;
-               }
-               case 0x36:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       // Get the offset
-                               sdwAddr = ((INT32) cpu.z80IY + sdwAddr) & 0xffff;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((sdwAddr >= psMemWrite->lowAddr) && (sdwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(sdwAddr, *pbPC++, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (sdwAddr - psMemWrite->lowAddr)) = *pbPC++;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[sdwAddr] = (UINT8) *pbPC++;
-                               }
-
-                       break;
-               }
-               case 0x37:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x38:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x39:
-               {
-                       sdwCyclesRemaining -= 15;
-                       cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY);
-                       dwTemp = cpu.z80IY + cpu.z80sp;
-                       cpu.z80F |= ((dwTemp >> 16) & Z80_FLAG_CARRY) | (((cpu.z80IY ^ dwTemp ^ cpu.z80sp) >> 8) & Z80_FLAG_HALF_CARRY);
-                       cpu.z80IY = dwTemp & 0xffff;
-                       break;
-               }
-               case 0x3a:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x3b:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x3c:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x3d:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x3e:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x3f:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x40:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x41:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x42:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x43:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x44:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80B = cpu.z80YH;
-                       break;
-               }
-               case 0x45:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80B = cpu.z80YL;
-                       break;
-               }
-               case 0x46:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       // Get the offset
-                               sdwAddr = ((INT32) cpu.z80IY + sdwAddr) & 0xffff;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((sdwAddr >= psMemRead->lowAddr) && (sdwAddr <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       cpu.z80B = psMemRead->memoryCall(sdwAddr, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       cpu.z80B = *((UINT8 *) psMemRead->pUserArea + (sdwAddr - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       cpu.z80B = cpu.z80Base[sdwAddr];
-                               }
-
-                       break;
-               }
-               case 0x47:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x48:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x49:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x4a:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x4b:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x4c:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80C = cpu.z80YH;
-                       break;
-               }
-               case 0x4d:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80C = cpu.z80YL;
-                       break;
-               }
-               case 0x4e:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       // Get the offset
-                               sdwAddr = ((INT32) cpu.z80IY + sdwAddr) & 0xffff;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((sdwAddr >= psMemRead->lowAddr) && (sdwAddr <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       cpu.z80C = psMemRead->memoryCall(sdwAddr, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       cpu.z80C = *((UINT8 *) psMemRead->pUserArea + (sdwAddr - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       cpu.z80C = cpu.z80Base[sdwAddr];
-                               }
-
-                       break;
-               }
-               case 0x4f:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x50:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x51:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x52:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x53:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x54:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80D = cpu.z80YH;
-                       break;
-               }
-               case 0x55:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80D = cpu.z80YL;
-                       break;
-               }
-               case 0x56:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       // Get the offset
-                               sdwAddr = ((INT32) cpu.z80IY + sdwAddr) & 0xffff;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((sdwAddr >= psMemRead->lowAddr) && (sdwAddr <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       cpu.z80D = psMemRead->memoryCall(sdwAddr, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       cpu.z80D = *((UINT8 *) psMemRead->pUserArea + (sdwAddr - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       cpu.z80D = cpu.z80Base[sdwAddr];
-                               }
-
-                       break;
-               }
-               case 0x57:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x58:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x59:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x5a:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x5b:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x5c:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80E = cpu.z80YH;
-                       break;
-               }
-               case 0x5d:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80E = cpu.z80YL;
-                       break;
-               }
-               case 0x5e:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       // Get the offset
-                               sdwAddr = ((INT32) cpu.z80IY + sdwAddr) & 0xffff;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((sdwAddr >= psMemRead->lowAddr) && (sdwAddr <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       cpu.z80E = psMemRead->memoryCall(sdwAddr, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       cpu.z80E = *((UINT8 *) psMemRead->pUserArea + (sdwAddr - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       cpu.z80E = cpu.z80Base[sdwAddr];
-                               }
-
-                       break;
-               }
-               case 0x5f:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x60:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80YH = cpu.z80B;
-                       break;
-               }
-               case 0x61:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80YH = cpu.z80C;
-                       break;
-               }
-               case 0x62:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80YH = cpu.z80D;
-                       break;
-               }
-               case 0x63:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80YH = cpu.z80E;
-                       break;
-               }
-               case 0x64:
-               {
-                       sdwCyclesRemaining -= 9;
-                       break;
-               }
-               case 0x65:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80YH = cpu.z80YL;
-                       break;
-               }
-               case 0x66:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       // Get the offset
-                               sdwAddr = ((INT32) cpu.z80IY + sdwAddr) & 0xffff;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((sdwAddr >= psMemRead->lowAddr) && (sdwAddr <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       cpu.z80H = psMemRead->memoryCall(sdwAddr, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       cpu.z80H = *((UINT8 *) psMemRead->pUserArea + (sdwAddr - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       cpu.z80H = cpu.z80Base[sdwAddr];
-                               }
-
-                       break;
-               }
-               case 0x67:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80YH = cpu.z80A;
-                       break;
-               }
-               case 0x68:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80YL = cpu.z80B;
-                       break;
-               }
-               case 0x69:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80YL = cpu.z80C;
-                       break;
-               }
-               case 0x6a:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80YL = cpu.z80D;
-                       break;
-               }
-               case 0x6b:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80YL = cpu.z80E;
-                       break;
-               }
-               case 0x6c:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80YL = cpu.z80YH;
-                       break;
-               }
-               case 0x6d:
-               {
-                       sdwCyclesRemaining -= 9;
-                       break;
-               }
-               case 0x6e:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       // Get the offset
-                               sdwAddr = ((INT32) cpu.z80IY + sdwAddr) & 0xffff;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((sdwAddr >= psMemRead->lowAddr) && (sdwAddr <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       cpu.z80L = psMemRead->memoryCall(sdwAddr, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       cpu.z80L = *((UINT8 *) psMemRead->pUserArea + (sdwAddr - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       cpu.z80L = cpu.z80Base[sdwAddr];
-                               }
-
-                       break;
-               }
-               case 0x6f:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80YL = cpu.z80A;
-                       break;
-               }
-               case 0x70:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       // Get the offset
-                               sdwAddr = ((INT32) cpu.z80IY + sdwAddr) & 0xffff;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((sdwAddr >= psMemWrite->lowAddr) && (sdwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(sdwAddr, cpu.z80B, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (sdwAddr - psMemWrite->lowAddr)) = cpu.z80B;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[sdwAddr] = (UINT8) cpu.z80B;
-                               }
-
-                       break;
-               }
-               case 0x71:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       // Get the offset
-                               sdwAddr = ((INT32) cpu.z80IY + sdwAddr) & 0xffff;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((sdwAddr >= psMemWrite->lowAddr) && (sdwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(sdwAddr, cpu.z80C, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (sdwAddr - psMemWrite->lowAddr)) = cpu.z80C;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[sdwAddr] = (UINT8) cpu.z80C;
-                               }
-
-                       break;
-               }
-               case 0x72:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       // Get the offset
-                               sdwAddr = ((INT32) cpu.z80IY + sdwAddr) & 0xffff;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((sdwAddr >= psMemWrite->lowAddr) && (sdwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(sdwAddr, cpu.z80D, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (sdwAddr - psMemWrite->lowAddr)) = cpu.z80D;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[sdwAddr] = (UINT8) cpu.z80D;
-                               }
-
-                       break;
-               }
-               case 0x73:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       // Get the offset
-                               sdwAddr = ((INT32) cpu.z80IY + sdwAddr) & 0xffff;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((sdwAddr >= psMemWrite->lowAddr) && (sdwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(sdwAddr, cpu.z80E, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (sdwAddr - psMemWrite->lowAddr)) = cpu.z80E;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[sdwAddr] = (UINT8) cpu.z80E;
-                               }
-
-                       break;
-               }
-               case 0x74:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       // Get the offset
-                               sdwAddr = ((INT32) cpu.z80IY + sdwAddr) & 0xffff;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((sdwAddr >= psMemWrite->lowAddr) && (sdwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(sdwAddr, cpu.z80H, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (sdwAddr - psMemWrite->lowAddr)) = cpu.z80H;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[sdwAddr] = (UINT8) cpu.z80H;
-                               }
-
-                       break;
-               }
-               case 0x75:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       // Get the offset
-                               sdwAddr = ((INT32) cpu.z80IY + sdwAddr) & 0xffff;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((sdwAddr >= psMemWrite->lowAddr) && (sdwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(sdwAddr, cpu.z80L, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (sdwAddr - psMemWrite->lowAddr)) = cpu.z80L;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[sdwAddr] = (UINT8) cpu.z80L;
-                               }
-
-                       break;
-               }
-               case 0x76:
-               {
-                       sdwCyclesRemaining -= 19;
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x77:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       // Get the offset
-                               sdwAddr = ((INT32) cpu.z80IY + sdwAddr) & 0xffff;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((sdwAddr >= psMemWrite->lowAddr) && (sdwAddr <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(sdwAddr, cpu.z80A, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (sdwAddr - psMemWrite->lowAddr)) = cpu.z80A;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[sdwAddr] = (UINT8) cpu.z80A;
-                               }
-
-                       break;
-               }
-               case 0x78:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x79:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x7a:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x7b:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x7c:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80A = cpu.z80YH;
-                       break;
-               }
-               case 0x7d:
-               {
-                       sdwCyclesRemaining -= 9;
-                       cpu.z80A = cpu.z80YL;
-                       break;
-               }
-               case 0x7e:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       // Get the offset
-                               sdwAddr = ((INT32) cpu.z80IY + sdwAddr) & 0xffff;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((sdwAddr >= psMemRead->lowAddr) && (sdwAddr <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       cpu.z80A = psMemRead->memoryCall(sdwAddr, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       cpu.z80A = *((UINT8 *) psMemRead->pUserArea + (sdwAddr - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       cpu.z80A = cpu.z80Base[sdwAddr];
-                               }
-
-                       break;
-               }
-               case 0x7f:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x80:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x81:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x82:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x83:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x84:
-               {
-                       sdwCyclesRemaining -= 9;
-                               bTemp2 = cpu.z80A + cpu.z80YH;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbAddAdcTable[((UINT32) cpu.z80A << 8) | cpu.z80YH];
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x85:
-               {
-                       sdwCyclesRemaining -= 9;
-                               bTemp2 = cpu.z80A + cpu.z80YL;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbAddAdcTable[((UINT32) cpu.z80A << 8) | cpu.z80YL];
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x86:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       /* Get LSB first */
-                               dwAddr = (sdwAddr + (INT32) cpu.z80IY) & 0xffff;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemRead->lowAddr) && (dwAddr <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(dwAddr, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (dwAddr - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[dwAddr];
-                               }
-
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbAddAdcTable[((UINT32) cpu.z80A << 8) | bTemp];
-                               cpu.z80A += bTemp;
-                       break;
-               }
-               case 0x87:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x88:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x89:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x8a:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x8b:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x8c:
-               {
-                       sdwCyclesRemaining -= 9;
-                               bTemp2 = cpu.z80A + cpu.z80YH + (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbAddAdcTable[((UINT32) cpu.z80A << 8) | cpu.z80YH | (((UINT32) cpu.z80F & Z80_FLAG_CARRY) << 16)];
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x8d:
-               {
-                       sdwCyclesRemaining -= 9;
-                               bTemp2 = cpu.z80A + cpu.z80YL + (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbAddAdcTable[((UINT32) cpu.z80A << 8) | cpu.z80YL | (((UINT32) cpu.z80F & Z80_FLAG_CARRY) << 16)];
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x8e:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       /* Get LSB first */
-                               dwAddr = (sdwAddr + (INT32) cpu.z80IY) & 0xffff;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemRead->lowAddr) && (dwAddr <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(dwAddr, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (dwAddr - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[dwAddr];
-                               }
-
-                               bTemp2 = (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbAddAdcTable[((UINT32) cpu.z80A << 8) | bTemp | (((UINT32) cpu.z80F & Z80_FLAG_CARRY) << 16)];
-                               cpu.z80A += bTemp + bTemp2;
-                       break;
-               }
-               case 0x8f:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x90:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x91:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x92:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x93:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x94:
-               {
-                       sdwCyclesRemaining -= 9;
-                               bTemp2 = cpu.z80A - cpu.z80YH;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | cpu.z80YH];
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x95:
-               {
-                       sdwCyclesRemaining -= 9;
-                               bTemp2 = cpu.z80A - cpu.z80YL;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | cpu.z80YL];
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x96:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       /* Get LSB first */
-                               dwAddr = (sdwAddr + (INT32) cpu.z80IY) & 0xffff;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemRead->lowAddr) && (dwAddr <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(dwAddr, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (dwAddr - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[dwAddr];
-                               }
-
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | bTemp];
-                               cpu.z80A -= bTemp;
-                       break;
-               }
-               case 0x97:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x98:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x99:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x9a:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x9b:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x9c:
-               {
-                       sdwCyclesRemaining -= 9;
-                               bTemp2 = cpu.z80A - cpu.z80YH - (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | cpu.z80YH | (((UINT32) cpu.z80F & Z80_FLAG_CARRY) << 16)];
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x9d:
-               {
-                       sdwCyclesRemaining -= 9;
-                               bTemp2 = cpu.z80A - cpu.z80YL - (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | cpu.z80YL | (((UINT32) cpu.z80F & Z80_FLAG_CARRY) << 16)];
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0x9e:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       /* Get LSB first */
-                               dwAddr = (sdwAddr + (INT32) cpu.z80IY) & 0xffff;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemRead->lowAddr) && (dwAddr <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(dwAddr, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (dwAddr - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[dwAddr];
-                               }
-
-                               bTemp2 = cpu.z80A;
-                               cpu.z80A = cpu.z80A - bTemp - (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) bTemp2 << 8) | bTemp | (((UINT32) cpu.z80F & Z80_FLAG_CARRY) << 16)];
-                       break;
-               }
-               case 0x9f:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xa0:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xa1:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xa2:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xa3:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xa4:
-               {
-                       sdwCyclesRemaining -= 9;
-                               cpu.z80A &= cpu.z80YH;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostANDFlags[cpu.z80A];
-
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xa5:
-               {
-                       sdwCyclesRemaining -= 9;
-                               cpu.z80A &= cpu.z80YL;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostANDFlags[cpu.z80A];
-
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xa6:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       /* Get LSB first */
-                               dwAddr = (sdwAddr + (INT32) cpu.z80IY) & 0xffff;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemRead->lowAddr) && (dwAddr <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(dwAddr, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (dwAddr - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[dwAddr];
-                               }
-
-                               cpu.z80A &= bTemp;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostANDFlags[cpu.z80A];
-
-                       break;
-               }
-               case 0xa7:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xa8:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xa9:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xaa:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xab:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xac:
-               {
-                       sdwCyclesRemaining -= 9;
-                               cpu.z80A ^= cpu.z80YH;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xad:
-               {
-                       sdwCyclesRemaining -= 9;
-                               cpu.z80A ^= cpu.z80YL;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xae:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       /* Get LSB first */
-                               dwAddr = (sdwAddr + (INT32) cpu.z80IY) & 0xffff;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemRead->lowAddr) && (dwAddr <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(dwAddr, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (dwAddr - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[dwAddr];
-                               }
-
-                               cpu.z80A ^= bTemp;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-
-                       break;
-               }
-               case 0xaf:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xb0:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xb1:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xb2:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xb3:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xb4:
-               {
-                       sdwCyclesRemaining -= 9;
-                               cpu.z80A |= cpu.z80YH;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xb5:
-               {
-                       sdwCyclesRemaining -= 9;
-                               cpu.z80A |= cpu.z80YL;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xb6:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       /* Get LSB first */
-                               dwAddr = (sdwAddr + (INT32) cpu.z80IY) & 0xffff;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemRead->lowAddr) && (dwAddr <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(dwAddr, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (dwAddr - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[dwAddr];
-                               }
-
-                               cpu.z80A |= bTemp;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-
-                       break;
-               }
-               case 0xb7:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xb8:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xb9:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xba:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xbb:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xbc:
-               {
-                       sdwCyclesRemaining -= 9;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xbd:
-               {
-                       sdwCyclesRemaining -= 9;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xbe:
-               {
-                       sdwCyclesRemaining -= 19;
-                               sdwAddr = (INT8) *pbPC++;       /* Get LSB first */
-                               dwAddr = (sdwAddr + (INT32) cpu.z80IY) & 0xffff;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemRead->lowAddr) && (dwAddr <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(dwAddr, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (dwAddr - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[dwAddr];
-                               }
-
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | bTemp];
-                       break;
-               }
-               case 0xbf:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xc0:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xc1:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xc2:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xc3:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xc4:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xc5:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xc6:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xc7:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xc8:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xc9:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xca:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xcb:
-               {
-                               DDFDCBHandler(1);
-                       break;
-               }
-               case 0xcc:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xcd:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xce:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xcf:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xd0:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xd1:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xd2:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xd3:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xd4:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xd5:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xd6:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xd7:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xd8:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xd9:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xda:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xdb:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xdc:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xdd:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xde:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xdf:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xe0:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xe1:
-               {
-                       sdwCyclesRemaining -= 14;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80sp >= psMemRead->lowAddr) && (cpu.z80sp <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       cpu.z80IY = psMemRead->memoryCall(cpu.z80sp, psMemRead);
-                                                       cpu.z80IY |= (UINT32) ((UINT32) psMemRead->memoryCall(cpu.z80sp + 1, psMemRead) << 8);
-                                               }
-                                               else
-                                               {
-                                                       cpu.z80IY = *((UINT8 *) psMemRead->pUserArea + (cpu.z80sp - psMemRead->lowAddr));
-                                                       cpu.z80IY |= (UINT32) ((UINT32) *((UINT8 *) psMemRead->pUserArea + (cpu.z80sp - psMemRead->lowAddr + 1)) << 8);
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       cpu.z80IY = cpu.z80Base[cpu.z80sp];
-                                       cpu.z80IY |= (UINT32) ((UINT32) cpu.z80Base[cpu.z80sp + 1] << 8);
-                               }
-
-                                       cpu.z80sp += 2;
-                                       pbSP = (cpu.z80Base + cpu.z80sp);       /* Normalize the stack pointer */
-                       break;
-               }
-               case 0xe2:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xe3:
-               {
-                       sdwCyclesRemaining -= 23;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80sp >= psMemRead->lowAddr) && (cpu.z80sp <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       dwAddr = psMemRead->memoryCall(cpu.z80sp, psMemRead);
-                                                       dwAddr |= (UINT32) ((UINT32) psMemRead->memoryCall(cpu.z80sp + 1, psMemRead) << 8);
-                                               }
-                                               else
-                                               {
-                                                       dwAddr = *((UINT8 *) psMemRead->pUserArea + (cpu.z80sp - psMemRead->lowAddr));
-                                                       dwAddr |= (UINT32) ((UINT32) *((UINT8 *) psMemRead->pUserArea + (cpu.z80sp - psMemRead->lowAddr + 1)) << 8);
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       dwAddr = cpu.z80Base[cpu.z80sp];
-                                       dwAddr |= (UINT32) ((UINT32) cpu.z80Base[cpu.z80sp + 1] << 8);
-                               }
-
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80sp >= psMemWrite->lowAddr) && (cpu.z80sp <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80sp, (cpu.z80IY & 0xff), psMemWrite);
-                                                       psMemWrite->memoryCall(cpu.z80sp + 1, (cpu.z80IY >> 8), psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80sp - psMemWrite->lowAddr)) = cpu.z80IY;
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80sp - psMemWrite->lowAddr) + 1) = cpu.z80IY >> 8;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80sp] = (UINT8) cpu.z80IY;
-                                       cpu.z80Base[cpu.z80sp + 1] = (UINT8) ((UINT32) cpu.z80IY >> 8);
-                               }
-
-                               cpu.z80IY = dwAddr;
-                       break;
-               }
-               case 0xe4:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xe5:
-               {
-                       sdwCyclesRemaining -= 15;
-                                       cpu.z80sp -= 2;
-                                       pbSP = (cpu.z80Base + cpu.z80sp);       /* Normalize the stack pointer */
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80sp >= psMemWrite->lowAddr) && (cpu.z80sp <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80sp, (cpu.z80IY & 0xff), psMemWrite);
-                                                       psMemWrite->memoryCall(cpu.z80sp + 1, (cpu.z80IY >> 8), psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80sp - psMemWrite->lowAddr)) = cpu.z80IY;
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80sp - psMemWrite->lowAddr) + 1) = cpu.z80IY >> 8;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80sp] = (UINT8) cpu.z80IY;
-                                       cpu.z80Base[cpu.z80sp + 1] = (UINT8) ((UINT32) cpu.z80IY >> 8);
-                               }
-
-                       break;
-               }
-               case 0xe6:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xe7:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xe8:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xe9:
-               {
-                       sdwCyclesRemaining -= 8;
-                               pbPC = cpu.z80Base + cpu.z80IY;
-                       break;
-               }
-               case 0xea:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xeb:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xec:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xed:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xee:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xef:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xf0:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xf1:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xf2:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xf3:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xf4:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xf5:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xf6:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xf7:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xf8:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xf9:
-               {
-                       sdwCyclesRemaining -= 10;
-                               cpu.z80sp = cpu.z80IY;
-                       break;
-               }
-               case 0xfa:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xfb:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xfc:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xfd:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xfe:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-               case 0xff:
-               {
-                               InvalidInstruction(2);
-                       break;
-               }
-       }
-}
-/* Main execution entry point */
-
-UINT32 mz80exec(UINT32 dwCycles)
-{
-       UINT8 bOpcode;
-
-       dwReturnCode = 0x80000000; /* Assume it'll work */
-       sdwCyclesRemaining = dwCycles;
-       dwOriginalCycles = dwCycles;
-               if (cpu.z80halted)
-               {
-               dwElapsedTicks += dwCycles;
-               return(0x80000000);
-               }
-
-       pbPC = cpu.z80Base + cpu.z80pc;
-
-       while (sdwCyclesRemaining > 0)
-       {
-               bOpcode = *pbPC++;
-               switch (bOpcode)
-               {
-                       case 0x00:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               /* Intentionally not doing anything - NOP! */
-                               break;
-                       }
-                       case 0x01:
-                       {
-                               sdwCyclesRemaining -= 10;
-                               cpu.z80BC = *pbPC++;    /* LSB First */
-                               cpu.z80BC |= (((UINT32) *pbPC++ << 8)); /* Now the MSB */
-                               break;
-                       }
-                       case 0x02:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80BC >= psMemWrite->lowAddr) && (cpu.z80BC <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80BC, cpu.z80A, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80BC - psMemWrite->lowAddr)) = cpu.z80A;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80BC] = (UINT8) cpu.z80A;
-                               }
-
-                               break;
-                       }
-                       case 0x03:
-                       {
-                               sdwCyclesRemaining -= 6;
-                               cpu.z80BC++;
-                               cpu.z80BC &= 0xffff;
-                               break;
-                       }
-                       case 0x04:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= bPostIncFlags[cpu.z80B++];
-                               break;
-                       }
-                       case 0x05:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY);
-                               cpu.z80F |= bPostDecFlags[cpu.z80B--];
-                               break;
-                       }
-                       case 0x06:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               cpu.z80B = *pbPC++;     /* Get immediate byte into register */
-                               break;
-                       }
-                       case 0x07:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY);
-                               cpu.z80F |= (cpu.z80A >> 7);
-                               cpu.z80A = (cpu.z80A << 1) | (cpu.z80A >> 7);
-                               break;
-                       }
-                       case 0x08:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               dwAddr = (UINT32) cpu.z80AF;
-                               cpu.z80AF = cpu.z80afprime;
-                               cpu.z80afprime = dwAddr;
-                               break;
-                       }
-                       case 0x09:
-                       {
-                               sdwCyclesRemaining -= 11;
-                       cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY);
-                       dwTemp = cpu.z80HL + cpu.z80BC;
-                       cpu.z80F |= ((dwTemp >> 16) & Z80_FLAG_CARRY) | (((cpu.z80HL ^ dwTemp ^ cpu.z80BC) >> 8) & Z80_FLAG_HALF_CARRY);
-                       cpu.z80HL = dwTemp & 0xffff;
-                               break;
-                       }
-                       case 0x0a:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80BC >= psMemRead->lowAddr) && (cpu.z80BC <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       cpu.z80A = psMemRead->memoryCall(cpu.z80BC, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       cpu.z80A = *((UINT8 *) psMemRead->pUserArea + (cpu.z80BC - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       cpu.z80A = cpu.z80Base[cpu.z80BC];
-                               }
-
-                               break;
-                       }
-                       case 0x0b:
-                       {
-                               sdwCyclesRemaining -= 6;
-                               cpu.z80BC--;
-                               cpu.z80BC &= 0xffff;
-                               break;
-                       }
-                       case 0x0c:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= bPostIncFlags[cpu.z80C++];
-                               break;
-                       }
-                       case 0x0d:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY);
-                               cpu.z80F |= bPostDecFlags[cpu.z80C--];
-                               break;
-                       }
-                       case 0x0e:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               cpu.z80C = *pbPC++;     /* Get immediate byte into register */
-                               break;
-                       }
-                       case 0x0f:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY);
-                               cpu.z80F |= (cpu.z80A & Z80_FLAG_CARRY);
-                               cpu.z80A = (cpu.z80A >> 1) | (cpu.z80A << 7);
-                               break;
-                       }
-                       case 0x10:
-                       {
-                               sdwCyclesRemaining -= 8;
-                               sdwAddr = (INT8) *pbPC++;       /* Get LSB first */
-                               if (--cpu.z80B)
-                               {
-                                       dwElapsedTicks += 5;    /* 5 More for jump taken */
-                                       cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                       sdwAddr = (sdwAddr + (INT32) cpu.z80pc) & 0xffff;
-                                       pbPC = cpu.z80Base + sdwAddr;   /* Normalize the address */
-                               }
-                               break;
-                       }
-                       case 0x11:
-                       {
-                               sdwCyclesRemaining -= 10;
-                               cpu.z80DE = *pbPC++;    /* LSB First */
-                               cpu.z80DE |= (((UINT32) *pbPC++ << 8)); /* Now the MSB */
-                               break;
-                       }
-                       case 0x12:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80DE >= psMemWrite->lowAddr) && (cpu.z80DE <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80DE, cpu.z80A, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80DE - psMemWrite->lowAddr)) = cpu.z80A;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80DE] = (UINT8) cpu.z80A;
-                               }
-
-                               break;
-                       }
-                       case 0x13:
-                       {
-                               sdwCyclesRemaining -= 6;
-                               cpu.z80DE++;
-                               cpu.z80DE &= 0xffff;
-                               break;
-                       }
-                       case 0x14:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= bPostIncFlags[cpu.z80D++];
-                               break;
-                       }
-                       case 0x15:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY);
-                               cpu.z80F |= bPostDecFlags[cpu.z80D--];
-                               break;
-                       }
-                       case 0x16:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               cpu.z80D = *pbPC++;     /* Get immediate byte into register */
-                               break;
-                       }
-                       case 0x17:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               bTemp = cpu.z80A >> 7;
-                               cpu.z80A = (cpu.z80A << 1) | (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY)) | bTemp;
-                               break;
-                       }
-                       case 0x18:
-                       {
-                               sdwCyclesRemaining -= 12;
-                               sdwAddr = (INT8) *pbPC++;       /* Get LSB first */
-                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                               sdwAddr = (sdwAddr + (INT32) cpu.z80pc) & 0xffff;
-                               {
-                               sdwCyclesRemaining -= 5;
-                                       pbPC = cpu.z80Base + sdwAddr;   /* Normalize the address */
-                               }
-                               break;
-                       }
-                       case 0x19:
-                       {
-                               sdwCyclesRemaining -= 11;
-                       cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY);
-                       dwTemp = cpu.z80HL + cpu.z80DE;
-                       cpu.z80F |= ((dwTemp >> 16) & Z80_FLAG_CARRY) | (((cpu.z80HL ^ dwTemp ^ cpu.z80DE) >> 8) & Z80_FLAG_HALF_CARRY);
-                       cpu.z80HL = dwTemp & 0xffff;
-                               break;
-                       }
-                       case 0x1a:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80DE >= psMemRead->lowAddr) && (cpu.z80DE <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       cpu.z80A = psMemRead->memoryCall(cpu.z80DE, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       cpu.z80A = *((UINT8 *) psMemRead->pUserArea + (cpu.z80DE - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       cpu.z80A = cpu.z80Base[cpu.z80DE];
-                               }
-
-                               break;
-                       }
-                       case 0x1b:
-                       {
-                               sdwCyclesRemaining -= 6;
-                               cpu.z80DE--;
-                               cpu.z80DE &= 0xffff;
-                               break;
-                       }
-                       case 0x1c:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= bPostIncFlags[cpu.z80E++];
-                               break;
-                       }
-                       case 0x1d:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY);
-                               cpu.z80F |= bPostDecFlags[cpu.z80E--];
-                               break;
-                       }
-                       case 0x1e:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               cpu.z80E = *pbPC++;     /* Get immediate byte into register */
-                               break;
-                       }
-                       case 0x1f:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               bTemp = (cpu.z80F & Z80_FLAG_CARRY) << 7;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY)) | (cpu.z80A & Z80_FLAG_CARRY);
-                               cpu.z80A = ((cpu.z80A >> 1) | bTemp);
-                               break;
-                       }
-                       case 0x20:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               sdwAddr = (INT8) *pbPC++;       /* Get LSB first */
-                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                               sdwAddr = (sdwAddr + (INT32) cpu.z80pc) & 0xffff;
-                               if (!(cpu.z80F & Z80_FLAG_ZERO))
-                               {
-                               sdwCyclesRemaining -= 5;
-                                       pbPC = cpu.z80Base + sdwAddr;   /* Normalize the address */
-                               }
-                               break;
-                       }
-                       case 0x21:
-                       {
-                               sdwCyclesRemaining -= 10;
-                               cpu.z80HL = *pbPC++;    /* LSB First */
-                               cpu.z80HL |= (((UINT32) *pbPC++ << 8)); /* Now the MSB */
-                               break;
-                       }
-                       case 0x22:
-                       {
-                               sdwCyclesRemaining -= 16;
-                               dwTemp = *pbPC++;
-                               dwTemp |= ((UINT32) *pbPC++ << 8);
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwTemp >= psMemWrite->lowAddr) && (dwTemp <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(dwTemp, (cpu.z80HL & 0xff), psMemWrite);
-                                                       psMemWrite->memoryCall(dwTemp + 1, (cpu.z80HL >> 8), psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwTemp - psMemWrite->lowAddr)) = cpu.z80HL;
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwTemp - psMemWrite->lowAddr) + 1) = cpu.z80HL >> 8;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[dwTemp] = (UINT8) cpu.z80HL;
-                                       cpu.z80Base[dwTemp + 1] = (UINT8) ((UINT32) cpu.z80HL >> 8);
-                               }
-
-                               break;
-                       }
-                       case 0x23:
-                       {
-                               sdwCyclesRemaining -= 6;
-                               cpu.z80HL++;
-                               cpu.z80HL &= 0xffff;
-                               break;
-                       }
-                       case 0x24:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= bPostIncFlags[cpu.z80H++];
-                               break;
-                       }
-                       case 0x25:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY);
-                               cpu.z80F |= bPostDecFlags[cpu.z80H--];
-                               break;
-                       }
-                       case 0x26:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               cpu.z80H = *pbPC++;     /* Get immediate byte into register */
-                               break;
-                       }
-                       case 0x27:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               dwAddr = (((cpu.z80F & Z80_FLAG_CARRY) | 
-                                               ((cpu.z80F & Z80_FLAG_HALF_CARRY) >> 3) | 
-                                               ((cpu.z80F & Z80_FLAG_NEGATIVE) << 1)) << 8) | cpu.z80A;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= (wDAATable[dwAddr] >> 8);
-                               cpu.z80A = wDAATable[dwAddr] & 0xff;
-                               break;
-                       }
-                       case 0x28:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               sdwAddr = (INT8) *pbPC++;       /* Get LSB first */
-                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                               sdwAddr = (sdwAddr + (INT32) cpu.z80pc) & 0xffff;
-                               if (cpu.z80F & Z80_FLAG_ZERO)
-                               {
-                               sdwCyclesRemaining -= 5;
-                                       pbPC = cpu.z80Base + sdwAddr;   /* Normalize the address */
-                               }
-                               break;
-                       }
-                       case 0x29:
-                       {
-                               sdwCyclesRemaining -= 11;
-                       cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY);
-                       dwTemp = cpu.z80HL + cpu.z80HL;
-                       cpu.z80F |= ((dwTemp >> 16) & Z80_FLAG_CARRY) | (((cpu.z80HL ^ dwTemp ^ cpu.z80HL) >> 8) & Z80_FLAG_HALF_CARRY);
-                       cpu.z80HL = dwTemp & 0xffff;
-                               break;
-                       }
-                       case 0x2a:
-                       {
-                               sdwCyclesRemaining -= 16;
-                               dwAddr = *pbPC++;
-                               dwAddr |= ((UINT32) *pbPC++ << 8);
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwAddr >= psMemRead->lowAddr) && (dwAddr <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       cpu.z80HL = psMemRead->memoryCall(dwAddr, psMemRead);
-                                                       cpu.z80HL |= (UINT32) ((UINT32) psMemRead->memoryCall(dwAddr + 1, psMemRead) << 8);
-                                               }
-                                               else
-                                               {
-                                                       cpu.z80HL = *((UINT8 *) psMemRead->pUserArea + (dwAddr - psMemRead->lowAddr));
-                                                       cpu.z80HL |= (UINT32) ((UINT32) *((UINT8 *) psMemRead->pUserArea + (dwAddr - psMemRead->lowAddr + 1)) << 8);
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       cpu.z80HL = cpu.z80Base[dwAddr];
-                                       cpu.z80HL |= (UINT32) ((UINT32) cpu.z80Base[dwAddr + 1] << 8);
-                               }
-
-                               break;
-                       }
-                       case 0x2b:
-                       {
-                               sdwCyclesRemaining -= 6;
-                               cpu.z80HL--;
-                               cpu.z80HL &= 0xffff;
-                               break;
-                       }
-                       case 0x2c:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= bPostIncFlags[cpu.z80L++];
-                               break;
-                       }
-                       case 0x2d:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY);
-                               cpu.z80F |= bPostDecFlags[cpu.z80L--];
-                               break;
-                       }
-                       case 0x2e:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               cpu.z80L = *pbPC++;     /* Get immediate byte into register */
-                               break;
-                       }
-                       case 0x2f:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80A ^= 0xff;
-                               cpu.z80F |= (Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY);
-                               break;
-                       }
-                       case 0x30:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               sdwAddr = (INT8) *pbPC++;       /* Get LSB first */
-                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                               sdwAddr = (sdwAddr + (INT32) cpu.z80pc) & 0xffff;
-                               if (!(cpu.z80F & Z80_FLAG_CARRY))
-                               {
-                               sdwCyclesRemaining -= 5;
-                                       pbPC = cpu.z80Base + sdwAddr;   /* Normalize the address */
-                               }
-                               break;
-                       }
-                       case 0x31:
-                       {
-                               sdwCyclesRemaining -= 10;
-                               cpu.z80sp = *pbPC++;    /* LSB First */
-                               cpu.z80sp |= (((UINT32) *pbPC++ << 8)); /* Now the MSB */
-                               break;
-                       }
-                       case 0x32:
-                       {
-                               sdwCyclesRemaining -= 13;
-                               dwTemp = *pbPC++;
-                               dwTemp |= ((UINT32) *pbPC++ << 8);
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwTemp >= psMemWrite->lowAddr) && (dwTemp <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(dwTemp, cpu.z80A, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (dwTemp - psMemWrite->lowAddr)) = cpu.z80A;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[dwTemp] = (UINT8) cpu.z80A;
-                               }
-
-                               break;
-                       }
-                       case 0x33:
-                       {
-                               sdwCyclesRemaining -= 6;
-                               cpu.z80sp++;
-                               cpu.z80sp &= 0xffff;
-                               break;
-                       }
-                       case 0x34:
-                       {
-                               sdwCyclesRemaining -= 11;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= bPostIncFlags[bTemp];
-                               bTemp++;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) bTemp;
-                               }
-
-                               break;
-                       }
-                       case 0x35:
-                       {
-                               sdwCyclesRemaining -= 11;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= bPostDecFlags[bTemp];
-                               bTemp--;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, bTemp, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = bTemp;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) bTemp;
-                               }
-
-                               break;
-                       }
-                       case 0x36:
-                       {
-                               sdwCyclesRemaining -= 10;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, *pbPC++, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = *pbPC++;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) *pbPC++;
-                               }
-
-                               break;
-                       }
-                       case 0x37:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= Z80_FLAG_CARRY;
-                               break;
-                       }
-                       case 0x38:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               sdwAddr = (INT8) *pbPC++;       /* Get LSB first */
-                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                               sdwAddr = (sdwAddr + (INT32) cpu.z80pc) & 0xffff;
-                               if (cpu.z80F & Z80_FLAG_CARRY)
-                               {
-                               sdwCyclesRemaining -= 5;
-                                       pbPC = cpu.z80Base + sdwAddr;   /* Normalize the address */
-                               }
-                               break;
-                       }
-                       case 0x39:
-                       {
-                               sdwCyclesRemaining -= 11;
-                       cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY);
-                       dwTemp = cpu.z80HL + cpu.z80sp;
-                       cpu.z80F |= ((dwTemp >> 16) & Z80_FLAG_CARRY) | (((cpu.z80HL ^ dwTemp ^ cpu.z80sp) >> 8) & Z80_FLAG_HALF_CARRY);
-                       cpu.z80HL = dwTemp & 0xffff;
-                               break;
-                       }
-                       case 0x3a:
-                       {
-                               sdwCyclesRemaining -= 13;
-                               dwTemp = *pbPC++;
-                               dwTemp |= (((UINT32) *pbPC++) << 8);
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((dwTemp >= psMemRead->lowAddr) && (dwTemp <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       cpu.z80A = psMemRead->memoryCall(dwTemp, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       cpu.z80A = *((UINT8 *) psMemRead->pUserArea + (dwTemp - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       cpu.z80A = cpu.z80Base[dwTemp];
-                               }
-
-                               break;
-                       }
-                       case 0x3b:
-                       {
-                               sdwCyclesRemaining -= 6;
-                               cpu.z80sp--;
-                               cpu.z80sp &= 0xffff;
-                               break;
-                       }
-                       case 0x3c:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F |= bPostIncFlags[cpu.z80A++];
-                               break;
-                       }
-                       case 0x3d:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY);
-                               cpu.z80F |= bPostDecFlags[cpu.z80A--];
-                               break;
-                       }
-                       case 0x3e:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               cpu.z80A = *pbPC++;     /* Get immediate byte into register */
-                               break;
-                       }
-                       case 0x3f:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               bTemp = (cpu.z80F & Z80_FLAG_CARRY) << 4;
-                               cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE);
-                               cpu.z80F ^= Z80_FLAG_CARRY;
-                               break;
-                       }
-                       case 0x40:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               break;
-                       }
-                       case 0x41:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80B = cpu.z80C;
-                               break;
-                       }
-                       case 0x42:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80B = cpu.z80D;
-                               break;
-                       }
-                       case 0x43:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80B = cpu.z80E;
-                               break;
-                       }
-                       case 0x44:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80B = cpu.z80H;
-                               break;
-                       }
-                       case 0x45:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80B = cpu.z80L;
-                               break;
-                       }
-                       case 0x46:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       cpu.z80B = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       cpu.z80B = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       cpu.z80B = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               break;
-                       }
-                       case 0x47:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80B = cpu.z80A;
-                               break;
-                       }
-                       case 0x48:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80C = cpu.z80B;
-                               break;
-                       }
-                       case 0x49:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               break;
-                       }
-                       case 0x4a:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80C = cpu.z80D;
-                               break;
-                       }
-                       case 0x4b:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80C = cpu.z80E;
-                               break;
-                       }
-                       case 0x4c:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80C = cpu.z80H;
-                               break;
-                       }
-                       case 0x4d:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80C = cpu.z80L;
-                               break;
-                       }
-                       case 0x4e:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       cpu.z80C = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       cpu.z80C = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       cpu.z80C = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               break;
-                       }
-                       case 0x4f:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80C = cpu.z80A;
-                               break;
-                       }
-                       case 0x50:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80D = cpu.z80B;
-                               break;
-                       }
-                       case 0x51:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80D = cpu.z80C;
-                               break;
-                       }
-                       case 0x52:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               break;
-                       }
-                       case 0x53:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80D = cpu.z80E;
-                               break;
-                       }
-                       case 0x54:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80D = cpu.z80H;
-                               break;
-                       }
-                       case 0x55:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80D = cpu.z80L;
-                               break;
-                       }
-                       case 0x56:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       cpu.z80D = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       cpu.z80D = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       cpu.z80D = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               break;
-                       }
-                       case 0x57:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80D = cpu.z80A;
-                               break;
-                       }
-                       case 0x58:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80E = cpu.z80B;
-                               break;
-                       }
-                       case 0x59:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80E = cpu.z80C;
-                               break;
-                       }
-                       case 0x5a:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80E = cpu.z80D;
-                               break;
-                       }
-                       case 0x5b:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               break;
-                       }
-                       case 0x5c:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80E = cpu.z80H;
-                               break;
-                       }
-                       case 0x5d:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80E = cpu.z80L;
-                               break;
-                       }
-                       case 0x5e:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       cpu.z80E = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       cpu.z80E = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       cpu.z80E = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               break;
-                       }
-                       case 0x5f:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80E = cpu.z80A;
-                               break;
-                       }
-                       case 0x60:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80H = cpu.z80B;
-                               break;
-                       }
-                       case 0x61:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80H = cpu.z80C;
-                               break;
-                       }
-                       case 0x62:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80H = cpu.z80D;
-                               break;
-                       }
-                       case 0x63:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80H = cpu.z80E;
-                               break;
-                       }
-                       case 0x64:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               break;
-                       }
-                       case 0x65:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80H = cpu.z80L;
-                               break;
-                       }
-                       case 0x66:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       cpu.z80H = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       cpu.z80H = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       cpu.z80H = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               break;
-                       }
-                       case 0x67:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80H = cpu.z80A;
-                               break;
-                       }
-                       case 0x68:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80L = cpu.z80B;
-                               break;
-                       }
-                       case 0x69:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80L = cpu.z80C;
-                               break;
-                       }
-                       case 0x6a:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80L = cpu.z80D;
-                               break;
-                       }
-                       case 0x6b:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80L = cpu.z80E;
-                               break;
-                       }
-                       case 0x6c:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80L = cpu.z80H;
-                               break;
-                       }
-                       case 0x6d:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               break;
-                       }
-                       case 0x6e:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       cpu.z80L = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       cpu.z80L = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       cpu.z80L = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               break;
-                       }
-                       case 0x6f:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80L = cpu.z80A;
-                               break;
-                       }
-                       case 0x70:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, cpu.z80B, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = cpu.z80B;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) cpu.z80B;
-                               }
-
-                               break;
-                       }
-                       case 0x71:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, cpu.z80C, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = cpu.z80C;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) cpu.z80C;
-                               }
-
-                               break;
-                       }
-                       case 0x72:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, cpu.z80D, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = cpu.z80D;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) cpu.z80D;
-                               }
-
-                               break;
-                       }
-                       case 0x73:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, cpu.z80E, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = cpu.z80E;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) cpu.z80E;
-                               }
-
-                               break;
-                       }
-                       case 0x74:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, cpu.z80H, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = cpu.z80H;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) cpu.z80H;
-                               }
-
-                               break;
-                       }
-                       case 0x75:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, cpu.z80L, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = cpu.z80L;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) cpu.z80L;
-                               }
-
-                               break;
-                       }
-                       case 0x76:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80halted = 1;
-                               dwElapsedTicks += sdwCyclesRemaining;
-                               sdwCyclesRemaining = 0;
-                               break;
-                       }
-                       case 0x77:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemWrite->lowAddr) && (cpu.z80HL <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80HL, cpu.z80A, psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80HL - psMemWrite->lowAddr)) = cpu.z80A;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80HL] = (UINT8) cpu.z80A;
-                               }
-
-                               break;
-                       }
-                       case 0x78:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80A = cpu.z80B;
-                               break;
-                       }
-                       case 0x79:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80A = cpu.z80C;
-                               break;
-                       }
-                       case 0x7a:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80A = cpu.z80D;
-                               break;
-                       }
-                       case 0x7b:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80A = cpu.z80E;
-                               break;
-                       }
-                       case 0x7c:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80A = cpu.z80H;
-                               break;
-                       }
-                       case 0x7d:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80A = cpu.z80L;
-                               break;
-                       }
-                       case 0x7e:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       cpu.z80A = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       cpu.z80A = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       cpu.z80A = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               break;
-                       }
-                       case 0x7f:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               break;
-                       }
-                       case 0x80:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               bTemp2 = cpu.z80A + cpu.z80B;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbAddAdcTable[((UINT32) cpu.z80A << 8) | cpu.z80B];
-                               cpu.z80A = bTemp2;
-                               break;
-                       }
-                       case 0x81:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               bTemp2 = cpu.z80A + cpu.z80C;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbAddAdcTable[((UINT32) cpu.z80A << 8) | cpu.z80C];
-                               cpu.z80A = bTemp2;
-                               break;
-                       }
-                       case 0x82:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               bTemp2 = cpu.z80A + cpu.z80D;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbAddAdcTable[((UINT32) cpu.z80A << 8) | cpu.z80D];
-                               cpu.z80A = bTemp2;
-                               break;
-                       }
-                       case 0x83:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               bTemp2 = cpu.z80A + cpu.z80E;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbAddAdcTable[((UINT32) cpu.z80A << 8) | cpu.z80E];
-                               cpu.z80A = bTemp2;
-                               break;
-                       }
-                       case 0x84:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               bTemp2 = cpu.z80A + cpu.z80H;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbAddAdcTable[((UINT32) cpu.z80A << 8) | cpu.z80H];
-                               cpu.z80A = bTemp2;
-                               break;
-                       }
-                       case 0x85:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               bTemp2 = cpu.z80A + cpu.z80L;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbAddAdcTable[((UINT32) cpu.z80A << 8) | cpu.z80L];
-                               cpu.z80A = bTemp2;
-                               break;
-                       }
-                       case 0x86:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               bTemp2 = cpu.z80A + bTemp;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbAddAdcTable[((UINT32) cpu.z80A << 8) | bTemp];
-                               cpu.z80A = bTemp2;
-                               break;
-                       }
-                       case 0x87:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               bTemp2 = cpu.z80A + cpu.z80A;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbAddAdcTable[((UINT32) cpu.z80A << 8) | cpu.z80A];
-                               cpu.z80A = bTemp2;
-                               break;
-                       }
-                       case 0x88:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               bTemp2 = cpu.z80A + cpu.z80B + (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbAddAdcTable[((UINT32) cpu.z80A << 8) | cpu.z80B | (((UINT32) cpu.z80F & Z80_FLAG_CARRY) << 16)];
-                               cpu.z80A = bTemp2;
-                               break;
-                       }
-                       case 0x89:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               bTemp2 = cpu.z80A + cpu.z80C + (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbAddAdcTable[((UINT32) cpu.z80A << 8) | cpu.z80C | (((UINT32) cpu.z80F & Z80_FLAG_CARRY) << 16)];
-                               cpu.z80A = bTemp2;
-                               break;
-                       }
-                       case 0x8a:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               bTemp2 = cpu.z80A + cpu.z80D + (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbAddAdcTable[((UINT32) cpu.z80A << 8) | cpu.z80D | (((UINT32) cpu.z80F & Z80_FLAG_CARRY) << 16)];
-                               cpu.z80A = bTemp2;
-                               break;
-                       }
-                       case 0x8b:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               bTemp2 = cpu.z80A + cpu.z80E + (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbAddAdcTable[((UINT32) cpu.z80A << 8) | cpu.z80E | (((UINT32) cpu.z80F & Z80_FLAG_CARRY) << 16)];
-                               cpu.z80A = bTemp2;
-                               break;
-                       }
-                       case 0x8c:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               bTemp2 = cpu.z80A + cpu.z80H + (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbAddAdcTable[((UINT32) cpu.z80A << 8) | cpu.z80H | (((UINT32) cpu.z80F & Z80_FLAG_CARRY) << 16)];
-                               cpu.z80A = bTemp2;
-                               break;
-                       }
-                       case 0x8d:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               bTemp2 = cpu.z80A + cpu.z80L + (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbAddAdcTable[((UINT32) cpu.z80A << 8) | cpu.z80L | (((UINT32) cpu.z80F & Z80_FLAG_CARRY) << 16)];
-                               cpu.z80A = bTemp2;
-                               break;
-                       }
-                       case 0x8e:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               bTemp2 = cpu.z80A + bTemp + (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbAddAdcTable[((UINT32) cpu.z80A << 8) | bTemp | (((UINT32) cpu.z80F & Z80_FLAG_CARRY) << 16)];
-                               cpu.z80A = bTemp2;
-                               break;
-                       }
-                       case 0x8f:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               bTemp2 = cpu.z80A + cpu.z80A + (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbAddAdcTable[((UINT32) cpu.z80A << 8) | cpu.z80A | (((UINT32) cpu.z80F & Z80_FLAG_CARRY) << 16)];
-                               cpu.z80A = bTemp2;
-                               break;
-                       }
-                       case 0x90:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               bTemp2 = cpu.z80A - cpu.z80B;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | cpu.z80B];
-                               cpu.z80A = bTemp2;
-                               break;
-                       }
-                       case 0x91:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               bTemp2 = cpu.z80A - cpu.z80C;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | cpu.z80C];
-                               cpu.z80A = bTemp2;
-                               break;
-                       }
-                       case 0x92:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               bTemp2 = cpu.z80A - cpu.z80D;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | cpu.z80D];
-                               cpu.z80A = bTemp2;
-                               break;
-                       }
-                       case 0x93:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               bTemp2 = cpu.z80A - cpu.z80E;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | cpu.z80E];
-                               cpu.z80A = bTemp2;
-                               break;
-                       }
-                       case 0x94:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               bTemp2 = cpu.z80A - cpu.z80H;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | cpu.z80H];
-                               cpu.z80A = bTemp2;
-                               break;
-                       }
-                       case 0x95:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               bTemp2 = cpu.z80A - cpu.z80L;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | cpu.z80L];
-                               cpu.z80A = bTemp2;
-                               break;
-                       }
-                       case 0x96:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               bTemp2 = cpu.z80A - bTemp;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | bTemp];
-                               cpu.z80A = bTemp2;
-                               break;
-                       }
-                       case 0x97:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               bTemp2 = cpu.z80A - cpu.z80A;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | cpu.z80A];
-                               cpu.z80A = bTemp2;
-                               break;
-                       }
-                       case 0x98:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               bTemp2 = cpu.z80A - cpu.z80B - (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | cpu.z80B | (((UINT32) cpu.z80F & Z80_FLAG_CARRY) << 16)];
-                               cpu.z80A = bTemp2;
-                               break;
-                       }
-                       case 0x99:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               bTemp2 = cpu.z80A - cpu.z80C - (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | cpu.z80C | (((UINT32) cpu.z80F & Z80_FLAG_CARRY) << 16)];
-                               cpu.z80A = bTemp2;
-                               break;
-                       }
-                       case 0x9a:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               bTemp2 = cpu.z80A - cpu.z80D - (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | cpu.z80D | (((UINT32) cpu.z80F & Z80_FLAG_CARRY) << 16)];
-                               cpu.z80A = bTemp2;
-                               break;
-                       }
-                       case 0x9b:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               bTemp2 = cpu.z80A - cpu.z80E - (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | cpu.z80E | (((UINT32) cpu.z80F & Z80_FLAG_CARRY) << 16)];
-                               cpu.z80A = bTemp2;
-                               break;
-                       }
-                       case 0x9c:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               bTemp2 = cpu.z80A - cpu.z80H - (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | cpu.z80H | (((UINT32) cpu.z80F & Z80_FLAG_CARRY) << 16)];
-                               cpu.z80A = bTemp2;
-                               break;
-                       }
-                       case 0x9d:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               bTemp2 = cpu.z80A - cpu.z80L - (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | cpu.z80L | (((UINT32) cpu.z80F & Z80_FLAG_CARRY) << 16)];
-                               cpu.z80A = bTemp2;
-                               break;
-                       }
-                       case 0x9e:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               bTemp2 = cpu.z80A - bTemp - (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | bTemp | (((UINT32) cpu.z80F & Z80_FLAG_CARRY) << 16)];
-                               cpu.z80A = bTemp2;
-                               break;
-                       }
-                       case 0x9f:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               bTemp2 = cpu.z80A - cpu.z80A - (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | cpu.z80A | (((UINT32) cpu.z80F & Z80_FLAG_CARRY) << 16)];
-                               cpu.z80A = bTemp2;
-                               break;
-                       }
-                       case 0xa0:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80A &= cpu.z80B;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostANDFlags[cpu.z80A];
-
-                               break;
-                       }
-                       case 0xa1:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80A &= cpu.z80C;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostANDFlags[cpu.z80A];
-
-                               break;
-                       }
-                       case 0xa2:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80A &= cpu.z80D;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostANDFlags[cpu.z80A];
-
-                               break;
-                       }
-                       case 0xa3:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80A &= cpu.z80E;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostANDFlags[cpu.z80A];
-
-                               break;
-                       }
-                       case 0xa4:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80A &= cpu.z80H;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostANDFlags[cpu.z80A];
-
-                               break;
-                       }
-                       case 0xa5:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80A &= cpu.z80L;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostANDFlags[cpu.z80A];
-
-                               break;
-                       }
-                       case 0xa6:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               cpu.z80A &= bTemp;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostANDFlags[cpu.z80A];
-
-                               break;
-                       }
-                       case 0xa7:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80A &= cpu.z80A;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostANDFlags[cpu.z80A];
-
-                               break;
-                       }
-                       case 0xa8:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80A ^= cpu.z80B;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-
-                               break;
-                       }
-                       case 0xa9:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80A ^= cpu.z80C;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-
-                               break;
-                       }
-                       case 0xaa:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80A ^= cpu.z80D;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-
-                               break;
-                       }
-                       case 0xab:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80A ^= cpu.z80E;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-
-                               break;
-                       }
-                       case 0xac:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80A ^= cpu.z80H;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-
-                               break;
-                       }
-                       case 0xad:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80A ^= cpu.z80L;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-
-                               break;
-                       }
-                       case 0xae:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               cpu.z80A ^= bTemp;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-
-                               break;
-                       }
-                       case 0xaf:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80A ^= cpu.z80A;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-
-                               break;
-                       }
-                       case 0xb0:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80A |= cpu.z80B;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-
-                               break;
-                       }
-                       case 0xb1:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80A |= cpu.z80C;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-
-                               break;
-                       }
-                       case 0xb2:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80A |= cpu.z80D;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-
-                               break;
-                       }
-                       case 0xb3:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80A |= cpu.z80E;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-
-                               break;
-                       }
-                       case 0xb4:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80A |= cpu.z80H;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-
-                               break;
-                       }
-                       case 0xb5:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80A |= cpu.z80L;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-
-                               break;
-                       }
-                       case 0xb6:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               cpu.z80A |= bTemp;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-
-                               break;
-                       }
-                       case 0xb7:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80A |= cpu.z80A;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-
-                               break;
-                       }
-                       case 0xb8:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | cpu.z80B];
-                               break;
-                       }
-                       case 0xb9:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | cpu.z80C];
-                               break;
-                       }
-                       case 0xba:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | cpu.z80D];
-                               break;
-                       }
-                       case 0xbb:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | cpu.z80E];
-                               break;
-                       }
-                       case 0xbc:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | cpu.z80H];
-                               break;
-                       }
-                       case 0xbd:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | cpu.z80L];
-                               break;
-                       }
-                       case 0xbe:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80HL >= psMemRead->lowAddr) && (cpu.z80HL <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       bTemp = psMemRead->memoryCall(cpu.z80HL, psMemRead);
-                                               }
-                                               else
-                                               {
-                                                       bTemp = *((UINT8 *) psMemRead->pUserArea + (cpu.z80HL - psMemRead->lowAddr));
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       bTemp = cpu.z80Base[cpu.z80HL];
-                               }
-
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | bTemp];
-                               break;
-                       }
-                       case 0xbf:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | cpu.z80A];
-                               break;
-                       }
-                       case 0xc0:
-                       {
-                               sdwCyclesRemaining -= 5;
-                               if (!(cpu.z80F & Z80_FLAG_ZERO))
-                               {
-                                       dwElapsedTicks += 6;
-                               pbSP = cpu.z80Base + cpu.z80sp; /* Normalize our stack PTR */
-                               dwAddr = *pbSP++;       /* Pop LSB */
-                               dwAddr |= ((UINT32) *pbSP << 8);        /* Pop MSB */
-                               cpu.z80sp += 2; /* Pop the word off */
-                               pbPC = (cpu.z80Base + dwAddr);  /* Point PC to our return address */
-                               }
-                               break;
-                       }
-                       case 0xc1:
-                       {
-                               sdwCyclesRemaining -= 10;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80sp >= psMemRead->lowAddr) && (cpu.z80sp <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       cpu.z80BC = psMemRead->memoryCall(cpu.z80sp, psMemRead);
-                                                       cpu.z80BC |= (UINT32) ((UINT32) psMemRead->memoryCall(cpu.z80sp + 1, psMemRead) << 8);
-                                               }
-                                               else
-                                               {
-                                                       cpu.z80BC = *((UINT8 *) psMemRead->pUserArea + (cpu.z80sp - psMemRead->lowAddr));
-                                                       cpu.z80BC |= (UINT32) ((UINT32) *((UINT8 *) psMemRead->pUserArea + (cpu.z80sp - psMemRead->lowAddr + 1)) << 8);
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       cpu.z80BC = cpu.z80Base[cpu.z80sp];
-                                       cpu.z80BC |= (UINT32) ((UINT32) cpu.z80Base[cpu.z80sp + 1] << 8);
-                               }
-
-                                       cpu.z80sp += 2;
-                                       pbSP = (cpu.z80Base + cpu.z80sp);       /* Normalize the stack pointer */
-                               break;
-                       }
-                       case 0xc2:
-                       {
-                               sdwCyclesRemaining -= 10;
-                                       dwAddr = *pbPC++;       /* Get LSB first */
-                                       dwAddr |= ((UINT32) *pbPC++ << 8); /* Get MSB last */
-                               if (!(cpu.z80F & Z80_FLAG_ZERO))
-                               {
-                                       pbPC = cpu.z80Base + dwAddr;    /* Normalize the address */
-                               }
-                               break;
-                       }
-                       case 0xc3:
-                       {
-                               sdwCyclesRemaining -= 10;
-                                       dwAddr = *pbPC++;       /* Get LSB first */
-                                       dwAddr |= ((UINT32) *pbPC++ << 8); /* Get MSB last */
-                               pbPC = cpu.z80Base + dwAddr;    /* Normalize the address */
-                               break;
-                       }
-                       case 0xc4:
-                       {
-                               sdwCyclesRemaining -= 10;
-                               dwAddr = *pbPC++;       /* Get LSB first */
-                               dwAddr |= ((UINT32) *pbPC++ << 8); /* Get MSB last */
-                               if (!(cpu.z80F & Z80_FLAG_ZERO))
-                               {
-                                       cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                       pbSP = (cpu.z80Base + cpu.z80sp - 1);   /* Normalize the stack pointer */
-                                       *pbSP-- = cpu.z80pc >> 8;       /* MSB */
-                                       *pbSP = (UINT8) cpu.z80pc;      /* LSB */
-                                       cpu.z80sp -= 2; /* Back our stack up */
-                                       pbPC = cpu.z80Base + dwAddr;    /* Normalize the address */
-                               }
-                               break;
-                       }
-                       case 0xc5:
-                       {
-                               sdwCyclesRemaining -= 11;
-                                       cpu.z80sp -= 2;
-                                       pbSP = (cpu.z80Base + cpu.z80sp);       /* Normalize the stack pointer */
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80sp >= psMemWrite->lowAddr) && (cpu.z80sp <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80sp, (cpu.z80BC & 0xff), psMemWrite);
-                                                       psMemWrite->memoryCall(cpu.z80sp + 1, (cpu.z80BC >> 8), psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80sp - psMemWrite->lowAddr)) = cpu.z80BC;
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80sp - psMemWrite->lowAddr) + 1) = cpu.z80BC >> 8;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80sp] = (UINT8) cpu.z80BC;
-                                       cpu.z80Base[cpu.z80sp + 1] = (UINT8) ((UINT32) cpu.z80BC >> 8);
-                               }
-
-                               break;
-                       }
-                       case 0xc6:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               bTemp = *pbPC++;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbAddAdcTable[((UINT32) cpu.z80A << 8) | bTemp];
-                               cpu.z80A += bTemp;
-                               break;
-                       }
-                       case 0xc7:
-                       {
-                               sdwCyclesRemaining -= 11;
-                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                               pbSP = (cpu.z80Base + cpu.z80sp - 1);   /* Normalize the stack pointer */
-                               *pbSP-- = cpu.z80pc >> 8;       /* LSB */
-                               *pbSP = (UINT8) cpu.z80pc;      /* MSB */
-                               cpu.z80sp -= 2; /* Back our stack up */
-                               pbPC = cpu.z80Base + 0x00;      /* Normalize the address */
-                               break;
-                       }
-                       case 0xc8:
-                       {
-                               sdwCyclesRemaining -= 5;
-                               if (cpu.z80F & Z80_FLAG_ZERO)
-                               {
-                                       dwElapsedTicks += 6;
-                               pbSP = cpu.z80Base + cpu.z80sp; /* Normalize our stack PTR */
-                               dwAddr = *pbSP++;       /* Pop LSB */
-                               dwAddr |= ((UINT32) *pbSP << 8);        /* Pop MSB */
-                               cpu.z80sp += 2; /* Pop the word off */
-                               pbPC = (cpu.z80Base + dwAddr);  /* Point PC to our return address */
-                               }
-                               break;
-                       }
-                       case 0xc9:
-                       {
-                               sdwCyclesRemaining -= 10;
-                               pbSP = cpu.z80Base + cpu.z80sp; /* Normalize our stack PTR */
-                               dwAddr = *pbSP++;       /* Pop LSB */
-                               dwAddr |= ((UINT32) *pbSP << 8);        /* Pop MSB */
-                               cpu.z80sp += 2; /* Pop the word off */
-                               pbPC = (cpu.z80Base + dwAddr);  /* Point PC to our return address */
-                               break;
-                       }
-                       case 0xca:
-                       {
-                               sdwCyclesRemaining -= 10;
-                                       dwAddr = *pbPC++;       /* Get LSB first */
-                                       dwAddr |= ((UINT32) *pbPC++ << 8); /* Get MSB last */
-                               if (cpu.z80F & Z80_FLAG_ZERO)
-                               {
-                                       pbPC = cpu.z80Base + dwAddr;    /* Normalize the address */
-                               }
-                               break;
-                       }
-                       case 0xcb:
-                       {
-                               CBHandler();
-                               break;
-                       }
-                       case 0xcc:
-                       {
-                               sdwCyclesRemaining -= 10;
-                               dwAddr = *pbPC++;       /* Get LSB first */
-                               dwAddr |= ((UINT32) *pbPC++ << 8); /* Get MSB last */
-                               if (cpu.z80F & Z80_FLAG_ZERO)
-                               {
-                                       cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                       pbSP = (cpu.z80Base + cpu.z80sp - 1);   /* Normalize the stack pointer */
-                                       *pbSP-- = cpu.z80pc >> 8;       /* MSB */
-                                       *pbSP = (UINT8) cpu.z80pc;      /* LSB */
-                                       cpu.z80sp -= 2; /* Back our stack up */
-                                       pbPC = cpu.z80Base + dwAddr;    /* Normalize the address */
-                               }
-                               break;
-                       }
-                       case 0xcd:
-                       {
-                               sdwCyclesRemaining -= 17;
-                               dwAddr = *pbPC++;       /* Get LSB first */
-                               dwAddr |= ((UINT32) *pbPC++ << 8); /* Get MSB last */
-                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                               pbSP = (cpu.z80Base + cpu.z80sp - 1);   /* Normalize the stack pointer */
-                               *pbSP-- = cpu.z80pc >> 8;       /* LSB */
-                               *pbSP = (UINT8) cpu.z80pc;      /* MSB */
-                               cpu.z80sp -= 2; /* Back our stack up */
-                               pbPC = cpu.z80Base + dwAddr;    /* Normalize the address */
-                               break;
-                       }
-                       case 0xce:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               bTemp = *pbPC++ + (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbAddAdcTable[((UINT32) cpu.z80A << 8) | bTemp | (((UINT32) cpu.z80F & Z80_FLAG_CARRY) << 16)];
-                               cpu.z80A += bTemp;
-                               break;
-                       }
-                       case 0xcf:
-                       {
-                               sdwCyclesRemaining -= 11;
-                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                               pbSP = (cpu.z80Base + cpu.z80sp - 1);   /* Normalize the stack pointer */
-                               *pbSP-- = cpu.z80pc >> 8;       /* LSB */
-                               *pbSP = (UINT8) cpu.z80pc;      /* MSB */
-                               cpu.z80sp -= 2; /* Back our stack up */
-                               pbPC = cpu.z80Base + 0x08;      /* Normalize the address */
-                               break;
-                       }
-                       case 0xd0:
-                       {
-                               sdwCyclesRemaining -= 5;
-                               if (!(cpu.z80F & Z80_FLAG_CARRY))
-                               {
-                                       dwElapsedTicks += 6;
-                               pbSP = cpu.z80Base + cpu.z80sp; /* Normalize our stack PTR */
-                               dwAddr = *pbSP++;       /* Pop LSB */
-                               dwAddr |= ((UINT32) *pbSP << 8);        /* Pop MSB */
-                               cpu.z80sp += 2; /* Pop the word off */
-                               pbPC = (cpu.z80Base + dwAddr);  /* Point PC to our return address */
-                               }
-                               break;
-                       }
-                       case 0xd1:
-                       {
-                               sdwCyclesRemaining -= 10;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80sp >= psMemRead->lowAddr) && (cpu.z80sp <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       cpu.z80DE = psMemRead->memoryCall(cpu.z80sp, psMemRead);
-                                                       cpu.z80DE |= (UINT32) ((UINT32) psMemRead->memoryCall(cpu.z80sp + 1, psMemRead) << 8);
-                                               }
-                                               else
-                                               {
-                                                       cpu.z80DE = *((UINT8 *) psMemRead->pUserArea + (cpu.z80sp - psMemRead->lowAddr));
-                                                       cpu.z80DE |= (UINT32) ((UINT32) *((UINT8 *) psMemRead->pUserArea + (cpu.z80sp - psMemRead->lowAddr + 1)) << 8);
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       cpu.z80DE = cpu.z80Base[cpu.z80sp];
-                                       cpu.z80DE |= (UINT32) ((UINT32) cpu.z80Base[cpu.z80sp + 1] << 8);
-                               }
-
-                                       cpu.z80sp += 2;
-                                       pbSP = (cpu.z80Base + cpu.z80sp);       /* Normalize the stack pointer */
-                               break;
-                       }
-                       case 0xd2:
-                       {
-                               sdwCyclesRemaining -= 10;
-                                       dwAddr = *pbPC++;       /* Get LSB first */
-                                       dwAddr |= ((UINT32) *pbPC++ << 8); /* Get MSB last */
-                               if (!(cpu.z80F & Z80_FLAG_CARRY))
-                               {
-                                       pbPC = cpu.z80Base + dwAddr;    /* Normalize the address */
-                               }
-                               break;
-                       }
-                       case 0xd3:
-                       {
-                               sdwCyclesRemaining -= 11;
-                       dwTemp = *pbPC++;
-                               psIoWrite = cpu.z80IoWrite;     /* Beginning of our handler */
-                               while (psIoWrite->lowIoAddr != 0xffff)
-                               {
-                                       if ((dwTemp >= psIoWrite->lowIoAddr) && (dwTemp <= psIoWrite->highIoAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               psIoWrite->IOCall(dwTemp, cpu.z80A, psIoWrite);
-                                               psIoWrite = NULL;
-                                               break;
-                                       }
-                                       ++psIoWrite;
-                               }
-
-                               break;
-                       }
-                       case 0xd4:
-                       {
-                               sdwCyclesRemaining -= 10;
-                               dwAddr = *pbPC++;       /* Get LSB first */
-                               dwAddr |= ((UINT32) *pbPC++ << 8); /* Get MSB last */
-                               if (!(cpu.z80F & Z80_FLAG_CARRY))
-                               {
-                                       cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                       pbSP = (cpu.z80Base + cpu.z80sp - 1);   /* Normalize the stack pointer */
-                                       *pbSP-- = cpu.z80pc >> 8;       /* MSB */
-                                       *pbSP = (UINT8) cpu.z80pc;      /* LSB */
-                                       cpu.z80sp -= 2; /* Back our stack up */
-                                       pbPC = cpu.z80Base + dwAddr;    /* Normalize the address */
-                               }
-                               break;
-                       }
-                       case 0xd5:
-                       {
-                               sdwCyclesRemaining -= 11;
-                                       cpu.z80sp -= 2;
-                                       pbSP = (cpu.z80Base + cpu.z80sp);       /* Normalize the stack pointer */
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80sp >= psMemWrite->lowAddr) && (cpu.z80sp <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80sp, (cpu.z80DE & 0xff), psMemWrite);
-                                                       psMemWrite->memoryCall(cpu.z80sp + 1, (cpu.z80DE >> 8), psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80sp - psMemWrite->lowAddr)) = cpu.z80DE;
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80sp - psMemWrite->lowAddr) + 1) = cpu.z80DE >> 8;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80sp] = (UINT8) cpu.z80DE;
-                                       cpu.z80Base[cpu.z80sp + 1] = (UINT8) ((UINT32) cpu.z80DE >> 8);
-                               }
-
-                               break;
-                       }
-                       case 0xd6:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               bTemp = *pbPC++;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | bTemp];
-                               cpu.z80A -= bTemp;
-                               break;
-                       }
-                       case 0xd7:
-                       {
-                               sdwCyclesRemaining -= 11;
-                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                               pbSP = (cpu.z80Base + cpu.z80sp - 1);   /* Normalize the stack pointer */
-                               *pbSP-- = cpu.z80pc >> 8;       /* LSB */
-                               *pbSP = (UINT8) cpu.z80pc;      /* MSB */
-                               cpu.z80sp -= 2; /* Back our stack up */
-                               pbPC = cpu.z80Base + 0x10;      /* Normalize the address */
-                               break;
-                       }
-                       case 0xd8:
-                       {
-                               sdwCyclesRemaining -= 5;
-                               if (cpu.z80F & Z80_FLAG_CARRY)
-                               {
-                                       dwElapsedTicks += 6;
-                               pbSP = cpu.z80Base + cpu.z80sp; /* Normalize our stack PTR */
-                               dwAddr = *pbSP++;       /* Pop LSB */
-                               dwAddr |= ((UINT32) *pbSP << 8);        /* Pop MSB */
-                               cpu.z80sp += 2; /* Pop the word off */
-                               pbPC = (cpu.z80Base + dwAddr);  /* Point PC to our return address */
-                               }
-                               break;
-                       }
-                       case 0xd9:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               dwTemp = cpu.z80DE;
-                               cpu.z80DE = cpu.z80deprime;
-                               cpu.z80deprime = dwTemp;
-                               dwTemp = cpu.z80BC;
-                               cpu.z80BC = cpu.z80bcprime;
-                               cpu.z80bcprime = dwTemp;
-                               dwTemp = cpu.z80HL;
-                               cpu.z80HL = cpu.z80hlprime;
-                               cpu.z80hlprime = dwTemp;
-                               break;
-                       }
-                       case 0xda:
-                       {
-                               sdwCyclesRemaining -= 10;
-                                       dwAddr = *pbPC++;       /* Get LSB first */
-                                       dwAddr |= ((UINT32) *pbPC++ << 8); /* Get MSB last */
-                               if (cpu.z80F & Z80_FLAG_CARRY)
-                               {
-                                       pbPC = cpu.z80Base + dwAddr;    /* Normalize the address */
-                               }
-                               break;
-                       }
-                       case 0xdb:
-                       {
-                               sdwCyclesRemaining -= 11;
-                       dwTemp = *pbPC++;
-                               psIoRead = cpu.z80IoRead;       /* Beginning of our handler */
-                               while (psIoRead->lowIoAddr != 0xffff)
-                               {
-                                       if ((dwTemp >= psIoRead->lowIoAddr) && (dwTemp <= psIoRead->highIoAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               cpu.z80A = psIoRead->IOCall(dwTemp, psIoRead);
-                                               psIoRead = NULL;
-                                               break;
-                                       }
-                                       ++psIoRead;
-                               }
-
-                               if (psIoRead)
-                               {
-                                       cpu.z80A = 0xff; /* Unclaimed I/O read */
-                               }
-
-                               break;
-                       }
-                       case 0xdc:
-                       {
-                               sdwCyclesRemaining -= 10;
-                               dwAddr = *pbPC++;       /* Get LSB first */
-                               dwAddr |= ((UINT32) *pbPC++ << 8); /* Get MSB last */
-                               if (cpu.z80F & Z80_FLAG_CARRY)
-                               {
-                                       cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                       pbSP = (cpu.z80Base + cpu.z80sp - 1);   /* Normalize the stack pointer */
-                                       *pbSP-- = cpu.z80pc >> 8;       /* MSB */
-                                       *pbSP = (UINT8) cpu.z80pc;      /* LSB */
-                                       cpu.z80sp -= 2; /* Back our stack up */
-                                       pbPC = cpu.z80Base + dwAddr;    /* Normalize the address */
-                               }
-                               break;
-                       }
-                       case 0xdd:
-                       {
-                               DDHandler();
-                               break;
-                       }
-                       case 0xde:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               bTemp = *pbPC++ + (cpu.z80F & Z80_FLAG_CARRY);
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | bTemp | (((UINT32) cpu.z80F & Z80_FLAG_CARRY) << 16)];
-                               cpu.z80A = cpu.z80A - bTemp;
-                               break;
-                       }
-                       case 0xdf:
-                       {
-                               sdwCyclesRemaining -= 11;
-                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                               pbSP = (cpu.z80Base + cpu.z80sp - 1);   /* Normalize the stack pointer */
-                               *pbSP-- = cpu.z80pc >> 8;       /* LSB */
-                               *pbSP = (UINT8) cpu.z80pc;      /* MSB */
-                               cpu.z80sp -= 2; /* Back our stack up */
-                               pbPC = cpu.z80Base + 0x18;      /* Normalize the address */
-                               break;
-                       }
-                       case 0xe0:
-                       {
-                               sdwCyclesRemaining -= 5;
-                               if (!(cpu.z80F & Z80_FLAG_OVERFLOW_PARITY))
-                               {
-                                       dwElapsedTicks += 6;
-                               pbSP = cpu.z80Base + cpu.z80sp; /* Normalize our stack PTR */
-                               dwAddr = *pbSP++;       /* Pop LSB */
-                               dwAddr |= ((UINT32) *pbSP << 8);        /* Pop MSB */
-                               cpu.z80sp += 2; /* Pop the word off */
-                               pbPC = (cpu.z80Base + dwAddr);  /* Point PC to our return address */
-                               }
-                               break;
-                       }
-                       case 0xe1:
-                       {
-                               sdwCyclesRemaining -= 10;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80sp >= psMemRead->lowAddr) && (cpu.z80sp <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       cpu.z80HL = psMemRead->memoryCall(cpu.z80sp, psMemRead);
-                                                       cpu.z80HL |= (UINT32) ((UINT32) psMemRead->memoryCall(cpu.z80sp + 1, psMemRead) << 8);
-                                               }
-                                               else
-                                               {
-                                                       cpu.z80HL = *((UINT8 *) psMemRead->pUserArea + (cpu.z80sp - psMemRead->lowAddr));
-                                                       cpu.z80HL |= (UINT32) ((UINT32) *((UINT8 *) psMemRead->pUserArea + (cpu.z80sp - psMemRead->lowAddr + 1)) << 8);
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       cpu.z80HL = cpu.z80Base[cpu.z80sp];
-                                       cpu.z80HL |= (UINT32) ((UINT32) cpu.z80Base[cpu.z80sp + 1] << 8);
-                               }
-
-                                       cpu.z80sp += 2;
-                                       pbSP = (cpu.z80Base + cpu.z80sp);       /* Normalize the stack pointer */
-                               break;
-                       }
-                       case 0xe2:
-                       {
-                               sdwCyclesRemaining -= 10;
-                                       dwAddr = *pbPC++;       /* Get LSB first */
-                                       dwAddr |= ((UINT32) *pbPC++ << 8); /* Get MSB last */
-                               if (!(cpu.z80F & Z80_FLAG_OVERFLOW_PARITY))
-                               {
-                                       pbPC = cpu.z80Base + dwAddr;    /* Normalize the address */
-                               }
-                               break;
-                       }
-                       case 0xe3:
-                       {
-                               sdwCyclesRemaining -= 19;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80sp >= psMemRead->lowAddr) && (cpu.z80sp <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       dwAddr = psMemRead->memoryCall(cpu.z80sp, psMemRead);
-                                                       dwAddr |= (UINT32) ((UINT32) psMemRead->memoryCall(cpu.z80sp + 1, psMemRead) << 8);
-                                               }
-                                               else
-                                               {
-                                                       dwAddr = *((UINT8 *) psMemRead->pUserArea + (cpu.z80sp - psMemRead->lowAddr));
-                                                       dwAddr |= (UINT32) ((UINT32) *((UINT8 *) psMemRead->pUserArea + (cpu.z80sp - psMemRead->lowAddr + 1)) << 8);
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       dwAddr = cpu.z80Base[cpu.z80sp];
-                                       dwAddr |= (UINT32) ((UINT32) cpu.z80Base[cpu.z80sp + 1] << 8);
-                               }
-
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80sp >= psMemWrite->lowAddr) && (cpu.z80sp <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80sp, (cpu.z80HL & 0xff), psMemWrite);
-                                                       psMemWrite->memoryCall(cpu.z80sp + 1, (cpu.z80HL >> 8), psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80sp - psMemWrite->lowAddr)) = cpu.z80HL;
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80sp - psMemWrite->lowAddr) + 1) = cpu.z80HL >> 8;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80sp] = (UINT8) cpu.z80HL;
-                                       cpu.z80Base[cpu.z80sp + 1] = (UINT8) ((UINT32) cpu.z80HL >> 8);
-                               }
-
-                               cpu.z80HL = dwAddr;
-                               break;
-                       }
-                       case 0xe4:
-                       {
-                               sdwCyclesRemaining -= 10;
-                               dwAddr = *pbPC++;       /* Get LSB first */
-                               dwAddr |= ((UINT32) *pbPC++ << 8); /* Get MSB last */
-                               if (!(cpu.z80F & Z80_FLAG_OVERFLOW_PARITY))
-                               {
-                                       cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                       pbSP = (cpu.z80Base + cpu.z80sp - 1);   /* Normalize the stack pointer */
-                                       *pbSP-- = cpu.z80pc >> 8;       /* MSB */
-                                       *pbSP = (UINT8) cpu.z80pc;      /* LSB */
-                                       cpu.z80sp -= 2; /* Back our stack up */
-                                       pbPC = cpu.z80Base + dwAddr;    /* Normalize the address */
-                               }
-                               break;
-                       }
-                       case 0xe5:
-                       {
-                               sdwCyclesRemaining -= 11;
-                                       cpu.z80sp -= 2;
-                                       pbSP = (cpu.z80Base + cpu.z80sp);       /* Normalize the stack pointer */
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80sp >= psMemWrite->lowAddr) && (cpu.z80sp <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80sp, (cpu.z80HL & 0xff), psMemWrite);
-                                                       psMemWrite->memoryCall(cpu.z80sp + 1, (cpu.z80HL >> 8), psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80sp - psMemWrite->lowAddr)) = cpu.z80HL;
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80sp - psMemWrite->lowAddr) + 1) = cpu.z80HL >> 8;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80sp] = (UINT8) cpu.z80HL;
-                                       cpu.z80Base[cpu.z80sp + 1] = (UINT8) ((UINT32) cpu.z80HL >> 8);
-                               }
-
-                               break;
-                       }
-                       case 0xe6:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               cpu.z80A &= *pbPC++;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostANDFlags[cpu.z80A];
-
-                               break;
-                       }
-                       case 0xe7:
-                       {
-                               sdwCyclesRemaining -= 11;
-                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                               pbSP = (cpu.z80Base + cpu.z80sp - 1);   /* Normalize the stack pointer */
-                               *pbSP-- = cpu.z80pc >> 8;       /* LSB */
-                               *pbSP = (UINT8) cpu.z80pc;      /* MSB */
-                               cpu.z80sp -= 2; /* Back our stack up */
-                               pbPC = cpu.z80Base + 0x20;      /* Normalize the address */
-                               break;
-                       }
-                       case 0xe8:
-                       {
-                               sdwCyclesRemaining -= 5;
-                               if (cpu.z80F & Z80_FLAG_OVERFLOW_PARITY)
-                               {
-                                       dwElapsedTicks += 6;
-                               pbSP = cpu.z80Base + cpu.z80sp; /* Normalize our stack PTR */
-                               dwAddr = *pbSP++;       /* Pop LSB */
-                               dwAddr |= ((UINT32) *pbSP << 8);        /* Pop MSB */
-                               cpu.z80sp += 2; /* Pop the word off */
-                               pbPC = (cpu.z80Base + dwAddr);  /* Point PC to our return address */
-                               }
-                               break;
-                       }
-                       case 0xe9:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               pbPC = cpu.z80Base + cpu.z80HL;
-                               break;
-                       }
-                       case 0xea:
-                       {
-                               sdwCyclesRemaining -= 10;
-                                       dwAddr = *pbPC++;       /* Get LSB first */
-                                       dwAddr |= ((UINT32) *pbPC++ << 8); /* Get MSB last */
-                               if (cpu.z80F & Z80_FLAG_OVERFLOW_PARITY)
-                               {
-                                       pbPC = cpu.z80Base + dwAddr;    /* Normalize the address */
-                               }
-                               break;
-                       }
-                       case 0xeb:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               dwAddr = cpu.z80DE;
-                               cpu.z80DE = cpu.z80HL;
-                               cpu.z80HL = dwAddr;
-                               break;
-                       }
-                       case 0xec:
-                       {
-                               sdwCyclesRemaining -= 10;
-                               dwAddr = *pbPC++;       /* Get LSB first */
-                               dwAddr |= ((UINT32) *pbPC++ << 8); /* Get MSB last */
-                               if (cpu.z80F & Z80_FLAG_OVERFLOW_PARITY)
-                               {
-                                       cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                       pbSP = (cpu.z80Base + cpu.z80sp - 1);   /* Normalize the stack pointer */
-                                       *pbSP-- = cpu.z80pc >> 8;       /* MSB */
-                                       *pbSP = (UINT8) cpu.z80pc;      /* LSB */
-                                       cpu.z80sp -= 2; /* Back our stack up */
-                                       pbPC = cpu.z80Base + dwAddr;    /* Normalize the address */
-                               }
-                               break;
-                       }
-                       case 0xed:
-                       {
-                               EDHandler();
-                               break;
-                       }
-                       case 0xee:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               cpu.z80A ^= *pbPC++;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-
-                               break;
-                       }
-                       case 0xef:
-                       {
-                               sdwCyclesRemaining -= 11;
-                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                               pbSP = (cpu.z80Base + cpu.z80sp - 1);   /* Normalize the stack pointer */
-                               *pbSP-- = cpu.z80pc >> 8;       /* LSB */
-                               *pbSP = (UINT8) cpu.z80pc;      /* MSB */
-                               cpu.z80sp -= 2; /* Back our stack up */
-                               pbPC = cpu.z80Base + 0x28;      /* Normalize the address */
-                               break;
-                       }
-                       case 0xf0:
-                       {
-                               sdwCyclesRemaining -= 5;
-                               if (!(cpu.z80F & Z80_FLAG_SIGN))
-                               {
-                                       dwElapsedTicks += 6;
-                               pbSP = cpu.z80Base + cpu.z80sp; /* Normalize our stack PTR */
-                               dwAddr = *pbSP++;       /* Pop LSB */
-                               dwAddr |= ((UINT32) *pbSP << 8);        /* Pop MSB */
-                               cpu.z80sp += 2; /* Pop the word off */
-                               pbPC = (cpu.z80Base + dwAddr);  /* Point PC to our return address */
-                               }
-                               break;
-                       }
-                       case 0xf1:
-                       {
-                               sdwCyclesRemaining -= 10;
-                               psMemRead = cpu.z80MemRead;     /* Beginning of our handler */
-                               while (psMemRead->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80sp >= psMemRead->lowAddr) && (cpu.z80sp <= psMemRead->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemRead->memoryCall)
-                                               {
-                                                       cpu.z80AF = psMemRead->memoryCall(cpu.z80sp, psMemRead);
-                                                       cpu.z80AF |= (UINT32) ((UINT32) psMemRead->memoryCall(cpu.z80sp + 1, psMemRead) << 8);
-                                               }
-                                               else
-                                               {
-                                                       cpu.z80AF = *((UINT8 *) psMemRead->pUserArea + (cpu.z80sp - psMemRead->lowAddr));
-                                                       cpu.z80AF |= (UINT32) ((UINT32) *((UINT8 *) psMemRead->pUserArea + (cpu.z80sp - psMemRead->lowAddr + 1)) << 8);
-                                               }
-                                               psMemRead = NULL;
-                                               break;
-                                       }
-                                       ++psMemRead;
-                               }
-
-                               if (psMemRead)
-                               {
-                                       cpu.z80AF = cpu.z80Base[cpu.z80sp];
-                                       cpu.z80AF |= (UINT32) ((UINT32) cpu.z80Base[cpu.z80sp + 1] << 8);
-                               }
-
-                                       cpu.z80sp += 2;
-                                       pbSP = (cpu.z80Base + cpu.z80sp);       /* Normalize the stack pointer */
-                               break;
-                       }
-                       case 0xf2:
-                       {
-                               sdwCyclesRemaining -= 10;
-                                       dwAddr = *pbPC++;       /* Get LSB first */
-                                       dwAddr |= ((UINT32) *pbPC++ << 8); /* Get MSB last */
-                               if (!(cpu.z80F & Z80_FLAG_SIGN))
-                               {
-                                       pbPC = cpu.z80Base + dwAddr;    /* Normalize the address */
-                               }
-                               break;
-                       }
-                       case 0xf3:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80iff &= (~IFF1);
-                               break;
-                       }
-                       case 0xf4:
-                       {
-                               sdwCyclesRemaining -= 10;
-                               dwAddr = *pbPC++;       /* Get LSB first */
-                               dwAddr |= ((UINT32) *pbPC++ << 8); /* Get MSB last */
-                               if (!(cpu.z80F & Z80_FLAG_SIGN))
-                               {
-                                       cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                       pbSP = (cpu.z80Base + cpu.z80sp - 1);   /* Normalize the stack pointer */
-                                       *pbSP-- = cpu.z80pc >> 8;       /* MSB */
-                                       *pbSP = (UINT8) cpu.z80pc;      /* LSB */
-                                       cpu.z80sp -= 2; /* Back our stack up */
-                                       pbPC = cpu.z80Base + dwAddr;    /* Normalize the address */
-                               }
-                               break;
-                       }
-                       case 0xf5:
-                       {
-                               sdwCyclesRemaining -= 11;
-                                       cpu.z80sp -= 2;
-                                       pbSP = (cpu.z80Base + cpu.z80sp);       /* Normalize the stack pointer */
-                               psMemWrite = cpu.z80MemWrite;   /* Beginning of our handler */
-                               while (psMemWrite->lowAddr != 0xffffffff)
-                               {
-                                       if ((cpu.z80sp >= psMemWrite->lowAddr) && (cpu.z80sp <= psMemWrite->highAddr))
-                                       {
-                                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                               if (psMemWrite->memoryCall)
-                                               {
-                                                       psMemWrite->memoryCall(cpu.z80sp, (cpu.z80AF & 0xff), psMemWrite);
-                                                       psMemWrite->memoryCall(cpu.z80sp + 1, (cpu.z80AF >> 8), psMemWrite);
-                                               }
-                                               else
-                                               {
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80sp - psMemWrite->lowAddr)) = cpu.z80AF;
-                                                       *((UINT8 *) psMemWrite->pUserArea + (cpu.z80sp - psMemWrite->lowAddr) + 1) = cpu.z80AF >> 8;
-                                               }
-                                               psMemWrite = NULL;
-                                               break;
-                                       }
-                                       ++psMemWrite;
-                               }
-
-                               if (psMemWrite)
-                               {
-                                       cpu.z80Base[cpu.z80sp] = (UINT8) cpu.z80AF;
-                                       cpu.z80Base[cpu.z80sp + 1] = (UINT8) ((UINT32) cpu.z80AF >> 8);
-                               }
-
-                               break;
-                       }
-                       case 0xf6:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               cpu.z80A |= *pbPC++;
-                               cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);
-                               cpu.z80F |= bPostORFlags[cpu.z80A];
-
-                               break;
-                       }
-                       case 0xf7:
-                       {
-                               sdwCyclesRemaining -= 11;
-                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                               pbSP = (cpu.z80Base + cpu.z80sp - 1);   /* Normalize the stack pointer */
-                               *pbSP-- = cpu.z80pc >> 8;       /* LSB */
-                               *pbSP = (UINT8) cpu.z80pc;      /* MSB */
-                               cpu.z80sp -= 2; /* Back our stack up */
-                               pbPC = cpu.z80Base + 0x30;      /* Normalize the address */
-                               break;
-                       }
-                       case 0xf8:
-                       {
-                               sdwCyclesRemaining -= 5;
-                               if (cpu.z80F & Z80_FLAG_SIGN)
-                               {
-                                       dwElapsedTicks += 6;
-                               pbSP = cpu.z80Base + cpu.z80sp; /* Normalize our stack PTR */
-                               dwAddr = *pbSP++;       /* Pop LSB */
-                               dwAddr |= ((UINT32) *pbSP << 8);        /* Pop MSB */
-                               cpu.z80sp += 2; /* Pop the word off */
-                               pbPC = (cpu.z80Base + dwAddr);  /* Point PC to our return address */
-                               }
-                               break;
-                       }
-                       case 0xf9:
-                       {
-                               sdwCyclesRemaining -= 6;
-                               cpu.z80sp = cpu.z80HL;
-                               break;
-                       }
-                       case 0xfa:
-                       {
-                               sdwCyclesRemaining -= 10;
-                                       dwAddr = *pbPC++;       /* Get LSB first */
-                                       dwAddr |= ((UINT32) *pbPC++ << 8); /* Get MSB last */
-                               if (cpu.z80F & Z80_FLAG_SIGN)
-                               {
-                                       pbPC = cpu.z80Base + dwAddr;    /* Normalize the address */
-                               }
-                               break;
-                       }
-                       case 0xfb:
-                       {
-                               sdwCyclesRemaining -= 4;
-                               cpu.z80iff |= IFF1;
-                               break;
-                       }
-                       case 0xfc:
-                       {
-                               sdwCyclesRemaining -= 10;
-                               dwAddr = *pbPC++;       /* Get LSB first */
-                               dwAddr |= ((UINT32) *pbPC++ << 8); /* Get MSB last */
-                               if (cpu.z80F & Z80_FLAG_SIGN)
-                               {
-                                       cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                                       pbSP = (cpu.z80Base + cpu.z80sp - 1);   /* Normalize the stack pointer */
-                                       *pbSP-- = cpu.z80pc >> 8;       /* MSB */
-                                       *pbSP = (UINT8) cpu.z80pc;      /* LSB */
-                                       cpu.z80sp -= 2; /* Back our stack up */
-                                       pbPC = cpu.z80Base + dwAddr;    /* Normalize the address */
-                               }
-                               break;
-                       }
-                       case 0xfd:
-                       {
-                               FDHandler();
-                               break;
-                       }
-                       case 0xfe:
-                       {
-                               sdwCyclesRemaining -= 7;
-                               cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | 
-                                                          Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |
-                                                               pbSubSbcTable[((UINT32) cpu.z80A << 8) | *pbPC++];
-                               break;
-                       }
-                       case 0xff:
-                       {
-                               sdwCyclesRemaining -= 11;
-                               cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-                               pbSP = (cpu.z80Base + cpu.z80sp - 1);   /* Normalize the stack pointer */
-                               *pbSP-- = cpu.z80pc >> 8;       /* LSB */
-                               *pbSP = (UINT8) cpu.z80pc;      /* MSB */
-                               cpu.z80sp -= 2; /* Back our stack up */
-                               pbPC = cpu.z80Base + 0x38;      /* Normalize the address */
-                               break;
-                       }
-               }
-       }
-
-       dwElapsedTicks += (dwOriginalCycles - sdwCyclesRemaining);
-
-       cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;
-       return(dwReturnCode); /* Indicate success */
-}
-
-/* Get mz80's context */
-
-void mz80GetContext(void *pData)
-{
-       memcpy(pData, &cpu, sizeof(CONTEXTMZ80));
-}
-
-/* Set mz80's context */
-
-void mz80SetContext(void *pData)
-{
-       memcpy(&cpu, pData, sizeof(CONTEXTMZ80));
-}
-
-/* Get mz80's context size */
-
-UINT32 mz80GetContextSize(void)
-{
-       return(sizeof(CONTEXTMZ80));
-}
-
-/* This will return the elapsed ticks */
-
-UINT32 mz80GetElapsedTicks(UINT32 dwClear)
-{
-       UINT32 dwTemp = dwElapsedTicks;
-
-       if (dwClear)
-       {
-               dwElapsedTicks = 0;
-       }
-
-       return(dwTemp);
-}
-
-/* Releases mz80 from its current timeslice */
-
-void mz80ReleaseTimeslice(void)
-{
-       dwOriginalCycles -= sdwCyclesRemaining;
-       sdwCyclesRemaining = 0;
-}
-
-/* This routine is mz80's reset handler */
-
-void mz80reset(void)
-{
-       cpu.z80halted = 0;
-       cpu.z80AF = 0;
-       cpu.z80F = Z80_FLAG_ZERO;
-       cpu.z80BC = 0;
-       cpu.z80DE = 0;
-       cpu.z80HL = 0;
-       cpu.z80afprime = 0;
-       cpu.z80bcprime = 0;
-       cpu.z80deprime = 0;
-       cpu.z80hlprime = 0;
-       cpu.z80i = 0;
-       cpu.z80r = 0;
-       cpu.z80IX = 0xffff; /* Yes, this is intentional */
-       cpu.z80IY = 0xffff; /* Yes, this is intentional */
-       cpu.z80pc = 0;
-       cpu.z80sp = 0;
-       cpu.z80interruptMode = 0;
-       cpu.z80intAddr = 0x38;
-       cpu.z80nmiAddr = 0x66;
-}
-
-/* Interrupt handler */
-
-UINT32 mz80int(UINT32 dwLowAddr)
-{
-       cpu.z80halted = 0;
-       if (0 == (cpu.z80iff & IFF1))
-               return(0xffffffff);
-       cpu.z80iff &= ~(IFF1 | IFF2);
-       pbSP = (cpu.z80Base + cpu.z80sp - 1);   /* Normalize the stack pointer */
-       *pbSP-- = cpu.z80pc >> 8;       /* LSB */
-       *pbSP = (UINT8) cpu.z80pc;      /* MSB */
-       cpu.z80sp -= 2; /* Back our stack up */
-       if (2 == cpu.z80interruptMode)
-       {
-               cpu.z80pc = ((UINT16) cpu.z80i << 8) | (dwLowAddr & 0xff);
-               cpu.z80pc = ((UINT16) cpu.z80Base[cpu.z80pc + 1] << 8) | (cpu.z80Base[cpu.z80pc]);
-       }
-       else
-       {
-               cpu.z80pc = cpu.z80intAddr;
-       }
-       pbPC = cpu.z80Base + cpu.z80pc; /* Normalize the address */
-       return(0);
-}
-
-/* NMI Handler */
-
-UINT32 mz80nmi(void)
-{
-       cpu.z80halted = 0;
-       pbSP = (cpu.z80Base + cpu.z80sp - 1);   /* Normalize the stack pointer */
-       *pbSP-- = cpu.z80pc >> 8;       /* LSB */
-       *pbSP = (UINT8) cpu.z80pc;      /* MSB */
-       cpu.z80sp -= 2; /* Back our stack up */
-       cpu.z80pc = cpu.z80nmiAddr;     /* Our NMI */
-       return(0);
-}
-
-/* Initialize MZ80 for action */
-
-void mz80init(void)
-{
-       UINT32 dwLoop;
-       UINT8 *pbTempPtr;
-       UINT8 *pbTempPtr2;
-       UINT8 bNewAdd;
-       UINT8 bNewSub;
-       UINT8 bFlag;
-       UINT8 bLow;
-       UINT8 bHigh;
-       UINT8 bCarry;
-
-       if (NULL == pbAddAdcTable)
-       {
-               pbAddAdcTable = malloc(256*256*2);
-
-               if (NULL == pbAddAdcTable)
-               {
-                       return;
-               }
-
-               pbTempPtr = pbAddAdcTable;
-
-               pbSubSbcTable = malloc(256*256*2);
-
-               if (NULL == pbSubSbcTable)
-               {
-                       return;
-               }
-
-               pbTempPtr2 = pbSubSbcTable;
-
-               for (dwLoop = 0; dwLoop < (256*256*2); dwLoop++)
-               {
-                       bLow = dwLoop & 0xff;
-                       bHigh = (dwLoop >> 8) & 0xff;
-                       bCarry = (dwLoop >> 16);
-
-                       bFlag = 0;
-                       bNewAdd = bHigh + bLow + bCarry;
-
-                       if (0 == bNewAdd)
-                       {
-                               bFlag |= Z80_FLAG_ZERO;
-                       }
-                       else
-                       {
-                               bFlag = bNewAdd & 0x80; /* Sign flag */
-                       }
-
-                       if (((UINT32) bLow + (UINT32) bHigh + (UINT32) bCarry) >= 0x100)
-                       {
-                               bFlag |= Z80_FLAG_CARRY;
-                       }
-
-                       if ( ((bLow ^ bHigh ^ 0x80) & (bLow ^ (bNewAdd & 0x80))) & 0x80)
-                       {
-                               bFlag |= Z80_FLAG_OVERFLOW_PARITY;
-                       }
-
-                       if (((bLow & 0x0f) + (bHigh & 0x0f) + bCarry) >= 0x10)
-                       {
-                               bFlag |= Z80_FLAG_HALF_CARRY;
-                       }
-
-                       *pbTempPtr++ = bFlag;   /* Store our new flag */
-
-                       // Now do subtract - Zero
-
-                       bFlag = Z80_FLAG_NEGATIVE;
-                       bNewSub = bHigh - bLow - bCarry;
-
-                       if (0 == bNewSub)
-                       {
-                               bFlag |= Z80_FLAG_ZERO;
-                       }
-                       else
-                       {
-                               bFlag |= bNewSub & 0x80; /* Sign flag */
-                       }
-
-                       if ( ((INT32) bHigh - (INT32) bLow - (INT32) bCarry) < 0)
-                       {
-                               bFlag |= Z80_FLAG_CARRY;
-                       }
-
-                       if ( ((INT32) (bHigh & 0xf) - (INT32) (bLow & 0x0f) - (INT32) bCarry) < 0)
-                       {
-                               bFlag |= Z80_FLAG_HALF_CARRY;
-                       }
-
-                       if ( ((bLow ^ bHigh) & (bHigh ^ bNewSub) & 0x80) )
-                       {
-                               bFlag |= Z80_FLAG_OVERFLOW_PARITY;
-                       }
-
-                       *pbTempPtr2++ = bFlag;  /* Store our sub flag */
-
-               }
-       }
-}
-/* Shut down MZ80 */
-
-void mz80shutdown(void)
-{
-       // notaz: why weren't these here?
-       free(pbAddAdcTable);
-       pbAddAdcTable = 0;
-       free(pbSubSbcTable);
-       pbSubSbcTable = 0;
-}
-
diff --git a/cpu/mz80/mz80.h b/cpu/mz80/mz80.h
deleted file mode 100644 (file)
index 1e2c47c..0000000
+++ /dev/null
@@ -1,394 +0,0 @@
-/* Multi-Z80 32 Bit emulator */\r
-\r
-/* Copyright 1996, Neil Bradley, All rights reserved\r
- *\r
- * License agreement:\r
- *\r
- * The mZ80 emulator may be distributed in unmodified form to any medium.\r
- *\r
- * mZ80 May not be sold, or sold as a part of a commercial package without\r
- * the express written permission of Neil Bradley (neil@synthcom.com). This\r
- * includes shareware.\r
- *\r
- * Modified versions of mZ80 may not be publicly redistributed without author\r
- * approval (neil@synthcom.com). This includes distributing via a publicly\r
- * accessible LAN. You may make your own source modifications and distribute\r
- * mZ80 in object only form.\r
- *\r
- * mZ80 Licensing for commercial applications is available. Please email\r
- * neil@synthcom.com for details.\r
- *\r
- * Synthcom Systems, Inc, and Neil Bradley will not be held responsible for\r
- * any damage done by the use of mZ80. It is purely "as-is".\r
- *\r
- * If you use mZ80 in a freeware application, credit in the following text:\r
- *\r
- * "Multi-Z80 CPU emulator by Neil Bradley (neil@synthcom.com)"\r
- *\r
- * must accompany the freeware application within the application itself or\r
- * in the documentation.\r
- *\r
- * Legal stuff aside:\r
- *\r
- * If you find problems with mZ80, please email the author so they can get\r
- * resolved. If you find a bug and fix it, please also email the author so\r
- * that those bug fixes can be propogated to the installed base of mZ80\r
- * users. If you find performance improvements or problems with mZ80, please\r
- * email the author with your changes/suggestions and they will be rolled in\r
- * with subsequent releases of mZ80.\r
- *\r
- * The whole idea of this emulator is to have the fastest available 32 bit\r
- * Multi-z80 emulator for the PC, giving maximum performance. \r
- */ \r
-\r
-/* General z80 based defines */\r
-\r
-#ifndef        _MZ80_H_\r
-#define        _MZ80_H_\r
-\r
-#ifndef UINT32\r
-#define UINT32  unsigned long int\r
-#endif\r
-\r
-#ifndef UINT16\r
-#define UINT16  unsigned short int\r
-#endif\r
-\r
-#ifndef UINT8\r
-#define UINT8   unsigned char\r
-#endif\r
-\r
-#ifndef INT32\r
-#define INT32  signed long int\r
-#endif\r
-\r
-#ifndef INT16\r
-#define INT16  signed short int\r
-#endif\r
-\r
-#ifndef INT8\r
-#define INT8   signed char\r
-#endif\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-#ifndef _MEMORYREADWRITEBYTE_\r
-#define _MEMORYREADWRITEBYTE_\r
-\r
-struct MemoryWriteByte\r
-{\r
-       UINT32 lowAddr;\r
-       UINT32 highAddr;\r
-       void (*memoryCall)(UINT32, UINT8, struct MemoryWriteByte *);\r
-       void *pUserArea;\r
-};      \r
-\r
-struct MemoryReadByte\r
-{\r
-       UINT32 lowAddr;\r
-       UINT32 highAddr;\r
-       UINT8 (*memoryCall)(UINT32, struct MemoryReadByte *);\r
-       void *pUserArea;\r
-};      \r
-\r
-#endif // _MEMORYREADWRITEBYTE_\r
-\r
-struct z80PortWrite\r
-{\r
-       UINT16 lowIoAddr;\r
-       UINT16 highIoAddr;\r
-       void (*IOCall)(UINT16, UINT8, struct z80PortWrite *);\r
-       void *pUserArea;\r
-};\r
-\r
-struct z80PortRead\r
-{\r
-       UINT16 lowIoAddr;\r
-       UINT16 highIoAddr;\r
-       UINT16 (*IOCall)(UINT16, struct z80PortRead *);\r
-       void *pUserArea;\r
-};     \r
-\r
-struct z80TrapRec\r
-{\r
-       UINT16 trapAddr;\r
-       UINT8  skipCnt;\r
-       UINT8  origIns;\r
-};\r
-\r
-typedef union\r
-{\r
-       UINT32 af;\r
-\r
-       struct\r
-       {\r
-#ifdef WORDS_BIGENDIAN\r
-               UINT16 wFiller;\r
-               UINT8 a;\r
-               UINT8 f;\r
-#else\r
-               UINT8 f;\r
-               UINT8 a;\r
-               UINT16 wFiller;\r
-#endif\r
-       } half;\r
-} reg_af;\r
-\r
-#define        z80AF   z80af.af\r
-#define        z80A    z80af.half.a\r
-#define        z80F    z80af.half.f\r
-\r
-typedef union\r
-{\r
-       UINT32 bc;\r
-\r
-       struct\r
-       {\r
-#ifdef WORDS_BIGENDIAN\r
-               UINT16 wFiller;\r
-               UINT8 b;\r
-               UINT8 c;\r
-#else\r
-               UINT8 c;\r
-               UINT8 b;\r
-               UINT16 wFiller;\r
-#endif\r
-       } half;\r
-} reg_bc;\r
-\r
-#define        z80BC   z80bc.bc\r
-#define        z80B    z80bc.half.b\r
-#define        z80C    z80bc.half.c\r
-\r
-typedef union\r
-{\r
-       UINT32 de;\r
-\r
-       struct\r
-       {\r
-#ifdef WORDS_BIGENDIAN\r
-               UINT16 wFiller;\r
-               UINT8 d;\r
-               UINT8 e;\r
-#else\r
-               UINT8 e;\r
-               UINT8 d;\r
-               UINT16 wFiller;\r
-#endif\r
-       } half;\r
-} reg_de;\r
-\r
-#define        z80DE   z80de.de\r
-#define        z80D    z80de.half.d\r
-#define        z80E    z80de.half.e\r
-\r
-typedef union\r
-{\r
-       UINT32 hl;\r
-\r
-       struct\r
-       {\r
-#ifdef WORDS_BIGENDIAN\r
-               UINT16 wFiller;\r
-               UINT8 h;\r
-               UINT8 l;\r
-#else\r
-               UINT8 l;\r
-               UINT8 h;\r
-               UINT16 wFiller;\r
-#endif\r
-       } half;\r
-} reg_hl;\r
-\r
-#define        z80HL   z80hl.hl\r
-#define        z80H    z80hl.half.h\r
-#define        z80L    z80hl.half.l\r
-\r
-#define        z80SP   z80sp.sp\r
-\r
-typedef union\r
-{\r
-       UINT32 ix;\r
-\r
-       struct\r
-       {\r
-#ifdef WORDS_BIGENDIAN\r
-               UINT16 wFiller;\r
-               UINT8 xh;\r
-               UINT8 xl;\r
-#else\r
-               UINT8 xl;\r
-               UINT8 xh;\r
-               UINT16 wFiller;\r
-#endif\r
-       } half;\r
-} reg_ix;\r
-\r
-#define        z80IX   z80ix.ix\r
-#define        z80XH   z80ix.half.xh\r
-#define        z80XL   z80ix.half.xl\r
-\r
-typedef union\r
-{\r
-       UINT32 iy;\r
-\r
-       struct\r
-       {\r
-#ifdef WORDS_BIGENDIAN\r
-               UINT16 wFiller;\r
-               UINT8 yh;\r
-               UINT8 yl;\r
-#else\r
-               UINT8 yl;\r
-               UINT8 yh;\r
-               UINT16 wFiller;\r
-#endif\r
-       } half;\r
-} reg_iy;\r
-\r
-#define        z80IY   z80iy.iy\r
-#define        z80YH   z80iy.half.yh\r
-#define        z80YL   z80iy.half.yl\r
-\r
-struct mz80context\r
-{\r
-       UINT8 *z80Base;\r
-       struct MemoryReadByte *z80MemRead;\r
-       struct MemoryWriteByte *z80MemWrite;\r
-       struct z80PortRead *z80IoRead;\r
-       struct z80PortWrite *z80IoWrite;\r
-       UINT32 z80clockticks;\r
-       UINT32 z80iff;\r
-       UINT32 z80interruptMode;\r
-       UINT32 z80halted;\r
-\r
-       reg_af z80af;\r
-       reg_bc z80bc;\r
-       reg_de z80de;\r
-       reg_hl z80hl;\r
-       UINT32 z80afprime;\r
-       UINT32 z80bcprime;\r
-       UINT32 z80deprime;\r
-       UINT32 z80hlprime;\r
-       reg_ix z80ix;\r
-       reg_iy z80iy;\r
-       UINT32 z80sp;\r
-       UINT32 z80pc;\r
-       UINT32 z80nmiAddr;\r
-       UINT32 z80intAddr;\r
-       UINT32 z80rCounter;\r
-       UINT8 z80i;\r
-       UINT8 z80r;\r
-       UINT8 z80intPending;\r
-}; \r
-\r
-// These are the enumerations used for register access. DO NOT ALTER THEIR\r
-// ORDER! It must match the same order as in the mz80.c/mz80.asm files!\r
-\r
-enum\r
-{\r
-#ifndef CPUREG_PC\r
-       CPUREG_PC = 0,\r
-#endif\r
-       CPUREG_Z80_AF = 1,\r
-       CPUREG_Z80_BC,\r
-       CPUREG_Z80_DE,\r
-       CPUREG_Z80_HL,\r
-       CPUREG_Z80_AFPRIME,\r
-       CPUREG_Z80_BCPRIME,\r
-       CPUREG_Z80_DEPRIME,\r
-       CPUREG_Z80_HLPRIME,\r
-       CPUREG_Z80_IX,\r
-       CPUREG_Z80_IY,\r
-       CPUREG_Z80_SP,\r
-       CPUREG_Z80_I,\r
-       CPUREG_Z80_R,\r
-       CPUREG_Z80_A,\r
-       CPUREG_Z80_B,\r
-       CPUREG_Z80_C,\r
-       CPUREG_Z80_D,\r
-       CPUREG_Z80_E,\r
-       CPUREG_Z80_H,\r
-       CPUREG_Z80_L,\r
-       CPUREG_Z80_F,\r
-       CPUREG_Z80_CARRY,\r
-       CPUREG_Z80_NEGATIVE,\r
-       CPUREG_Z80_PARITY,\r
-       CPUREG_Z80_OVERFLOW,\r
-       CPUREG_Z80_HALFCARRY,\r
-       CPUREG_Z80_ZERO,\r
-       CPUREG_Z80_SIGN,\r
-       CPUREG_Z80_IFF1,\r
-       CPUREG_Z80_IFF2,\r
-\r
-       // Leave this here!\r
-\r
-       CPUREG_Z80_MAX_INDEX\r
-};\r
-\r
-extern UINT32 mz80exec(UINT32);\r
-extern UINT32 mz80GetContextSize(void);\r
-extern UINT32 mz80GetElapsedTicks(UINT32);\r
-extern void mz80ReleaseTimeslice(void);\r
-extern void mz80GetContext(void *);\r
-extern void mz80SetContext(void *);\r
-extern void mz80reset(void);\r
-extern void mz80ClearPendingInterrupt(void);\r
-extern UINT32 mz80int(UINT32);\r
-extern UINT32 mz80nmi(void);\r
-extern void mz80init(void);\r
-extern void mz80shutdown(void);\r
-extern UINT32 z80intAddr;\r
-extern UINT32 z80nmiAddr;\r
-\r
-// Debugger useful routines\r
-\r
-extern UINT8 mz80SetRegisterValue(void *, UINT32, UINT32);\r
-extern UINT32 mz80GetRegisterValue(void *, UINT32);\r
-extern UINT32 mz80GetRegisterTextValue(void *, UINT32, UINT8 *);\r
-extern UINT8 *mz80GetRegisterName(UINT32);\r
-\r
-// Memory/IO read/write commands\r
-\r
-#ifndef VALUE_BYTE\r
-#define        VALUE_BYTE      0\r
-#endif\r
-\r
-#ifndef VALUE_WORD\r
-#define        VALUE_WORD      1\r
-#endif\r
-\r
-#ifndef VALUE_DWORD\r
-#define        VALUE_DWORD     2\r
-#endif\r
-\r
-#ifndef VALUE_IO\r
-#define        VALUE_IO        3\r
-#endif\r
-\r
-extern void mz80WriteValue(UINT8 bWhat, UINT32 dwAddr, UINT32 dwData);\r
-extern UINT32 mz80ReadValue(UINT8 bWhat, UINT32 dwAddr);\r
-\r
-// Flag definitions\r
-\r
-#define        Z80_FLAG_CARRY                                  0x01\r
-#define        Z80_FLAG_NEGATIVE                               0x02\r
-#define        Z80_FLAG_OVERFLOW_PARITY        0x04\r
-#define        Z80_FLAG_UNDEFINED1                     0x08\r
-#define        Z80_FLAG_HALF_CARRY                     0x10\r
-#define        Z80_FLAG_UNDEFINED2                     0x20\r
-#define        Z80_FLAG_ZERO                                   0x40\r
-#define        Z80_FLAG_SIGN                                   0x80\r
-\r
-#define        IFF1                    0x01\r
-#define        IFF2                    0x02\r
-\r
-typedef struct mz80context CONTEXTMZ80;\r
-\r
-#ifdef __cplusplus\r
-};\r
-#endif\r
-\r
-#endif // _MZ80_H_\r
diff --git a/cpu/mz80/mz80.txt b/cpu/mz80/mz80.txt
deleted file mode 100644 (file)
index c4f8444..0000000
+++ /dev/null
@@ -1,809 +0,0 @@
-Multi-Z80 32 Bit emulator\r
-Copyright 1996, 1997, 1998, 1999, 2000 - Neil Bradley, All rights reserved\r
-\r
-                           MZ80 License agreement\r
-                           -----------------------\r
-\r
-(MZ80 Refers to both the assembly code emitted by makez80.c and makez80.c\r
-itself)\r
-\r
-MZ80 May be distributed in unmodified form to any medium.\r
-\r
-MZ80 May not be sold, or sold as a part of a commercial package without\r
-the express written permission of Neil Bradley (neil@synthcom.com). This\r
-includes shareware.\r
-\r
-Modified versions of MZ80 may not be publicly redistributed without author\r
-approval (neil@synthcom.com). This includes distributing via a publicly\r
-accessible LAN. You may make your own source modifications and distribute\r
-MZ80 in source or object form, but if you make modifications to MZ80\r
-then it should be noted in the top as a comment in makez80.c.\r
-\r
-MZ80 Licensing for commercial applications is available. Please email\r
-neil@synthcom.com for details.\r
-\r
-Synthcom Systems, Inc, and Neil Bradley will not be held responsible for\r
-any damage done by the use of MZ80. It is purely "as-is".\r
-\r
-If you use MZ80 in a freeware application, credit in the following text:\r
-\r
-"Multi-Z80 CPU emulator by Neil Bradley (neil@synthcom.com)"\r
-\r
-must accompany the freeware application within the application itself or\r
-in the documentation.\r
-\r
-Legal stuff aside:\r
-\r
-If you find problems with MZ80, please email the author so they can get\r
-resolved. If you find a bug and fix it, please also email the author so\r
-that those bug fixes can be propogated to the installed base of MZ80\r
-users. If you find performance improvements or problems with MZ80, please\r
-email the author with your changes/suggestions and they will be rolled in\r
-with subsequent releases of MZ80.\r
-\r
-The whole idea of this emulator is to have the fastest available 32 bit\r
-Multi-Z80 emulator for the x86, giving maximum performance.\r
\r
-                         MZ80 Contact information\r
-                         -------------------------\r
-\r
-Author      : Neil Bradley (neil@synthcom.com)\r
-Distribution: ftp://ftp.synthcom.com/pub/emulators/cpu/makez80.zip (latest)\r
-\r
-You can join the cpuemu mailing list on Synthcom for discussion of Neil\r
-Bradley's Z80 (and other) CPU emulators. Send a message to \r
-"cpuemu-request@synthcom.com" with "subscribe" in the message body. The\r
-traffic is fairly low, and is used as a general discussion and announcement\r
-for aforementioned emulators.\r
-\r
-\r
-                            MZ80 Documentation\r
-                            -------------------\r
-\r
-MZ80 Is a full featured Z80 emulator coded in 32 bit assembly. It runs well\r
-over a hundred games, in addition to it supporting many undocumented Z80\r
-instructions required to run some of the Midway MCR games, Galaga, and\r
-countless other wonderful Z80 based arcade games.\r
-\r
-MZ80 Contains a makez80.c program that must be compiled. It is the program\r
-that emits the assembly code that NASM will compile. This minimizes the\r
-possibility of bugs creeping in to MZ80 for the different addressing modes\r
-for each instruction. It requires NASM 0.97 or greater.\r
-\r
-The goal of MZ80 is to have a high performance Z80 emulator that is capable\r
-of running multiple emulations concurrently at full speed, even on lower-end\r
-machines (486/33). MZ80 Harnesses the striking similarities of both the Z80\r
-and the x86 instruction sets to take advantage of flag handling which greatly\r
-reduces the time required to emulate a processor, so no extra time is spent\r
-computing things that are already available in the native x86 processor,\r
-allowing it to perform leaps and bounds over comparable C based Z80 emulators\r
-on the same platform.\r
-\r
-MZ80 Is designed exclusively for use with NASM, the Netwide Assembler. This\r
-gives the ultimate in flexibility, as NASM can emit object files that work\r
-with Watcom, Microsoft Visual C++ (4.0-current), DJGPP, Borland C++, and\r
-gcc under FreeBSD or Linux. MZ80 Has been tested with each one of these\r
-compilers and is known to work properly on each.\r
-\r
-\r
-                           What's in the package\r
-                           ---------------------\r
-\r
-MZ80.TXT               - This text file\r
-\r
-MAKEZ80.C              - Multi Z80 32 Bit emulator emitter program\r
-\r
-MZ80.H                 - C Header file for MZ80 functions\r
-\r
-\r
-                         What's new in this release\r
-                         --------------------------\r
-\r
-Revision 3.4:\r
-\r
-       * Fixed the overflow flag not getting cleared in the SetOverflow()\r
-         routine. It caused strange problems with a handful of Genesis games\r
-       * Removed invalid instruction in the C version so that more\r
-         instructions will execute\r
-\r
-Revision 3.3:\r
-\r
-       * Undocumented opcodes added to the C emitter\r
-       * Bug fix to the C emission that properly handles shared RAM regions\r
-         (I.E. with handlers that are NULL)\r
-       * Now using 32 bit registers to do register/memory access. Slight\r
-         speed increase (assembly version only)\r
-\r
-Revision 3.2:\r
-       \r
-       * R Register emulation now accurate with a real Z80\r
-       * mz80int() Called when interrupts are disabled causes the\r
-         z80intPending flag to be set, and an interrupt will be caused after\r
-         the execution of EI and the next instruction. See "IMPORTANT NOTE\r
-         ABOUT INTERRUPTS" below\r
-       * The instruction after EI executes fully before interrupt status is\r
-         checked. (as does a real Z80)\r
-\r
-\r
-Revision 3.1:\r
-\r
-       * Fixed bug in memory dereference when handler was set to NULL (keeps\r
-         system from crashing or faulting)\r
-       * Removed the only stricmp() from the entire file and replaced it\r
-         with strcmp() so that stdlibs without it will compile\r
-       * Changed cyclesRemaining > 0 to cyclesRemaining >= 0 to be compatible\r
-         with the ASM core\r
-       * Removed additional sub [dwCyclesRemaining], 5 at the beginning of\r
-         mz80exec() (ASM Core only). Increases timing accuracy.\r
-       * NMIs And INTs add additional time to dwElapsedTicks as it should\r
-       * mz80ReleaseTimeslice() Sets remaining clocks to 0 instead of 1\r
-\r
-\r
-Revision 3.0:\r
-\r
-       * All instructions validated against a real Z80. Used an ISA card\r
-         with a Z80 on it to validate flag handling, instruction handling,\r
-         timing, and other goodies. The only thing not implemented/emulated\r
-         is flag bit 3 & 5 emulation. Believed to be 100% bug free!\r
-       * 80% Speed improvement over version 2.7 of mz80\r
-       * z80stb.c Removed. Use -c to emit a C version of mz80! API compatible!\r
-         Note that this is mostly, but not fully, debugged, so consider the\r
-         C version a beta! It's at least healthier than z80stb.c was. The C \r
-         version does not include the undocumented Z80 instructions.\r
-       * mz80nmi() No longer trashes registers it uses when using -cs\r
-       * IN/OUT Instructions work properly when using -16\r
-       * IN A, (xxh) uses A as high 8 bits of I/O fetch address when using -16\r
-       * IM 0/IM 1 Description in documentation fixed\r
-       * Sizes of all context registers increased to 32 bits - for speed!\r
-       * IFF1/IFF2 Now properly emulated\r
-       * JR Instruction offset can fetch from $ffff and properly wrap\r
-       * LDIR/LDDR Instruction now won't go to completion - instead it will\r
-         run until BC=0 or the # of cycles to execute have expired. These\r
-         instructions used to run to completion - even beyond the # of cycles\r
-         left to execute\r
-       * INI/IND/INIR/INDR countdown bug fixed - it was decrementing B twice\r
-         for each IN! Whoops!\r
-       * If you specify NULL as a handler address to a memory region, mz80 will\r
-         use vpData as a pointer to where that block of data resides. Quite\r
-         useful for multiprocessor emulations that share the same memory.\r
-       * EDI Now keeps track of cycle counting for faster execution\r
-       * Modified memory region scanning code to use 32 bit registers instead\r
-         of their 16 bit counterparts\r
-       * Get/SetContext() uses rep movsd/movsb. Insignificant overall, but\r
-         why waste the time?\r
-       * Debugging routines added. See the "DEBUGGING" section below for more\r
-         information. NOTE: The debugging routines are not yet available in\r
-         the C emission.\r
-       * Timing done slightly differently now. Mz80 now executes one \r
-         instruction past the timing given on input. For example, mz80exec(0)\r
-         will cause a single instruction to be executed (thusly -ss was\r
-         removed).\r
-\r
-Revision 2.7:\r
-\r
-       * Fixed OTIR/OTDR/INIR/INDR instructions so their 16 bit counterparts\r
-         work properly\r
-       * Emulation core 30-70% faster overall than 2.6 due to optimization to\r
-         the timing routines\r
-       * Replaced word reads/writes with a special word write routine rather\r
-         than the standard calling to read/write byte functions\r
-       * z80stb.c (the C equivalent of mz80) compiles properly now\r
-       * Fixed OS/2 text/segment issue\r
-       * Fixed bug in set/getCPU context that ensures that ES=DS and avoids\r
-         crashes. Caused crashes under OS/2 and other OS's\r
-\r
-Revision 2.6:\r
-\r
-       * Emulator core 5-30% faster overall. Some 16 and 8 bit instructions\r
-         sped up when using their 32 bit equivalents.\r
-       * Fix to -l so that proper labels without leading and trailing \r
-         underscores so Linux/FreeBSD compiles will work properly\r
-       * Single step now executes the # of instructions passed in to z80exec()\r
-         instead of just 1 as it had in prior releases. This is only active\r
-         when the -ss option is used.\r
-       * The -nt option was added. This will cause the timing information to\r
-         not be added in, speeding up execution. Warning: Only do this if your\r
-         emulated target does not require instruction timing!\r
-       * Updated documentation errors\r
-       * C Version of mz80 (mz80.c) that is API compliant is distributed with\r
-         the archive (With kind permission of Edward Massey).\r
-\r
-Revision 2.5:\r
-\r
-       * Fixed an unconditional flag being cleared in the ddcbxx instructions.\r
-         It caused Donkey Kong's barrels to not roll.\r
-\r
-Revision 2.4:\r
-\r
-       * Fixed improper HALT handling (didn't advance the PTR when it should)\r
-       * Fixed SRL (IX+$xx) instruction so that carry wasn't trashed\r
-       * Fixed single stepping problems with it giving too much time to \r
-         any given instruction\r
-       * Fixed half carry flag handling with 16 bit SBC and ADD instructions\r
-       * Fixed DAA emulation so that parity flags weren't getting trashed\r
-\r
-Revision 2.3:\r
-\r
-       * Fixed many stack handling bugs\r
-       * Timing problems fixed. The prior version was causing massive \r
-         overruns on maximum timeslices with some insutructions.\r
-\r
-Revision 2.2:\r
-\r
-       * Fixed a bug in CPI/CPD/CPIR/CPDR that mishandled flags\r
-       * All known bugs are out of mz80 now\r
-       * Added the -cs option to route all stack operations through the\r
-         handlers (required for games like Galaga)\r
-\r
-Revision 2.1:\r
-\r
-       * Fixed a bug in CPI/CPD/CPIR/CPDR that caused intermittent lockups.\r
-         Also fixed a bug that caused erratic behavior in several video games.\r
-       * Added INI/IND/INIR/INDR instruction group\r
-       * Added OUTI/OUTD/OTIR/OTDR instruction group\r
-\r
-Revision 1.0:\r
-\r
-       * First release! The whole thing is new!\r
-\r
-\r
-ASSEMBLING FOR USE WITH WATCOM C/C++\r
-------------------------------------\r
-\r
-Watcom, by default, uses register calling conventions, as does MZ80. To\r
-create a proper emulator for Watcom:\r
-\r
-       makez80 MZ80.asm -x86\r
-\r
-From here:\r
-\r
-       nasm -f win32 MZ80.asm\r
-\r
-Link the MZ80.obj with your Watcom linker.\r
-\r
-\r
-ASSEMBLING FOR USE WITH MICROSOFT VISUAL C++ AND BORLAND C++\r
---------------------------------------------------------------------\r
-\r
-Visual C++ and Borland C++ use stack calling conventions by default. To\r
-create a proper emulator for these compilers:\r
-\r
-       makez80 MZ80.asm -s -x86\r
-\r
-For Visual C++ or Borland C++:\r
-\r
-       nasm -f win32 MZ80.asm\r
-\r
-Link with your standard Visual C++ or Borland C++.\r
-\r
-\r
-ASSEMBLING FOR USE WITH DJGPP, GCC/FREEBSD, OR GCC/LINUX\r
---------------------------------------------------------------------\r
-\r
-DJGPP Uses stack calling conventions:\r
-\r
-       makez80 MZ80.asm -s -x86\r
-\r
-To assemble:\r
-\r
-       nasm -f coff MZ80.asm\r
-\r
-Link with your standard DJGPP linker. The same holds true for GCC under\r
-FreeBSD or Linux. If you're using GCC, use the -l option to generate "plain"\r
-labels so that gcc's linker will properly link things.\r
-\r
-\r
-MAKEZ80 COMMAND LINE OPTIONS\r
-----------------------------\r
-\r
--s     - Use stack calling conventions (DJGPP, MSVC, Borland, etc...)\r
-\r
--cs    - Force all stack operations to go through the Read/Write memory handlers.\r
-         This slows things down, but is useful when needed.\r
-\r
--16    - Treat all I/O input and output as 16 bit (BC)\r
-\r
--l     - Create 'plain' labels - ones without leading and trailing underscores\r
-\r
--nt    - Do not generate timing code - this speeds the emulator up, but the\r
-         downside is that no timing info is available.\r
-\r
--c     - Emit a C mz80 emulator (API Compatible with the assembly version - \r
-         handy for porters!)\r
-\r
--x86   - Emit an assembly (x86) mz80 emulator\r
-\r
--os2   - Generate OS/2 compatible segmentation\r
-\r
-\r
-IMPORTANT NOTE ABOUT INTERRUPTS\r
--------------------------------\r
-\r
-A minor change was made between the 3.1 and 3.2 versions of makez80 in the\r
-way that interrupts were handled.\r
-\r
-On a real Z80, the !INT line is a level triggered interrupt, meaning that if\r
-the interrupt line is held low, the Z80 will continue to take interrupts \r
-immediately after the instruction after the EI instruction is executed until\r
-the interrupt line is high again.\r
-\r
-In 3.1, if an interrupt came in and interrupts were disabled, the interrupt\r
-would never be "latched" for later execution. The Z80 does not have any\r
-internal latching capabilities, however external hardware often does hold\r
-the interrupt line low until the interrupt is executed, in effect, a latch.\r
-\r
-I've only found one video game so far that requires the "raising/lowering"\r
-of the interrupt line (Ataxx). In the games that I've tried, it has improved\r
-performance, in some cases drastically, and in others not at all. This can\r
-be accounted for by interrupts being taken now, where they were being dropped\r
-in prior mz80 releases.\r
-\r
-mz80 Emulates the most commonly used scenario. Now when mz80int() is executed\r
-and a nonzero value is returned (indicating interrupts were disabled), it\r
-will set z80intPending, and the interrupt will be taken after execution of\r
-one instruction beyond the EI instruction.\r
-\r
-So now, if mz80int() returns a nonzero value, that means an interrupt is\r
-latched. If clearing this latch is desired or the old behavior of 3.1 is \r
-desired, make a call to the mz80ClearPendingInterrupt() call. It's a 2 \r
-instruction call that has extremely small overhead and will not affect \r
-performance in any measurable way.\r
-\r
-In any case, MZ80 will now execute one instruction after EI regardless of\r
-how much time is available to avoid the possibility of an interrupt request\r
-coming in directly after the EI instruction. \r
-\r
-\r
-STEPS TO EMULATION\r
-------------------\r
-\r
-NOTE: -16 Is a command line option that will treat all I/O as 16 bit. That\r
-is, in an instruction like "IN AL, (C)", the addressed passed to the I/O\r
-handler will be BC instead of just C. Bear this in mind when considering your\r
-emulated platform.\r
-\r
-There are a few steps you want to go through to get proper emulation, and a\r
-few guidelines must be followed.\r
-\r
-1) Create a MZ80CONTEXT\r
-\r
-2) Create your virtual 64K memory space using whatever means of obtaining\r
-   memory you need to do.\r
-\r
-3) Set mz80Base in your context to be the base of your 64K memory space\r
-\r
-4) Load up your image to be emulated within that 64K address space.\r
-\r
-5) Set z80IoRead and z80IoWrite to their appropriate structure arrays. Here's\r
-   an example:\r
-\r
-struct z80PortRead ReadPorts[] =\r
-{\r
-       {0x10,  0x1f,   SoundChip1Read},\r
-       {0x20,  0x2f,   SoundChip2Read}\r
-       {(UINT32) -1,     (UINT32) -1, NULL}\r
-};\r
-\r
-When an IN instruction occurs, mz80 will probe this table looking for a\r
-handler to the address of the "IN" instruction. If it is found in the list,\r
-it's up to the handler to return the proper value. Otherwise, a value of\r
-0ffh is returned internally if no handler for that I/O address is found. In\r
-the case above, SoundChip1Read is called when the I/O address is between 0x10-\r
-0x1f. A similar structure is used for I/O writes as well (OUT):\r
-\r
-struct z80PortWrite WritePorts[] =\r
-{\r
-       {0x20,  0x2f,   SoundChip2Write},\r
-       {0x30,  0x36,   VideoCtrlWrite},\r
-       {(UINT32) -1,   (UINT32) -1, NULL}\r
-}\r
-\r
-Of course, this does the opposite that the z80PortRead struct, and instead\r
-looks for a handler to hand some data to. If it doesn't find an appropriate\r
-handler, nothing happens.\r
-\r
-6) Set mz80MemoryRead & mz80MemoryWrite to their appropriate structure\r
-   arrays. Here is an example:\r
-\r
-struct MemoryWriteByte GameWrite[] =\r
-{\r
-       {0x3000, 0x3fff,  VideoWrite},\r
-       {0x4000, 0x4fff,  SpriteWrite},\r
-       {(UINT32) -1,     (UINT32) -1, NULL}\r
-};\r
-\r
-The above example says that any time a write occurs in the 0x3000-0x3fff\r
-range, call the VideoWrite routine. The same holds true for the SpriteWrite\r
-region as well.\r
-\r
-NOTE: When your write handler is called, it is passed the address of the\r
-write and the data that is to be written to it. If your handler doesn't\r
-write the data to the virtual image, the mz80 internal code will not.\r
-\r
-NOTE: These routines will *NOT* be called when execution asks for these\r
-addresses. It will only call them when a particular instruction uses the\r
-memory at these locations.\r
-\r
-If you wish for a region to be RAM, just leave it out of your memory region\r
-exception list. The WriteMemoryByte routine will treat it as read/write\r
-RAM and will write to mz80Base + addr directly.\r
-\r
-If you wish to protect ROM regions (not often necessary), create a range that\r
-encompasses the ROM image, and have it call a routine that does nothing. This\r
-will prevent data from being written back onto the ROM image.\r
-\r
-Leave your last entry in the table as shown above, with a null handler and\r
-0xffffffff-0xffffffff as your read address. Even though the Z80 only\r
-addresses 64K of space, the read/write handlers are defined as 32 bit so\r
-the compiler won't pass junk in the upper 16 bits of the address lines. Not\r
-only that, it allows orthoganality for future CPU emulators that may use\r
-these upper bits.\r
-\r
-You can do a mz80GetContext() if you'd like to read the current context of\r
-the registers. Note that by the time your handler gets called, the program\r
-counter will be pointing to the *NEXT* instruction.\r
-\r
-struct MemoryReadByte GameRead[] =\r
-{\r
-       {0x2000,        0x200f,         ReadHandler},\r
-       {(UINT32) -1,     (UINT32) -1,  NULL}\r
-};\r
-\r
-Same story here. If you have a special handler for an attempted read at a\r
-particular address, place its range in this table and create a handler\r
-routine for it.   \r
-\r
-If you don't define a handler for a particular region, then the ReadMemoryByte\r
-in mz80.ASM will actually read the value out of mz80Base + the offset \r
-required to complete the instruction.\r
-\r
-7) Set the intAddr and nmiAddr to the addresses where you want mz80 to start\r
-   executing when an interrupt or NMI happens. Take a look at the section\r
-   entitled "INTERRUPTS" below for more information on this.\r
-\r
-8) Call mz80SetContext() on your Z80 context\r
-\r
-9) Call mz80Reset(). This will prime the program counter and cause a virtual\r
-   CPU-wide reset.\r
-\r
-10) Once you have those defined, you're ready to begin emulation. There's some\r
-    sort of main loop that you'll want. Maybe something like:\r
-\r
-       while (hit == 0)\r
-       {\r
-               if (lastSec != (UINT32) time(0))\r
-               {\r
-                       diff = (mz80clockticks - prior) / 3000000;\r
-                       printf("%ld Clockticks, %ld frames, %ld Times original speed\n", MZ80clockticks - prior, frames, diff);\r
-                       frames = 0;\r
-                       prior = mz80clockticks;\r
-                       lastSec = time(0);\r
-                       if (kbhit())\r
-                       {\r
-                               getch();\r
-                               hit = 1;\r
-                       }\r
-               }\r
-\r
-               /* 9000 Cycles per NMI (~3 milliseconds @ 3MHZ) */\r
-\r
-               dwResult = mz80exec(9000);\r
-               mz80clockticks += mz80GetElapsedTicks(TRUE);\r
-               mz80nmi();\r
-\r
-               /* If the result is not 0x80000000, it's an address where\r
-                  an invalid instruction was hit. */\r
-\r
-               if (0x80000000 != dwResult)\r
-               {\r
-                       mz80GetContext(&sCpu1);\r
-                       printf("Invalid instruction at %.2x\n", sCpu1.MZ80pc);\r
-                       exit(1);\r
-               }\r
-       }\r
-\r
-Call mz80exec() With the # of virtual CPU cycles you'd like mz80 to\r
-execute. Be sure to use the mz80GetElapsedTicks() call *AFTER* execution to\r
-see how many virtual CPU cycles it actually executed. For example, if you tell\r
-mz80 to execute 500 virtual CPU cycles, it will execute slightly more. Anything\r
-from 500 to 524 (24 cycles being the longest any 1 instruction takes in the\r
-Z80).\r
-\r
-Use the mz80GetElapsedTicks() call for more accurate cycle counting. Of course,\r
-this is only if you have *NOT* included the -nt option.\r
-\r
-If you pass FALSE to the mz80GetElapsedTicks() function, the internal CPU \r
-elapsed tick clock will not be reset. The elapsed tick counter is something \r
-that continues to increase every emulated instruction, and like an odometer,\r
-will keep counting unless you pass TRUE to mz80GetElapsedTicks(), of which \r
-case it will return you the current value of the elapsed ticks and set it to \r
-0 when complete.\r
-\r
-NOTE: The bigger value you pass to mz80exec, the greater benefit you get out\r
-of the virtual registers persisting within the emulator, and it will run\r
-faster. Pass in a value that is large enough to take advantage of it, but\r
-not so often that you can't handle nmi or int's properly.\r
-\r
-If you wish to create a virtual NMI, call mz80nmi(), and it will be taken\r
-the next time you call mz80exec, or alternately if you have a handler call\r
-mz80nmi/mz80int(), the interrupt will be taken upon return. Note that \r
-mz80nmi() doesn't actually execute any code - it only primes the emulator to\r
-begin executing NMI/INT code.\r
-\r
-NOTE: mz80int() is defined with a UINT32 as a formal parameter. Depending \r
-upon what interrupt mode you're executing in (described later), it may or may\r
-not take a value.\r
-\r
-NMI's can interrupt interrupts, but not the other way around - just like a\r
-real Z80. If your program is already in an interrupt, another one will not be\r
-taken. The same holds true for an NMI - Just like a real Z80!\r
-\r
-\r
-MUTLI-PROCESSOR NOTES\r
----------------------\r
-\r
-Doing multi processor support is a bit trickier, but is still fairly straight-\r
-forward.\r
-\r
-For each processor to be emulated, go through steps 1-7 above - giving each\r
-CPU its own memory space, register storage, and read/write handlers.\r
-\r
-\r
-EXECUTION OF MULTI-CPUS:\r
--------------------------\r
-\r
-When you're ready to execute a given CPU, do the following:\r
-\r
-       mz80SetContext(contextPointer);\r
-\r
-This will load up all information saved before into the emulator and ready it\r
-for execution. Then execute step 7 above to do your virtual NMI's, interrupts,\r
-etc... All CPU state information is saved within a context.\r
-\r
-When the execution cycle is complete, do the following to save the updated\r
-context away for later:\r
-\r
-       mz80GetContext(contextPointer);\r
-\r
-Give each virtual processor a slice of time to execute. Don't make the values\r
-too small or it will spend its time swapping contexts. While this in itself\r
-isn't particularly CPU expensive, the more time you spend executing the better.\r
-mz80 Keeps all of the Z80 register in native x86 register (including most\r
-of the flags, HL, BC, and A). If no context swap is needed, then you get the\r
-added advantage of the register storage. For example, let's say you were \r
-running two Z80s - one at 2.0MHZ and one at 3.0MHZ. An example like this \r
-might be desirable:\r
-\r
-       mz80SetContext(cpu1Context);    // Set CPU #1's information\r
-       mz80exec(2000);         // 2000 Instructions for 2.0MHZ CPU\r
-       mz80GetContext(cpu1Context);    // Get CPU #1's state info\r
-\r
-       mz80SetContext(cpu2Context);    // Set CPU #2's state information\r
-       mz80exec(3000);         // 3000 Instructions for 3.0MHZ CPU\r
-       mz80GetContext(cpu2Context);    // Get CPU #2's state information\r
-\r
-This isn't entirely realistic, but if you keep the instruction or timing\r
-ratios between the emulated CPUs even, then timing is a bit more accurate.\r
-\r
-NOTE: If you need to make a particular CPU give up its own time cycle because\r
-of a memory read/write, simply trap a particular address (say, a write to a\r
-slave processor) and call mz80ReleaseTimeslice(). It will not execute any \r
-further instructions, and will give up its timeslice. Put this in your \r
-read/write memory trap.\r
-\r
-NOTE: You are responsible for "holding back" the processor emulator from\r
-running too fast.\r
-\r
-\r
-INTERRUPTS\r
-----------\r
-\r
-The Z80 has three interrupt modes: IM 0 - IM 2. Each act differently. Here's\r
-a description of each:\r
-\r
-IM 0\r
-\r
-This mode will cause the Z80 to be able to pull a "single byte instruction"\r
-off the bus when an interrupt occurs. Since we're not doing bus cycle\r
-emulation, it acts identically to mode 1 (described below). The formal\r
-parameter to mz80int() is ignored. There is really no point in actually \r
-emulating the instruction execution since any instruction that would be\r
-executed would be a branch instruction!\r
-\r
-IM 1\r
-\r
-This mode is the "default" mode that the Z80 (and mz80 for that matter) comes\r
-up in. When you call mz80reset(), the interrupt address is set to 38h and\r
-the NMI address is set to 66h. So when you're in IM 1 and mz80int() is\r
-called, the formal parameter is ignored and the z80intAddr/z80nmiAddr values\r
-are appropriately loaded into the program counter.\r
-\r
-IM 2\r
-\r
-This mode causes the Z80 to read the upper 8 bits from the current value\r
-of the "I" register, and the lower 8 bits from the value passed into mz80int().\r
-So, if I contained 35h, and you did an mz80int(0x64), then an interrupt at\r
-address 3564h would be taken. Simple!\r
-\r
-\r
-OTHER GOODIES\r
--------------\r
-\r
-MZ80 Has a nice feature for allowing the same handler to handle different\r
-data regions on a single handler. Here's an example:\r
-\r
-struct PokeyDataStruct Pokey1;\r
-struct PokeyDataStruct Pokey2;\r
-\r
-struct MemoryWriteByte GameWrite[] =\r
-{\r
-       {0x1000, 0x100f,  PokeyHandler, Pokey1},\r
-       {0x1010, 0x101f,  PokeyHandler, Pokey2},\r
-       {(UINT32) -1,     (UINT32) -1, NULL}\r
-};\r
-\r
-void PokeyHandler(UINT32 dwAddr, UINT8 bData, struct sMemoryWriteByte *psMem)\r
-{\r
-       struct PokeyDataStruct *psPokey = psMem->pUserArea;\r
-\r
-       // Do stuff with psPokey here....\r
-}\r
-\r
-This passes in the pointer to the sMemoryWriteByte structure that caused\r
-the handler to be called. The pUserArea is a user defined address that can\r
-be anything. It is not necessary to fill it in with anything or even\r
-initialize it if the handler doesn't actually use it.\r
-\r
-This allows a single handler to handle multiple data references. This is\r
-particularly useful when handling sound chip emulation, where there might\r
-be more than one of a given device. Sure beats having multiple unique\r
-handlers that are identical with the exception of the data area where it\r
-writes! This allows a good deal of flexibility.\r
-\r
-The same construct holds for MemoryReadByte, z80PortRead, and z80PortWrite,\r
-so all can take advantage of this feature.\r
-\r
-\r
-SHARED MEMORY FEATURES\r
-----------------------\r
-\r
-MZ80 Also has another useful feature for dealing with shared memory regions:\r
-\r
-UINT8 bSharedRAM[0x100];\r
-\r
-struct MemoryWriteByte Processor1[] = \r
-{\r
-       {0x1000, 0x10ff, NULL, bSharedRAM},\r
-       {(UINT32) -1, (UINT32) -1, NULL}\r
-};\r
-\r
-struct MemoryWriteByte Processor2[] = \r
-{\r
-       {0x1000, 0x10ff, NULL, bSharedRAM},\r
-       {(UINT32) -1, (UINT32) -1, NULL}\r
-};\r
-\r
-If the handler address is NULL, mz80 will look at the pUserArea field as a\r
-pointer to RAM to read from/write to. This comes in extremely handy when you\r
-have an emulation that requires two or more processors writing to the same\r
-memory block. And it's lots faster than creating a handler that writes to\r
-a common area as well.\r
-\r
-\r
-DEBUGGING\r
----------\r
-\r
-Several new functions have been added to mz80 that assist the emulator\r
-author by providing a standard set of functions for register access:\r
-\r
-UINT8 mz80SetRegisterValue(void *pContext, UINT32 dwRegister, UINT32 dwValue)\r
-\r
-This allows setting of any register within the Z80. The register field can be\r
-one of the following values (defined in mz80.h):\r
-\r
-       CPUREG_PC\r
-       CPUREG_Z80_AF\r
-       CPUREG_Z80_BC\r
-       CPUREG_Z80_DE\r
-       CPUREG_Z80_HL\r
-       CPUREG_Z80_AFPRIME\r
-       CPUREG_Z80_BCPRIME\r
-       CPUREG_Z80_DEPRIME\r
-       CPUREG_Z80_HLPRIME\r
-       CPUREG_Z80_IX\r
-       CPUREG_Z80_IY\r
-       CPUREG_Z80_SP\r
-       CPUREG_Z80_I\r
-       CPUREG_Z80_R\r
-       CPUREG_Z80_A\r
-       CPUREG_Z80_B\r
-       CPUREG_Z80_C\r
-       CPUREG_Z80_D\r
-       CPUREG_Z80_E\r
-       CPUREG_Z80_H\r
-       CPUREG_Z80_L\r
-       CPUREG_Z80_F\r
-       CPUREG_Z80_CARRY\r
-       CPUREG_Z80_NEGATIVE\r
-       CPUREG_Z80_PARITY\r
-       CPUREG_Z80_OVERFLOW\r
-       CPUREG_Z80_HALFCARRY\r
-       CPUREG_Z80_ZERO\r
-       CPUREG_Z80_SIGN\r
-       CPUREG_Z80_IFF1\r
-       CPUREG_Z80_IFF2\r
-\r
-Each individual register's value can be set, including the flags at the end.\r
-The only valid values for the flags are 1 and 0. Setting these will\r
-automatically adjust the "F" register. \r
-\r
-If pContext is NULL, then the registers in the currently active context are\r
-changed. If pContext points to a non-NULL area, that area is assumed to be\r
-a CONTEXTMZ80 structure where the new register value will be written.\r
-\r
-If mz80SetRegisterValue() returns a nonzero value, either the register value\r
-or register is out of range or invalid.\r
-\r
-\r
-UINT32 mz80GetRegisterValue(void *pContext, UINT32 dwRegister)\r
-\r
-This returns the value of the register given on input (listed above as\r
-CPUREG_Z80_xxxxx). Flag values will be 1 or 0.\r
-\r
-If pContext is NULL, then the registers in the currently active context are\r
-read. If pContext points to a non-NULL area, that area is assumed to be\r
-a CONTEXTMZ80 structure from which register values are pulled.\r
-\r
-\r
-UINT32 mz80GetRegisterTextValue(void *pContext, UINT32 dwRegister, \r
-                                UINT8 *pbTextArea)\r
-\r
-This returns the textual representation of the value of a given register.\r
-It is a text printable string that can be used in sprintf() statements and\r
-the like. This function is useful because different representations for\r
-registers (like flags) can be a group of 8 flag bytes instead of a single\r
-value.\r
-\r
-On entry, pContext being set to NULL indicates that mz80 should get the\r
-register value from the currently active context. Otherwise, it is assumed\r
-to be pointing to a CONTEXTMZ80 structure, which contains the value of the\r
-registers to be read.\r
-\r
-pbTextArea points to a buffer where the value text can be written. This points\r
-to a user supplied buffer.\r
-\r
-On exit, if any nonzero value is encountered, either the register # is out\r
-of range or pbTextArea is NULL.\r
-\r
-\r
-UINT8 *mz80GetRegisterName(UINT32 dwRegister)\r
-\r
-This returns a pointer to the textual name of the register passed in. NULL\r
-Is returned if the register index (CPUREG_Z80_xxxx table described above) is\r
-out of range. DO NOT MODIFY THE TEXT! It is static data.\r
-\r
-\r
-FINAL NOTES\r
------------\r
-\r
-I have debugged MZ80.ASM to the best of my abilities. There might still be\r
-a few bugs floating around in it, but I'm not aware of any. I've validated\r
-all instructions (That I could) against a custom built Z80 on an ISA card\r
-(that fits in a PC) so I'm quite confident that it works just like a real\r
-Z80. \r
-\r
-If you see any problems, please point them out to me, as I am eager to make\r
-mz80 the best emulator that I can. \r
-\r
-If you have questions, comments, etc... about mz80, please don't hesitate\r
-to send me an email. And if you use mz80 in your emulator, I'd love to take\r
-a look at your work. If you have special needs, or need implementation\r
-specific hints, feel free to email me, Neil Bradley (neil@synthcom.com). I\r
-will do my best to help you.\r
-\r
-Enjoy!\r
-\r
-Neil Bradley\r
-neil@synthcom.com\r
-\r
-\r
index da0a9a7..561cae1 100644 (file)
@@ -225,13 +225,6 @@ extern short *PsndOut;
 extern void (*PsndMix_32_to_16l)(short *dest, int *src, int count);\r
 void PsndRerate(int preserve_state);\r
 \r
-// Utils.c\r
-extern int PicuAnd;\r
-int PicuQuick(unsigned short *dest,unsigned short *src);\r
-int PicuShrink(unsigned short *dest,int destLen,unsigned short *src,int srcLen);\r
-int PicuShrinkReverse(unsigned short *dest,int destLen,unsigned short *src,int srcLen);\r
-int PicuMerge(unsigned short *dest,int destLen,unsigned short *src,int srcLen);\r
-\r
 #ifdef __cplusplus\r
 } // End of extern "C"\r
 #endif\r
diff --git a/pico/utils.c b/pico/utils.c
deleted file mode 100644 (file)
index 467bc78..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-// This is part of Pico Library\r
-\r
-// (c) Copyright 2004 Dave, All rights reserved.\r
-// (c) Copyright 2006 notaz, All rights reserved.\r
-// Free for non-commercial use.\r
-\r
-// For commercial use, separate licencing terms must be obtained.\r
-\r
-\r
-#include "pico_int.h"\r
-\r
-int PicuAnd=0xf7de;\r
-\r
-// Quick low-quality conversion of 320 to 176:\r
-int PicuQuick(unsigned short *dest,unsigned short *src)\r
-{\r
-  unsigned short *end=NULL;\r
-\r
-  src+=13; end=src+290;\r
-  dest++;\r
-\r
-  do\r
-  {\r
-    *dest++=*src++;\r
-    *dest++=*src; src+=2;\r
-    *dest++=*src; src+=2;\r
-    *dest++=*src++;\r
-    *dest++=*src; src+=2;\r
-    *dest++=*src; src+=2;\r
-  }\r
-  while (src<end);\r
-\r
-  return 0;\r
-}\r
-\r
-// Shrink the pixels in src/srcLen, to the screen line pointed to by dest/destLen\r
-int PicuShrink(unsigned short *dest,int destLen,unsigned short *src,int srcLen)\r
-{\r
-  unsigned short *end=NULL;\r
-  int bias=0,pa=0,sub=0;\r
-\r
-  end=dest+destLen;\r
-  sub=srcLen-destLen;\r
-\r
-  do\r
-  {\r
-    pa=*src++; bias-=sub;\r
-    if (bias<0) { pa+=*src++; pa>>=1; bias+=destLen; }\r
-    *dest++=(unsigned short)pa;\r
-\r
-    pa=*src++; bias-=sub;\r
-    if (bias<0) { pa+=*src++; pa>>=1; bias+=destLen; }\r
-    *dest++=(unsigned short)pa;\r
-  }\r
-  while (dest<end);\r
-  \r
-  return 0;\r
-}\r
-\r
-// same thing, only reversed (dest is in pre-decremental mode)\r
-int PicuShrinkReverse(unsigned short *dest,int destLen,unsigned short *src,int srcLen)\r
-{\r
-  unsigned short *end=NULL;\r
-  int bias=0,pa=0,sub=0;\r
-\r
-  end=dest-destLen;\r
-  sub=srcLen-destLen;\r
-\r
-  do\r
-  {\r
-    pa=*src++; bias-=sub;\r
-    if (bias<0) { pa+=*src++; pa>>=1; bias+=destLen; }\r
-    *(--dest)=(unsigned short)pa;\r
-\r
-    pa=*src++; bias-=sub;\r
-    if (bias<0) { pa+=*src++; pa>>=1; bias+=destLen; }\r
-    *(--dest)=(unsigned short)pa;\r
-  }\r
-  while (dest>end);\r
-  \r
-  return 0;\r
-}\r
-\r
-int PicuMerge(unsigned short *dest,int destLen,unsigned short *src,int srcLen)\r
-{\r
-  unsigned short *end=NULL;\r
-  int bias=0,pa=0,mask=PicuAnd,sub=0;\r
-\r
-  end=dest+destLen;\r
-  sub=srcLen-destLen;\r
-\r
-  do\r
-  {\r
-    pa=*src++; bias-=sub;\r
-    if (bias<0) { pa+=*src++; pa>>=1; bias+=destLen; }\r
-    pa&=mask; pa+=(*dest)&mask; pa>>=1;\r
-    *dest++=(unsigned short)pa;\r
-\r
-    pa=*src++; bias-=sub;\r
-    if (bias<0) { pa+=*src++; pa>>=1; bias+=destLen; }\r
-    pa&=mask; pa+=(*dest)&mask; pa>>=1;\r
-    *dest++=(unsigned short)pa;\r
-  }\r
-  while (dest<end);\r
-  \r
-  return 0;\r
-}\r
-\r
diff --git a/platform/uiq2/ClientServer.h b/platform/uiq2/ClientServer.h
deleted file mode 100644 (file)
index b320bce..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-// protocol used to talk between exe and it's launcher\r
-\r
-#ifndef __CLIENTSERVER_H\r
-#define __CLIENTSERVER_H\r
-\r
-#include <w32std.h>\r
-\r
-// names\r
-_LIT(KServerName,   "PicodriveNServ");\r
-_LIT(KServerWGName, "Picosmall"); // window group name\r
-_LIT(KClientName,   "PicodriveN");\r
-_LIT(KClientFind,   "PicodriveN*"); // client search mask (for TFindLibrary)\r
-\r
-\r
-// opcodes used in message passing between client and server\r
-enum TPicoServRqst {\r
-       PicoMsgLoadState,\r
-       PicoMsgSaveState,\r
-       PicoMsgLoadROM,\r
-       PicoMsgResume,\r
-       PicoMsgReset,\r
-       PicoMsgKeys,\r
-       PicoMsgPause,\r
-       PicoMsgQuit,\r
-       PicoMsgConfigChange,    // launcher -> emu\r
-       PicoMsgRetrieveConfig,  // emu -> launcher\r
-       PicoMsgRetrieveDebugStr,// fixed to 512 bytes 4 now\r
-       kDefaultMessageSlots // this is how many messages we need :)\r
-};\r
-\r
-\r
-// event messages to launcher\r
-enum TPicoLauncherEvents {\r
-       EEventKeyCfgDone = EEventUser + 1,\r
-       EEventGamePaused,\r
-};\r
-\r
-\r
-// configuration data to be sent between server and client\r
-struct TPicoConfig {\r
-       enum TPicoScreenRotation {\r
-               PRot0,\r
-               PRot90,\r
-               PRot180,\r
-               PRot270\r
-       };\r
-       enum TPicoScreenMode {\r
-               PMCenter,\r
-               PMFit,\r
-               PMFit2\r
-       };\r
-       enum TPicoFrameSkip {\r
-               PFSkipAuto = -1,\r
-               PFSkip0\r
-       };\r
-       TInt32                          iScreenRotation;\r
-       TInt32                          iScreenMode;\r
-       TUint32                         iFlags;   // LSb->MSb: use_sram, show_fps, enable_sound, sound_rate(3bits), gzip_saves{=0x40}, dont_use_mot_vol\r
-    // enable_ym2612&dac, enable_sn76496, enable_z80, stereo_sound;\r
-    // alt_renderer, 6button_gamepad, accurate_timing\r
-       TInt32                          iPicoOpt;\r
-       TInt32                          iFrameskip;\r
-       TUint32                         iKeyBinds[32];\r
-       TUint32                         iAreaBinds[19];\r
-       TInt32                          PicoRegion;\r
-};\r
-\r
-\r
-#endif // __CLIENTSERVER_H\r
diff --git a/platform/uiq2/Makefile b/platform/uiq2/Makefile
deleted file mode 100644 (file)
index 3b96009..0000000
+++ /dev/null
@@ -1,321 +0,0 @@
-# environmental vars required:\r
-# EPOCROOT2 - root of your SDK with slash at the end\r
-\r
-# settings\r
-#dprint = 1\r
-#mz80 = 1\r
-#debug_cyclone = 1\r
-asm_memory = 1\r
-#asm_render = 1\r
-#use_musashi = 1\r
-\r
-EPOCBLDUREL = _BUILD\r
-EPOCTRGUREL = $(EPOCROOT2)EPOC32\RELEASE\ARMI\UREL\r
-EPOCLINKUREL = $(EPOCTRGUREL)\r
-EPOCSTATLINKUREL = $(EPOCTRGUREL)\r
-\r
-\r
-# must set both PATH and Path to make it work correctly (?)\r
-Path:=$(EPOCROOT2)EPOC32\gcc\bin;$(Path)\r
-PATH:=$(Path)\r
-ERASE = @erase 2>>nul\r
-\r
-\r
-ALL : UREL\r
-UREL : CHECKENV MAKEDIRS\r
-UREL : $(EPOCTRGUREL)\PICOSMALL.EXE\r
-\r
-CLEAN :\r
-       @perl -S ermdir.pl "$(EPOCBLDUREL)"\r
-       @del *.o 2> NUL\r
-\r
-CLEANZ :\r
-       del ..\..\zlib\*.o 2> NUL\r
-\r
-CLEANM :\r
-       del ..\..\musashi\*.o 2> NUL\r
-\r
-CLEANALL : CLEAN CLEANZ CLEANM\r
-\r
-\r
-# check for EPOCROOT2\r
-CHECKENV : $(EPOCROOT2)epoc32\r
-\r
-$(EPOCROOT2)epoc32 :\r
-       @echo Please set EPOCROOT2 environmental variable to full path to your SDK\r
-       @echo with ending slash (something like C:\Uiq_21\)\r
-       @cd : 2> NUL # do something stupid to make it silently fail\r
-\r
-\r
-# GCC\r
-INCDIR  = -I. -I "..\..\" -I "$(EPOCROOT2)EPOC32\INCLUDE" -I "$(EPOCROOT2)EPOC32\INCLUDE\LIBC"\r
-\r
-GCCFLAGS = -nostdinc -Wall -Wno-ctor-dtor-privacy -Wno-unknown-pragmas -march=armv4t -mthumb-interwork -pipe -O3 -fomit-frame-pointer\r
-\r
-GCCDEFS = -D__SYMBIAN32__ -D__GCC32__ -D__EPOC32__ -D__MARM__ -D__MARM_ARMI__ -D__EXE__ -DNDEBUG -D_UNICODE -DARM\r
-\r
-# dprint\r
-ifeq "$(dprint)" "1"\r
-GCCDEFS += -D__DEBUG_PRINT\r
-endif\r
-# drz80/mz80\r
-ifeq "$(mz80)" "1"\r
-GCCDEFS += -D_USE_MZ80\r
-else\r
-GCCDEFS += -D_USE_DRZ80\r
-endif\r
-# debug_cyclone\r
-ifeq "$(debug_cyclone)" "1"\r
-use_musashi := 1\r
-GCCDEFS += -DEMU_C68K\r
-asm_memory := 0\r
-endif\r
-# musashi\r
-ifeq "$(use_musashi)" "1"\r
-GCCDEFS += -DEMU_M68K\r
-else\r
-GCCDEFS += -DEMU_C68K\r
-endif\r
-\r
-\r
-GCC = gcc -c $(GCCFLAGS) $(GCCDEFS) $(INCDIR)\r
-\r
-\r
-LIBSUREL = \\r
-       $(EPOCSTATLINKUREL)\EGCC.LIB \\r
-       $(EPOCLINKUREL)\ESTLIB.LIB \\r
-       $(EPOCLINKUREL)\WS32.LIB \\r
-       $(EPOCLINKUREL)\HAL.LIB \\r
-       $(EPOCLINKUREL)\EUSER.LIB \\r
-       $(EPOCLINKUREL)\EFSRV.LIB \\r
-       $(EPOCLINKUREL)\EZLIB.LIB\r
-\r
-$(EPOCTRGUREL)\PICOSMALL.EXE : $(EPOCBLDUREL)\PICOSMALL.in $(EPOCSTATLINKUREL)\EEXE.LIB $(LIBSUREL)\r
-       @echo * linking and finishing\r
-       @ld  -s -e _E32Startup -u _E32Startup \\r
-               --base-file "$(EPOCBLDUREL)\PICOSMALL.bas" -o "$(EPOCBLDUREL)\PICOSMALL.EXE" \\r
-               "$(EPOCSTATLINKUREL)\EEXE.LIB" --whole-archive "$(EPOCBLDUREL)\PICOSMALL.in" \\r
-               --no-whole-archive $(LIBSUREL) $(USERLDFLAGS)\r
-       -$(ERASE) "$(EPOCBLDUREL)\PICOSMALL.EXE"\r
-       @dlltool -m arm_interwork \\r
-               --base-file "$(EPOCBLDUREL)\PICOSMALL.bas" \\r
-               --output-exp "$(EPOCBLDUREL)\PICOSMALL.exp" \r
-       -$(ERASE) "$(EPOCBLDUREL)\PICOSMALL.bas"\r
-       @ld  -s -e _E32Startup -u _E32Startup \\r
-               "$(EPOCBLDUREL)\PICOSMALL.exp" \\r
-               -Map "$(EPOCBLDUREL)\PICOSMALL.EXE.map" -o "$(EPOCBLDUREL)\PICOSMALL.EXE" \\r
-               "$(EPOCSTATLINKUREL)\EEXE.LIB" --whole-archive "$(EPOCBLDUREL)\PICOSMALL.in" \\r
-               --no-whole-archive $(LIBSUREL) $(USERLDFLAGS)\r
-       -$(ERASE) "$(EPOCBLDUREL)\PICOSMALL.exp"\r
-ifeq "$(noecompxl)" "1"\r
-       @petran  "$(EPOCBLDUREL)\PICOSMALL.EXE" "$@" \\r
-                -nocall -uid1 0x1000007a -uid2 0x00000000 -uid3 0x00000000 \\r
-                -heap 0x00000001 0x00800000\r
-else\r
-       @petran_ "$(EPOCBLDUREL)\PICOSMALL.EXE" "$@" \\r
-                -nocall -uid1 0x1000007a -uid2 0x00000000 -uid3 0x00000000 \\r
-                -heap 0x00000001 0x00800000 -stack 0x80000000\r
-endif\r
-#      -$(ERASE) "$(EPOCBLDUREL)\PICOSMALL.EXE"\r
-       @perl -S ecopyfile.pl "$@" "PICOSMALL.EXE"\r
-ifeq "$(up)" "1"\r
-       @quploadpico.cmd\r
-endif\r
-\r
-\r
-OBJECTSUREL= \\r
-       $(EPOCBLDUREL)\debug.o \\r
-       $(EPOCBLDUREL)\CART.o \\r
-       $(EPOCBLDUREL)\DRAW.o \\r
-       $(EPOCBLDUREL)\DRAW2.o \\r
-       $(EPOCBLDUREL)\MAIN.o \\r
-       $(EPOCBLDUREL)\MEMORY.o \\r
-       $(EPOCBLDUREL)\PICO.o \\r
-       $(EPOCBLDUREL)\SEK.o \\r
-       $(EPOCBLDUREL)\VIDEOPORT.o \\r
-       $(EPOCBLDUREL)\SIMPLESERVER.o \\r
-       $(EPOCBLDUREL)\VID.o \\r
-       $(EPOCBLDUREL)\Utils.o \\r
-       $(EPOCBLDUREL)\Area.o \\r
-       $(EPOCBLDUREL)\Misc.o \\r
-       $(EPOCBLDUREL)\unzip.o \\r
-       ..\..\zlib\gzio_symb.o \\r
-       $(EPOCBLDUREL)\sound.o \\r
-       $(EPOCBLDUREL)\sn76496.o \\r
-       $(EPOCBLDUREL)\ym2612.o \\r
-       $(EPOCBLDUREL)\blit.o\r
-\r
-ifeq "$(debug_cyclone)" "1"\r
-OBJECTSUREL += $(EPOCBLDUREL)\Cyclone.o $(EPOCBLDUREL)\_cyclone_debug.o\r
-endif\r
-# the MUSASHI core\r
-ifeq "$(use_musashi)" "1"\r
-OBJECTSUREL += \\r
-       ..\..\musashi\m68kcpu.o \\r
-       ..\..\musashi\m68kops.o \\r
-       ..\..\musashi\m68kopac.o \\r
-       ..\..\musashi\m68kopdm.o \\r
-       ..\..\musashi\m68kopnz.o \\r
-       ..\..\musashi\m68kdasm.o\r
-else\r
-OBJECTSUREL += $(EPOCBLDUREL)\Cyclone.o\r
-endif\r
-\r
-ifeq "$(mz80)" "1"\r
-OBJECTSUREL := $(OBJECTSUREL) $(EPOCBLDUREL)\mz80.o\r
-else\r
-OBJECTSUREL := $(OBJECTSUREL) $(EPOCBLDUREL)\DrZ80.o\r
-endif\r
-\r
-ifeq "$(asm_memory)" "1"\r
-ASMDEFINES += -D_ASM_MEMORY_C\r
-OBJECTSUREL := $(OBJECTSUREL) $(EPOCBLDUREL)\memory_asm.o\r
-endif\r
-\r
-ifeq "$(asm_render)" "1"\r
-ASMDEFINES += -D_ASM_DRAW_C\r
-OBJECTSUREL := $(OBJECTSUREL) $(EPOCBLDUREL)\draw_asm.o $(EPOCBLDUREL)\draw2_asm.o\r
-endif\r
-\r
-$(EPOCBLDUREL)\PICOSMALL.in : $(OBJECTSUREL)\r
-       @echo * ar\r
-       @if exist "$@" del "$@"\r
-       @ar cr $@ $^\r
-\r
-..\..\Cyclone\proj\Cyclone.s :\r
-       @echo You need to build Cyclone first. See Cyclone.txt in cyclone directory.\r
-       @cd : 2> NUL # do something stupid to make it silently fail\r
-\r
-$(EPOCBLDUREL)\Cyclone.o : ..\..\Cyclone\proj\Cyclone.s\r
-       @echo * assembling Cyclone..\r
-       @as -marmv4t -mthumb-interwork -o $@ $^\r
-\r
-$(EPOCBLDUREL)\DrZ80.o : ..\..\pico\sound\DrZ80.s ..\..\pico\sound\DrZ80.h\r
-       @echo * assembling DrZ80..\r
-       @as -marmv4t -mthumb-interwork -o $@ ..\..\pico\sound\DrZ80.s\r
-\r
-\r
-# Source\r
-\r
-$(EPOCBLDUREL)\debug.o : debug.cpp debug.h\r
-       @echo * debug.cpp\r
-       @$(GCC) -o $@ debug.cpp\r
-\r
-$(EPOCBLDUREL)\MAIN.o : Main.cpp ..\..\pico\picoInt.h vid.h SimpleServer.h ClientServer.h audio.h debug.h\r
-       @echo * Main.cpp\r
-       @$(GCC) -o $@ "Main.cpp"\r
-\r
-$(EPOCBLDUREL)\VID.o : VID.cpp vid.h ClientServer.h ..\..\pico\picoInt.h\r
-       @echo * Vid.cpp\r
-       @$(GCC) -o $@ "VID.cpp"\r
-\r
-$(EPOCBLDUREL)\SIMPLESERVER.o : SIMPLESERVER.cpp version.h ClientServer.h SimpleServer.h ..\..\pico\picoInt.h debug.h\r
-       @echo * SimpleServer.cpp\r
-       @$(GCC) -o $@ "SIMPLESERVER.cpp"\r
-\r
-$(EPOCBLDUREL)\CART.o : ..\..\pico\Cart.c ..\..\pico\picoInt.h ..\..\pico\Pico.h ..\..\unzip\unzip.h\r
-       @echo * Cart.c\r
-       @$(GCC) -D_UNZIP_SUPPORT -o $@ "..\..\pico\Cart.c"\r
-\r
-$(EPOCBLDUREL)\DRAW.o : ..\..\pico\Draw.c ..\..\pico\picoInt.h ..\..\pico\Pico.h\r
-       @echo * Draw.c\r
-       @$(GCC) $(ASMDEFINES) -o $@ "..\..\pico\Draw.c"\r
-#\r
-\r
-$(EPOCBLDUREL)\DRAW2.o : ..\..\pico\Draw2.c ..\..\pico\picoInt.h ..\..\pico\Pico.h\r
-       @echo * Draw2.c\r
-       @$(GCC) $(ASMDEFINES) -o $@ "..\..\pico\Draw2.c"\r
-\r
-$(EPOCBLDUREL)\MEMORY.o : ..\..\pico\Memory.c ..\..\pico\picoInt.h ..\..\pico\Pico.h\r
-       @echo * Memory.c\r
-       @$(GCC) $(ASMDEFINES) -o $@ "..\..\pico\Memory.c"\r
-\r
-$(EPOCBLDUREL)\PICO.o : ..\..\pico\Pico.c ..\..\pico\picoInt.h ..\..\pico\Pico.h\r
-       @echo * Pico.c\r
-       @$(GCC) -o $@ "..\..\pico\Pico.c"\r
-\r
-$(EPOCBLDUREL)\SEK.o : ..\..\pico\Sek.c ..\..\pico\picoInt.h ..\..\pico\Pico.h\r
-       @echo * Sek.c\r
-       @$(GCC) -o $@ "..\..\pico\Sek.c"\r
-\r
-$(EPOCBLDUREL)\VIDEOPORT.o : ..\..\pico\Videoport.c ..\..\pico\picoInt.h ..\..\pico\Pico.h\r
-       @echo * Videoport.c\r
-       @$(GCC) -o $@ "..\..\pico\Videoport.c"\r
-\r
-$(EPOCBLDUREL)\Utils.o : ..\..\pico\Utils.c ..\..\pico\picoInt.h ..\..\pico\Pico.h\r
-       @echo * Utils.c\r
-       @$(GCC) -o $@ "..\..\pico\Utils.c"\r
-\r
-$(EPOCBLDUREL)\Area.o : ..\..\pico\Area.c ..\..\pico\picoInt.h ..\..\pico\Pico.h\r
-       @echo * Area.c\r
-       @$(GCC) -o $@ "..\..\pico\Area.c"\r
-\r
-$(EPOCBLDUREL)\Misc.o : ..\..\pico\Misc.c ..\..\pico\picoInt.h ..\..\pico\Pico.h\r
-       @echo * Misc.c\r
-       @$(GCC) -o $@ "..\..\pico\Misc.c"\r
-\r
-$(EPOCBLDUREL)\unzip.o : ..\..\unzip\unzip.c ..\..\unzip\unzip.h\r
-       @echo * unzip.c\r
-       @$(GCC) -o $@ "..\..\unzip\unzip.c"\r
-\r
-# assembly "optimized" stuff\r
-$(EPOCBLDUREL)\blit.o : blit.s\r
-       @echo * blit.s\r
-       @as -marmv4t -mthumb-interwork -o $@ blit.s\r
-\r
-$(EPOCBLDUREL)\draw_asm.o : ..\..\pico\draw.s\r
-       @echo * draw.s\r
-       @as -marmv4t -mthumb-interwork -o $@ ..\..\pico\draw.s\r
-\r
-$(EPOCBLDUREL)\draw2_asm.o : ..\..\pico\draw2.s\r
-       @echo * draw2.s\r
-       @as -marmv4t -mthumb-interwork -o $@ ..\..\pico\draw2.s\r
-\r
-$(EPOCBLDUREL)\memory_asm.o : ..\..\pico\memory.s\r
-       @echo * memory.s\r
-       @as -marmv4t -mthumb-interwork -o $@ ..\..\pico\memory.s\r
-\r
-# sound stuff\r
-$(EPOCBLDUREL)\sound.o : ..\..\pico\sound\sound.c ..\..\pico\sound\sound.h\r
-       @echo * sound.c\r
-       @$(GCC) -o $@ "..\..\pico\sound\sound.c"\r
-\r
-$(EPOCBLDUREL)\ym2612.o : ..\..\pico\sound\ym2612.c ..\..\pico\sound\ym2612.h ..\..\pico\sound\driver.h\r
-       @echo * ym2612.c\r
-       @$(GCC) -o $@ "..\..\pico\sound\ym2612.c"\r
-\r
-$(EPOCBLDUREL)\sn76496.o : ..\..\pico\sound\sn76496.c ..\..\pico\sound\sn76496.h ..\..\pico\sound\driver.h\r
-       @echo * sn76496.c\r
-       @$(GCC) -o $@ "..\..\pico\sound\sn76496.c"\r
-\r
-$(EPOCBLDUREL)\mz80.o : ..\..\pico\sound\mz80.c ..\..\pico\sound\mz80.h\r
-       @echo * mz80.c\r
-       @$(GCC) -o $@ "..\..\pico\sound\mz80.c"\r
-\r
-# -D__DEBUG_PRINT_SND\r
-\r
-# misc\r
-\r
-$(EPOCBLDUREL)\_cyclone_debug.o : ..\..\pico\_cyclone_debug.c\r
-       @echo * _cyclone_debug.c\r
-       @$(GCC) -o $@ "..\..\pico\_cyclone_debug.c"\r
-\r
-# generic rule for generic C stuff\r
-\r
-.c.o:\r
-       @echo * $<\r
-       @$(GCC) $< -o $@\r
-\r
-\r
-\r
-# --- SRCFILES END ---\r
-\r
-\r
-# Rules to create all necessary directories\r
-\r
-MAKEDIRS : \\r
-       _build\r
-\r
-_build :\r
-       @echo * making build dir\r
-       @perl -S emkdir.pl $@\r
diff --git a/platform/uiq2/SimpleServer.cpp b/platform/uiq2/SimpleServer.cpp
deleted file mode 100644 (file)
index d220b3f..0000000
+++ /dev/null
@@ -1,430 +0,0 @@
-// SimpleServer.cpp\r
-\r
-#include <e32svr.h>\r
-#include <e32math.h>\r
-#include <e32uid.h>\r
-\r
-#include <string.h>\r
-\r
-#include "debug.h"\r
-\r
-#include "version.h"\r
-#include "ClientServer.h"\r
-#include "SimpleServer.h"\r
-#include "pico\picoInt.h"\r
-\r
-extern TInt machineUid;\r
-extern int gamestate, gamestate_prev;\r
-extern TPicoConfig currentConfig;\r
-extern TPicoKeyConfigEntry keyConfigMotA[];\r
-extern const char *actionNames[];\r
-const char *RomFileName = 0;\r
-int pico_was_reset = 0;\r
-\r
-\r
-// utility\r
-unsigned int bigend(unsigned int l)\r
-{\r
-       return (l>>24)|((l>>8)&0xff00)|((l<<8)&0xff0000)|(l<<24);\r
-}\r
-\r
-\r
-//**********************************\r
-//CPicoServServer\r
-//**********************************\r
-\r
-\r
-CPicoServServer::CPicoServServer(TInt aPriority)\r
-       : CServer(aPriority)\r
-{\r
-}\r
-\r
-\r
-// Create and start a new count server.\r
-void CPicoServServer::New()\r
-{\r
-       CPicoServServer *pS=new CPicoServServer(EPriority);\r
-       __ASSERT_ALWAYS(pS!=NULL,PanicServer(ESvrCreateServer));\r
-       pS->StartL(KServerName);\r
-}\r
-\r
-\r
-// Create a new server session.\r
-CSharableSession *CPicoServServer::NewSessionL(const TVersion &aVersion) const\r
-{\r
-       // check we're the right version\r
-       TVersion v(KPicoMajorVersionNumber,KPicoMinorVersionNumber,0);\r
-       if (!User::QueryVersionSupported(v,aVersion))\r
-               User::Leave(KErrNotSupported);\r
-       // make new session\r
-       RThread aClient = Message().Client();\r
-       return CPicoServSession::NewL(aClient, (CPicoServServer*)this);\r
-}\r
-\r
-\r
-//**********************************\r
-//CPicoServSession\r
-//**********************************\r
-\r
-\r
-// constructor - must pass client to CSession\r
-CPicoServSession::CPicoServSession(RThread &aClient, CPicoServServer *aServer)\r
-: CSession(aClient), rom_data(0)\r
-{\r
-//     iPicoSvr=aServer;\r
-}\r
-\r
-CPicoServSession* CPicoServSession::NewL(RThread &aClient, CPicoServServer * aServer)\r
-{\r
-       return new(ELeave) CPicoServSession(aClient,aServer);\r
-}\r
-\r
-\r
-void CPicoServSession::ServiceL(const RMessage& aMessage)\r
-{\r
-       TRAPD(err,DispatchMessageL(aMessage));\r
-       aMessage.Complete(err);\r
-}\r
-\r
-\r
-\r
-// service a client request; test the opcode and then do appropriate servicing\r
-void CPicoServSession::DispatchMessageL(const RMessage &aMessage)\r
-{\r
-       switch (aMessage.Function()) {\r
-               case PicoMsgLoadState: \r
-                       if(!rom_data) User::Leave(-1); // no ROM\r
-                       User::LeaveIfError(saveLoadGame(1));\r
-                       gamestate = PGS_Running;\r
-                       return;\r
-\r
-               case PicoMsgSaveState:\r
-                       if(!rom_data) User::Leave(-1);\r
-                       User::LeaveIfError(saveLoadGame(0));\r
-                       gamestate = PGS_Running;\r
-                       return;\r
-\r
-               case PicoMsgLoadROM:\r
-                       loadROM();\r
-                       return;\r
-               \r
-               case PicoMsgResume:\r
-                       if(rom_data) gamestate = PGS_Running;\r
-                       return;\r
-\r
-               case PicoMsgReset: \r
-                       if(rom_data) {\r
-                               PicoReset();\r
-                               pico_was_reset = 1;\r
-                               gamestate = PGS_Running;\r
-                       }\r
-                       return;\r
-\r
-               case PicoMsgKeys:\r
-                       gamestate = PGS_KeyConfig;\r
-                       return;\r
-\r
-               case PicoMsgPause:\r
-                       gamestate = PGS_Paused;\r
-                       return;\r
-\r
-               case PicoMsgQuit:\r
-                       DEBUGPRINT(_L("got quit msg."));\r
-                       gamestate = PGS_Quit;\r
-                       return;\r
-\r
-               // config change\r
-               case PicoMsgConfigChange: // launcher -> emu\r
-                       changeConfig();\r
-                       return;\r
-\r
-               case PicoMsgRetrieveConfig: // emu -> launcher\r
-                       sendConfig();\r
-                       return;\r
-\r
-               case PicoMsgRetrieveDebugStr: // emu -> launcher\r
-                       sendDebug();\r
-                       return;\r
-\r
-               // requests we don't understand at all are a different thing,\r
-               // so panic the client here, this function also completes the message\r
-               default:\r
-                       PanicClient(EBadRequest);\r
-                       return;\r
-       }\r
-}\r
-\r
-\r
-void CPicoServSession::loadROM()\r
-{\r
-       TInt res;\r
-\r
-       const TAny* pD=Message().Ptr0();\r
-\r
-       // TInt desLen=Message().Client().GetDesLength(pD);\r
-\r
-       if(rom_data) {\r
-               // save SRAM for previous ROM\r
-               if(currentConfig.iFlags & 1)\r
-                       saveLoadGame(0, 1);\r
-       }\r
-\r
-       RomFileName = 0;\r
-       if(rom_data) {\r
-               free(rom_data);\r
-               rom_data = 0;\r
-       }\r
-\r
-       // read the contents of the client pointer into a TPtr.\r
-       static TBuf8<KMaxFileName> writeBuf;\r
-       TRAP(res,Message().ReadL(pD,writeBuf));\r
-       if (res!=KErrNone) {\r
-               PanicClient(EBadDescriptor);\r
-               return;\r
-       }\r
-\r
-       // detect wrong extensions (.srm and .mds)\r
-       TBuf8<5> ext;\r
-       ext.Copy(writeBuf.Right(4));\r
-       ext.LowerCase();\r
-       if(!strcmp((char *)ext.PtrZ(), ".srm") || !strcmp((char *)ext.PtrZ(), "s.gz") || // .mds.gz\r
-          !strcmp((char *)ext.PtrZ(), ".mds")) {\r
-               User::Leave(3);\r
-               return;\r
-       }\r
-\r
-       FILE *rom = fopen((char *) writeBuf.PtrZ(), "rb");\r
-       if(!rom) {\r
-               DEBUGPRINT(_L("failed to open rom."));\r
-               User::Leave(1);\r
-               return;\r
-       }\r
-\r
-\r
-       unsigned int rom_size = 0;\r
-       // zipfile support\r
-       if(!strcmp((char *)ext.PtrZ(), ".zip")) {\r
-               fclose(rom);\r
-               res = CartLoadZip((const char *) writeBuf.PtrZ(), &rom_data, &rom_size);\r
-               if(res) {\r
-                       User::Leave(res);\r
-                       return;\r
-               }\r
-       } else {\r
-               if( (res = PicoCartLoad(rom, &rom_data, &rom_size)) ) {\r
-                       DEBUGPRINT(_L("PicoCartLoad() failed."));\r
-                       fclose(rom);\r
-                       User::Leave(2);\r
-                       return;\r
-               }\r
-               fclose(rom);\r
-       }\r
-\r
-       // detect wrong files (Pico crashes on very small files), also see if ROM EP is good\r
-       if(rom_size <= 0x200 || strncmp((char *)rom_data, "Pico", 4) == 0 ||\r
-         ((*(TUint16 *)(rom_data+4)<<16)|(*(TUint16 *)(rom_data+6))) >= (int)rom_size) {\r
-               free(rom_data);\r
-               rom_data = 0;\r
-               User::Leave(3); // not a ROM\r
-       }\r
-\r
-       DEBUGPRINT(_L("PicoCartInsert(0x%08X, %d);"), rom_data, rom_size);\r
-       if(PicoCartInsert(rom_data, rom_size)) {\r
-               User::Leave(2);\r
-               return;\r
-       }\r
-\r
-       pico_was_reset = 1;\r
-\r
-       // global ROM file name for later use\r
-       RomFileName = (const char *) writeBuf.PtrZ();\r
-\r
-       // load SRAM for this ROM\r
-       if(currentConfig.iFlags & 1)\r
-               saveLoadGame(1, 1);\r
-\r
-       // debug\r
-       #ifdef __DEBUG_PRINT\r
-       TInt cells = User::CountAllocCells();\r
-       TInt mem;\r
-       User::AllocSize(mem);\r
-       DEBUGPRINT(_L("comm:   cels=%d, size=%d KB"), cells, mem/1024);\r
-       gamestate = PGS_DebugHeap;\r
-       gamestate_prev = PGS_Running;\r
-       #else\r
-       gamestate = PGS_Running;\r
-       #endif\r
-}\r
-\r
-\r
-void CPicoServSession::changeConfig()\r
-{\r
-       DEBUGPRINT(_L("got new config."));\r
-\r
-       // receve it\r
-       const TAny* pD=Message().Ptr0();\r
-       TPtr8 descr((TUint8*) &currentConfig, sizeof(currentConfig));\r
-       TRAPD(res,Message().ReadL(pD, descr));\r
-       if (res!=KErrNone) {\r
-               PanicClient(EBadDescriptor);\r
-               return;\r
-       }\r
-\r
-       // Motorola: enable experimental volume control\r
-       if((machineUid&0xfffffff0) == 0x101f6b20) { // Motorolas\r
-               if(currentConfig.iFlags & 0x40) {\r
-                       currentConfig.iKeyBinds[11]  =  0x00100000; // vol up\r
-                       currentConfig.iKeyBinds[12]  =  0x00200000; // vol down\r
-                       keyConfigMotA[11].flags |=  0x40; // add "not configurable" flag\r
-                       keyConfigMotA[12].flags |=  0x40;\r
-               } else {\r
-                       currentConfig.iKeyBinds[11] &= ~0x00100000; // remove vol actions\r
-                       currentConfig.iKeyBinds[12] &= ~0x00200000;\r
-                       keyConfigMotA[11].flags &= ~0x40; // remove "not configurable" flag\r
-                       keyConfigMotA[12].flags &= ~0x40;\r
-               }\r
-       }\r
-\r
-       // set region, PicoOpt and rate\r
-       PicoRegionOverride = currentConfig.PicoRegion;\r
-       PicoOpt = currentConfig.iPicoOpt;\r
-       switch((currentConfig.iFlags>>3)&3) {\r
-               case 1:  PsndRate=11025; break;\r
-               case 2:  PsndRate=16000; break;\r
-               case 3:  PsndRate=22050; break;\r
-               default: PsndRate= 8000; break;\r
-       }\r
-\r
-       // 6 button pad, enable XYZM config if needed\r
-       if(PicoOpt & 0x20) {\r
-               actionNames[8]  = "Z";\r
-               actionNames[9]  = "Y";\r
-               actionNames[10] = "X";\r
-               actionNames[11] = "MODE";\r
-       } else {\r
-               actionNames[8] = actionNames[9] = actionNames[10] = actionNames[11] = 0;\r
-       }\r
-\r
-       // if we are in center 90||270 modes, we can bind renderer switcher\r
-       if(currentConfig.iScreenMode == TPicoConfig::PMCenter &&\r
-               (currentConfig.iScreenRotation == TPicoConfig::PRot90 || currentConfig.iScreenRotation == TPicoConfig::PRot270))\r
-                                actionNames[25] = "RENDERER";\r
-                       else actionNames[25] = 0;\r
-}\r
-\r
-\r
-void CPicoServSession::sendConfig()\r
-{\r
-       // send current config to client\r
-       currentConfig.iPicoOpt = PicoOpt;\r
-       TPtrC8 descr((TUint8*) &currentConfig, sizeof(currentConfig));\r
-       Write(Message().Ptr0(), descr);\r
-}\r
-\r
-#ifdef __DEBUG_PRINT\r
-extern "C" char *debugString();\r
-#endif\r
-\r
-void CPicoServSession::sendDebug()\r
-{\r
-#ifdef __DEBUG_PRINT\r
-       char *str = debugString();\r
-       // send current config to client\r
-       currentConfig.iPicoOpt = PicoOpt;\r
-       TPtrC8 descr((TUint8*) str, 1024);\r
-       Write(Message().Ptr0(), descr);\r
-#endif\r
-}\r
-\r
-// panic the client\r
-void CPicoServSession::PanicClient(TInt aPanic) const\r
-{\r
-       Panic(_L("PicoN client"), aPanic);\r
-       // client screwed up - there is nothing for us to do now\r
-       RProcess me;\r
-       me.Terminate(1);\r
-}\r
-\r
-\r
-// write to the client thread; if unsuccessful, panic the client\r
-void CPicoServSession::Write(const TAny* aPtr,const TDesC8& aDes,TInt anOffset)\r
-{\r
-       TRAPD(ret,WriteL(aPtr,aDes,anOffset);)\r
-       if (ret!=KErrNone)\r
-               PanicClient(EBadDescriptor);\r
-}\r
-\r
-\r
-\r
-//**********************************\r
-//Global functions\r
-//**********************************\r
-\r
-\r
-// The server thread.\r
-TInt CPicoServServer::ThreadFunction(TAny* anArg)\r
-{\r
-       // install our exception hanler first\r
-       RThread().SetExceptionHandler(&ExceptionHandler, -1);\r
-\r
-       // convert argument into semaphore reference\r
-//     RSemaphore& semaphore=*(RSemaphore *)anArg;\r
-\r
-       // start scheduler and server\r
-       CActiveScheduler *pA=new CActiveScheduler;\r
-       __ASSERT_ALWAYS(pA!=NULL,PanicServer(EMainSchedulerError));\r
-       CActiveScheduler::Install(pA);\r
-       //CTrapCleanup::New(); // docs say this is created automatically, but I somehow got E32USER-CBase 69 panic\r
-       CPicoServServer::New();\r
-       // signal that we've started\r
-//     semaphore.Signal();\r
-       // start fielding requests from clients\r
-       CActiveScheduler::Start();\r
-       // finished\r
-       return(KErrNone);\r
-}\r
-\r
-\r
-// Panic the server\r
-//GLDEF_C \r
-void PanicServer(TPicoServPanic aPanic)\r
-{\r
-       User::Panic(_L("PicoN server"),aPanic);\r
-}\r
-\r
-\r
-// Create the server thread\r
-// This function is exported from the DLL and called from the client \r
-//EXPORT_C\r
-TInt StartThread()\r
-{\r
-       TInt res=KErrNone;\r
-       // create server - if one of this name does not already exist\r
-       TFindServer findPicoServer(KServerName);\r
-       TFullName name;\r
-       if(findPicoServer.Next(name) == KErrNone) return -1; // we already exist\r
-\r
-       RThread thread;\r
-//     RSemaphore semaphore;\r
-//     semaphore.CreateLocal(0); // create a semaphore so we know when thread finished\r
-       res=thread.Create(KServerName,   // create new server thread\r
-               CPicoServServer::ThreadFunction, // thread's main function\r
-               KDefaultStackSize,\r
-               KMinHeapSize,\r
-               KPicoMaxHeapSize,\r
-//             &semaphore // passed as TAny* argument to thread function\r
-               0\r
-               );\r
-\r
-       if(res==KErrNone) { // thread created ok - now start it going\r
-               thread.SetPriority(EPriorityNormal);\r
-               thread.Resume(); // start it going\r
-//             semaphore.Wait(); // wait until it's initialized\r
-               thread.Close(); // we're no longer interested in the other thread\r
-       }\r
-\r
-//     semaphore.Close();\r
-\r
-    return res;\r
-}\r
-\r
diff --git a/platform/uiq2/SimpleServer.h b/platform/uiq2/SimpleServer.h
deleted file mode 100644 (file)
index b88e4d7..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-// SimpleServer.h\r
-\r
-#ifndef __SIMPLESERVER_H\r
-#define __SIMPLESERVER_H\r
-\r
-#include <e32base.h>\r
-\r
-\r
-TInt StartThread();\r
-\r
-\r
-// engine states\r
-enum TPicoGameState {\r
-       PGS_Running,\r
-       PGS_Paused,\r
-       PGS_Quit,\r
-       PGS_KeyConfig,\r
-       PGS_DebugHeap,\r
-};\r
-\r
-// needed for creating server thread.\r
-const TUint KPicoMaxHeapSize=0x00800000;\r
-\r
-// reasons for server panic\r
-enum TPicoServPanic\r
-{\r
-       EBadRequest,\r
-       EBadDescriptor,\r
-       EMainSchedulerError,\r
-       ESvrCreateServer,\r
-       ESvrStartServer,\r
-       ECreateTrapCleanup,\r
-       ENotImplementedYet,\r
-};\r
-\r
-\r
-// key config entry (touchpad areas)\r
-struct TPicoAreaConfigEntry {\r
-       TRect rect;\r
-       //unsigned long actions;\r
-};\r
-\r
-struct TPicoKeyConfigEntry\r
-{\r
-       unsigned short keyCode;\r
-       unsigned char scanCode;\r
-       unsigned char flags; // lsb->msb: key_down, pulse_only, ?, ?,  ?, ?, not_configurable, disabled\r
-       TInt32 handle1; // for CancelCaptureKeyUpAndDowns()\r
-       TInt32 handle2; // for CancelCaptureKey()\r
-       char *name;\r
-};\r
-\r
-\r
-//**********************************\r
-//CPicoServServer\r
-//**********************************\r
-//The server class; an active object.\r
-//Contains an instance of RServer; a handle to the kernel server representation which is used \r
-//to receive messages. \r
-\r
-class CPicoServServer : public CServer\r
-{\r
-public:\r
-       enum {EPriority=950};\r
-public:\r
-       static void New();\r
-       virtual CSharableSession *NewSessionL(const TVersion &aVersion) const;\r
-       static TInt ThreadFunction(TAny* aStarted);\r
-protected:\r
-       CPicoServServer(TInt aPriority);\r
-private:\r
-       TInt                            iActive;\r
-};\r
-\r
-\r
-//**********************************\r
-//CPicoServSession\r
-//**********************************\r
-//This class represents a session in the server.\r
-//CSession::Client() returns the client thread.\r
-//Functions are provided to respond appropriately to client messages.\r
-\r
-\r
-class CPicoServSession : public CSession\r
-{\r
-public:\r
-       // construct/destruct\r
-       CPicoServSession(RThread &aClient, CPicoServServer * aServer);\r
-       static CPicoServSession* NewL(RThread &aClient, CPicoServServer * aServer);\r
-       //service request\r
-       virtual void ServiceL(const RMessage &aMessage);\r
-       void DispatchMessageL(const RMessage &aMessage);\r
-\r
-       // services available\r
-       void loadROM();\r
-       void changeConfig();\r
-       void sendConfig();\r
-       void sendDebug();\r
-\r
-protected:\r
-       // panic the client\r
-       void PanicClient(TInt aPanic) const;\r
-       // safewrite between client and server\r
-       void Write(const TAny* aPtr,const TDesC8& aDes,TInt anOffset=0);\r
-private:\r
-       //CPicoServServer *iPicoSvr;\r
-\r
-       unsigned char *rom_data;\r
-};\r
-\r
-\r
-\r
-//**********************************\r
-//global functions\r
-//**********************************\r
-\r
-// function to panic the server\r
-GLREF_C void PanicServer(TPicoServPanic aPanic);\r
-int saveLoadGame(int load, int sram=0);\r
-\r
-#endif // __SIMPLESERVER_H\r
diff --git a/platform/uiq2/_out/PicodriveN.pkg b/platform/uiq2/_out/PicodriveN.pkg
deleted file mode 100644 (file)
index 74bf4fd..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-#{"PicodriveN"},(0x1000C193),0,93,0\r
-\r
-;\r
-; For the UIQ?\r
-(0x101F617B), 2, 0, 0, {"UIQ20ProductID"}\r
-\r
-;\r
-; PicodriveN (Frontend)\r
-;\r
-"..\..\..\..\..\epoc32\release\armi\urel\PicodriveN.app"-"!:\system\apps\PicodriveN\PicodriveN.app"\r
-"..\..\..\..\..\epoc32\data\z\system\apps\PicodriveN\PicodriveN.rsc"-"!:\system\apps\PicodriveN\PicodriveN.rsc"\r
-"..\..\..\..\..\epoc32\data\z\system\apps\PicodriveN\PicodriveN.aif"-"!:\system\apps\PicodriveN\PicodriveN.aif"\r
-"..\audio\audio_mediaserver.dll"-"!:\system\apps\PicodriveN\audio_mediaserver.dll"\r
-"..\audio\audio_motorola.dll"-"!:\system\apps\PicodriveN\audio_motorola.dll"\r
-\r
-;\r
-; Picosmall\r
-;\r
-"..\PICOSMALL.EXE"-"!:\system\apps\PicodriveN\PICOSMALL.EXE"\r
-\r
-;\r
-; Text to show during installation, not copied to destination\r
-;\r
-".\install.txt"-"!:\system\apps\PicodriveN\install.txt",FILETEXT\r
diff --git a/platform/uiq2/_out/install.txt b/platform/uiq2/_out/install.txt
deleted file mode 100644 (file)
index e646d04..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-Be sure to configure keys before loading your first ROM, because there is no default config. You need to configure 'pause emu' function to exit game.\r
-\r
-Key configuration tutorial:\r
-http://notaz.atspace.com/pico_tut/\r
-\r
-You can also hold power button to exit (PXXX only).\r
-(Motorola users, try the 'end' button).\r
-\r
-Some quick sound related notes:\r
-* You must use auto frameskip or you will get stuttering sound.\r
-* Sound needs a lot of CPU power, so it is best to use "fit 0" or "fit 180" display modes and to exit all other apps.\r
-* if you change sound settings AFTER loading a ROM, you may need to reset game to get sound (this depends on a ROM itself).\r
-\r
-Enabling Z80 in sound settings will improve compatibility (you don't have to enable anything else, only Z80), because some games need it to run. But it slows emulation down, so turn it off if the game doesn't need it.\r
-\r
-See readme for more details.\r
diff --git a/platform/uiq2/_out/readme.txt b/platform/uiq2/_out/readme.txt
deleted file mode 100644 (file)
index ea5e6e4..0000000
+++ /dev/null
@@ -1,347 +0,0 @@
-\r
-About\r
------\r
-\r
-PicodriveN is another port of PicoDrive, Dave's Megadrive / Genesis\r
-emulator for Pocket PC. This version is based on PicoDrive 0.030 and is\r
-made for Symbian UIQ devices. It is alternative version to another port by\r
-AnotherGuest / Someone and is not based on it (so it has a little\r
-different name). It also has full sound support (starting\r
-from version 0.70) .\r
-\r
-\r
-Features\r
---------\r
-\r
-* Good compatibility (> 90%)\r
-* Improved Cyclone 68000 core.\r
-* Zipped ROMs and savestates.\r
-* SRAM support, including serial SRAM.\r
-* Game screen rotation with many render modes (like 'centered' and 'fit').\r
-* Selectable frameskip.\r
-* Configurable keys and touchpad.\r
-* Flip-closed mode for SE phones.\r
-* Full sound support.\r
-\r
-\r
-Problems / limitations\r
-----------------------\r
-\r
-* 32x, Sega CD, SVP are not emulated.\r
-* Various VDP quirks (window bug, scroll size 2, etc.) are not emulated,\r
-  as very few games use this.\r
-* Some games don't work or have glitches because of inaccurate sync.\r
-\r
-\r
-Configuration\r
--------------\r
-\r
-1. Keys:\r
-\r
-If it looks confusing to you, check this tutorial first:\r
-http://notaz.atspace.com/pico_tut/\r
-\r
-There are no default settings.\r
-When you start key configuration mode, black screen with dark-red squares will\r
-appear. Also there will be little 'control' on the right with the function\r
-name in it, and arrows on the corners of it. You can tap on these corners to\r
-select a function. You can also tap on these squares to bind that function to\r
-them. This way you can associate touchpad areas with game-controls or functions.\r
-I also made a small square in every corner of the screen to be used as a virtual\r
-button for some function, like save state. You can bind it as you like. To\r
-bind phone buttons, simply select the function you need, and press a button\r
-you want. To unbind any key or touchpad area, simply push or tap it again.\r
-To configure flip-closed mode, enter configuration mode and close flip.\r
-\r
-When finished, select 'done' and press any key. You can also hold 'Power'\r
-button for a while to exit (seems to work on PXXX only).\r
-\r
-You need to bind 'pause emu' function to be able exit game when ROM is loaded.\r
-You can also exit game by holding 'power' button (possibly 'end' for motorola\r
-users (?)).\r
-\r
-2. Main Settings:\r
-\r
-Here you can set the orientation of screen and the drawing mode. The "fit"\r
-option will scale the image so it fully fits in the screen, but some detail\r
-will be lost. "center" displays the game at the center of the screen, but\r
-non-fitting parts are not visible then (better for RPG games with lots of\r
-text, which becomes unreadable in 'fit' mode). "fit2" was meant for Pxxx FC\r
-gaming and will always use 208x146 for P800 and 208x208 for all other phones.\r
-\r
-"Fast renderer" enables faster rendering method, but it works only with some\r
-games (some other have serious glitches or even hang).\r
-\r
-"Accurate timing" is needed for some games to run (like Red Zone). It should\r
-be kept off for all other games, because it slows emulation down. Some games\r
-also need this option for proper sound, so enable this if game has any\r
-glitches.\r
-\r
-"Accurate sprites" fixes sprite priority problems, for example if game\r
-character is in front of or behind some object it should not be, this option\r
-should fix it. This option does not work in "Fast renderer" mode.\r
-\r
-"Show FPS" shows game frames per second in format XX/YY, where XX is the\r
-number of frames shown per previous second, and YY is the number of frames\r
-emulated, but not necessarily shown. By calculating YY-XX you get the number\r
-of skipped frames per second.\r
-\r
-3. Sound settings:\r
-\r
-Sound emulation is very picky on CPU power (in most cases sound alone uses\r
-more CPU power than everything else altogether), but it is still possible to\r
-play some games. When using sound, the recommended display modes are "fit 0"\r
-and "fit 180", because these are the fastest ones. Also try "Alternative\r
-renderer", but it might cause graphical glitches. You must use auto frameskip\r
-when using sound, or else you will get stuttering sound. Also, it is\r
-recommended to exit all other non-vital apps (you can use SMan for this),\r
-disable bluetooth and any other devices your phone may have. I also noticed\r
-that simply connecting the phone battery charger strangely slows everything\r
-down.\r
-\r
-"Enable sound" tries to enable sound output on your device, but that alone is\r
-not enough to get sound. You need to enable the sound chips below:\r
-"Z80" is secondary CPU in genesis and is mostly used to control the other 2\r
-sound chips. So if you disable Z80, sound will be lost in most games, with\r
-some exceptions like Sonic1. It is possible to use Z80 for other things,\r
-some games do that and Z80 must be enabled to run them at all.\r
-"YM2612" is a fairly complex Frequency Modulation (FM) sound synthesis chip.\r
-It was the main sound output device in genesis and is horrible CPU hog when\r
-is tried to be emulated in software. Disabling it gives large speed\r
-improvement, but most of the sound is lost.\r
-"SN76496" is programmable sound generator (PSG) chip, used for various sound\r
-effects and music elements.\r
-The lowest setting is audio quality setting, which should be left set to\r
-"8000Hz mono", because other choces slow everything down terribly and\r
-are left for testing and possibly for use in other ports to faster future\r
-devices with faster CPUs.\r
-\r
-Note: if you change sound settings AFTER loading a ROM, you may need to reset\r
-game to get sound. This is because most games initialize sound chips on\r
-startup, and this data is lost when sound chips are being enabled/disabled.\r
-\r
-4. Misc:\r
-\r
-"6 button pad" will enable 6 button gamepad emulation and will add additional\r
-X, Y, Z and MODE actions to key configuration.\r
-Note: if you enable this, games may detect that and use different button\r
-configuration, for example A ("high punch") will change to "low punch" in\r
-Mortal Kombat and you will need to bind X for "high punch".\r
-\r
-"gzip save states" enables gzip (similar to ordinary zip, but a little\r
-different) compression on your save states to save space. The compression\r
-ratio is 50-90%, so it's worth to enable this.\r
-\r
-"Use SRAM saves" option enables emulation of batery-backed save RAM some game\r
-cartridges had. RPG games used it alot, but there were some others too, like\r
-Sonic 3. If this is enabled, <ROMname>.srm files are generated when you exit\r
-the emulator or load another ROM. Format is compatible with other popular\r
-emulators (like Gens and Fusion).\r
-\r
-\r
-5. Frameskip:\r
-\r
-"Auto"  option tries to run the game in it's original speed by skipping next\r
-        frame if the previous was rendered too slow.\r
-"0"     displays every frame, thus game runs very slow.\r
-"1"     skips every other frame. Use this for a game which is smoother, but a bit\r
-        too slow (actually depends on display mode you use).\r
-"2"     also makes the game smoother, but it will be too fast in most areas.\r
-"4","8" is way too fast and is useful for skiping intros, etc.\r
-\r
-\r
-\r
-Credits\r
--------\r
-\r
-This emulator uses code from these people/projects:\r
-\r
-Dave\r
-Cyclone 68000 core, Pico emulation library\r
-Homepage: http://www.finalburn.com/\r
-E-mail: david(atsymbol)finalburn.com\r
-\r
-notaz\r
-UIQ port, Cyclone 68000 hacks, some additional coding (see changelog).\r
-Homepage: http://notaz.atspace.com/\r
-E-mail: notasas(atsymbol)gmail.com\r
-\r
-Reesy & FluBBa\r
-DrZ80, the Z80 emulator written in ARM assembly.\r
-Homepage: http://reesy.gp32x.de/\r
-E-mail: drsms_reesy(atsymbol)yahoo.co.uk\r
-\r
-Tatsuyuki Satoh, Jarek Burczynski, MultiArcadeMachineEmulator development\r
-software implementation of Yamaha FM sound generator\r
-\r
-MultiArcadeMachineEmulator (MAME) development\r
-Texas Instruments SN76489 / SN76496 programmable tone /noise generator\r
-Homepage: http://www.mame.net/\r
-\r
-\r
-Additional thanks\r
------------------\r
-\r
-* Peter van Sebille for ECompXL and his various open-source Symbian projects\r
-  to learn from.\r
-* Steve Fischer for his open-source Motorola projects.\r
-* Charles MacDonald (http://cgfm2.emuviews.com/) for old but still very useful\r
-  info about genesis hardware.\r
-* Stéphane Dallongeville for creating Gens and making it open-source.\r
-* Steve Snake for all that he has done for Genesis emulation scene.\r
-* Bart Trzynadlowski for his SSFII and 68000 docs.\r
-* Haze for his research (http://haze.mameworld.info).\r
-* The development team behind "Symbian GCC Improvement Project"\r
-  (http://www.inf.u-szeged.hu/symbian-gcc/) for their updated compile tools.\r
-* Mark and Jean-loup for zlib library.\r
-* Reesy for also finding some Cyclone bugs.\r
-* Inder for the icons.\r
-\r
-\r
-Changelog\r
----------\r
-0.94\r
-  * Improved interrupt timing, Mazin Saga and Burning Force now works.\r
-  * Rewritten renderer code to better suit gp2x, should be faster on other\r
-    ports too.\r
-  + Added support for banking used by 12-in-1 and 4-in-1 ROMs (thanks Haze).\r
-  + Added some protection device faking, used by some unlicensed games like\r
-    Super Bubble Bobble, King of Fighters, Elf Wor, ...\r
-  + Added primitive Virtua Racing SVP faking, so menus can be seen now.\r
-\r
-0.93\r
-  * Fixed a problem with P900/P910 key configuration in FC mode.\r
-  * Improved shadow/hilight mode emulation. Still not perfect, but should be\r
-    enough for most games.\r
-  + Save state slots added.\r
-  + Region selector added.\r
-\r
-0.92\r
-  VDP changes:\r
-  * VDP emulation is now more accurate (fixes flickering in Chase HQ II,\r
-    Super Hang-On and some other problems in other games).\r
-  * HV counter emulation is now much more accurate. Fixes the Asterix games,\r
-    line in Road Rash 3, etc.\r
-  * Minnor sprite and layer scroll masking bugs fixed.\r
-  + Added partial interlace mode renderer (Sonic 2 vs mode)\r
-  * Fixed a crash in both renderers when certain size window layers were used.\r
-  + Added emulation of shadow/hilight operator sprites. Other shadow/hilight\r
-    effects are still unemulated.\r
-  + Sprite emulation is more accurate, sprite limit is emulated.\r
-  + Added "accurate sprites" option, which always draws sprites in correct\r
-    order and emulates sprite collision bit, but is significantly slower.\r
-\r
-  Emulation changes:\r
-  * Improved interrupt handling, added deferred interrupt emulation\r
-    (Lemmings, etc).\r
-  + Added serial EEPROM SRAM support (Wonder Boy in Monster World,\r
-    Megaman - The Wily Wars and many EA sports games like NBA Jam).\r
-  + Implemented ROM banking for Super Street Fighter II - The New Challengers\r
-  * Updated to the latest version of DrZ80 core, integrated memory handlers\r
-    in it for better performance. A noticeable performance increase, but save\r
-       states may not work from the previous version (you can only use them with\r
-       sound disabled in that case).\r
-  + SRAM word read handler was using incorrect byte order, fixed.\r
-\r
-  Changes in Cyclone 0.0086:\r
-  + Added missing CHK opcode handler (used by SeaQuest DSV).\r
-  + Added missing TAS opcode handler (Gargoyles,Bubba N Stix,...). As in real genesis,\r
-    memory write-back phase is ignored (but can be enabled in config.h if needed).\r
-  + Added missing NBCD and TRAPV opcode handlers.\r
-  + Added missing addressing mode for CMP/EOR.\r
-  + Added some minor optimizations.\r
-  - Removed 216 handlers for 2927 opcodes which were generated for invalid addressing modes.\r
-  + Fixed flags for ASL, NEG, NEGX, DIVU, ADDX, SUBX, ROXR.\r
-  + Bugs fixed in MOVEP, LINK, ADDQ, DIVS handlers.\r
-  * Undocumented flags for CHK, ABCD, SBCD and NBCD are now emulated the same way as in Musashi.\r
-  + Added Uninitialized Interrupt emulation.\r
-  + Altered timing for about half of opcodes to match Musashi's.\r
-\r
-0.80\r
-  * Nearly all VDP code was rewritten in ARM asm. Gives ~10-25% performance\r
-    increase (depends on game).\r
-  * Optimized 32-column renderer not to render tiles offscreen, games which\r
-    use 32-column display (like Shining Force) run ~50% faster.\r
-  + Added new "Alternative renderer", which gives another ~30-45% performance\r
-    increase (in addition to mentioned above), but works only with some games,\r
-    because it is missing some features (it uses tile-based renderering\r
-    instead of default line-based and disables H-ints).\r
-  + Added "fit2" display mode for all FC gamers. It always uses 208x146 for\r
-    P800 and 208x208 for all other phones.\r
-  + Added volume control for Motorolas (experimental).\r
-\r
-  VDP changes:\r
-  + Added support for vertical window (used by Vapor Trail, Mercs, GRIND\r
-    Stormer and others).\r
-  + Added sprite masking (hiding), adds some speed.\r
-  + Added preliminary H counter emulation. Comix Zone and Sonic 3D Blast\r
-    special stage are now playable.\r
-  + Added column based vertical scrolling (Gunstar Heroes battleship level,\r
-    Sonic and Knuckles lava boss, etc).\r
-\r
-  Emulation changes:\r
-  + Re-added and improved Z80 faking when Z80 is disabled. Many games now can\r
-    be played without enabling Z80 (Lost Vikings, Syndicate, etc), but some\r
-    still need it (International Superstar Soccer Deluxe).\r
-  * Improved ym2612 timers, Outrun music plays at correct speed, voices in\r
-    Earthworm Jim play better, more games play sound.\r
-  * I/O registers now remember their values (needed for Pirates! Gold)\r
-  + Added support for 6 button pad.\r
-\r
-  Changes in Cyclone 0.0083wip:\r
-  + Added missing CHK opcode (used by SeaQuest DSV).\r
-  + Added missing TAS opcode (Gargoyles). As in real genesis, write-back phase\r
-    is ignored (but is enabled for other systems).\r
-\r
-  Backported stuff from Snes9x:\r
-  * Fixed Pxxx jog up/down which were not working in game.\r
-  + Added an option to gzip save states to save space.\r
-  + The emulator now pauses whenever it is loosing focus, so it will now pause\r
-    when alarm/ponecall/battery low/... windows come up.\r
-  - Removed 'pause on phonecall' feature, as it is no longer needed.\r
-  + Video fix for asian A1000s.\r
-\r
-0.70\r
-  * Started using tools from "Symbian GCC Improvement Project", which give\r
-    considerable speed increase (~4fps in "center 90" mode).\r
-  * Rewrote some drawing routines in ARM assembly (gives ~6 more fps in\r
-    "center 90" mode).\r
-  * Minor improvement to 0 and 180 "fit" modes. Now they look slightly better\r
-    and are faster.\r
-  * Minor stability improvements (emulator is less likely to crash).\r
-  + Added some background for OSD text for better readability.\r
-  + Added Pal/NTSC detection. This is needed for proper sound speed.\r
-  + Implemented Reesy's DrZ80 Z80 emu. Made some changes to it with hope to make\r
-    it faster.\r
-  + Implemented ym2612 emu from the MAME project. Runs well but sometimes sounds\r
-    a bit weird. Could be a little faster, so made some changes too.\r
-  + Implemented SN76489 emu from the MAME project.\r
-  + Added two separate sound output methods (mediaserver and cmaudiofb) with\r
-    autodetection (needs testing).\r
-  * Fixed VDP DMA fill emulation (as described in Charles MacDonald's docs),\r
-    fixes Contra and some other games.\r
-\r
-0.301\r
-  Launcher:\r
-  * Launcher now starts emulation process from current directory,\r
-    not from hardcoded paths.\r
-  * Improved 'pause on call' feature, should hopefully work with Motorola phones.\r
-\r
-0.30\r
-  Initial release.\r
-\r
-\r
-Disclaimer\r
-----------\r
-\r
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" \r
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE \r
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE \r
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE \r
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR \r
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF \r
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS \r
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN \r
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \r
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \r
-POSSIBILITY OF SUCH DAMAGE. \r
diff --git a/platform/uiq2/audio.h b/platform/uiq2/audio.h
deleted file mode 100644 (file)
index 0b1ae38..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-// audio interface, used in picodriveN\r
-\r
-#ifndef __AUDIO_H\r
-#define __AUDIO_H\r
-\r
-#include <e32std.h>\r
-\r
-\r
-class IGameAudio : public CBase\r
-{\r
-public:\r
-       virtual TInt16 *NextFrameL() = 0;\r
-       virtual TInt16 *DupeFrameL(TInt &aUnderflowed) = 0;\r
-       virtual TInt16 *ResumeL() = 0;\r
-       virtual void Pause() = 0;\r
-       virtual void ChangeVolume(TInt aUp) = 0; // for Motorolas (experimental)\r
-};\r
-\r
-\r
-// our audio object maker type\r
-typedef IGameAudio *(*_gameAudioNew)(TInt aRate, TBool aStereo, TInt aPcmFrames, TInt aBufferedFrames);\r
-\r
-\r
-#endif                 /* __AUDIO_H */\r
diff --git a/platform/uiq2/audio/AUDIO_MEDIASERVER.DLL b/platform/uiq2/audio/AUDIO_MEDIASERVER.DLL
deleted file mode 100644 (file)
index 38172c4..0000000
Binary files a/platform/uiq2/audio/AUDIO_MEDIASERVER.DLL and /dev/null differ
diff --git a/platform/uiq2/audio/AUDIO_MOTOROLA.DLL b/platform/uiq2/audio/AUDIO_MOTOROLA.DLL
deleted file mode 100644 (file)
index c510a22..0000000
Binary files a/platform/uiq2/audio/AUDIO_MOTOROLA.DLL and /dev/null differ
diff --git a/platform/uiq2/audio/mediaserver/AUDIO_MEDIASERVER.ARMI b/platform/uiq2/audio/mediaserver/AUDIO_MEDIASERVER.ARMI
deleted file mode 100644 (file)
index ab9cb64..0000000
+++ /dev/null
@@ -1,402 +0,0 @@
-\r
-# CWD \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\\r
-# MMPFile \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER.MMP\r
-# Target AUDIO_MEDIASERVER.DLL\r
-# TargetType DLL\r
-# BasicTargetType DLL\r
-# MakefileType GNU\r
-\r
-ERASE = @erase 2>>nul\r
-\r
-# EPOC DEFINITIONS\r
-\r
-EPOCBLD = ..\..\..\..\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER\ARMI\r
-EPOCTRG = ..\..\..\..\EPOC32\RELEASE\ARMI\r
-EPOCLIB = ..\..\..\..\EPOC32\RELEASE\ARMI\r
-EPOCLINK = ..\..\..\..\EPOC32\RELEASE\ARMI\r
-EPOCSTATLINK = ..\..\..\..\EPOC32\RELEASE\ARMI\r
-EPOCASSPLINK = ..\..\..\..\EPOC32\RELEASE\MARM\r
-EPOCDATA = \DEV\UIQ21\EPOC32\DATA\r
-EPOCINC = \DEV\UIQ21\EPOC32\INCLUDE\r
-TRGDIR = \r
-DATADIR = Z\SYSTEM\DATA\r
-\r
-EPOCBLDUREL = $(EPOCBLD)\UREL\r
-EPOCTRGUREL = $(EPOCTRG)\UREL\r
-EPOCLIBUREL = $(EPOCLIB)\UREL\r
-EPOCLINKUREL = $(EPOCLINK)\UREL\r
-EPOCSTATLINKUREL = $(EPOCSTATLINK)\UREL\r
-EPOCASSPLINKUREL = $(EPOCASSPLINK)\UREL\r
-\r
-EPOCBLDUDEB = $(EPOCBLD)\UDEB\r
-EPOCTRGUDEB = $(EPOCTRG)\UDEB\r
-EPOCLIBUDEB = $(EPOCLIB)\UREL\r
-EPOCLINKUDEB = $(EPOCLINK)\UREL\r
-EPOCSTATLINKUDEB = $(EPOCSTATLINK)\UDEB\r
-EPOCASSPLINKUDEB = $(EPOCASSPLINK)\UREL\r
-\r
-# EPOC PSEUDOTARGETS\r
-\r
-UREL : MAKEWORKUREL RESOURCEUREL\r
-\r
-UDEB : MAKEWORKUDEB RESOURCEUDEB\r
-\r
-ALL : UREL UDEB\r
-\r
-CLEAN CLEANALL : CLEANBUILD CLEANRELEASE CLEANLIBRARY\r
-\r
-\r
-\r
-WHAT WHATALL : WHATUREL WHATUDEB\r
-\r
-RESOURCE RESOURCEALL : RESOURCEUREL RESOURCEUDEB\r
-\r
-CLEANBUILD CLEANBUILDALL : CLEANBUILDUREL CLEANBUILDUDEB\r
-\r
-CLEANRELEASE CLEANRELEASEALL : CLEANRELEASEUREL CLEANRELEASEUDEB\r
-\r
-MAKEWORK MAKEWORKALL : MAKEWORKUREL MAKEWORKUDEB\r
-\r
-LISTING LISTINGALL : LISTINGUREL LISTINGUDEB\r
-\r
-MAKEWORK : MAKEWORKLIBRARY\r
-\r
-RESOURCEUREL RESOURCEUDEB : GENERIC_RESOURCE\r
-\r
-\r
-# must set both PATH and Path to make it work correctly\r
-Path:=X:\DEV\UIQ21\EPOC32\gcc\bin;$(Path)\r
-PATH:=$(Path)\r
-\r
-INCDIR  = -I "." -I "..\.." -I "..\..\..\..\EPOC32\INCLUDE"\r
-\r
-GCCFLAGS=-march=armv4t -mthumb-interwork \\r
-               -pipe -c -nostdinc -Wall -Wno-ctor-dtor-privacy -Wno-unknown-pragmas \r
-\r
-GCCDEFS = -D__SYMBIAN32__ -D__GCC32__ -D__EPOC32__ -D__MARM__ -D__MARM_ARMI__ -D__DLL__ $(USERDEFS)\r
-\r
-GCCUREL = gcc -s -fomit-frame-pointer -O $(GCCFLAGS) -DNDEBUG -D_UNICODE $(GCCDEFS)\r
-GCCUDEB = gcc -g -O $(GCCFLAGS) -D_DEBUG -D_UNICODE $(GCCDEFS)\r
-\r
-\r
-UREL : \\r
-       $(EPOCTRGUREL)\AUDIO_MEDIASERVER.DLL \\r
-       LIBRARY\r
-\r
-\r
-UDEB : \\r
-       $(EPOCTRGUDEB)\AUDIO_MEDIASERVER.DLL \\r
-       LIBRARY\r
-\r
-\r
-\r
-RESOURCEUREL : MAKEWORKUREL\r
-RESOURCEUDEB : MAKEWORKUDEB\r
-\r
-LIBRARY : MAKEWORKLIBRARY $(EPOCLIB)\UREL\AUDIO_MEDIASERVER.LIB \DEV\UIQ21\EPOC32\RELEASE\ARM4\UREL\AUDIO_MEDIASERVER.LIB \DEV\UIQ21\EPOC32\RELEASE\THUMB\UREL\AUDIO_MEDIASERVER.LIB\r
-\r
-\r
-# REAL TARGET - LIBRARY\r
-\r
-$(EPOCLIB)\UREL\AUDIO_MEDIASERVER.LIB : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER.DEF\r
-       dlltool -m arm_interwork --output-lib "$(EPOCLIB)\UREL\AUDIO_MEDIASERVER.LIB" \\r
-               --def ".\AUDIO_MEDIASERVER.DEF" \\r
-               --dllname "AUDIO_MEDIASERVER[1000c196].DLL" \r
-\r
-\DEV\UIQ21\EPOC32\RELEASE\ARM4\UREL\AUDIO_MEDIASERVER.LIB : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER.DEF\r
-       dlltool -m arm --output-lib "..\..\..\..\EPOC32\RELEASE\ARM4\UREL\AUDIO_MEDIASERVER.LIB" \\r
-               --def ".\AUDIO_MEDIASERVER.DEF" \\r
-               --dllname "AUDIO_MEDIASERVER[1000c196].DLL" \r
-\r
-\DEV\UIQ21\EPOC32\RELEASE\THUMB\UREL\AUDIO_MEDIASERVER.LIB : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER.DEF\r
-       dlltool -m thumb --output-lib "..\..\..\..\EPOC32\RELEASE\THUMB\UREL\AUDIO_MEDIASERVER.LIB" \\r
-               --def ".\AUDIO_MEDIASERVER.DEF" \\r
-               --dllname "AUDIO_MEDIASERVER[1000c196].DLL" \r
-\r
-\r
-FREEZE :\r
-       perl -S efreeze.pl "\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER.DEF" "$(EPOCBLD)\AUDIO_MEDIASERVER.def" \r
-\r
-CLEANLIBRARY :\r
-       -$(ERASE) "$(EPOCLIB)\UREL\AUDIO_MEDIASERVER.LIB"\r
-       -$(ERASE) "\DEV\UIQ21\EPOC32\RELEASE\ARM4\UREL\AUDIO_MEDIASERVER.LIB"\r
-       -$(ERASE) "\DEV\UIQ21\EPOC32\RELEASE\THUMB\UREL\AUDIO_MEDIASERVER.LIB"\r
-\r
-\r
-GENERIC_RESOURCE : GENERIC_MAKEWORK\r
-\r
-# REAL TARGET - BUILD VARIANT UREL\r
-\r
-WHATUREL : WHATGENERIC\r
-\r
-CLEANUREL : CLEANBUILDUREL CLEANRELEASEUREL\r
-\r
-CLEANBUILDUREL : \r
-       @perl -S ermdir.pl "$(EPOCBLDUREL)"\r
-\r
-CLEANRELEASEUREL : CLEANGENERIC\r
-\r
-\r
-UREL_RELEASEABLES1= \\r
-       \DEV\UIQ21\EPOC32\RELEASE\ARM4\UREL\AUDIO_MEDIASERVER.LIB \\r
-       \DEV\UIQ21\EPOC32\RELEASE\ARMI\UREL\AUDIO_MEDIASERVER.DLL \\r
-       \DEV\UIQ21\EPOC32\RELEASE\ARMI\UREL\AUDIO_MEDIASERVER.DLL.MAP \\r
-       \DEV\UIQ21\EPOC32\RELEASE\ARMI\UREL\AUDIO_MEDIASERVER.LIB \\r
-       \DEV\UIQ21\EPOC32\RELEASE\THUMB\UREL\AUDIO_MEDIASERVER.LIB\r
-\r
-WHATUREL:\r
-       @echo $(UREL_RELEASEABLES1)\r
-\r
-CLEANRELEASEUREL:\r
-       -$(ERASE) $(UREL_RELEASEABLES1)\r
-\r
-LISTINGUREL : MAKEWORKUREL \\r
-       LISTINGURELAUDIO_MEDIASERVER \\r
-       LISTINGURELPOLLEDAS\r
-\r
-LIBSUREL= \\r
-       $(EPOCSTATLINKUREL)\EDLLSTUB.LIB \\r
-       $(EPOCSTATLINKUREL)\EGCC.LIB \\r
-       $(EPOCLINKUREL)\EUSER.LIB \\r
-       $(EPOCLINKUREL)\MEDIACLIENTAUDIOSTREAM.LIB \\r
-       $(EPOCLINKUREL)\MEDIACLIENT.LIB\r
-\r
-$(EPOCTRGUREL)\AUDIO_MEDIASERVER.DLL : $(EPOCBLDUREL)\AUDIO_MEDIASERVER.in \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER.DEF $(EPOCSTATLINKUREL)\EDLL.LIB $(LIBSUREL)\r
-       dlltool -m arm_interwork --output-def "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.inf" "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.in"\r
-       perl -S makedef.pl -Deffile "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.inf" -Frzfile "\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER.DEF" "$(EPOCBLD)\AUDIO_MEDIASERVER.def"\r
-       -$(ERASE) "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.inf"\r
-       dlltool -m arm_interwork --def "$(EPOCBLD)\AUDIO_MEDIASERVER.def" \\r
-               --output-exp "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.exp" \\r
-               --dllname "AUDIO_MEDIASERVER[1000c196].DLL"\r
-       ld  -s -e _E32Dll -u _E32Dll "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.exp" --dll \\r
-               --base-file "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.bas" -o "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.DLL" \\r
-               "$(EPOCSTATLINKUREL)\EDLL.LIB" --whole-archive "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.in" \\r
-               --no-whole-archive $(LIBSUREL) $(USERLDFLAGS)\r
-       -$(ERASE) "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.exp"\r
-       -$(ERASE) "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.DLL"\r
-       dlltool -m arm_interwork \\r
-               --def "$(EPOCBLD)\AUDIO_MEDIASERVER.def" \\r
-               --dllname "AUDIO_MEDIASERVER[1000c196].DLL" \\r
-               --base-file "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.bas" \\r
-               --output-exp "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.exp" \r
-       -$(ERASE) "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.bas"\r
-       ld  -s -e _E32Dll -u _E32Dll --dll \\r
-               "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.exp" \\r
-               -Map "$(EPOCTRGUREL)\AUDIO_MEDIASERVER.DLL.map" -o "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.DLL" \\r
-               "$(EPOCSTATLINKUREL)\EDLL.LIB" --whole-archive "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.in" \\r
-               --no-whole-archive $(LIBSUREL) $(USERLDFLAGS)\r
-       -$(ERASE) "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.exp"\r
-       petran  "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.DLL" "$@" \\r
-                -nocall -uid1 0x10000079 -uid2 0x100039ce -uid3 0x1000c196\r
-       -$(ERASE) "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.DLL"\r
-\r
-OBJECTSUREL= \\r
-       $(EPOCBLDUREL)\AUDIO_MEDIASERVER.o \\r
-       $(EPOCBLDUREL)\POLLEDAS.o\r
-\r
-$(EPOCBLDUREL)\AUDIO_MEDIASERVER.in : $(OBJECTSUREL)\r
-       if exist "$@" del "$@"\r
-       ar cr $@ $^\r
-\r
-\r
-# REAL TARGET - BUILD VARIANT UDEB\r
-\r
-WHATUDEB : WHATGENERIC\r
-\r
-CLEANUDEB : CLEANBUILDUDEB CLEANRELEASEUDEB\r
-\r
-CLEANBUILDUDEB : \r
-       @perl -S ermdir.pl "$(EPOCBLDUDEB)"\r
-\r
-CLEANRELEASEUDEB : CLEANGENERIC\r
-\r
-\r
-UDEB_RELEASEABLES1= \\r
-       \DEV\UIQ21\EPOC32\RELEASE\ARM4\UREL\AUDIO_MEDIASERVER.LIB \\r
-       \DEV\UIQ21\EPOC32\RELEASE\ARMI\UDEB\AUDIO_MEDIASERVER.DLL \\r
-       \DEV\UIQ21\EPOC32\RELEASE\ARMI\UDEB\AUDIO_MEDIASERVER.DLL.MAP \\r
-       \DEV\UIQ21\EPOC32\RELEASE\ARMI\UREL\AUDIO_MEDIASERVER.LIB \\r
-       \DEV\UIQ21\EPOC32\RELEASE\THUMB\UREL\AUDIO_MEDIASERVER.LIB\r
-\r
-WHATUDEB:\r
-       @echo $(UDEB_RELEASEABLES1)\r
-\r
-CLEANRELEASEUDEB:\r
-       -$(ERASE) $(UDEB_RELEASEABLES1)\r
-\r
-LISTINGUDEB : MAKEWORKUDEB \\r
-       LISTINGUDEBAUDIO_MEDIASERVER \\r
-       LISTINGUDEBPOLLEDAS\r
-\r
-LIBSUDEB= \\r
-       $(EPOCSTATLINKUDEB)\EDLLSTUB.LIB \\r
-       $(EPOCSTATLINKUDEB)\EGCC.LIB \\r
-       $(EPOCLINKUDEB)\EUSER.LIB \\r
-       $(EPOCLINKUDEB)\MEDIACLIENTAUDIOSTREAM.LIB \\r
-       $(EPOCLINKUDEB)\MEDIACLIENT.LIB\r
-\r
-$(EPOCTRGUDEB)\AUDIO_MEDIASERVER.DLL : $(EPOCBLDUDEB)\AUDIO_MEDIASERVER.in \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER.DEF $(EPOCSTATLINKUDEB)\EDLL.LIB $(LIBSUDEB)\r
-       dlltool -m arm_interwork --output-def "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.inf" "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.in"\r
-       perl -S makedef.pl -Deffile "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.inf" -Frzfile "\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER.DEF" "$(EPOCBLD)\AUDIO_MEDIASERVER.def"\r
-       -$(ERASE) "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.inf"\r
-       dlltool -m arm_interwork --def "$(EPOCBLD)\AUDIO_MEDIASERVER.def" \\r
-               --output-exp "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.exp" \\r
-               --dllname "AUDIO_MEDIASERVER[1000c196].DLL"\r
-       ld  -s -e _E32Dll -u _E32Dll "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.exp" --dll \\r
-               --base-file "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.bas" -o "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.DLL" \\r
-               "$(EPOCSTATLINKUDEB)\EDLL.LIB" --whole-archive "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.in" \\r
-               --no-whole-archive $(LIBSUDEB) $(USERLDFLAGS)\r
-       -$(ERASE) "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.exp"\r
-       -$(ERASE) "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.DLL"\r
-       dlltool -m arm_interwork \\r
-               --def "$(EPOCBLD)\AUDIO_MEDIASERVER.def" \\r
-               --dllname "AUDIO_MEDIASERVER[1000c196].DLL" \\r
-               --base-file "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.bas" \\r
-               --output-exp "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.exp" \r
-       -$(ERASE) "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.bas"\r
-       ld  -e _E32Dll -u _E32Dll --dll \\r
-               "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.exp" \\r
-               -Map "$(EPOCTRGUDEB)\AUDIO_MEDIASERVER.DLL.map" -o "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.DLL" \\r
-               "$(EPOCSTATLINKUDEB)\EDLL.LIB" --whole-archive "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.in" \\r
-               --no-whole-archive $(LIBSUDEB) $(USERLDFLAGS)\r
-       -$(ERASE) "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.exp"\r
-       objcopy -X "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.DLL" "$(EPOCTRGUDEB)\AUDIO_MEDIASERVER.sym"\r
-       petran  "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.DLL" "$@" \\r
-                -nocall -uid1 0x10000079 -uid2 0x100039ce -uid3 0x1000c196\r
-       -$(ERASE) "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.DLL"\r
-\r
-OBJECTSUDEB= \\r
-       $(EPOCBLDUDEB)\AUDIO_MEDIASERVER.o \\r
-       $(EPOCBLDUDEB)\POLLEDAS.o\r
-\r
-$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.in : $(OBJECTSUDEB)\r
-       if exist "$@" del "$@"\r
-       ar cr $@ $^\r
-\r
-\r
-# SOURCES\r
-\r
-# Source AUDIO_MEDIASERVER.CPP\r
-\r
-$(EPOCBLDUREL)\AUDIO_MEDIASERVER.lis $(EPOCBLDUREL)\AUDIO_MEDIASERVER.o \\r
-$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.lis $(EPOCBLDUDEB)\AUDIO_MEDIASERVER.o \\r
-: \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32BASE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32BASE.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32DEF.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32DES16.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32DES8.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32HAL.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32KEYS.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32PCCD.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32STD.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32STD.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32SVR.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\MDAAUDIOOUTPUTSTREAM.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\MDA\CLIENT\BASE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\MDA\CLIENT\BASE.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\MDA\CLIENT\CONTROLLER.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\MDA\CLIENT\PORT.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\MDA\CLIENT\UTILITY.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\AUDIO.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\AUDIO.HRH \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\AUDIOSTREAM.HRH \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\BASE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\BASE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\BASE.HRH \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\BASE.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\CONTROLLER.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\CONTROLLER.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\CONTROLLER.HRH \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\PORT.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\PORT.HRH \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\RESOURCE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\RESOURCE.HRH \\r
-       \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO.H \\r
-       \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER.H \\r
-       \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\POLLEDAS.H\r
-\r
-$(EPOCBLDUREL)\AUDIO_MEDIASERVER.o : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\Audio_mediaserver.cpp\r
-       $(GCCUREL) -I "." $(INCDIR) -o $@ ".\Audio_mediaserver.cpp"\r
-\r
-LISTINGURELAUDIO_MEDIASERVER : $(EPOCBLDUREL)\AUDIO_MEDIASERVER.lis\r
-       perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER.lst.ARMI\r
-\r
-$(EPOCBLDUREL)\AUDIO_MEDIASERVER.lis : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\Audio_mediaserver.cpp\r
-       $(GCCUREL) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Audio_mediaserver.cpp" > $@\r
-\r
-$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.o : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\Audio_mediaserver.cpp\r
-       $(GCCUDEB) -I "." $(INCDIR) -o $@ ".\Audio_mediaserver.cpp"\r
-\r
-LISTINGUDEBAUDIO_MEDIASERVER : $(EPOCBLDUDEB)\AUDIO_MEDIASERVER.lis\r
-       perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER.lst.ARMI\r
-\r
-$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.lis : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\Audio_mediaserver.cpp\r
-       $(GCCUDEB) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Audio_mediaserver.cpp" > $@\r
-\r
-\r
-\r
-# Source POLLEDAS.CPP\r
-\r
-$(EPOCBLDUREL)\POLLEDAS.lis $(EPOCBLDUREL)\POLLEDAS.o \\r
-$(EPOCBLDUDEB)\POLLEDAS.lis $(EPOCBLDUDEB)\POLLEDAS.o \\r
-: \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32DEF.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32DES16.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32DES8.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32STD.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32STD.INL \\r
-       \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\POLLEDAS.H\r
-\r
-$(EPOCBLDUREL)\POLLEDAS.o : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\Polledas.cpp\r
-       $(GCCUREL) -I "." $(INCDIR) -o $@ ".\Polledas.cpp"\r
-\r
-LISTINGURELPOLLEDAS : $(EPOCBLDUREL)\POLLEDAS.lis\r
-       perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\POLLEDAS.lst.ARMI\r
-\r
-$(EPOCBLDUREL)\POLLEDAS.lis : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\Polledas.cpp\r
-       $(GCCUREL) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Polledas.cpp" > $@\r
-\r
-$(EPOCBLDUDEB)\POLLEDAS.o : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\Polledas.cpp\r
-       $(GCCUDEB) -I "." $(INCDIR) -o $@ ".\Polledas.cpp"\r
-\r
-LISTINGUDEBPOLLEDAS : $(EPOCBLDUDEB)\POLLEDAS.lis\r
-       perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\POLLEDAS.lst.ARMI\r
-\r
-$(EPOCBLDUDEB)\POLLEDAS.lis : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\Polledas.cpp\r
-       $(GCCUDEB) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Polledas.cpp" > $@\r
-\r
-\r
-\r
-ROMFILE:\r
-       @echo file=\DEV\UIQ21\EPOC32\RELEASE\ARMI\##BUILD##\AUDIO_MEDIASERVER.DLL System\Libs\AUDIO_MEDIASERVER.DLL \r
-\r
-\r
-WHATGENERIC CLEANGENERIC :\r
-       @rem none\r
-\r
-# Rules to create all necessary directories\r
-\r
-GENERIC_MAKEWORK : \\r
-       \DEV\UIQ21\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER\ARMI\r
-MAKEWORKLIBRARY : \\r
-       \DEV\UIQ21\EPOC32\RELEASE\ARM4\UREL \\r
-       \DEV\UIQ21\EPOC32\RELEASE\ARMI\UREL \\r
-       \DEV\UIQ21\EPOC32\RELEASE\THUMB\UREL\r
-MAKEWORKUDEB : \\r
-       \DEV\UIQ21\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER\ARMI\UDEB \\r
-       \DEV\UIQ21\EPOC32\RELEASE\ARMI\UDEB\r
-MAKEWORKUREL : \\r
-       \DEV\UIQ21\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER\ARMI\UREL \\r
-       \DEV\UIQ21\EPOC32\RELEASE\ARMI\UREL\r
-\r
-\DEV\UIQ21\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER\ARMI \\r
-\DEV\UIQ21\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER\ARMI\UDEB \\r
-\DEV\UIQ21\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER\ARMI\UREL \\r
-\DEV\UIQ21\EPOC32\RELEASE\ARM4\UREL \\r
-\DEV\UIQ21\EPOC32\RELEASE\ARMI\UDEB \\r
-\DEV\UIQ21\EPOC32\RELEASE\ARMI\UREL \\r
-\DEV\UIQ21\EPOC32\RELEASE\THUMB\UREL \\r
-:\r
-       perl -S emkdir.pl $@\r
-\r
diff --git a/platform/uiq2/audio/mediaserver/PolledAS.h b/platform/uiq2/audio/mediaserver/PolledAS.h
deleted file mode 100644 (file)
index f360c89..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************\r
- *\r
- *     File:           PolledAS.h\r
- *\r
- *     Author:         Peter van Sebille (peter@yipton.net)\r
- *\r
- *     (c) Copyright 2001, Peter van Sebille\r
- *     All Rights Reserved\r
- *\r
- *******************************************************************/\r
-\r
-#ifndef __POLLED_AS_H\r
-#define __POLLED_AS_H\r
-\r
-class CPrivatePolledActiveScheduler;\r
-\r
-class CPolledActiveScheduler : public CBase\r
-{\r
-public:\r
-       ~CPolledActiveScheduler();\r
-       static CPolledActiveScheduler* NewL();\r
-       //static CPolledActiveScheduler* Instance();\r
-       void Schedule();\r
-protected:\r
-       CPolledActiveScheduler(){};\r
-       void ConstructL();\r
-       CPrivatePolledActiveScheduler*  iPrivatePolledActiveScheduler;\r
-};\r
-\r
-\r
-#endif                 /* __POLLED_AS_H */\r
-\r
diff --git a/platform/uiq2/audio/mediaserver/audio_mediaserver.cpp b/platform/uiq2/audio/mediaserver/audio_mediaserver.cpp
deleted file mode 100644 (file)
index 6655205..0000000
+++ /dev/null
@@ -1,321 +0,0 @@
-/*******************************************************************\r
- *\r
- *     File:           Audio_mediaserver.cpp\r
- *\r
- *     Author:         Peter van Sebille (peter@yipton.net)\r
- *\r
- *  Modified/adapted for picodriveN by notaz, 2006\r
- *\r
- *  (c) Copyright 2006, notaz\r
- *     (c) Copyright 2001, Peter van Sebille\r
- *     All Rights Reserved\r
- *\r
- *******************************************************************/\r
-\r
-#include "audio_mediaserver.h"\r
-\r
-//#define __DEBUG_PRINT_SND\r
-\r
-#ifdef __DEBUG_PRINT_SND\r
-       #include <e32svr.h> // RDebug\r
-       #define DEBUGPRINT(x...) RDebug::Print(x)\r
-#else\r
-       #define DEBUGPRINT(x...)\r
-#endif\r
-\r
-\r
-GLDEF_C TInt E32Dll(TDllReason)\r
-{\r
-       return KErrNone;\r
-}\r
-\r
-\r
-/*******************************************\r
- *\r
- * CGameAudioMS\r
- *\r
- *******************************************/\r
-\r
-CGameAudioMS::CGameAudioMS(TInt aRate, TBool aStereo, TInt aPcmFrames,  TInt aBufferedFrames)\r
-: iRate(aRate), iStereo(aStereo), iBufferedFrames(aBufferedFrames), iPcmFrames(aPcmFrames)\r
-{\r
-}\r
-\r
-\r
-CGameAudioMS* CGameAudioMS::NewL(TInt aRate, TBool aStereo, TInt aPcmFrames, TInt aBufferedFrames)\r
-{\r
-       DEBUGPRINT(_L("CGameAudioMS::NewL(%i, %i, %i, %i)"),aRate, aStereo, aPcmFrames, aBufferedFrames);\r
-       CGameAudioMS*           self = new(ELeave) CGameAudioMS(aRate, aStereo, aPcmFrames, aBufferedFrames);\r
-       CleanupStack::PushL(self);\r
-       self->ConstructL();\r
-       CleanupStack::Pop();            // self\r
-       return self;\r
-}\r
-\r
-\r
-CGameAudioMS::~CGameAudioMS()\r
-{\r
-       DEBUGPRINT(_L("CGameAudioMS::~CGameAudioMS()"));\r
-       if(iMdaAudioOutputStream) {\r
-               iScheduler->Schedule(); // let it finish it's stuff\r
-               iMdaAudioOutputStream->Stop();\r
-               delete iMdaAudioOutputStream;\r
-       }\r
-       if(iServer) delete iServer;\r
-\r
-       for (TInt i=0 ; i<KSoundBuffers+1 ; i++)\r
-               delete iSoundBuffers[i];\r
-\r
-       // Polled AS\r
-       if(iScheduler) delete iScheduler;\r
-}\r
-\r
-\r
-void CGameAudioMS::ConstructL()\r
-{\r
-       iServer = CMdaServer::NewL();\r
-\r
-       iScheduler = CPolledActiveScheduler::NewL();\r
-\r
-       switch(iRate) {\r
-               case 11025: iMdaAudioDataSettings.iSampleRate = TMdaAudioDataSettings::ESampleRate11025Hz; break;\r
-               case 16000: iMdaAudioDataSettings.iSampleRate = TMdaAudioDataSettings::ESampleRate16000Hz; break;\r
-               case 22050: iMdaAudioDataSettings.iSampleRate = TMdaAudioDataSettings::ESampleRate22050Hz; break;\r
-               default:    iMdaAudioDataSettings.iSampleRate = TMdaAudioDataSettings::ESampleRate8000Hz;  break;\r
-       }\r
-\r
-       iMdaAudioDataSettings.iChannels   = (iStereo) ? TMdaAudioDataSettings::EChannelsStereo : TMdaAudioDataSettings::EChannelsMono;\r
-       iMdaAudioDataSettings.iCaps       = TMdaAudioDataSettings::ESampleRateFixed | iMdaAudioDataSettings.iSampleRate;\r
-       iMdaAudioDataSettings.iFlags      = TMdaAudioDataSettings::ENoNetworkRouting;\r
-\r
-       TInt    bytesPerFrame = iStereo ? iPcmFrames << 2 : iPcmFrames << 1;\r
-       for (TInt i=0 ; i<KSoundBuffers ; i++)\r
-       {\r
-               iSoundBuffers[i] = HBufC8::NewL(bytesPerFrame * iBufferedFrames);\r
-               iSoundBuffers[i]->Des().FillZ  (bytesPerFrame * iBufferedFrames);\r
-       }\r
-       // because feeding 2 buffers after an underflow is a little too much, but feeding 1 may be not enough,\r
-       // prepare this ~50ms empty buffer to additionaly feed after every underflow.\r
-       // Another strange thing here: if we try to make and odd-length sound buffer here,\r
-       // system then outputs horrible noise! (this happened on 22050 mono and when there\r
-       // were no parenthesis around iBufferedFrames / 4.\r
-       iSoundBuffers[KSoundBuffers] = HBufC8::NewL(bytesPerFrame * (iBufferedFrames / 4));\r
-       iSoundBuffers[KSoundBuffers]->Des().FillZ  (bytesPerFrame * (iBufferedFrames / 4));\r
-\r
-       iCurrentBuffer = 0;\r
-\r
-       // here we actually test if we can create and open CMdaAudioOutputStream at all, but really create and use it later.\r
-       iMdaAudioOutputStream = CMdaAudioOutputStream::NewL(iListener, iServer);\r
-       if(iMdaAudioOutputStream) {\r
-               delete iMdaAudioOutputStream;\r
-               iMdaAudioOutputStream = 0;\r
-       }\r
-}\r
-\r
-/* currently unused\r
-TInt CGameAudioMS::Write(TInt16* aBuffer, TInt aSize)\r
-{\r
-       TInt    byteSize = iStereo ? aSize << 2 : aSize << 1;\r
-       Mem::Copy(iCurrentPosition, aBuffer, byteSize);\r
-       iCurrentPosition += aSize;\r
-\r
-       if (++iFrameCount == iBufferedFrames)\r
-       {\r
-               WriteBlock();\r
-       }\r
-\r
-       CPolledActiveScheduler::Instance()->Schedule();\r
-       if(iListener.iUnderflowed) Underflowed(); // oh no, CMdaAudioOutputStream underflowed!\r
-\r
-       return aSize;\r
-}\r
-*/\r
-\r
-// returns a pointer to buffer for next frame,\r
-// to be used when iSoundBuffers are used directly\r
-TInt16 *CGameAudioMS::NextFrameL()\r
-{\r
-       iCurrentPosition += iPcmFrames << (iStereo?1:0);\r
-\r
-       if (++iFrameCount == iBufferedFrames)\r
-       {\r
-               WriteBlockL();\r
-       }\r
-\r
-       iScheduler->Schedule();\r
-\r
-       if(iListener.iUnderflowed) {\r
-               if(iListener.iUnderflowed > KMaxUnderflows) {\r
-                       delete iMdaAudioOutputStream;\r
-                       iMdaAudioOutputStream = 0;\r
-                       return 0;\r
-               }\r
-               UnderflowedL(); // not again!\r
-       }\r
-\r
-       return iCurrentPosition;\r
-}\r
-\r
-TInt16 *CGameAudioMS::DupeFrameL(TInt &aUnderflowed)\r
-{\r
-       TInt shorts = iStereo ? (iPcmFrames << 1) : iPcmFrames;\r
-       if(iFrameCount)\r
-               Mem::Copy(iCurrentPosition, iCurrentPosition-shorts, shorts<<1);\r
-       else {\r
-               TInt lastBuffer = iCurrentBuffer;\r
-               if(--lastBuffer < 0) lastBuffer = KSoundBuffers - 1;\r
-               Mem::Copy(iCurrentPosition, ((TInt16*) (iSoundBuffers[lastBuffer]->Ptr()))+shorts*(iBufferedFrames-1), shorts<<1);\r
-       }                               \r
-       iCurrentPosition += shorts;\r
-\r
-       if (++iFrameCount == iBufferedFrames)\r
-       {\r
-               WriteBlockL();\r
-       }\r
-\r
-       iScheduler->Schedule();\r
-\r
-       if((aUnderflowed = iListener.iUnderflowed)) { // not again!\r
-               if(iListener.iUnderflowed > KMaxUnderflows) {\r
-                       delete iMdaAudioOutputStream;\r
-                       iMdaAudioOutputStream = 0;\r
-                       return 0;\r
-               }\r
-               UnderflowedL(); // not again!\r
-       }\r
-\r
-       return iCurrentPosition;\r
-}\r
-\r
-void CGameAudioMS::WriteBlockL()\r
-{\r
-       iScheduler->Schedule();\r
-       // do not write until stream is open\r
-       if(!iListener.iIsOpen) WaitForOpenToCompleteL();\r
-       //if(!iListener.iHasCopied) WaitForCopyToCompleteL(); // almost never happens anyway and sometimes even deadlocks?\r
-       //iListener.iHasCopied = EFalse;\r
-       \r
-\r
-       if(!iListener.iUnderflowed) {\r
-               // don't write if sound is lagging too much\r
-               if(iTime - iMdaAudioOutputStream->Position().Int64() <= TInt64(0, KMaxLag)) {\r
-                       //RDebug::Print(_L("delta: %i"), iTime.Low() - iMdaAudioOutputStream->Position().Int64().Low());\r
-                       iMdaAudioOutputStream->WriteL(*iSoundBuffers[iCurrentBuffer]);\r
-                       iTime += KBlockTime;\r
-               }\r
-       }\r
-\r
-       iFrameCount = 0;\r
-       if (++iCurrentBuffer == KSoundBuffers)\r
-               iCurrentBuffer = 0;\r
-       iCurrentPosition = (TInt16*) iSoundBuffers[iCurrentBuffer]->Ptr();\r
-}\r
-\r
-void CGameAudioMS::Pause()\r
-{\r
-       if(!iMdaAudioOutputStream) return;\r
-\r
-       iScheduler->Schedule(); // let it finish it's stuff\r
-       iMdaAudioOutputStream->Stop();\r
-       delete iMdaAudioOutputStream;\r
-       iMdaAudioOutputStream = 0;\r
-}\r
-\r
-// call this before doing any playback!\r
-TInt16 *CGameAudioMS::ResumeL()\r
-{\r
-       DEBUGPRINT(_L("CGameAudioMS::Resume()"));\r
-       iScheduler->Schedule();\r
-\r
-       // we act a bit strange here: simulate buffer underflow, which actually starts audio\r
-       iListener.iIsOpen = ETrue;\r
-       iListener.iUnderflowed = 1;\r
-       iFrameCount = 0;\r
-       iCurrentPosition = (TInt16*) iSoundBuffers[iCurrentBuffer]->Ptr();\r
-       return iCurrentPosition;\r
-}\r
-\r
-// handles underflow condition\r
-void CGameAudioMS::UnderflowedL()\r
-{\r
-       // recreate the stream\r
-       //iMdaAudioOutputStream->Stop();\r
-       if(iMdaAudioOutputStream) delete iMdaAudioOutputStream;\r
-       iMdaAudioOutputStream = CMdaAudioOutputStream::NewL(iListener, iServer);\r
-       iMdaAudioOutputStream->Open(&iMdaAudioDataSettings);\r
-       iListener.iIsOpen = EFalse;   // wait for it to open\r
-       //iListener.iHasCopied = ETrue; // but don't wait for last copy to complete\r
-       // let it open and feed some stuff to make it happy\r
-       User::After(0);\r
-       TInt lastBuffer = iCurrentBuffer;\r
-       if(--lastBuffer < 0) lastBuffer = KSoundBuffers - 1;\r
-       iScheduler->Schedule();\r
-       if(!iListener.iIsOpen) WaitForOpenToCompleteL();\r
-       iMdaAudioOutputStream->WriteL(*iSoundBuffers[KSoundBuffers]); // special empty fill-up\r
-       iMdaAudioOutputStream->WriteL(*iSoundBuffers[lastBuffer]);\r
-       iTime = TInt64(0, KBlockTime/4 + KBlockTime);\r
-}\r
-\r
-/*\r
-void CGameAudioMS::WaitForCopyToCompleteL()\r
-{\r
-       DEBUGPRINT(_L("CGameAudioMS::WaitForCopyToCompleteL"));\r
-       while (!iListener.iHasCopied) {\r
-               //User::After(0);\r
-               iScheduler->Schedule();\r
-       }\r
-}\r
-*/\r
-\r
-void CGameAudioMS::WaitForOpenToCompleteL()\r
-{\r
-       DEBUGPRINT(_L("CGameAudioMS::WaitForOpenToCompleteL"));\r
-       TInt    count = 20;             // 2 seconds\r
-       TInt    waitPeriod = 100 * 1000;\r
-\r
-       if(!iListener.iIsOpen) {\r
-               // it is often enough to do this\r
-               User::After(0);\r
-               iScheduler->Schedule();\r
-       }\r
-       while (!iListener.iIsOpen && --count)\r
-       {\r
-               User::After(waitPeriod);\r
-               iScheduler->Schedule();\r
-       }\r
-       if (!iListener.iIsOpen)\r
-               User::LeaveIfError(KErrNotSupported);\r
-}\r
-\r
-void CGameAudioMS::ChangeVolume(TInt aUp)\r
-{\r
-       // do nothing\r
-       DEBUGPRINT(_L("CGameAudioMS::ChangeVolume(%i)"), aUp);\r
-}\r
-\r
-void TGameAudioEventListener::MaoscOpenComplete(TInt aError)\r
-{\r
-       DEBUGPRINT(_L("CGameAudioMS::MaoscOpenComplete, error=%d"), aError);\r
-\r
-       iIsOpen = ETrue;\r
-       if(aError) iUnderflowed++;\r
-       else       iUnderflowed = 0;\r
-}\r
-\r
-void TGameAudioEventListener::MaoscBufferCopied(TInt aError, const TDesC8& aBuffer)\r
-{\r
-       DEBUGPRINT(_L("CGameAudioMS::MaoscBufferCopied, error=%d"), aError);\r
-\r
-//     iHasCopied = ETrue;\r
-\r
-       if(aError) // shit!\r
-                iUnderflowed++;\r
-}\r
-\r
-void TGameAudioEventListener::MaoscPlayComplete(TInt aError)\r
-{\r
-       DEBUGPRINT(_L("CGameAudioMS::MaoscPlayComplete: %i"), aError);\r
-       if(aError)\r
-               iUnderflowed++; // never happened to me while testing, but just in case\r
-}\r
-\r
diff --git a/platform/uiq2/audio/mediaserver/audio_mediaserver.def b/platform/uiq2/audio/mediaserver/audio_mediaserver.def
deleted file mode 100644 (file)
index c55290b..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-EXPORTS\r
-; NEW:\r
-       NewL__12CGameAudioMSiiii @ 1 NONAME ; static CGameAudioMS* NewL(TInt aRate, TBool aStereo, TInt aPcmFrames, TInt aBufferedFrames);\r
diff --git a/platform/uiq2/audio/mediaserver/audio_mediaserver.h b/platform/uiq2/audio/mediaserver/audio_mediaserver.h
deleted file mode 100644 (file)
index 6937a48..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************\r
- *\r
- *     File:           Audio_mediaserver.h\r
- *\r
- *     Author:         Peter van Sebille (peter@yipton.net)\r
- *\r
- *  Modified/adapted for picodriveN by notaz, 2006\r
- *\r
- *  (c) Copyright 2006, notaz\r
- *     (c) Copyright 2001, Peter van Sebille\r
- *     All Rights Reserved\r
- *\r
- *******************************************************************/\r
-\r
-#ifndef __AUDIO_MEDIASERVER_H\r
-#define __AUDIO_MEDIASERVER_H\r
-\r
-#include <Mda\Common\Audio.h>\r
-#include <MdaAudioOutputStream.h>\r
-\r
-#include "audio.h"\r
-#include "polledas.h"\r
-\r
-const TInt KSoundBuffers = 4;\r
-const TInt KBlockTime = 1000000 / 5; // hardcoded: 5 updates/sec\r
-const TInt KMaxLag = 260000; // max sound lag, lower values increase chanse of underflow\r
-const TInt KMaxUnderflows = 50; // max underflows/API errors we are going allow in a row (to prevent lockups)\r
-\r
-\r
-class TGameAudioEventListener : public MMdaAudioOutputStreamCallback\r
-{\r
-public: // implements MMdaAudioOutputStreamCallback\r
-       void MaoscOpenComplete(TInt aError);\r
-       void MaoscBufferCopied(TInt aError, const TDesC8& );\r
-       void MaoscPlayComplete(TInt aError);\r
-\r
-       TBool                                   iIsOpen;\r
-//     TBool                                   iHasCopied;\r
-       TInt                                    iUnderflowed;\r
-};\r
-\r
-\r
-class CGameAudioMS : public IGameAudio // IGameAudio MUST be specified first!\r
-{\r
-public:        // implements IGameAudio\r
-       TInt16 *NextFrameL();\r
-       TInt16 *DupeFrameL(TInt &aUnderflowed);\r
-       TInt16 *ResumeL();\r
-       void Pause();\r
-       void ChangeVolume(TInt aUp);\r
-\r
-public:\r
-       ~CGameAudioMS();\r
-       CGameAudioMS(TInt aRate, TBool aStereo, TInt aPcmFrames, TInt aBufferedFrames);\r
-       void ConstructL();\r
-       EXPORT_C static CGameAudioMS* NewL(TInt aRate, TBool aStereo, TInt aPcmFrames, TInt aBufferedFrames);\r
-\r
-protected:\r
-       void WriteBlockL();\r
-       void UnderflowedL();\r
-\r
-protected:\r
-       void WaitForOpenToCompleteL();\r
-//     void WaitForCopyToCompleteL();\r
-\r
-       TInt                                    iRate;\r
-       TBool                                   iStereo;\r
-\r
-       CMdaAudioOutputStream   *iMdaAudioOutputStream;\r
-       TMdaAudioDataSettings   iMdaAudioDataSettings;\r
-\r
-       TGameAudioEventListener iListener;\r
-\r
-       CPolledActiveScheduler  *iScheduler;\r
-\r
-       HBufC8*                                 iSoundBuffers[KSoundBuffers+1];\r
-       TInt                                    iBufferedFrames;\r
-       TInt16*                                 iCurrentPosition;\r
-       TInt                                    iCurrentBuffer;\r
-       TInt                                    iFrameCount;\r
-       TInt                                    iPcmFrames;\r
-       CMdaServer*                             iServer;\r
-\r
-       TInt64                                  iTime;\r
-};\r
-\r
-#endif                 /* __AUDIO_MEDIASERVER_H */\r
diff --git a/platform/uiq2/audio/mediaserver/audio_mediaserver.mmp b/platform/uiq2/audio/mediaserver/audio_mediaserver.mmp
deleted file mode 100644 (file)
index 3c3a6db..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-TARGET                 audio_mediaserver.dll\r
-TARGETTYPE             dll\r
-UID                            0x100039CE 0x1000C196\r
-\r
-USERINCLUDE     .\r
-USERINCLUDE     ..\..\\r
-\r
-SYSTEMINCLUDE  \epoc32\include\r
-\r
-SOURCEPATH      .\r
-SOURCE                 audio_mediaserver.cpp\r
-SOURCE                 polledas.cpp\r
-\r
-LIBRARY                        EUSER.LIB mediaclientaudiostream.lib mediaclient.lib\r
-\r
-deffile                        .\audio_mediaserver.def\r
-\r
-nostrictdef\r
diff --git a/platform/uiq2/audio/mediaserver/polledas.cpp b/platform/uiq2/audio/mediaserver/polledas.cpp
deleted file mode 100644 (file)
index 8650c33..0000000
+++ /dev/null
@@ -1,213 +0,0 @@
-/*******************************************************************\r
- *\r
- *     File:           PolledAS.cpp\r
- *\r
- *     Author:         Peter van Sebille (peter@yipton.net)\r
- *\r
- *     (c) Copyright 2002, Peter van Sebille\r
- *     All Rights Reserved\r
- *\r
- *******************************************************************/\r
-\r
-/*\r
- * Oh Lord, forgive me for I have sinned.\r
- * In their infinite wisdom, Symbian Engineers have decided that\r
- * the Active Scheduler's queue of Active Objects is private\r
- * and no getters are provided... sigh.\r
- * This mere mortal will have to excercise the power of C pre-processor \r
- * once more to circumvent the will of the gods.\r
- */\r
-\r
-\r
-#include <e32std.h>\r
-\r
-// from e32base.h\r
-class CBase\r
-       {\r
-public:\r
-       IMPORT_C virtual ~CBase();\r
-       inline TAny* operator new(TUint aSize,TAny *aBase) {Mem::FillZ(aBase,aSize);return(aBase);}\r
-       IMPORT_C TAny* operator new(TUint aSize);\r
-       inline TAny* operator new(TUint aSize, TLeave) {return newL(aSize);}\r
-       IMPORT_C TAny* operator new(TUint aSize,TUint anExtraSize);\r
-protected:\r
-       IMPORT_C CBase();\r
-private:\r
-       CBase(const CBase&);\r
-       CBase& operator=(const CBase&);\r
-       IMPORT_C static TAny* newL(TUint aSize);\r
-       };\r
-\r
-class CActive : public CBase\r
-       {\r
-public:\r
-enum TPriority\r
-       {\r
-       EPriorityIdle=-100,\r
-       EPriorityLow=-20,\r
-       EPriorityStandard=0,\r
-       EPriorityUserInput=10,\r
-       EPriorityHigh=20,\r
-       };\r
-public:\r
-       IMPORT_C ~CActive();\r
-       IMPORT_C void Cancel();\r
-       IMPORT_C void Deque();\r
-       IMPORT_C void SetPriority(TInt aPriority);\r
-       inline TBool IsActive() const {return(iActive);}\r
-       inline TBool IsAdded() const  {return(iLink.iNext!=NULL);}\r
-       inline TInt Priority() const  {return iLink.iPriority;}\r
-protected:\r
-       IMPORT_C CActive(TInt aPriority);\r
-       IMPORT_C void SetActive();\r
-// Pure virtual\r
-       virtual void DoCancel() =0;\r
-       virtual void RunL() =0;\r
-       IMPORT_C virtual TInt RunError(TInt aError);\r
-public:\r
-       TRequestStatus iStatus;\r
-private:\r
-       TBool iActive;\r
-       TPriQueLink iLink;\r
-       friend class CActiveScheduler;\r
-//     friend class CServer;\r
-       friend class CPrivatePolledActiveScheduler; // added\r
-       };\r
-\r
-class CActiveScheduler : public CBase\r
-       {\r
-public:\r
-       IMPORT_C CActiveScheduler();\r
-       IMPORT_C ~CActiveScheduler();\r
-       IMPORT_C static void Install(CActiveScheduler* aScheduler);\r
-       IMPORT_C static CActiveScheduler* Current();\r
-       IMPORT_C static void Add(CActive* anActive);\r
-       IMPORT_C static void Start();\r
-       IMPORT_C static void Stop();\r
-       IMPORT_C static TBool RunIfReady(TInt& aError, TInt aMinimumPriority);\r
-       IMPORT_C static CActiveScheduler* Replace(CActiveScheduler* aNewActiveScheduler);\r
-       IMPORT_C virtual void WaitForAnyRequest();\r
-       IMPORT_C virtual void Error(TInt anError) const;\r
-private:\r
-       void DoStart();\r
-       void OwnedStartLoop(TInt& aRunning);\r
-       IMPORT_C virtual void OnStarting();\r
-       IMPORT_C virtual void OnStopping();\r
-       IMPORT_C virtual void Reserved_1();\r
-       IMPORT_C virtual void Reserved_2();\r
-       friend class CPrivatePolledActiveScheduler; // added\r
-private:\r
-       // private interface used through by CActiveSchedulerWait objects\r
-       friend class CActiveSchedulerWait;\r
-       static void OwnedStart(CActiveSchedulerWait& aOwner);\r
-protected:\r
-       inline TInt Level() const {return(iLevel);}\r
-private:\r
-       TInt iLevel;\r
-       TPriQue<CActive> iActiveQ;\r
-       };\r
-\r
-class TCleanupItem;\r
-class CleanupStack\r
-       {\r
-public:\r
-       IMPORT_C static void PushL(TAny* aPtr);\r
-       IMPORT_C static void PushL(CBase* aPtr);\r
-       IMPORT_C static void PushL(TCleanupItem anItem);\r
-       IMPORT_C static void Pop();\r
-       IMPORT_C static void Pop(TInt aCount);\r
-       IMPORT_C static void PopAndDestroy();\r
-       IMPORT_C static void PopAndDestroy(TInt aCount);\r
-       IMPORT_C static void Check(TAny* aExpectedItem);\r
-       inline static void Pop(TAny* aExpectedItem);\r
-       inline static void Pop(TInt aCount, TAny* aLastExpectedItem);\r
-       inline static void PopAndDestroy(TAny* aExpectedItem);\r
-       inline static void PopAndDestroy(TInt aCount, TAny* aLastExpectedItem);\r
-       };\r
-\r
-\r
-/*\r
- * This will declare CPrivatePolledActiveScheduler as a friend\r
- * of all classes that define a friend. CPrivatePolledActiveScheduler needs to\r
- * be a friend of CActive\r
- */\r
-//#define friend friend class CPrivatePolledActiveScheduler; friend\r
-\r
-\r
-/*\r
- * This will change the:\r
- *              void DoStart();\r
- * method in CActiveScheduler to:\r
- *              void DoStart(); friend class CPrivatePolledActiveScheduler;\r
- * We need this to access the private datamembers in CActiveScheduler.\r
- */\r
-//#define DoStart() DoStart(); friend class CPrivatePolledActiveScheduler;\r
-//#include <e32base.h>\r
-#include "PolledAS.h"\r
-\r
-\r
-class CPrivatePolledActiveScheduler : public CActiveScheduler\r
-{\r
-public:\r
-       void Schedule();\r
-};\r
-\r
-\r
-\r
-void CPrivatePolledActiveScheduler::Schedule()\r
-{\r
-       TDblQueIter<CActive> q(iActiveQ);\r
-       q.SetToFirst();\r
-       FOREVER\r
-       {\r
-               CActive *pR=q++;\r
-               if (pR)\r
-               {\r
-                       if (pR->IsActive() && pR->iStatus!=KRequestPending)\r
-                       {\r
-                               pR->iActive=EFalse;\r
-                               TRAPD(r,pR->RunL());\r
-                               break;\r
-                       }\r
-               }\r
-               else\r
-                       break;\r
-       }\r
-}\r
-\r
-\r
-CPolledActiveScheduler::~CPolledActiveScheduler()\r
-{\r
-       delete iPrivatePolledActiveScheduler;\r
-}\r
-\r
-//static CPolledActiveScheduler* sPolledActiveScheduler = NULL;\r
-CPolledActiveScheduler* CPolledActiveScheduler::NewL()\r
-{\r
-       //sPolledActiveScheduler = \r
-       CPolledActiveScheduler* self = new(ELeave)CPolledActiveScheduler;\r
-       CleanupStack::PushL(self);\r
-       self->ConstructL();\r
-       CleanupStack::Pop();\r
-       return self;\r
-}\r
-\r
-void CPolledActiveScheduler::ConstructL()\r
-{\r
-       iPrivatePolledActiveScheduler = new(ELeave) CPrivatePolledActiveScheduler;\r
-       iPrivatePolledActiveScheduler->Install(iPrivatePolledActiveScheduler);\r
-}\r
-\r
-\r
-void CPolledActiveScheduler::Schedule()\r
-{\r
-       iPrivatePolledActiveScheduler->Schedule();\r
-}\r
-\r
-/*\r
-CPolledActiveScheduler* CPolledActiveScheduler::Instance()\r
-{\r
-//     return (CPolledActiveScheduler*) CActiveScheduler::Current();\r
-       return sPolledActiveScheduler;\r
-}\r
-*/\r
diff --git a/platform/uiq2/audio/mediaserver/retr.cmd b/platform/uiq2/audio/mediaserver/retr.cmd
deleted file mode 100644 (file)
index f8e3574..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-copy %EPOCROOT%\epoc32\release\armi\urel\audio_mediaserver.dll ..\\r
-..\..\..\qconsole-1.52\qtty\release\qtty --qc-addr P800 --qc-channel 5 --user qconsole --pass server --cmds "put d:\system\apps\picodriven\audio_mediaserver.dll ..\audio_mediaserver.dll" exit\r
diff --git a/platform/uiq2/audio/mediaserver/retr2.cmd b/platform/uiq2/audio/mediaserver/retr2.cmd
deleted file mode 100644 (file)
index 766733b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-copy %EPOCROOT%\epoc32\release\armi\urel\audio_mediaserver.dll ..\\r
diff --git a/platform/uiq2/audio/motorola/AUDIO_MOTOROLA.ARMI b/platform/uiq2/audio/motorola/AUDIO_MOTOROLA.ARMI
deleted file mode 100644 (file)
index 3180600..0000000
+++ /dev/null
@@ -1,418 +0,0 @@
-\r
-# CWD \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\\r
-# MMPFile \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA.MMP\r
-# Target AUDIO_MOTOROLA.DLL\r
-# TargetType DLL\r
-# BasicTargetType DLL\r
-# MakefileType GNU\r
-\r
-ERASE = @erase 2>>nul\r
-\r
-# EPOC DEFINITIONS\r
-\r
-EPOCBLD = ..\..\..\..\..\A925SDK\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA\ARMI\r
-EPOCTRG = ..\..\..\..\..\A925SDK\EPOC32\RELEASE\ARMI\r
-EPOCLIB = ..\..\..\..\..\A925SDK\EPOC32\RELEASE\ARMI\r
-EPOCLINK = ..\..\..\..\..\A925SDK\EPOC32\RELEASE\ARMI\r
-EPOCSTATLINK = ..\..\..\..\..\A925SDK\EPOC32\RELEASE\ARMI\r
-EPOCASSPLINK = ..\..\..\..\..\A925SDK\EPOC32\RELEASE\MARM\r
-EPOCDATA = \DEV\A925SDK\EPOC32\DATA\r
-EPOCINC = \DEV\A925SDK\EPOC32\INCLUDE\r
-TRGDIR = \r
-DATADIR = Z\SYSTEM\DATA\r
-\r
-EPOCBLDUREL = $(EPOCBLD)\UREL\r
-EPOCTRGUREL = $(EPOCTRG)\UREL\r
-EPOCLIBUREL = $(EPOCLIB)\UREL\r
-EPOCLINKUREL = $(EPOCLINK)\UREL\r
-EPOCSTATLINKUREL = $(EPOCSTATLINK)\UREL\r
-EPOCASSPLINKUREL = $(EPOCASSPLINK)\UREL\r
-\r
-EPOCBLDUDEB = $(EPOCBLD)\UDEB\r
-EPOCTRGUDEB = $(EPOCTRG)\UDEB\r
-EPOCLIBUDEB = $(EPOCLIB)\UREL\r
-EPOCLINKUDEB = $(EPOCLINK)\UREL\r
-EPOCSTATLINKUDEB = $(EPOCSTATLINK)\UDEB\r
-EPOCASSPLINKUDEB = $(EPOCASSPLINK)\UREL\r
-\r
-# EPOC PSEUDOTARGETS\r
-\r
-UREL : MAKEWORKUREL RESOURCEUREL\r
-\r
-UDEB : MAKEWORKUDEB RESOURCEUDEB\r
-\r
-ALL : UREL UDEB\r
-\r
-CLEAN CLEANALL : CLEANBUILD CLEANRELEASE CLEANLIBRARY\r
-\r
-\r
-\r
-WHAT WHATALL : WHATUREL WHATUDEB\r
-\r
-RESOURCE RESOURCEALL : RESOURCEUREL RESOURCEUDEB\r
-\r
-CLEANBUILD CLEANBUILDALL : CLEANBUILDUREL CLEANBUILDUDEB\r
-\r
-CLEANRELEASE CLEANRELEASEALL : CLEANRELEASEUREL CLEANRELEASEUDEB\r
-\r
-MAKEWORK MAKEWORKALL : MAKEWORKUREL MAKEWORKUDEB\r
-\r
-LISTING LISTINGALL : LISTINGUREL LISTINGUDEB\r
-\r
-MAKEWORK : MAKEWORKLIBRARY\r
-\r
-RESOURCEUREL RESOURCEUDEB : GENERIC_RESOURCE\r
-\r
-\r
-# must set both PATH and Path to make it work correctly\r
-Path:=X:\DEV\A925SDK\EPOC32\gcc\bin;$(Path)\r
-PATH:=$(Path)\r
-\r
-INCDIR  = -I "." -I "..\.." -I "..\..\..\..\..\A925SDK\EPOC32\INCLUDE"\r
-\r
-GCCFLAGS=-march=armv4t -mthumb-interwork \\r
-               -pipe -c -nostdinc -Wall -Wno-ctor-dtor-privacy -Wno-unknown-pragmas \r
-\r
-GCCDEFS = -D__SYMBIAN32__ -D__GCC32__ -D__EPOC32__ -D__MARM__ -D__MARM_ARMI__ -D__DLL__ $(USERDEFS)\r
-\r
-GCCUREL = gcc -s -fomit-frame-pointer -O $(GCCFLAGS) -DNDEBUG -D_UNICODE $(GCCDEFS)\r
-GCCUDEB = gcc -g -O $(GCCFLAGS) -D_DEBUG -D_UNICODE $(GCCDEFS)\r
-\r
-\r
-UREL : \\r
-       $(EPOCTRGUREL)\AUDIO_MOTOROLA.DLL \\r
-       LIBRARY\r
-\r
-\r
-UDEB : \\r
-       $(EPOCTRGUDEB)\AUDIO_MOTOROLA.DLL \\r
-       LIBRARY\r
-\r
-\r
-\r
-RESOURCEUREL : MAKEWORKUREL\r
-RESOURCEUDEB : MAKEWORKUDEB\r
-\r
-LIBRARY : MAKEWORKLIBRARY $(EPOCLIB)\UREL\AUDIO_MOTOROLA.LIB \DEV\A925SDK\EPOC32\RELEASE\ARM4\UREL\AUDIO_MOTOROLA.LIB \DEV\A925SDK\EPOC32\RELEASE\THUMB\UREL\AUDIO_MOTOROLA.LIB\r
-\r
-\r
-# REAL TARGET - LIBRARY\r
-\r
-$(EPOCLIB)\UREL\AUDIO_MOTOROLA.LIB : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA.DEF\r
-       @echo AUDIO_MOTOROLA.LIB: dlltool\r
-       @dlltool -m arm_interwork --output-lib "$(EPOCLIB)\UREL\AUDIO_MOTOROLA.LIB" \\r
-               --def ".\AUDIO_MOTOROLA.DEF" \\r
-               --dllname "AUDIO_MOTOROLA[1000c197].DLL" \r
-\r
-\DEV\A925SDK\EPOC32\RELEASE\ARM4\UREL\AUDIO_MOTOROLA.LIB : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA.DEF\r
-       @echo AUDIO_MOTOROLA.LIB: dlltool\r
-       @dlltool -m arm --output-lib "..\..\..\..\..\A925SDK\EPOC32\RELEASE\ARM4\UREL\AUDIO_MOTOROLA.LIB" \\r
-               --def ".\AUDIO_MOTOROLA.DEF" \\r
-               --dllname "AUDIO_MOTOROLA[1000c197].DLL" \r
-\r
-\DEV\A925SDK\EPOC32\RELEASE\THUMB\UREL\AUDIO_MOTOROLA.LIB : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA.DEF\r
-       @echo AUDIO_MOTOROLA.LIB: dlltool\r
-       @dlltool -m thumb --output-lib "..\..\..\..\..\A925SDK\EPOC32\RELEASE\THUMB\UREL\AUDIO_MOTOROLA.LIB" \\r
-               --def ".\AUDIO_MOTOROLA.DEF" \\r
-               --dllname "AUDIO_MOTOROLA[1000c197].DLL" \r
-\r
-\r
-FREEZE :\r
-       perl -S efreeze.pl "\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA.DEF" "$(EPOCBLD)\AUDIO_MOTOROLA.def" \r
-\r
-CLEANLIBRARY :\r
-       -$(ERASE) "$(EPOCLIB)\UREL\AUDIO_MOTOROLA.LIB"\r
-       -$(ERASE) "\DEV\A925SDK\EPOC32\RELEASE\ARM4\UREL\AUDIO_MOTOROLA.LIB"\r
-       -$(ERASE) "\DEV\A925SDK\EPOC32\RELEASE\THUMB\UREL\AUDIO_MOTOROLA.LIB"\r
-\r
-\r
-GENERIC_RESOURCE : GENERIC_MAKEWORK\r
-\r
-# REAL TARGET - BUILD VARIANT UREL\r
-\r
-WHATUREL : WHATGENERIC\r
-\r
-CLEANUREL : CLEANBUILDUREL CLEANRELEASEUREL\r
-\r
-CLEANBUILDUREL : \r
-       @perl -S ermdir.pl "$(EPOCBLDUREL)"\r
-\r
-CLEANRELEASEUREL : CLEANGENERIC\r
-\r
-\r
-UREL_RELEASEABLES1= \\r
-       \DEV\A925SDK\EPOC32\RELEASE\ARM4\UREL\AUDIO_MOTOROLA.LIB \\r
-       \DEV\A925SDK\EPOC32\RELEASE\ARMI\UREL\AUDIO_MOTOROLA.DLL \\r
-       \DEV\A925SDK\EPOC32\RELEASE\ARMI\UREL\AUDIO_MOTOROLA.DLL.MAP \\r
-       \DEV\A925SDK\EPOC32\RELEASE\ARMI\UREL\AUDIO_MOTOROLA.LIB \\r
-       \DEV\A925SDK\EPOC32\RELEASE\THUMB\UREL\AUDIO_MOTOROLA.LIB\r
-\r
-WHATUREL:\r
-       @echo $(UREL_RELEASEABLES1)\r
-\r
-CLEANRELEASEUREL:\r
-       -$(ERASE) $(UREL_RELEASEABLES1)\r
-\r
-LISTINGUREL : MAKEWORKUREL \\r
-       LISTINGURELAUDIO_MOTOROLA \\r
-       LISTINGURELPOLLEDAS\r
-\r
-LIBSUREL= \\r
-       $(EPOCSTATLINKUREL)\EDLLSTUB.LIB \\r
-       $(EPOCSTATLINKUREL)\EGCC.LIB \\r
-       $(EPOCLINKUREL)\EUSER.LIB \\r
-       $(EPOCLINKUREL)\MAUDIOFB.LIB \\r
-       $(EPOCLINKUREL)\MAUDIOAC.LIB\r
-\r
-$(EPOCTRGUREL)\AUDIO_MOTOROLA.DLL : $(EPOCBLDUREL)\AUDIO_MOTOROLA.in \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA.DEF $(EPOCSTATLINKUREL)\EDLL.LIB $(LIBSUREL)\r
-       @echo AUDIO_MOTOROLA.DLL: dlltool\r
-       @dlltool -m arm_interwork --output-def "$(EPOCBLDUREL)\AUDIO_MOTOROLA.inf" "$(EPOCBLDUREL)\AUDIO_MOTOROLA.in"\r
-       @echo AUDIO_MOTOROLA.DLL: perl -S makedef.pl\r
-       @perl -S makedef.pl -Deffile "$(EPOCBLDUREL)\AUDIO_MOTOROLA.inf" -Frzfile "\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA.DEF" "$(EPOCBLD)\AUDIO_MOTOROLA.def"\r
-       -$(ERASE) "$(EPOCBLDUREL)\AUDIO_MOTOROLA.inf"\r
-       @echo AUDIO_MOTOROLA.DLL: dlltool\r
-       @dlltool -m arm_interwork --def "$(EPOCBLD)\AUDIO_MOTOROLA.def" \\r
-               --output-exp "$(EPOCBLDUREL)\AUDIO_MOTOROLA.exp" \\r
-               --dllname "AUDIO_MOTOROLA[1000c197].DLL"\r
-       @echo AUDIO_MOTOROLA.DLL: ld\r
-       @ld  -s -e _E32Dll -u _E32Dll "$(EPOCBLDUREL)\AUDIO_MOTOROLA.exp" --dll \\r
-               --base-file "$(EPOCBLDUREL)\AUDIO_MOTOROLA.bas" -o "$(EPOCBLDUREL)\AUDIO_MOTOROLA.DLL" \\r
-               "$(EPOCSTATLINKUREL)\EDLL.LIB" --whole-archive "$(EPOCBLDUREL)\AUDIO_MOTOROLA.in" \\r
-               --no-whole-archive $(LIBSUREL) $(USERLDFLAGS)\r
-       -$(ERASE) "$(EPOCBLDUREL)\AUDIO_MOTOROLA.exp"\r
-       -$(ERASE) "$(EPOCBLDUREL)\AUDIO_MOTOROLA.DLL"\r
-       @echo AUDIO_MOTOROLA.DLL: dlltool\r
-       @dlltool -m arm_interwork \\r
-               --def "$(EPOCBLD)\AUDIO_MOTOROLA.def" \\r
-               --dllname "AUDIO_MOTOROLA[1000c197].DLL" \\r
-               --base-file "$(EPOCBLDUREL)\AUDIO_MOTOROLA.bas" \\r
-               --output-exp "$(EPOCBLDUREL)\AUDIO_MOTOROLA.exp" \r
-       -$(ERASE) "$(EPOCBLDUREL)\AUDIO_MOTOROLA.bas"\r
-       @echo AUDIO_MOTOROLA.DLL: ld\r
-       @ld  -s -e _E32Dll -u _E32Dll --dll \\r
-               "$(EPOCBLDUREL)\AUDIO_MOTOROLA.exp" \\r
-               -Map "$(EPOCTRGUREL)\AUDIO_MOTOROLA.DLL.map" -o "$(EPOCBLDUREL)\AUDIO_MOTOROLA.DLL" \\r
-               "$(EPOCSTATLINKUREL)\EDLL.LIB" --whole-archive "$(EPOCBLDUREL)\AUDIO_MOTOROLA.in" \\r
-               --no-whole-archive $(LIBSUREL) $(USERLDFLAGS)\r
-       -$(ERASE) "$(EPOCBLDUREL)\AUDIO_MOTOROLA.exp"\r
-       @echo AUDIO_MOTOROLA.DLL: petran\r
-       @petran  "$(EPOCBLDUREL)\AUDIO_MOTOROLA.DLL" "$@" \\r
-                -nocall -uid1 0x10000079 -uid2 0x100039ce -uid3 0x1000c197\r
-       -$(ERASE) "$(EPOCBLDUREL)\AUDIO_MOTOROLA.DLL"\r
-\r
-OBJECTSUREL= \\r
-       $(EPOCBLDUREL)\AUDIO_MOTOROLA.o \\r
-       $(EPOCBLDUREL)\POLLEDAS.o\r
-\r
-$(EPOCBLDUREL)\AUDIO_MOTOROLA.in : $(OBJECTSUREL)\r
-       @echo AUDIO_MOTOROLA.in: if exist (del?)\r
-       @if exist "$@" del "$@"\r
-       @echo AUDIO_MOTOROLA.in: ar\r
-       @ar cr $@ $^\r
-\r
-\r
-# REAL TARGET - BUILD VARIANT UDEB\r
-\r
-WHATUDEB : WHATGENERIC\r
-\r
-CLEANUDEB : CLEANBUILDUDEB CLEANRELEASEUDEB\r
-\r
-CLEANBUILDUDEB : \r
-       @perl -S ermdir.pl "$(EPOCBLDUDEB)"\r
-\r
-CLEANRELEASEUDEB : CLEANGENERIC\r
-\r
-\r
-UDEB_RELEASEABLES1= \\r
-       \DEV\A925SDK\EPOC32\RELEASE\ARM4\UREL\AUDIO_MOTOROLA.LIB \\r
-       \DEV\A925SDK\EPOC32\RELEASE\ARMI\UDEB\AUDIO_MOTOROLA.DLL \\r
-       \DEV\A925SDK\EPOC32\RELEASE\ARMI\UDEB\AUDIO_MOTOROLA.DLL.MAP \\r
-       \DEV\A925SDK\EPOC32\RELEASE\ARMI\UREL\AUDIO_MOTOROLA.LIB \\r
-       \DEV\A925SDK\EPOC32\RELEASE\THUMB\UREL\AUDIO_MOTOROLA.LIB\r
-\r
-WHATUDEB:\r
-       @echo $(UDEB_RELEASEABLES1)\r
-\r
-CLEANRELEASEUDEB:\r
-       -$(ERASE) $(UDEB_RELEASEABLES1)\r
-\r
-LISTINGUDEB : MAKEWORKUDEB \\r
-       LISTINGUDEBAUDIO_MOTOROLA \\r
-       LISTINGUDEBPOLLEDAS\r
-\r
-LIBSUDEB= \\r
-       $(EPOCSTATLINKUDEB)\EDLLSTUB.LIB \\r
-       $(EPOCSTATLINKUDEB)\EGCC.LIB \\r
-       $(EPOCLINKUDEB)\EUSER.LIB \\r
-       $(EPOCLINKUDEB)\MAUDIOFB.LIB \\r
-       $(EPOCLINKUDEB)\MAUDIOAC.LIB\r
-\r
-$(EPOCTRGUDEB)\AUDIO_MOTOROLA.DLL : $(EPOCBLDUDEB)\AUDIO_MOTOROLA.in \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA.DEF $(EPOCSTATLINKUDEB)\EDLL.LIB $(LIBSUDEB)\r
-       @echo AUDIO_MOTOROLA.DLL: dlltool\r
-       @dlltool -m arm_interwork --output-def "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.inf" "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.in"\r
-       @echo AUDIO_MOTOROLA.DLL: perl -S makedef.pl\r
-       @perl -S makedef.pl -Deffile "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.inf" -Frzfile "\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA.DEF" "$(EPOCBLD)\AUDIO_MOTOROLA.def"\r
-       -$(ERASE) "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.inf"\r
-       @echo AUDIO_MOTOROLA.DLL: dlltool\r
-       @dlltool -m arm_interwork --def "$(EPOCBLD)\AUDIO_MOTOROLA.def" \\r
-               --output-exp "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.exp" \\r
-               --dllname "AUDIO_MOTOROLA[1000c197].DLL"\r
-       @echo AUDIO_MOTOROLA.DLL: ld\r
-       @ld  -s -e _E32Dll -u _E32Dll "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.exp" --dll \\r
-               --base-file "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.bas" -o "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.DLL" \\r
-               "$(EPOCSTATLINKUDEB)\EDLL.LIB" --whole-archive "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.in" \\r
-               --no-whole-archive $(LIBSUDEB) $(USERLDFLAGS)\r
-       -$(ERASE) "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.exp"\r
-       -$(ERASE) "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.DLL"\r
-       @echo AUDIO_MOTOROLA.DLL: dlltool\r
-       @dlltool -m arm_interwork \\r
-               --def "$(EPOCBLD)\AUDIO_MOTOROLA.def" \\r
-               --dllname "AUDIO_MOTOROLA[1000c197].DLL" \\r
-               --base-file "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.bas" \\r
-               --output-exp "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.exp" \r
-       -$(ERASE) "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.bas"\r
-       @echo AUDIO_MOTOROLA.DLL: ld\r
-       @ld  -e _E32Dll -u _E32Dll --dll \\r
-               "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.exp" \\r
-               -Map "$(EPOCTRGUDEB)\AUDIO_MOTOROLA.DLL.map" -o "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.DLL" \\r
-               "$(EPOCSTATLINKUDEB)\EDLL.LIB" --whole-archive "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.in" \\r
-               --no-whole-archive $(LIBSUDEB) $(USERLDFLAGS)\r
-       -$(ERASE) "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.exp"\r
-       objcopy -X "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.DLL" "$(EPOCTRGUDEB)\AUDIO_MOTOROLA.sym"\r
-       @echo AUDIO_MOTOROLA.DLL: petran\r
-       @petran  "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.DLL" "$@" \\r
-                -nocall -uid1 0x10000079 -uid2 0x100039ce -uid3 0x1000c197\r
-       -$(ERASE) "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.DLL"\r
-\r
-OBJECTSUDEB= \\r
-       $(EPOCBLDUDEB)\AUDIO_MOTOROLA.o \\r
-       $(EPOCBLDUDEB)\POLLEDAS.o\r
-\r
-$(EPOCBLDUDEB)\AUDIO_MOTOROLA.in : $(OBJECTSUDEB)\r
-       @echo AUDIO_MOTOROLA.in: if exist (del?)\r
-       @if exist "$@" del "$@"\r
-       @echo AUDIO_MOTOROLA.in: ar\r
-       @ar cr $@ $^\r
-\r
-\r
-# SOURCES\r
-\r
-# Source AUDIO_MOTOROLA.CPP\r
-\r
-$(EPOCBLDUREL)\AUDIO_MOTOROLA.lis $(EPOCBLDUREL)\AUDIO_MOTOROLA.o \\r
-$(EPOCBLDUDEB)\AUDIO_MOTOROLA.lis $(EPOCBLDUDEB)\AUDIO_MOTOROLA.o \\r
-: \\r
-       \DEV\A925SDK\EPOC32\INCLUDE\CMAUDIOAC.H \\r
-       \DEV\A925SDK\EPOC32\INCLUDE\CMAUDIOFB.H \\r
-       \DEV\A925SDK\EPOC32\INCLUDE\CMAUDIOFBFORMAT.H \\r
-       \DEV\A925SDK\EPOC32\INCLUDE\E32BASE.H \\r
-       \DEV\A925SDK\EPOC32\INCLUDE\E32BASE.INL \\r
-       \DEV\A925SDK\EPOC32\INCLUDE\E32DEF.H \\r
-       \DEV\A925SDK\EPOC32\INCLUDE\E32DES16.H \\r
-       \DEV\A925SDK\EPOC32\INCLUDE\E32DES8.H \\r
-       \DEV\A925SDK\EPOC32\INCLUDE\E32HAL.H \\r
-       \DEV\A925SDK\EPOC32\INCLUDE\E32KEYS.H \\r
-       \DEV\A925SDK\EPOC32\INCLUDE\E32PCCD.H \\r
-       \DEV\A925SDK\EPOC32\INCLUDE\E32STD.H \\r
-       \DEV\A925SDK\EPOC32\INCLUDE\E32STD.INL \\r
-       \DEV\A925SDK\EPOC32\INCLUDE\E32SVR.H \\r
-       \DEV\A925SDK\EPOC32\INCLUDE\F32FILE.H \\r
-       \DEV\A925SDK\EPOC32\INCLUDE\F32FILE.INL \\r
-       \DEV\A925SDK\EPOC32\INCLUDE\MAUDIOGLOBAL.H \\r
-       \DEV\A925SDK\EPOC32\INCLUDE\RPFILE.H \\r
-       \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO.H \\r
-       \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA.H \\r
-       \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\POLLEDAS.H\r
-\r
-$(EPOCBLDUREL)\AUDIO_MOTOROLA.o : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\Audio_motorola.cpp\r
-       @echo AUDIO_MOTOROLA.o: gcc\r
-       @$(GCCUREL) -I "." $(INCDIR) -o $@ ".\Audio_motorola.cpp"\r
-\r
-LISTINGURELAUDIO_MOTOROLA : $(EPOCBLDUREL)\AUDIO_MOTOROLA.lis\r
-       @echo ISTINGURELAUDIO_MOTOROLA: perl -S ecopyfile.pl\r
-       @perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA.lst.ARMI\r
-\r
-$(EPOCBLDUREL)\AUDIO_MOTOROLA.lis : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\Audio_motorola.cpp\r
-       $(GCCUREL) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Audio_motorola.cpp" > $@\r
-\r
-$(EPOCBLDUDEB)\AUDIO_MOTOROLA.o : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\Audio_motorola.cpp\r
-       $(GCCUDEB) -I "." $(INCDIR) -o $@ ".\Audio_motorola.cpp"\r
-\r
-LISTINGUDEBAUDIO_MOTOROLA : $(EPOCBLDUDEB)\AUDIO_MOTOROLA.lis\r
-       @echo ISTINGUDEBAUDIO_MOTOROLA: perl -S ecopyfile.pl\r
-       @perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA.lst.ARMI\r
-\r
-$(EPOCBLDUDEB)\AUDIO_MOTOROLA.lis : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\Audio_motorola.cpp\r
-       $(GCCUDEB) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Audio_motorola.cpp" > $@\r
-\r
-\r
-\r
-# Source POLLEDAS.CPP\r
-\r
-$(EPOCBLDUREL)\POLLEDAS.lis $(EPOCBLDUREL)\POLLEDAS.o \\r
-$(EPOCBLDUDEB)\POLLEDAS.lis $(EPOCBLDUDEB)\POLLEDAS.o \\r
-: \\r
-       \DEV\A925SDK\EPOC32\INCLUDE\E32DEF.H \\r
-       \DEV\A925SDK\EPOC32\INCLUDE\E32DES16.H \\r
-       \DEV\A925SDK\EPOC32\INCLUDE\E32DES8.H \\r
-       \DEV\A925SDK\EPOC32\INCLUDE\E32STD.H \\r
-       \DEV\A925SDK\EPOC32\INCLUDE\E32STD.INL \\r
-       \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\POLLEDAS.H\r
-\r
-$(EPOCBLDUREL)\POLLEDAS.o : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\Polledas.cpp\r
-       @echo POLLEDAS.o: gcc\r
-       @$(GCCUREL) -I "." $(INCDIR) -o $@ ".\Polledas.cpp"\r
-\r
-LISTINGURELPOLLEDAS : $(EPOCBLDUREL)\POLLEDAS.lis\r
-       @echo ISTINGURELPOLLEDAS: perl -S ecopyfile.pl\r
-       @perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\POLLEDAS.lst.ARMI\r
-\r
-$(EPOCBLDUREL)\POLLEDAS.lis : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\Polledas.cpp\r
-       $(GCCUREL) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Polledas.cpp" > $@\r
-\r
-$(EPOCBLDUDEB)\POLLEDAS.o : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\Polledas.cpp\r
-       $(GCCUDEB) -I "." $(INCDIR) -o $@ ".\Polledas.cpp"\r
-\r
-LISTINGUDEBPOLLEDAS : $(EPOCBLDUDEB)\POLLEDAS.lis\r
-       @echo ISTINGUDEBPOLLEDAS: perl -S ecopyfile.pl\r
-       @perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\POLLEDAS.lst.ARMI\r
-\r
-$(EPOCBLDUDEB)\POLLEDAS.lis : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\Polledas.cpp\r
-       $(GCCUDEB) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Polledas.cpp" > $@\r
-\r
-\r
-\r
-ROMFILE:\r
-       @echo file=\DEV\A925SDK\EPOC32\RELEASE\ARMI\##BUILD##\AUDIO_MOTOROLA.DLL System\Libs\AUDIO_MOTOROLA.DLL \r
-\r
-\r
-WHATGENERIC CLEANGENERIC :\r
-       @rem none\r
-\r
-# Rules to create all necessary directories\r
-\r
-GENERIC_MAKEWORK : \\r
-       \DEV\A925SDK\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA\ARMI\r
-MAKEWORKLIBRARY : \\r
-       \DEV\A925SDK\EPOC32\RELEASE\ARM4\UREL \\r
-       \DEV\A925SDK\EPOC32\RELEASE\ARMI\UREL \\r
-       \DEV\A925SDK\EPOC32\RELEASE\THUMB\UREL\r
-MAKEWORKUDEB : \\r
-       \DEV\A925SDK\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA\ARMI\UDEB \\r
-       \DEV\A925SDK\EPOC32\RELEASE\ARMI\UDEB\r
-MAKEWORKUREL : \\r
-       \DEV\A925SDK\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA\ARMI\UREL \\r
-       \DEV\A925SDK\EPOC32\RELEASE\ARMI\UREL\r
-\r
-\DEV\A925SDK\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA\ARMI \\r
-\DEV\A925SDK\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA\ARMI\UDEB \\r
-\DEV\A925SDK\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA\ARMI\UREL \\r
-\DEV\A925SDK\EPOC32\RELEASE\ARM4\UREL \\r
-\DEV\A925SDK\EPOC32\RELEASE\ARMI\UDEB \\r
-\DEV\A925SDK\EPOC32\RELEASE\ARMI\UREL \\r
-\DEV\A925SDK\EPOC32\RELEASE\THUMB\UREL \\r
-:\r
-       @echo UREL: perl -S emkdir.pl\r
-       @perl -S emkdir.pl $@\r
-\r
-\r
diff --git a/platform/uiq2/audio/motorola/PolledAS.h b/platform/uiq2/audio/motorola/PolledAS.h
deleted file mode 100644 (file)
index f360c89..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************\r
- *\r
- *     File:           PolledAS.h\r
- *\r
- *     Author:         Peter van Sebille (peter@yipton.net)\r
- *\r
- *     (c) Copyright 2001, Peter van Sebille\r
- *     All Rights Reserved\r
- *\r
- *******************************************************************/\r
-\r
-#ifndef __POLLED_AS_H\r
-#define __POLLED_AS_H\r
-\r
-class CPrivatePolledActiveScheduler;\r
-\r
-class CPolledActiveScheduler : public CBase\r
-{\r
-public:\r
-       ~CPolledActiveScheduler();\r
-       static CPolledActiveScheduler* NewL();\r
-       //static CPolledActiveScheduler* Instance();\r
-       void Schedule();\r
-protected:\r
-       CPolledActiveScheduler(){};\r
-       void ConstructL();\r
-       CPrivatePolledActiveScheduler*  iPrivatePolledActiveScheduler;\r
-};\r
-\r
-\r
-#endif                 /* __POLLED_AS_H */\r
-\r
diff --git a/platform/uiq2/audio/motorola/audio_motorola.cpp b/platform/uiq2/audio/motorola/audio_motorola.cpp
deleted file mode 100644 (file)
index b4ed401..0000000
+++ /dev/null
@@ -1,363 +0,0 @@
-/*******************************************************************\r
- *\r
- *     File:           Audio_motorola.cpp\r
- *\r
- *     Author:         Peter van Sebille (peter@yipton.net)\r
- *\r
- *  Modified/adapted for picodriveN by notaz, 2006\r
- *\r
- *  (c) Copyright 2006, notaz\r
- *     (c) Copyright 2001, Peter van Sebille\r
- *     All Rights Reserved\r
- *\r
- *******************************************************************/\r
-\r
-// if only I had Motorola to test this on..\r
-\r
-\r
-#include "audio_motorola.h"\r
-\r
-#ifdef __DEBUG_PRINT_SND\r
-       #include <e32svr.h> // RDebug\r
-       #define DEBUGPRINT(x...) RDebug::Print(x)\r
-#else\r
-       #define DEBUGPRINT(x...)\r
-#endif\r
-\r
-\r
-GLDEF_C TInt E32Dll(TDllReason)\r
-{\r
-       return KErrNone;\r
-}\r
-\r
-\r
-/*******************************************\r
- *\r
- * CGameAudioMot\r
- *\r
- *******************************************/\r
-\r
-CGameAudioMot::CGameAudioMot(TInt aRate, TBool aStereo, TInt aPcmFrames,  TInt aBufferedFrames)\r
-: iRate(aRate), iStereo(aStereo), iBufferedFrames(aBufferedFrames), iPcmFrames(aPcmFrames)\r
-{\r
-       DEBUGPRINT(_L("CGameAudioMot::CGameAudioMot"));\r
-}\r
-\r
-\r
-CGameAudioMot* CGameAudioMot::NewL(TInt aRate, TBool aStereo, TInt aPcmFrames, TInt aBufferedFrames)\r
-{\r
-       DEBUGPRINT(_L("CGameAudioMot::NewL(%i, %i, %i, %i)"),aRate, aStereo, aPcmFrames, aBufferedFrames);\r
-       CGameAudioMot*          self = new(ELeave) CGameAudioMot(aRate, aStereo, aPcmFrames, aBufferedFrames);\r
-       CleanupStack::PushL(self);\r
-       self->ConstructL();\r
-       CleanupStack::Pop();            // self\r
-       return self;\r
-}\r
-\r
-\r
-CGameAudioMot::~CGameAudioMot()\r
-{\r
-       DEBUGPRINT(_L("CGameAudioMot::~CGameAudioMot()"));\r
-       if(iAudioOutputStream) {\r
-               iScheduler->Schedule(); // let it finish it's stuff\r
-               //iAudioOutputStream->Stop();\r
-               delete iAudioOutputStream;\r
-       }\r
-\r
-       if(iAudioControl) delete iAudioControl;\r
-\r
-       for (TInt i=0 ; i < KSoundBuffers+1; i++) {\r
-               delete iSoundBufferPtrs[i];\r
-               delete iSoundBuffers[i];\r
-       }\r
-\r
-       // Polled AS\r
-       if(iScheduler) delete iScheduler;\r
-}\r
-\r
-\r
-void CGameAudioMot::ConstructL()\r
-{\r
-       iScheduler = CPolledActiveScheduler::NewL();\r
-\r
-       iSettings.iPCMSettings.iSamplingFreq = (TMSampleRate) iRate;\r
-       iSettings.iPCMSettings.iStereo       = iStereo;\r
-\r
-       TInt    bytesPerFrame = iStereo ? iPcmFrames << 2 : iPcmFrames << 1;\r
-       for (TInt i=0 ; i<KSoundBuffers ; i++)\r
-       {\r
-               iSoundBuffers[i] = HBufC8::NewL(bytesPerFrame * iBufferedFrames);\r
-               iSoundBuffers[i]->Des().FillZ  (bytesPerFrame * iBufferedFrames);\r
-               iSoundBufferPtrs[i] = new TPtr8( iSoundBuffers[i]->Des() );\r
-       }\r
-       // because feeding 2 buffers after an underflow is a little too much, but feeding 1 may be not enough,\r
-       // prepare this ~50ms empty buffer to additionaly feed after every underflow.\r
-       iSoundBuffers[KSoundBuffers] = HBufC8::NewL(bytesPerFrame * (iBufferedFrames / 4));\r
-       iSoundBuffers[KSoundBuffers]->Des().FillZ  (bytesPerFrame * (iBufferedFrames / 4));\r
-       iSoundBufferPtrs[KSoundBuffers] = new TPtr8( iSoundBuffers[KSoundBuffers]->Des() );\r
-\r
-       iCurrentBuffer = 0;\r
-       iListener.iFatalError = iListener.iIsOpen = iListener.iIsCtrlOpen = EFalse;\r
-\r
-       // here we actually test if we can create and open CMdaAudioOutputStream at all, but really create and use it later.\r
-       iAudioOutputStream = CMAudioFB::NewL(EMAudioFBRequestTypeDecode, EMAudioFBFormatPCM, iSettings, iListener);\r
-       if(iAudioOutputStream) {\r
-               delete iAudioOutputStream;\r
-               iAudioOutputStream = 0;\r
-       }\r
-\r
-       // ceate audio control object\r
-       iAudioControl = CMAudioAC::NewL(iListener);\r
-}\r
-\r
-\r
-// returns a pointer to buffer for next frame,\r
-// to be used when iSoundBuffers are used directly\r
-TInt16 *CGameAudioMot::NextFrameL()\r
-{\r
-       iCurrentPosition += iPcmFrames << (iStereo?1:0);\r
-\r
-       if (++iFrameCount == iBufferedFrames)\r
-       {\r
-               WriteBlockL();\r
-       }\r
-\r
-       iScheduler->Schedule();\r
-\r
-       if(iListener.iFatalError || iListener.iUnderflowed > KMaxUnderflows) {\r
-               if(iAudioOutputStream) delete iAudioOutputStream;\r
-               iAudioOutputStream = 0;\r
-               return 0;\r
-       }\r
-       else if(iListener.iUnderflowed) UnderflowedL();\r
-\r
-       return iCurrentPosition;\r
-}\r
-\r
-TInt16 *CGameAudioMot::DupeFrameL(TInt &aUnderflowed)\r
-{\r
-       TInt shorts = iStereo ? (iPcmFrames << 1) : iPcmFrames;\r
-       if(iFrameCount)\r
-               Mem::Copy(iCurrentPosition, iCurrentPosition-shorts, shorts<<1);\r
-       else {\r
-               TInt lastBuffer = iCurrentBuffer;\r
-               if(--lastBuffer < 0) lastBuffer = KSoundBuffers - 1;\r
-               Mem::Copy(iCurrentPosition, ((TInt16*) (iSoundBuffers[lastBuffer]->Ptr()))+shorts*(iBufferedFrames-1), shorts<<1);\r
-       }                               \r
-       iCurrentPosition += shorts;\r
-\r
-       if (++iFrameCount == iBufferedFrames)\r
-       {\r
-               WriteBlockL();\r
-       }\r
-\r
-       iScheduler->Schedule();\r
-\r
-       if(iListener.iFatalError || iListener.iUnderflowed > KMaxUnderflows) {\r
-               if(iAudioOutputStream) delete iAudioOutputStream;\r
-               iAudioOutputStream = 0;\r
-               return 0;\r
-       }\r
-       else if((aUnderflowed = iListener.iUnderflowed)) UnderflowedL(); // not again!\r
-\r
-       return iCurrentPosition;\r
-}\r
-\r
-void CGameAudioMot::WriteBlockL()\r
-{\r
-       iScheduler->Schedule();\r
-\r
-       // do not write until stream is open\r
-       if(!iListener.iIsOpen) WaitForOpenToCompleteL();\r
-       //if(!iListener.iHasCopied) WaitForCopyToCompleteL(); // almost never happens anyway and sometimes even deadlocks?\r
-       //iListener.iHasCopied = EFalse;\r
-       \r
-\r
-       if(!iListener.iUnderflowed) {\r
-               iAudioOutputStream->QueueBufferL(iSoundBufferPtrs[iCurrentBuffer]);\r
-               // it is certain we already Queued at least 2 buffers (one just after underflow, another above)\r
-               if(!iDecoding) {\r
-                       iAudioOutputStream->DecodeL();\r
-                       iDecoding = ETrue;\r
-               }\r
-       }\r
-\r
-       iFrameCount = 0;\r
-       if (++iCurrentBuffer == KSoundBuffers)\r
-               iCurrentBuffer = 0;\r
-       iCurrentPosition = (TInt16*) iSoundBuffers[iCurrentBuffer]->Ptr();\r
-}\r
-\r
-void CGameAudioMot::Pause()\r
-{\r
-       if(!iAudioOutputStream) return;\r
-\r
-       iScheduler->Schedule();\r
-       // iAudioOutputStream->Stop(); // may be this breaks everything in A925?\r
-       delete iAudioOutputStream;\r
-       iAudioOutputStream = 0;\r
-}\r
-\r
-// call this before doing any playback!\r
-TInt16 *CGameAudioMot::ResumeL()\r
-{\r
-       DEBUGPRINT(_L("CGameAudioMot::Resume()"));\r
-       iScheduler->Schedule();\r
-\r
-       // we act a bit strange here: simulate buffer underflow, which actually starts audio\r
-       iListener.iIsOpen = ETrue;\r
-       iListener.iUnderflowed = 1;\r
-       iListener.iFatalError = EFalse;\r
-       iFrameCount = 0;\r
-       iCurrentPosition = (TInt16*) iSoundBuffers[iCurrentBuffer]->Ptr();\r
-       return iCurrentPosition;\r
-}\r
-\r
-// handles underflow condition\r
-void CGameAudioMot::UnderflowedL()\r
-{\r
-       // recreate the stream\r
-       if(iAudioOutputStream) delete iAudioOutputStream;\r
-       if(iListener.iUnderflowed > 4) {\r
-               // HACK: A925 user said sound works for the first time, but fails after pause/resume, etc.\r
-               // at the very beginning we create and delete CMAudioFB object, maybe we should do this every time?\r
-               iAudioOutputStream = CMAudioFB::NewL(EMAudioFBRequestTypeDecode, EMAudioFBFormatPCM, iSettings, iListener);\r
-               if(iAudioOutputStream) delete iAudioOutputStream;\r
-       }\r
-\r
-       iAudioOutputStream = CMAudioFB::NewL(EMAudioFBRequestTypeDecode, EMAudioFBFormatPCM, iSettings, iListener);\r
-       iListener.iIsOpen = EFalse;   // wait for it to open\r
-       iDecoding = EFalse;\r
-       //iListener.iHasCopied = ETrue; // but don't wait for last copy to complete\r
-       // let it open and feed some stuff to make it happy\r
-       User::After(0);\r
-       //TInt lastBuffer = iCurrentBuffer;\r
-       //if(--lastBuffer < 0) lastBuffer = KSoundBuffers - 1;\r
-       iScheduler->Schedule();\r
-       if(!iListener.iIsOpen) WaitForOpenToCompleteL();\r
-       if(iListener.iUnderflowed) {\r
-               // something went wrong again. May be it needs time? Trying to fix something without ability to test is hell.\r
-               if(iAudioOutputStream) delete iAudioOutputStream;\r
-               iAudioOutputStream = 0;\r
-               User::After(50*000);\r
-               iScheduler->Schedule();\r
-               return;\r
-       }\r
-\r
-       iAudioOutputStream->QueueBufferL(iSoundBufferPtrs[KSoundBuffers]); // try a short buffer with hope to reduce lag\r
-}\r
-\r
-\r
-void CGameAudioMot::ChangeVolume(TInt aUp)\r
-{\r
-       if(iAudioControl && iListener.iIsCtrlOpen)\r
-       {\r
-               TInt vol = iAudioControl->GetMasterVolume();\r
-               TInt max = iAudioControl->GetMaxMasterVolume();\r
-\r
-               if(aUp) vol++; // adjust volume\r
-               else    vol--;\r
-\r
-               if(vol >= 0 && vol <= max)\r
-               {\r
-                       iAudioControl->SetMasterVolume(vol);\r
-               }\r
-       }\r
-}\r
-\r
-\r
-void CGameAudioMot::WaitForOpenToCompleteL()\r
-{\r
-       DEBUGPRINT(_L("CGameAudioMot::WaitForOpenToCompleteL"));\r
-       TInt    count = 20;             // 2 seconds\r
-       TInt    waitPeriod = 100 * 1000;\r
-\r
-       if(!iListener.iIsOpen) {\r
-               // it is often enough to do this\r
-               User::After(0);\r
-               iScheduler->Schedule();\r
-       }\r
-       while (!iListener.iIsOpen && --count)\r
-       {\r
-               User::After(waitPeriod);\r
-               iScheduler->Schedule();\r
-       }\r
-       if (!iListener.iIsOpen)\r
-               User::LeaveIfError(KErrNotSupported);\r
-}\r
-\r
-\r
-\r
-void TGameAudioEventListener::OnEvent(TMAudioFBCallbackState aState, TInt aError)\r
-{\r
-       switch ( aState )\r
-       {\r
-       case EMAudioFBCallbackStateReady:\r
-               iIsOpen = ETrue;\r
-               iUnderflowed = 0;\r
-               break;\r
-\r
-       case EMAudioFBCallbackStateDecodeCompleteStopped:\r
-               break;\r
-\r
-       //case EMAudioFBCallbackStateDecodeFileSystemError:\r
-       case EMAudioFBCallbackStateDecodeError:\r
-               switch( aError )\r
-               {\r
-               case EMAudioFBCallbackErrorBufferFull:\r
-               case EMAudioFBCallbackErrorForcedStop:\r
-               case EMAudioFBCallbackErrorForcedClose:\r
-               //case EMAudioFBCallbackErrorForcedPause:\r
-               case EMAudioFBCallbackErrorPriorityRejection:\r
-               case EMAudioFBCallbackErrorAlertModeRejection:\r
-               case EMAudioFBCallbackErrorResourceRejection:\r
-               case EMAudioFBCallbackErrorUnknown:\r
-                       iUnderflowed++;\r
-                       break;\r
-\r
-               // these look like really bad errors\r
-               case EMAudioFBCallbackErrorInvalidParameter:\r
-               case EMAudioFBCallbackErrorWrongState:\r
-               case EMAudioFBCallbackErrorFormatNotSupported:\r
-               case EMAudioFBCallbackErrorFunctionNotSupported:\r
-               case EMAudioFBCallbackErrorNoBuffer:\r
-               case EMAudioFBCallbackErrorSampleOrBitRateNotSupported:\r
-               //case EMAudioFBCallbackErrorPriorityOrPreferenceNotSupported:\r
-               //case EMAudioFBCallbackErrorFileSystemFull:\r
-                       //iFatalError = ETrue;\r
-                       // who cares, just keep retrying\r
-                       iUnderflowed++;\r
-                       break;\r
-\r
-               default:\r
-                       iUnderflowed++;\r
-                       break;\r
-               }\r
-               // in error condition we also set to open, so that the\r
-               // framework would not leave, catch the error and retry\r
-               iIsOpen = ETrue;\r
-               break;\r
-\r
-       default:\r
-               break;\r
-       }\r
-}\r
-\r
-void TGameAudioEventListener::OnEvent(TMAudioFBCallbackState aState, TInt aError, TDes8* aBuffer)\r
-{\r
-   switch( aState )\r
-   {\r
-   case EMAudioFBCallbackStateDecodeBufferDecoded:\r
-         break;\r
-\r
-   default:\r
-      OnEvent( aState, aError );\r
-      break;\r
-   }\r
-}\r
-\r
-void TGameAudioEventListener::OnEvent(TMAudioACCallbackState aState, TInt aError)\r
-{\r
-       if(aState == EMAudioACCallbackStateReady) iIsCtrlOpen = ETrue;\r
-}\r
-\r
diff --git a/platform/uiq2/audio/motorola/audio_motorola.def b/platform/uiq2/audio/motorola/audio_motorola.def
deleted file mode 100644 (file)
index 6098f2a..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-EXPORTS\r
-; NEW:\r
-       NewL__13CGameAudioMotiiii @ 1 NONAME ; static CGameAudioMot* NewL(TInt aRate, TBool aStereo, TInt aPcmFrames, TInt aBufferedFrames);\r
diff --git a/platform/uiq2/audio/motorola/audio_motorola.h b/platform/uiq2/audio/motorola/audio_motorola.h
deleted file mode 100644 (file)
index 26c4109..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************\r
- *\r
- *     File:           Audio_motorola.h\r
- *\r
- *     Author:         Peter van Sebille (peter@yipton.net)\r
- *\r
- *  Modified/adapted for picodriveN by notaz, 2006\r
- *\r
- *  (c) Copyright 2006, notaz\r
- *     (c) Copyright 2001, Peter van Sebille\r
- *     All Rights Reserved\r
- *\r
- *******************************************************************/\r
-\r
-#ifndef __AUDIO_MEDIASERVER_H\r
-#define __AUDIO_MEDIASERVER_H\r
-\r
-#include <cmaudiofb.h>\r
-\r
-#include "audio.h"\r
-#include "polledas.h"\r
-\r
-const TInt KSoundBuffers = 8;\r
-const TInt KMaxUnderflows = 20; // max underflows/API errors we are going allow in a row (to prevent lockups)\r
-\r
-\r
-class TGameAudioEventListener : public MMAudioFBObserver, public MMAudioACObserver\r
-{\r
-public:\r
-       // Implementation of MMAudioFBObserver\r
-       void OnEvent(TMAudioFBCallbackState aState, TInt aError);\r
-       void OnEvent(TMAudioFBCallbackState aState, TInt aError, TDes8* aBuffer);\r
-       // Implementation of MMAudioACObserver\r
-       void OnEvent(TMAudioACCallbackState aState, TInt aError);\r
-\r
-       TBool                                   iIsOpen;\r
-       TBool                                   iIsCtrlOpen;\r
-//     TBool                                   iHasCopied;\r
-       TInt                                    iUnderflowed;\r
-       TBool                                   iFatalError;\r
-};\r
-\r
-\r
-class CGameAudioMot : public IGameAudio // IGameAudio MUST be specified first!\r
-{\r
-public:        // implements IGameAudio\r
-       TInt16 *NextFrameL();\r
-       TInt16 *DupeFrameL(TInt &aUnderflowed);\r
-       TInt16 *ResumeL();\r
-       void Pause();\r
-       void ChangeVolume(TInt aUp);\r
-\r
-public:\r
-       ~CGameAudioMot();\r
-       CGameAudioMot(TInt aRate, TBool aStereo, TInt aPcmFrames, TInt aBufferedFrames);\r
-       void ConstructL();\r
-       EXPORT_C static CGameAudioMot* NewL(TInt aRate, TBool aStereo, TInt aPcmFrames, TInt aBufferedFrames);\r
-\r
-protected:\r
-       void WriteBlockL();\r
-       void UnderflowedL();\r
-\r
-protected:\r
-       void WaitForOpenToCompleteL();\r
-\r
-       TInt                                    iRate;\r
-       TBool                                   iStereo;\r
-\r
-       CMAudioFB                               *iAudioOutputStream;\r
-       CMAudioAC                               *iAudioControl;\r
-    TMAudioFBBufSettings       iSettings;\r
-\r
-       TGameAudioEventListener iListener;\r
-\r
-       CPolledActiveScheduler  *iScheduler;\r
-\r
-       HBufC8*                                 iSoundBuffers[KSoundBuffers+1];\r
-       TPtr8*                                  iSoundBufferPtrs[KSoundBuffers+1];\r
-\r
-       TInt                                    iBufferedFrames;\r
-       TInt16*                                 iCurrentPosition;\r
-       TInt                                    iCurrentBuffer;\r
-       TInt                                    iFrameCount;\r
-       TInt                                    iPcmFrames;\r
-\r
-       TBool                                   iDecoding;\r
-\r
-       //TInt64                                        iTime; // removed because can't test\r
-};\r
-\r
-#endif                 /* __AUDIO_MEDIASERVER_H */\r
diff --git a/platform/uiq2/audio/motorola/audio_motorola.mmp b/platform/uiq2/audio/motorola/audio_motorola.mmp
deleted file mode 100644 (file)
index 473c4dd..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-TARGET                 audio_motorola.dll\r
-TARGETTYPE             dll\r
-UID                            0x100039CE 0x1000C197\r
-\r
-USERINCLUDE     .\r
-USERINCLUDE     ..\..\\r
-\r
-SYSTEMINCLUDE  \epoc32\include\r
-\r
-SOURCEPATH      .\r
-SOURCE                 audio_motorola.cpp\r
-SOURCE                 polledas.cpp\r
-\r
-LIBRARY                        EUSER.LIB\r
-LIBRARY         maudiofb.lib\r
-LIBRARY         maudioac.lib\r
-\r
-deffile                        .\audio_motorola.def\r
-\r
-nostrictdef\r
diff --git a/platform/uiq2/audio/motorola/polledas.cpp b/platform/uiq2/audio/motorola/polledas.cpp
deleted file mode 100644 (file)
index 60991ec..0000000
+++ /dev/null
@@ -1,209 +0,0 @@
-/*******************************************************************\r
- *\r
- *     File:           PolledAS.cpp\r
- *\r
- *     Author:         Peter van Sebille (peter@yipton.net)\r
- *\r
- *     (c) Copyright 2002, Peter van Sebille\r
- *     All Rights Reserved\r
- *\r
- *******************************************************************/\r
-\r
-/*\r
- * Oh Lord, forgive me for I have sinned.\r
- * In their infinite wisdom, Symbian Engineers have decided that\r
- * the Active Scheduler's queue of Active Objects is private\r
- * and no getters are provided... sigh.\r
- * This mere mortal will have to excercise the power of C pre-processor \r
- * once more to circumvent the will of the gods.\r
- */\r
-\r
-\r
-#include <e32std.h>\r
-\r
-// from e32base.h\r
-class CBase\r
-       {\r
-public:\r
-       IMPORT_C virtual ~CBase();\r
-       inline TAny* operator new(TUint aSize,TAny *aBase) {Mem::FillZ(aBase,aSize);return(aBase);}\r
-       IMPORT_C TAny* operator new(TUint aSize);\r
-       inline TAny* operator new(TUint aSize, TLeave) {return newL(aSize);}\r
-       IMPORT_C TAny* operator new(TUint aSize,TUint anExtraSize);\r
-protected:\r
-       IMPORT_C CBase();\r
-private:\r
-       CBase(const CBase&);\r
-       CBase& operator=(const CBase&);\r
-       IMPORT_C static TAny* newL(TUint aSize);\r
-       };\r
-\r
-class CActive : public CBase\r
-       {\r
-public:\r
-enum TPriority\r
-       {\r
-       EPriorityIdle=-100,\r
-       EPriorityLow=-20,\r
-       EPriorityStandard=0,\r
-       EPriorityUserInput=10,\r
-       EPriorityHigh=20,\r
-       };\r
-public:\r
-       IMPORT_C ~CActive();\r
-       IMPORT_C void Cancel();\r
-       IMPORT_C void Deque();\r
-       IMPORT_C void SetPriority(TInt aPriority);\r
-       inline TBool IsActive() const {return(iActive);}\r
-       inline TBool IsAdded() const  {return(iLink.iNext!=NULL);}\r
-       inline TInt Priority() const  {return iLink.iPriority;}\r
-protected:\r
-       IMPORT_C CActive(TInt aPriority);\r
-       IMPORT_C void SetActive();\r
-// Pure virtual\r
-       virtual void DoCancel() =0;\r
-       virtual void RunL() =0;\r
-       IMPORT_C virtual TInt RunError(TInt aError);\r
-public:\r
-       TRequestStatus iStatus;\r
-private:\r
-       TBool iActive;\r
-       TPriQueLink iLink;\r
-       friend class CActiveScheduler;\r
-//     friend class CServer;\r
-       friend class CPrivatePolledActiveScheduler; // added\r
-       };\r
-\r
-//\r
-class CActiveScheduler : public CBase\r
-       {\r
-public:\r
-       IMPORT_C CActiveScheduler();\r
-       IMPORT_C ~CActiveScheduler();\r
-       IMPORT_C static void Install(CActiveScheduler* aScheduler);\r
-       IMPORT_C static CActiveScheduler* Current();\r
-       IMPORT_C static void Add(CActive* anActive);\r
-       IMPORT_C static void Start();\r
-       IMPORT_C static void Stop();\r
-       IMPORT_C static TBool RunIfReady(TInt& aError, TInt aMinimumPriority);\r
-       IMPORT_C static CActiveScheduler* Replace(CActiveScheduler* aNewActiveScheduler);\r
-       IMPORT_C virtual void WaitForAnyRequest();\r
-       IMPORT_C virtual void Error(TInt anError) const;\r
-private:\r
-       void DoStart();\r
-       IMPORT_C virtual void OnStarting();\r
-       IMPORT_C virtual void OnStopping();\r
-       IMPORT_C virtual void Reserved_1();\r
-       IMPORT_C virtual void Reserved_2();\r
-       friend class CPrivatePolledActiveScheduler; // added\r
-protected:\r
-       inline TInt Level() const;\r
-private:\r
-       TInt iLevel;\r
-       TPriQue<CActive> iActiveQ;\r
-       };\r
-\r
-class TCleanupItem;\r
-class CleanupStack\r
-       {\r
-public:\r
-       IMPORT_C static void PushL(TAny* aPtr);\r
-       IMPORT_C static void PushL(CBase* aPtr);\r
-       IMPORT_C static void PushL(TCleanupItem anItem);\r
-       IMPORT_C static void Pop();\r
-       IMPORT_C static void Pop(TInt aCount);\r
-       IMPORT_C static void PopAndDestroy();\r
-       IMPORT_C static void PopAndDestroy(TInt aCount);\r
-       IMPORT_C static void Check(TAny* aExpectedItem);\r
-       inline static void Pop(TAny* aExpectedItem);\r
-       inline static void Pop(TInt aCount, TAny* aLastExpectedItem);\r
-       inline static void PopAndDestroy(TAny* aExpectedItem);\r
-       inline static void PopAndDestroy(TInt aCount, TAny* aLastExpectedItem);\r
-       };\r
-\r
-\r
-/*\r
- * This will declare CPrivatePolledActiveScheduler as a friend\r
- * of all classes that define a friend. CPrivatePolledActiveScheduler needs to\r
- * be a friend of CActive\r
- */\r
-//#define friend friend class CPrivatePolledActiveScheduler; friend\r
-\r
-\r
-/*\r
- * This will change the:\r
- *              void DoStart();\r
- * method in CActiveScheduler to:\r
- *              void DoStart(); friend class CPrivatePolledActiveScheduler;\r
- * We need this to access the private datamembers in CActiveScheduler.\r
- */\r
-//#define DoStart() DoStart(); friend class CPrivatePolledActiveScheduler;\r
-//#include <e32base.h>\r
-#include "PolledAS.h"\r
-\r
-\r
-class CPrivatePolledActiveScheduler : public CActiveScheduler\r
-{\r
-public:\r
-       void Schedule();\r
-};\r
-\r
-\r
-\r
-void CPrivatePolledActiveScheduler::Schedule()\r
-{\r
-       TDblQueIter<CActive> q(iActiveQ);\r
-       q.SetToFirst();\r
-       FOREVER\r
-       {\r
-               CActive *pR=q++;\r
-               if (pR)\r
-               {\r
-                       if (pR->IsActive() && pR->iStatus!=KRequestPending)\r
-                       {\r
-                               pR->iActive=EFalse;\r
-                               TRAPD(r,pR->RunL());\r
-                               break;\r
-                       }\r
-               }\r
-               else\r
-                       break;\r
-       }\r
-}\r
-\r
-\r
-CPolledActiveScheduler::~CPolledActiveScheduler()\r
-{\r
-       delete iPrivatePolledActiveScheduler;\r
-}\r
-\r
-//static CPolledActiveScheduler* sPolledActiveScheduler = NULL;\r
-CPolledActiveScheduler* CPolledActiveScheduler::NewL()\r
-{\r
-       //sPolledActiveScheduler = \r
-       CPolledActiveScheduler* self = new(ELeave)CPolledActiveScheduler;\r
-       CleanupStack::PushL(self);\r
-       self->ConstructL();\r
-       CleanupStack::Pop();\r
-       return self;\r
-}\r
-\r
-void CPolledActiveScheduler::ConstructL()\r
-{\r
-       iPrivatePolledActiveScheduler = new(ELeave) CPrivatePolledActiveScheduler;\r
-       iPrivatePolledActiveScheduler->Install(iPrivatePolledActiveScheduler);\r
-}\r
-\r
-\r
-void CPolledActiveScheduler::Schedule()\r
-{\r
-       iPrivatePolledActiveScheduler->Schedule();\r
-}\r
-\r
-/*\r
-CPolledActiveScheduler* CPolledActiveScheduler::Instance()\r
-{\r
-//     return (CPolledActiveScheduler*) CActiveScheduler::Current();\r
-       return sPolledActiveScheduler;\r
-}\r
-*/\r
diff --git a/platform/uiq2/audio/motorola/retr.cmd b/platform/uiq2/audio/motorola/retr.cmd
deleted file mode 100644 (file)
index d7b22bb..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-copy %EPOCROOT%\epoc32\release\armi\urel\audio_motorola.dll ..\\r
-..\..\..\qconsole-1.52\qtty\release\qtty --qc-addr P800 --qc-channel 5 --user qconsole --pass server --cmds "put d:\system\apps\picodriven\audio_motorola.dll ..\audio_motorola.dll" exit\r
diff --git a/platform/uiq2/audio/motorola/retr2.cmd b/platform/uiq2/audio/motorola/retr2.cmd
deleted file mode 100644 (file)
index 41bc59c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-copy %EPOCROOT%\epoc32\release\armi\urel\audio_motorola.dll ..\\r
diff --git a/platform/uiq2/blit.h b/platform/uiq2/blit.h
deleted file mode 100644 (file)
index 5556e34..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-extern "C" {\r
-       void vidConvCpyRGB444(void *to, void *from, int pixels);\r
-       void vidConvCpyRGB565(void *to, void *from, int pixels);\r
-       void vidConvCpyRGB32 (void *to, void *from, int pixels);\r
-\r
-       // warning: the functions below will reboot the phone if used incorrectly!\r
-       void vidConvCpyM2_16_90    (void *to, void *from, int width); // width is in blocks of 8 pixels\r
-       void vidConvCpyM2_16_270   (void *to, void *from, int width);\r
-       void vidConvCpyM2_RGB32_90 (void *to, void *from, int width);\r
-       void vidConvCpyM2_RGB32_270(void *to, void *from, int width);\r
-}\r
diff --git a/platform/uiq2/blit.s b/platform/uiq2/blit.s
deleted file mode 100644 (file)
index 899f13e..0000000
+++ /dev/null
@@ -1,432 +0,0 @@
-@ assembly "optimized" blitter and copy functions\r
-@ all pointers must be word-aligned\r
-\r
-@ (c) Copyright 2006, notaz\r
-@ All Rights Reserved\r
-\r
-\r
-@ Convert 0000bbb0 ggg0rrr0\r
-@ to      0000rrr0 ggg0bbb0\r
-\r
-@ r2,r3 - scratch, lr = 0x000F000F\r
-.macro convRGB444 reg\r
-    and     r2,   \reg, lr         @ r2=red\r
-    and     r3,   \reg, lr, lsl #8 @ r3=blue\r
-    and     \reg, \reg, lr, lsl #4 @ green stays in place\r
-    orr     \reg, \reg, r2, lsl #8 @ add red back\r
-    orr     \reg, \reg, r3, lsr #8 @ add blue back\r
-.endm\r
-\r
-.global vidConvCpyRGB444 @ void *to, void *from, int pixels\r
-\r
-vidConvCpyRGB444:\r
-    stmfd   sp!, {r4-r11,lr}\r
-\r
-    mov     r12, r2, lsr #4 @ repeats\r
-    mov     lr, #0xF0000\r
-    orr     lr, lr, #0xF    @ lr == pattern 0x000F000F\r
-\r
-\r
-.loopRGB444:\r
-       subs    r12, r12, #1\r
-\r
-    @ I first thought storing multiple registers would be faster,\r
-    @ but this doesn't seem to be the case, probably because of\r
-    @ slow video memory we are dealing with\r
-       ldmia   r1!, {r4-r11}\r
-    convRGB444 r4\r
-    str     r4, [r0], #4\r
-    convRGB444 r5\r
-    str     r5, [r0], #4\r
-    convRGB444 r6\r
-    str     r6, [r0], #4\r
-    convRGB444 r7\r
-    str     r7, [r0], #4\r
-    convRGB444 r8\r
-    str     r8, [r0], #4\r
-    convRGB444 r9\r
-    str     r9, [r0], #4\r
-    convRGB444 r10\r
-    str     r10, [r0], #4\r
-    convRGB444 r11\r
-    str     r11, [r0], #4\r
-\r
-    bgt     .loopRGB444\r
-\r
-\r
-    ldmfd   sp!, {r4-r11,lr}\r
-    bx      lr\r
-\r
-\r
-@ Convert 0000bbb0 ggg0rrr0\r
-@ to      rrr00ggg 000bbb00\r
-\r
-@ r2,r3 - scratch, lr = 0x07800780\r
-.macro convRGB565 reg\r
-    and     r2,   \reg, lr,  lsr #7  @ r2=red\r
-    and     r3,   \reg, lr,  lsl #1  @ r3=blue\r
-    and     \reg, lr,   \reg,lsl #3  @ green stays, but needs shifting\r
-    orr     \reg, \reg, r2,  lsl #12 @ add red back\r
-    orr     \reg, \reg, r3,  lsr #7  @ add blue back\r
-.endm\r
-\r
-.global vidConvCpyRGB565 @ void *to, void *from, int pixels\r
-\r
-vidConvCpyRGB565:\r
-    stmfd   sp!, {r4-r11,lr}\r
-\r
-    mov     r12, r2, lsr #4 @ repeats\r
-    mov     lr, #0x07800000\r
-    orr     lr, lr, #0x780  @ lr == pattern 0x07800780\r
-\r
-.loopRGB565:\r
-       subs    r12, r12, #1\r
-\r
-       ldmia   r1!, {r4-r11}\r
-    convRGB565 r4\r
-    str     r4, [r0], #4\r
-    convRGB565 r5\r
-    str     r5, [r0], #4\r
-    convRGB565 r6\r
-    str     r6, [r0], #4\r
-    convRGB565 r7\r
-    str     r7, [r0], #4\r
-    convRGB565 r8\r
-    str     r8, [r0], #4\r
-    convRGB565 r9\r
-    str     r9, [r0], #4\r
-    convRGB565 r10\r
-    str     r10, [r0], #4\r
-    convRGB565 r11\r
-    str     r11, [r0], #4\r
-\r
-    bgt     .loopRGB565\r
-\r
-    ldmfd   sp!, {r4-r11,lr}\r
-    bx      lr\r
-\r
-\r
-@ Convert 0000bbb0 ggg0rrr0 0000bbb0 ggg0rrr0\r
-@ to      00000000 rrr00000 ggg00000 bbb00000 ...\r
-\r
-@ r2,r3 - scratch, lr = 0x0000F000\r
-@ rin - src reg, rout - dest reg (can be same for both; rout can be r3)\r
-.macro convRGB32_l rout rin\r
-    and     r2,    \rin,  lr,   lsr #12 @ r2=red\r
-    and     r3,    \rin,  lr,   lsr #4  @ r3=blue\r
-    orr     r2,    r3,    r2,   lsl #24\r
-    and     \rout, lr,    \rin, lsl #8  @ green stays, but needs shifting\r
-    orr     \rout, \rout, r2,   lsr #4  @ add red+blue back\r
-.endm\r
-\r
-@ r2,r3 - scratch, lr = 0x0000F000\r
-@ rin - src reg, rout - dest reg (can be same for both; rout can be r3)\r
-.macro convRGB32_h rout rin\r
-    and     r2,    \rin,  lr,   lsl #4  @ r2=red\r
-    mov     r3,    \rin,        lsr #24 @ r3=blue\r
-    orr     r2,    r3,    r2\r
-    and     \rout, lr,    \rin, lsr #8  @ green\r
-    orr     \rout, \rout, r2,   lsl #4\r
-.endm\r
-\r
-@ slightly faster conversion, saves 1 opcode, writes output\r
-@ lr =  0x00F000F0, out: r3=lower_pix, r2=higher_pix; trashes rin\r
-.macro convRGB32_2 rin rethigh=0\r
-    and     r2,  lr, \rin, lsr #4 @ blue\r
-    and     r3,  \rin, lr\r
-    orr     r2,  r2,   r3, lsl #8         @ g0b0g0b0\r
-\r
-    mov     r3,  r2,  lsl #16             @ g0b00000\r
-    and     \rin,lr,  \rin, ror #12       @ 00r000r0 (reversed)\r
-    orr     r3,  r3,  \rin, lsr #16       @ g0b000r0\r
-    mov     r3,  r3,  ror #16             @ r3=low\r
-\r
-    str     r3, [r0], #4\r
-\r
-    mov     r2,  r2,  lsr #16\r
-.if \rethigh\r
-    orr     \rin,r2,  \rin, lsl #16\r
-.else\r
-    orr     r2,  r2,  \rin, lsl #16\r
-    str     r2, [r0], #4\r
-.endif\r
-.endm\r
-\r
-\r
-.global vidConvCpyRGB32 @ void *to, void *from, int pixels\r
-\r
-vidConvCpyRGB32:\r
-    stmfd   sp!, {r4-r7,lr}\r
-\r
-    mov     r12, r2, lsr #3 @ repeats\r
-    mov     lr, #0x00F00000\r
-    orr     lr, lr, #0x00F0\r
-\r
-.loopRGB32:\r
-       subs    r12, r12, #1\r
-\r
-       ldmia   r1!, {r4-r7}\r
-    convRGB32_2 r4\r
-    convRGB32_2 r5\r
-    convRGB32_2 r6\r
-    convRGB32_2 r7\r
-\r
-    bgt     .loopRGB32\r
-\r
-    ldmfd   sp!, {r4-r7,lr}\r
-    bx      lr\r
-\r
-\r
-@ -------- M2 stuff ---------\r
-\r
-.bss\r
-tmpstore1d: .long\r
-\r
-.text\r
-tmpstore1:  .long tmpstore1d\r
-\r
-\r
-@ r3 - scratch, ru - reg with 2 pixels from upper col, rl - ... lower col\r
-.macro rot_str16_90 ru rl\r
-    mov     r3, \rl,lsl #16\r
-    mov     r3, r3, lsr #16\r
-    orr     r3, r3, \ru, lsl #16\r
-    str     r3, [r0], #208*2\r
-    mov     r3, \ru,lsr #16\r
-    mov     r3, r3, lsl #16\r
-    orr     r3, r3, \rl, lsr #16\r
-    str     r3, [r0], #208*2\r
-.endm\r
-\r
-\r
-.global vidConvCpyM2_16_90 @ void *to, void *from, int width\r
-\r
-vidConvCpyM2_16_90:\r
-    stmfd   sp!, {r4-r11,lr}\r
-\r
-    ldr     r4, =tmpstore1\r
-    str     sp, [r4]               @ save sp, we will need sp reg..\r
-    mov     sp, r0                 @ .. to store our dst\r
-\r
-    @ crashing beyond this point will be fatal (phone reboots), as Symbian OS expects sp to always point to stack\r
-\r
-    sub     r2,  r2, #1\r
-    mov     r12, #0x00670000\r
-    orr     r12, r12, r2, lsl #24\r
-    orr     r12, r12, r2           @ r12 == ((208-2)/2 << 16) | ((width-1)<<24) | (width-1)\r
-\r
-    add     r0,  r0, #206*2\r
-    add     r1,  r1, #8*2          @ skip left border\r
-    add     lr,  r1, #328*2\r
-\r
-.loopM2_16_90:\r
-       subs    r12, r12, #1<<24\r
-\r
-       ldmia   r1!, {r4-r7}\r
-       ldmia   lr!, {r8-r11}\r
-    rot_str16_90 r4 r8\r
-    rot_str16_90 r5 r9\r
-    rot_str16_90 r6 r10\r
-    rot_str16_90 r7 r11\r
-\r
-    bpl     .loopM2_16_90\r
-\r
-    add     r12, r12, #1<<24\r
-    subs    r12, r12, #0x00010000\r
-    bmi     .loopM2_16_90_end\r
-\r
-    add     r0,  sp,  r12, lsr #14 @ calculate new dst pointer\r
-    orr     r12, r12, r12, lsl #24 @ restore the width counter\r
-\r
-    @ skip remaining pixels on these 2 lines\r
-    mov     r4, #328/8-1         @ width of mode2 in line_pixels/8\r
-    sub     r4, r4, r12, lsr #24\r
-    add     r1, lr, r4,  lsl #4  @ skip src pixels\r
-    add     lr, r1, #328*2\r
-    b       .loopM2_16_90\r
-\r
-.loopM2_16_90_end:\r
-    @ restore sp\r
-    ldr     r4, =tmpstore1\r
-    ldr     sp, [r4]\r
-\r
-    ldmfd   sp!, {r4-r11,lr}\r
-    bx      lr\r
-\r
-\r
-\r
-@ r3 - scratch, ru - reg with 2 pixels from upper col, rl - ... lower col (for right-to-left copies)\r
-.macro rot_str16_270 ru rl\r
-    mov     r3, \rl,lsr #16\r
-    mov     r3, r3, lsl #16\r
-    orr     r3, r3, \ru, lsr #16\r
-    str     r3, [r0], #208*2\r
-    mov     r3, \ru,lsl #16\r
-    mov     r3, r3, lsr #16\r
-    orr     r3, r3, \rl, lsl #16\r
-    str     r3, [r0], #208*2\r
-.endm\r
-\r
-\r
-.global vidConvCpyM2_16_270 @ void *to, void *from, int width\r
-\r
-vidConvCpyM2_16_270:\r
-    stmfd   sp!, {r4-r11,lr}\r
-\r
-    ldr     r4, =tmpstore1\r
-    str     sp, [r4]               @ save sp, we will need sp reg to store our dst\r
-\r
-    sub     r2,  r2, #1\r
-    mov     r12, #0x00670000\r
-    orr     r12, r12, r2, lsl #24\r
-    orr     r12, r12, r2           @ r12 == ((208-2)/2 << 16) | ((width-1)<<24) | (width-1)\r
-\r
-    add     r1,  r1, #328*2        @ skip left border+1line\r
-    add     lr,  r1, #328*2\r
-    add     sp,  r0, #206*2        @ adjust for algo\r
-\r
-.loopM2_16_270:\r
-       subs    r12, r12, #1<<24\r
-\r
-       ldmdb   r1!, {r4-r7}\r
-       ldmdb   lr!, {r8-r11}\r
-    rot_str16_270 r7 r11           @ update the screen in incrementing direction, reduces tearing slightly\r
-    rot_str16_270 r6 r10\r
-    rot_str16_270 r5 r9\r
-    rot_str16_270 r4 r8\r
-\r
-    bpl     .loopM2_16_270\r
-\r
-    add     r12, r12, #1<<24\r
-    subs    r12, r12, #0x00010000\r
-    bmi     .loopM2_16_90_end      @ same end as in 90\r
-\r
-    sub     r0,  sp,  r12, lsr #14 @ calculate new dst pointer\r
-    orr     r12, r12, r12, lsl #24 @ restore the width counter\r
-\r
-    @ skip remaining pixels on these 2 lines\r
-    mov     r4, #328/8-1         @ width of mode2 in line_pixels/8\r
-    sub     r4, r4, r12, lsr #24\r
-    sub     r1, lr, r4,  lsl #4  @ skip src pixels\r
-    add     r1, r1, #328*2*2\r
-    add     lr, r1, #328*2\r
-    b       .loopM2_16_270\r
-\r
-\r
-\r
-.global vidConvCpyM2_RGB32_90 @ void *to, void *from, int width\r
-\r
-vidConvCpyM2_RGB32_90:\r
-    stmfd   sp!, {r4-r10,lr}\r
-\r
-    mov     lr, #0x00F00000\r
-    orr     lr, lr, #0x00F0\r
-\r
-    mov     r12, #208/4            @ row counter\r
-    mov     r10, r2, lsl #2        @ we do 2 pixel wide copies\r
-\r
-    add     r8,  r0, #208*4        @ parallel line\r
-    add     r1,  r1, #0x21000\r
-    add     r1,  r1, #0x00280      @ r1+=328*207*2+8*2\r
-    mov     r9,  r1\r
-\r
-.loopM2RGB32_90:\r
-       subs    r12, r12, #1\r
-\r
-    @ at first this loop was written differently: src pixels were fetched with ldm's and\r
-    @ dest was not sequential. It ran nearly 2 times slower. It seems it is very important\r
-    @ to do sequential memory access on those items, which we have more (to offload addressing bus?).\r
-\r
-    ldr     r4, [r1], #-328*2\r
-    ldr     r5, [r1], #-328*2\r
-    ldr     r6, [r1], #-328*2\r
-    ldr     r7, [r1], #-328*2\r
-\r
-    convRGB32_2 r4, 1\r
-    convRGB32_2 r5, 1\r
-    convRGB32_2 r6, 1\r
-    convRGB32_2 r7, 1\r
-\r
-    str     r4, [r8], #4\r
-    str     r5, [r8], #4\r
-    str     r6, [r8], #4\r
-    str     r7, [r8], #4\r
-\r
-    bne     .loopM2RGB32_90\r
-\r
-    subs    r10, r10, #1\r
-    ldmeqfd sp!, {r4-r10,pc}        @ return\r
-\r
-    mov     r12, #208/4             @ restore row counter\r
-    mov     r0,  r8                 @ set new dst pointer\r
-    add     r8,  r0,  #208*4\r
-    add     r9,  r9,  #2*2          @ fix src pointer\r
-    mov     r1,  r9\r
-    b       .loopM2RGB32_90\r
-\r
-\r
-\r
-@ converter for vidConvCpyM2_RGB32_270\r
-@ lr =  0x00F000F0, out: r3=lower_pix, r2=higher_pix; trashes rin\r
-.macro convRGB32_3 rin\r
-    and     r2,  lr, \rin, lsr #4 @ blue\r
-    and     r3,  \rin, lr\r
-    orr     r2,  r2,   r3, lsl #8         @ g0b0g0b0\r
-\r
-    mov     r3,  r2,  lsl #16             @ g0b00000\r
-    and     \rin,lr,  \rin, ror #12       @ 00r000r0 (reversed)\r
-    orr     r3,  r3,  \rin, lsr #16       @ g0b000r0\r
-\r
-    mov     r2,  r2,  lsr #16\r
-    orr     r2,  r2,  \rin, lsl #16\r
-    str     r2, [r0], #4\r
-\r
-    mov     \rin,r3,  ror #16             @ r3=low\r
-.endm\r
-\r
-\r
-.global vidConvCpyM2_RGB32_270 @ void *to, void *from, int width\r
-\r
-vidConvCpyM2_RGB32_270:\r
-    stmfd   sp!, {r4-r10,lr}\r
-\r
-    mov     lr, #0x00F00000\r
-    orr     lr, lr, #0x00F0\r
-\r
-    mov     r12, #208/4            @ row counter\r
-    mov     r10, r2, lsl #2        @ we do 2 pixel wide copies (right to left)\r
-\r
-    add     r8,  r0, #208*4        @ parallel line\r
-    add     r1,  r1, #326*2\r
-    mov     r9,  r1\r
-\r
-.loopM2RGB32_270:\r
-       subs    r12, r12, #1\r
-\r
-    ldr     r4, [r1], #328*2\r
-    ldr     r5, [r1], #328*2\r
-    ldr     r6, [r1], #328*2\r
-    ldr     r7, [r1], #328*2\r
-\r
-    convRGB32_3 r4\r
-    convRGB32_3 r5\r
-    convRGB32_3 r6\r
-    convRGB32_3 r7\r
-\r
-    str     r4, [r8], #4\r
-    str     r5, [r8], #4\r
-    str     r6, [r8], #4\r
-    str     r7, [r8], #4\r
-\r
-    bne     .loopM2RGB32_270\r
-\r
-    subs    r10, r10, #1\r
-    ldmeqfd sp!, {r4-r10,pc}        @ return\r
-\r
-    mov     r12, #208/4             @ restore row counter\r
-    mov     r0,  r8                 @ set new dst pointer\r
-    add     r8,  r0,  #208*4\r
-    sub     r9,  r9,  #2*2          @ fix src pointer\r
-    mov     r1,  r9\r
-    b       .loopM2RGB32_270\r
-\r
diff --git a/platform/uiq2/debug.cpp b/platform/uiq2/debug.cpp
deleted file mode 100644 (file)
index efa6095..0000000
+++ /dev/null
@@ -1,241 +0,0 @@
-\r
-#include <e32svr.h> // RDebug\r
-#include "debug.h"\r
-\r
-#ifdef __WINS__\r
-\r
-void ExceptionHandler(TExcType exc) {}\r
-\r
-#else\r
-\r
-static const wchar_t * const exception_names[] = {\r
-       L"General",\r
-       L"IntegerDivideByZero",\r
-       L"SingleStep",\r
-       L"BreakPoint",\r
-       L"IntegerOverflow",\r
-       L"BoundsCheck",\r
-       L"InvalidOpCode",\r
-       L"DoubleFault",\r
-       L"StackFault",\r
-       L"AccessViolation",\r
-       L"PrivInstruction",\r
-       L"Alignment",\r
-       L"PageFault",\r
-       L"FloatDenormal",\r
-       L"FloatDivideByZero",\r
-       L"FloatInexactResult",\r
-       L"FloatInvalidOperation",\r
-       L"FloatOverflow",\r
-       L"FloatStackCheck",\r
-       L"FloatUnderflow",\r
-       L"Abort",\r
-       L"Kill",\r
-       L"DataAbort",\r
-       L"CodeAbort",\r
-       L"MaxNumber",\r
-       L"InvalidVector",\r
-       L"UserInterrupt",\r
-       L"Unknown"\r
-};\r
-\r
-\r
-static void getASpace(TUint *code_start, TUint *code_end, TUint *stack_start, TUint *stack_end)\r
-{\r
-       TUint pc, sp;\r
-       RChunk chunk;\r
-       TFullName chunkname;\r
-       TFindChunk findChunk(_L("*"));\r
-\r
-       asm volatile ("str pc, %0" : "=m" (pc) );\r
-       asm volatile ("str sp, %0" : "=m" (sp) );\r
-\r
-       while( findChunk.Next(chunkname) != KErrNotFound ) {\r
-               chunk.Open(findChunk);\r
-               if((TUint)chunk.Base()+chunk.Bottom() < pc && pc < (TUint)chunk.Base()+chunk.Top()) {\r
-                       if(code_start) *code_start = (TUint)chunk.Base()+chunk.Bottom();\r
-                       if(code_end)   *code_end   = (TUint)chunk.Base()+chunk.Top();\r
-               } else\r
-               if((TUint)chunk.Base()+chunk.Bottom() < sp && sp < (TUint)chunk.Base()+chunk.Top()) {\r
-                       if(stack_start) *stack_start = (TUint)chunk.Base()+chunk.Bottom();\r
-                       if(stack_end)   *stack_end   = (TUint)chunk.Base()+chunk.Top();\r
-               }\r
-               chunk.Close();\r
-       }\r
-}\r
-\r
-// tmp\r
-#if defined(__DEBUG_PRINT)\r
-extern "C" char *debugString();\r
-#endif\r
-\r
-// our very own exception handler\r
-void ExceptionHandler(TExcType exc)\r
-{\r
-       TUint lr, sp, i;\r
-       TUint stack_end = 0;                            // ending address of our stack chunk\r
-       TUint code_start = 0, code_end = 0; // starting and ending addresses of our code chunk\r
-       TUint guessed_address = 0;\r
-\r
-       asm volatile ("str lr, %0" : "=m" (lr) );\r
-       asm volatile ("str sp, %0" : "=m" (sp) );\r
-\r
-       // first get some info about the chunks we live in\r
-       getASpace(&code_start, &code_end, 0, &stack_end);\r
-\r
-       // now we begin some black magic tricks\r
-       // we go up our stack until we pass our caller address\r
-       for(; sp < stack_end; sp += 4)\r
-               if(*(TUint *)sp == lr) break;\r
-\r
-       // there might be mirored caller address\r
-       for(i = sp + 4; i < sp + 0x300 && i < stack_end; i += 4)\r
-               if(*(TUint *)i == lr) { sp = i; break; }\r
-\r
-       // aah, it is always 0x9c bytes away from the caller address in my firmware,\r
-       // don't know how to detect it in any other way\r
-       sp += 0x9c;\r
-       guessed_address = *(TUint *)sp;\r
-\r
-       // output the info\r
-       TUint exec_show = exc;\r
-       if(exec_show > 27) exec_show = 27;\r
-       TPtrC ptrExc((TUint16 *) exception_names[exec_show]);\r
-\r
-       RDebug::Print(_L("!!!Exception %i (%S) @ 0x%08x (guessed; relative=0x%08x)"), exc, &ptrExc, guessed_address, guessed_address - code_start);\r
-#ifdef __DEBUG_PRINT_FILE\r
-       DEBUGPRINT(   _L("!!!Exception %i (%S) @ 0x%08x (guessed; relative=0x%08x)"), exc, &ptrExc, guessed_address, guessed_address - code_start);\r
-#endif\r
-\r
-       TBuf<148> buff1;\r
-       TBuf<10>  buff2;\r
-       buff1.Copy(_L("  guessed stack: "));\r
-\r
-       for(sp += 4, i = 0; i < 5 && sp < stack_end; sp += 4) {\r
-               if((*(TUint *)sp >> 28) == 5) {\r
-                       if(i++) buff1.Append(_L(", "));\r
-                       buff2.Format(_L("0x%08x"), *(TUint *)sp);\r
-                       buff1.Append(buff2);\r
-               }\r
-               else if(code_start < *(TUint *)sp && *(TUint *)sp < code_end) {\r
-                       if(i++) buff1.Append(_L(", "));\r
-                       buff2.Format(_L("0x%08x"), *(TUint *)sp);\r
-                       buff1.Append(buff2);\r
-                       buff1.Append(_L(" ("));\r
-                       buff2.Format(_L("0x%08x"), *(TUint *)sp - code_start);\r
-                       buff1.Append(buff2);\r
-                       buff1.Append(_L(")"));\r
-               }\r
-       }\r
-       RDebug::Print(_L("%S"), &buff1);\r
-#ifdef __DEBUG_PRINT_FILE\r
-       DEBUGPRINT(_L("%S"), &buff1);\r
-#endif\r
-\r
-       // tmp\r
-#if defined(__DEBUG_PRINT)\r
-       char *ps, *cstr = debugString();\r
-       for(ps = cstr; *ps; ps++) {\r
-         if(*ps == '\n') {\r
-           *ps = 0;\r
-           dprintf(cstr);\r
-               cstr = ps+1;\r
-         }\r
-       }\r
-#endif\r
-\r
-//     RDebug::Print(_L("Stack dump:"));\r
-//     asm volatile ("str sp, %0" : "=m" (sp) );\r
-//     for(TUint i = sp+0x400; i >= sp-16; i-=4)\r
-//             RDebug::Print(_L("%08x: %08x"), i, *(int *)i);\r
-\r
-       // more descriptive replacement of "KERN-EXEC 3" panic\r
-       buff1.Format(_L("K-EX3: %S"), &ptrExc);\r
-       User::Panic(buff1, exc);\r
-}\r
-\r
-#endif // ifdef __WINS__\r
-\r
-\r
-#if defined(__DEBUG_PRINT) || defined(__WINS__)\r
-\r
-#ifndef __DLL__\r
-       // c string dumper for RDebug::Print()\r
-       static  TBuf<1024> sTextBuffer;\r
-       TDesC* DO_CONV(const char* s)\r
-       {\r
-               TPtrC8  text8((TUint8*) (s));\r
-               sTextBuffer.Copy(text8);\r
-               return &sTextBuffer;\r
-       }\r
-#endif\r
-\r
-#ifdef __DEBUG_PRINT_C\r
-       #include <stdarg.h> // va_*\r
-       #include <stdio.h>  // vsprintf\r
-\r
-       // debug print from c code\r
-       extern "C" void dprintf(char *format, ...)\r
-       {\r
-               va_list args;\r
-               char    buffer[512];\r
-\r
-               va_start(args,format);\r
-               vsprintf(buffer,format,args);\r
-               va_end(args);\r
-\r
-               DEBUGPRINT(_L("%S"), DO_CONV(buffer));\r
-       }\r
-#endif\r
-\r
-#ifdef __DEBUG_PRINT_FILE\r
-       #include <f32file.h>\r
-\r
-       // note: uses tls, leaks some mem\r
-       void debugPrintFileInit()\r
-       {\r
-               RFs *fs = new(ELeave) RFs;\r
-               fs->Connect();\r
-               RFile *file = new(ELeave) RFile;\r
-               // try to open\r
-               TInt    res = file->Open(*fs, _L("C:\\documents\\Media files\\other\\snes9x.log"), EFileWrite|EFileShareAny);\r
-               if(res) res = file->Open(*fs, _L("C:\\snes9x.log"), EFileWrite|EFileShareAny);\r
-               if(!res) { TInt size; file->Size(size); file->Seek(ESeekStart, size); }\r
-               // try to create\r
-               if(res) res = file->Create(*fs, _L("C:\\documents\\Media files\\other\\snes9x.log"), EFileWrite|EFileShareAny);\r
-               if(res) res = file->Create(*fs, _L("C:\\snes9x.log"), EFileWrite|EFileShareAny);\r
-               Dll::SetTls(res ? 0 : file);\r
-       }\r
-\r
-       // debug print to file\r
-       void debugPrintFile(TRefByValue<const TDesC> aFmt, ...)\r
-       {\r
-               // get RFile\r
-               RFile *file = (RFile *) Dll::Tls();\r
-               if(!file) return; // shit!\r
-\r
-               TTime now; now.UniversalTime();\r
-               TBuf<512>  tmpBuff;\r
-               TBuf8<512> tmpBuff8;\r
-               TInt size;\r
-\r
-               file->Size(size); file->Seek(ESeekStart, size); // something else could have written to the file\r
-\r
-               now.FormatL(tmpBuff, _L("%H:%T:%S.%C: "));\r
-               tmpBuff8.Copy(tmpBuff);\r
-               file->Write(tmpBuff8);\r
-\r
-               VA_LIST args;\r
-               VA_START(args, aFmt);\r
-               tmpBuff.FormatList(aFmt, args);\r
-               VA_END(args);\r
-               tmpBuff8.Copy(tmpBuff);\r
-               file->Write(tmpBuff8);\r
-\r
-               file->Write(TPtrC8((TUint8 const *) "\r\n"));\r
-               file->Flush();\r
-       }\r
-#endif\r
-\r
-#endif\r
-\r
diff --git a/platform/uiq2/debug.h b/platform/uiq2/debug.h
deleted file mode 100644 (file)
index b91ce26..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#include <e32std.h>\r
-\r
-#define __DEBUG_PRINT_C\r
-\r
-#if defined(__DEBUG_PRINT) || defined(__WINS__)\r
-       #include <e32svr.h> // RDebug\r
-       #ifdef __DEBUG_PRINT_FILE\r
-               void debugPrintFileInit();\r
-               void debugPrintFile(TRefByValue<const TDesC> aFmt, ...);\r
-               #define DEBUG_PRINT_FILE_INIT debugPrintFileInit\r
-               #define DEBUGPRINT debugPrintFile\r
-       #else\r
-               #define DEBUG_PRINT_FILE_INIT()\r
-               #define DEBUGPRINT RDebug::Print\r
-       #endif\r
-       TDesC* DO_CONV(const char* s);\r
-       #ifdef __DEBUG_PRINT_C\r
-               #ifdef __cplusplus\r
-               extern "C"\r
-               #endif\r
-               void dprintf(char *format, ...);\r
-       #endif\r
-#else\r
-       #define DEBUGPRINT(x...)\r
-#endif\r
-\r
-void ExceptionHandler(TExcType exc);\r
diff --git a/platform/uiq2/launcher/App.cpp b/platform/uiq2/launcher/App.cpp
deleted file mode 100644 (file)
index 7836764..0000000
+++ /dev/null
@@ -1,644 +0,0 @@
-/*******************************************************************\r
- *\r
- *     File:           App.cpp\r
- *\r
- *     Author:         Peter van Sebille (peter@yipton.net)\r
- *\r
- *  Modified/adapted for picodriveN by notaz, 2006\r
- *\r
- *  (c) Copyright 2006, notaz\r
- *     (c) Copyright 2002, Peter van Sebille\r
- *     All Rights Reserved\r
- *\r
- *******************************************************************/\r
-\r
-#include "app.h"\r
-// #include "picodriven.mbg" // bitmap identifiers\r
-#include "picodriven.rsg"\r
-#include <eikenv.h>\r
-#include <qbtselectdlg.h>\r
-//#include <gulutil.h>\r
-//#include <bautils.h>\r
-#include <eikmenub.h> // CEikMenuBar\r
-#include <apgtask.h> // TApaSystemEvent\r
-\r
-#include "Dialogs.h"\r
-\r
-\r
-CApaDocument* CPicolApplication::CreateDocumentL()\r
-{\r
-       return new (ELeave) CPicolDocument(*this);\r
-}\r
-\r
-\r
-CPicolDocument::CPicolDocument(CEikApplication& aApp)\r
-               : CEikDocument(aApp)\r
-{\r
-}\r
-\r
-CPicolDocument::~CPicolDocument()\r
-{\r
-}\r
-\r
-CEikAppUi* CPicolDocument::CreateAppUiL()\r
-{\r
-       return new(ELeave) CPicolAppUi;\r
-}\r
-\r
-\r
-////////////////////////////////////////////////////////////////\r
-//\r
-// class CPicolAppUi\r
-//\r
-////////////////////////////////////////////////////////////////\r
-\r
-CPicolAppUi::CPicolAppUi()\r
-: iCurrentLConfig(iCurrentConfig)\r
-{\r
-       // set default config\r
-       Mem::FillZ(&iCurrentConfig, sizeof(iCurrentConfig));\r
-       iCurrentConfig.iFlags = 1; // use_sram\r
-       iCurrentConfig.iFrameskip               = TPicoConfig::PFSkipAuto;\r
-       iCurrentConfig.iScreenRotation  = TPicoConfig::PRot90;\r
-}\r
-\r
-CPicolAppUi::~CPicolAppUi()\r
-{\r
-       delete iAppView;\r
-       DeregisterView(*iFOView);\r
-       delete iFOView;\r
-       DeregisterView(*iFCView);\r
-       delete iFCView;\r
-}\r
-\r
-void CPicolAppUi::ConstructL()\r
-{\r
-       BaseConstructL();\r
-\r
-       // load config\r
-       iCurrentLConfig.Load();\r
-\r
-       iAppView=new(ELeave) CEPicolAppView;\r
-       iAppView->ConstructL(ClientRect());\r
-\r
-       iFOView=new(ELeave) CPicolFOView(*iAppView);\r
-       RegisterViewL(*iFOView);  \r
-       iFCView=new(ELeave) CPicolFCView(*iAppView);\r
-       RegisterViewL(*iFCView);\r
-}\r
-\r
-\r
-void CPicolAppUi::HandleCommandL(TInt aCommand)\r
-{\r
-       TInt oldFrameskip = iCurrentConfig.iFrameskip;\r
-       TInt res;\r
-\r
-       // give time for config dialog destruction\r
-       if(iAfterConfigDialog) {\r
-               iAfterConfigDialog = EFalse;\r
-               TTime now; now.UniversalTime();\r
-               if(now.MicroSecondsFrom(iConfigDialogClosed).Int64().Low() < 2500*1000)\r
-                       User::After(2500*1000-now.MicroSecondsFrom(iConfigDialogClosed).Int64().Low());\r
-       }\r
-\r
-       switch (aCommand)\r
-       {\r
-               case EEikCmdPicoLoadState:\r
-                       if(iGameRunner) {\r
-                               CEikonEnv::Static()->BusyMsgL(_L("Loading State"));\r
-                               res = ss.SendReceive(PicoMsgLoadState, 0);\r
-                               CEikonEnv::Static()->BusyMsgCancel();\r
-                               // emu doesn't start to run if load fails, so we can display this\r
-                               if(res) CEikonEnv::Static()->InfoMsg(_L("Load Failed"));\r
-                       }\r
-                       break;\r
-\r
-               case EEikCmdPicoSaveState:\r
-                       if(iGameRunner) {\r
-                               CEikonEnv::Static()->BusyMsgL(_L("Saving State"));\r
-                               res = ss.SendReceive(PicoMsgSaveState, 0);\r
-                               CEikonEnv::Static()->BusyMsgCancel();\r
-                               if(res) CEikonEnv::Static()->InfoMsg(_L("Save Failed"));\r
-                       }\r
-                       break;\r
-\r
-               case EEikCmdPicoLoadROM:\r
-                       DisplayOpenROMDialogL();\r
-                       break;\r
-\r
-               case EEikCmdPicoResume:\r
-                       ss.Send(PicoMsgResume, 0);\r
-                       iEmuRunning = ETrue;\r
-                       break;\r
-\r
-               case EEikCmdPicoReset: \r
-                       ss.Send(PicoMsgReset, 0);\r
-                       iEmuRunning = ETrue;\r
-                       break;\r
-\r
-               case EEikCmdPicoKeys:\r
-                       if(!iGameRunner) RunGameL();\r
-                       ss.Send(PicoMsgKeys, 0);\r
-                       iEmuRunning = ETrue;\r
-                       break;\r
-               \r
-               case EEikCmdPicoSettings:\r
-                       DisplayConfigDialogL();\r
-                       break;\r
-\r
-               case EEikCmdHelpAbout: // EEikCmdPicoAbout:\r
-                       DisplayAboutDialogL();\r
-                       break;\r
-\r
-               // standard identifier must be used here, TApaTask::EndTask() and probably others send it\r
-               case EEikCmdExit: // EEikCmdPicoExit:\r
-                       if(iGameRunner) {\r
-                               iQuitting = ETrue;\r
-                               iExitForcer = CExitForcer::NewL(*this, 2000);\r
-                               ss.Send(PicoMsgQuit, 0);\r
-                       } else {\r
-                               iCurrentLConfig.Save();\r
-                               DEBUGPRINT(_L("[app] Exit (menu)"));\r
-                               Exit();\r
-                       }\r
-                       break;\r
-\r
-               // frameskips\r
-               case EEikCmdPicoFrameskipAuto:\r
-                       iCurrentConfig.iFrameskip = TPicoConfig::PFSkipAuto;\r
-                       break;\r
-\r
-               case EEikCmdPicoFrameskip0:\r
-                       iCurrentConfig.iFrameskip = TPicoConfig::PFSkip0;\r
-                       break;\r
-\r
-               case EEikCmdPicoFrameskip1:\r
-                       iCurrentConfig.iFrameskip = 1;\r
-                       break;\r
-\r
-               case EEikCmdPicoFrameskip2:\r
-                       iCurrentConfig.iFrameskip = 2;\r
-                       break;\r
-\r
-               case EEikCmdPicoFrameskip4:\r
-                       iCurrentConfig.iFrameskip = 4;\r
-                       break;\r
-\r
-               case EEikCmdPicoFrameskip8:\r
-                       iCurrentConfig.iFrameskip = 8;\r
-                       break;\r
-\r
-               case EEikCmdPicoDebugKillEmu:\r
-                       if(iGameRunner) {\r
-                               iExitForcer = CExitForcer::NewL(*this, 4000);\r
-                               ss.Send(PicoMsgQuit, 0);\r
-                       }\r
-                       break;\r
-\r
-               case EEikCmdPicoDebugInfo:\r
-                       if(iGameRunner)\r
-                               DisplayDebugDialogL();\r
-                       break;\r
-       }\r
-\r
-       // send config update if needed\r
-       if(iCurrentConfig.iFrameskip != oldFrameskip)\r
-               SendConfig();\r
-}\r
-\r
-\r
-void CPicolAppUi::HandleSystemEventL(const TWsEvent& aEvent)\r
-{\r
-    TApaSystemEvent event;\r
-    event = *(TApaSystemEvent*)aEvent.EventData();\r
-        \r
-    if(event == EApaSystemEventBroughtToForeground) // application brought to foreground\r
-    {\r
-               DEBUGPRINT(_L("[app] EApaSystemEventBroughtToForeground, iEmuRunning=%i"), iEmuRunning);\r
-               // we might have missed flip open event (when moved to background),\r
-               // so make sure we have correct view active\r
-               if(iCoeEnv->ScreenDevice()->CurrentScreenMode() == EScreenModeFlipOpen) {\r
-                       ActivateViewL(TVwsViewId(KUidPicolApp, KUidPicolFOView));\r
-                       return;\r
-               }\r
-       }\r
-    if(event == EApaSystemEventShutdown)\r
-    {\r
-               DEBUGPRINT(_L("[app] EApaSystemEventShutdown"));\r
-       }\r
-\r
-       CEikAppUi::HandleSystemEventL(aEvent);\r
-}\r
-\r
-\r
-// called just before the menu is shown\r
-void CPicolAppUi::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)\r
-{\r
-       if(aResourceId == R_APP_EMU_MENU) {\r
-               TBool dimmed = !iGameRunner || !iROMLoaded;\r
-               aMenuPane->SetItemDimmed(EEikCmdPicoLoadState, dimmed);\r
-               aMenuPane->SetItemDimmed(EEikCmdPicoSaveState, dimmed);\r
-               aMenuPane->SetItemDimmed(EEikCmdPicoResume, dimmed);\r
-               aMenuPane->SetItemDimmed(EEikCmdPicoReset,  dimmed);\r
-       } else if(aResourceId == R_APP_FRAMESKIP_MENU) {\r
-               TInt itemToCheck = EEikCmdPicoFrameskipAuto;\r
-               switch(iCurrentConfig.iFrameskip) {\r
-                       case 0: itemToCheck = EEikCmdPicoFrameskip0; break;\r
-                       case 1: itemToCheck = EEikCmdPicoFrameskip1; break;\r
-                       case 2: itemToCheck = EEikCmdPicoFrameskip2; break;\r
-                       case 4: itemToCheck = EEikCmdPicoFrameskip4; break;\r
-                       case 8: itemToCheck = EEikCmdPicoFrameskip8; break;\r
-               }\r
-               aMenuPane->SetItemButtonState(itemToCheck, EEikMenuItemSymbolOn);\r
-       }\r
-}\r
-\r
-\r
-void CPicolAppUi::DisplayAboutDialogL()\r
-{\r
-       CEikDialog*     dialog = new(ELeave) CAboutDialog;\r
-       TInt iButtonRes = dialog->ExecuteLD(R_DIALOG_ABOUT);\r
-       if(iButtonRes == EEikBidYes) {\r
-               CCreditsDialog *creditsDialog = new (ELeave) CCreditsDialog();\r
-               creditsDialog->iMessageResourceID = R_TBUF_CREDITS;\r
-               creditsDialog->ExecuteLD(R_DIALOG_CREDITS);\r
-       }\r
-}\r
-\r
-\r
-void CPicolAppUi::DisplayOpenROMDialogL()\r
-{\r
-\r
-       TFileName file(iCurrentLConfig.iLastROMFile);\r
-       CEikDialog* dialog = new(ELeave) CEikFileOpenDialog(&file);\r
-       //((CEikFileOpenDialog *)dialog)->SetRequiredExtension(&ext);\r
-\r
-       if(dialog->ExecuteLD(R_EIK_DIALOG_FILE_OPEN) == EEikBidOk) {\r
-               CEikonEnv::Static()->BusyMsgL(_L("Loading ROM"));\r
-\r
-               // start emu process if it is not running\r
-               if(!iGameRunner) RunGameL();\r
-               iROMLoaded = EFalse;\r
-\r
-               TBuf8<KMaxFileName> file8;\r
-               file8.Copy(file);\r
-               TAny *p[KMaxMessageArguments];\r
-               p[0]= (TAny*)(&file8);\r
-               TInt res = ss.SendReceive(PicoMsgLoadROM, &p[0]);\r
-\r
-               CEikonEnv::Static()->BusyMsgCancel();\r
-\r
-               if(res == 1)\r
-                       CEikonEnv::Static()->InfoWinL(_L("Error"), _L("Failed to open file."));\r
-               else if(res == 2)\r
-                       CEikonEnv::Static()->InfoWinL(_L("Error"), _L("Failed to allocate memory."));\r
-               else if(res == 3)\r
-                       CEikonEnv::Static()->InfoWinL(_L("Error"), _L("The file you selected is not a game ROM."));\r
-               else if(res == 4)\r
-                       CEikonEnv::Static()->InfoWinL(_L("Error"), _L("No game ROMs found in zipfile."));\r
-               else if(res == 5)\r
-                       CEikonEnv::Static()->InfoWinL(_L("Error"), _L("Failed while unzipping ROM."));\r
-               else if(res < 0)\r
-                       CEikonEnv::Static()->InfoWinL(_L("Error"), _L("Failed to send request to emu process."));\r
-               else {\r
-                       iROMLoaded = ETrue;\r
-                       iEmuRunning = ETrue;\r
-               }\r
-\r
-               // sound errors which leave ROM loaded\r
-               if(res == 6)\r
-                       CEikonEnv::Static()->InfoWinL(_L("Error"), _L("Failed to allocate sound buffer, disabled sound."));\r
-               else if(res == 7)\r
-                       CEikonEnv::Static()->InfoWinL(_L("Error"), _L("Failed to start soundsystem, disabled sound."));\r
-               if(res == 6 || res == 7) iCurrentConfig.iFlags &= ~4;\r
-\r
-               iCurrentLConfig.iLastROMFile.Copy(file);\r
-       }\r
-}\r
-\r
-\r
-void CPicolAppUi::DisplayConfigDialogL()\r
-{\r
-       CPicoConfigDialog* configDialog = new(ELeave)CPicoConfigDialog(iCurrentConfig, iCurrentLConfig);\r
-       configDialog->ExecuteLD(R_PICO_CONFIG);\r
-\r
-       if(iGameRunner)\r
-               SendConfig();\r
-\r
-       iCurrentLConfig.Save();\r
-\r
-       // configDialog seems to be actually destroyed later after returning,\r
-       // and this usually happens just after resuming game and causes emu slowdowns :/\r
-       iAfterConfigDialog = ETrue;\r
-       iConfigDialogClosed.UniversalTime();\r
-}\r
-\r
-\r
-void CPicolAppUi::DisplayDebugDialogL()\r
-{\r
-       // first get our debug info\r
-       char dtxt[1024];\r
-\r
-       TAny *p[KMaxMessageArguments];\r
-       TPtr8 descr((TUint8*) dtxt, sizeof(dtxt));\r
-       p[0]= (TAny*)(&descr);\r
-       ss.SendReceive(PicoMsgRetrieveDebugStr, &p[0]);\r
-\r
-       CEikDialog*     dialog = new(ELeave) CDebugDialog(dtxt);\r
-       dialog->ExecuteLD(R_DIALOG_DEBUG);\r
-}\r
-\r
-\r
-void CPicolAppUi::SendConfig()\r
-{\r
-       // send config\r
-       if(iGameRunner) {\r
-               TAny *p[KMaxMessageArguments];\r
-               TPtrC8 descr((TUint8*) &iCurrentConfig, sizeof(iCurrentConfig));\r
-               p[0]= (TAny*)(&descr);\r
-               ss.Send(PicoMsgConfigChange, &p[0]);\r
-       }\r
-}\r
-\r
-\r
-// get config from emu proc\r
-void CPicolAppUi::RetrieveConfig()\r
-{\r
-       // ask to configure keys and receive new config\r
-       TAny *p[KMaxMessageArguments];\r
-       TPtr8 descr((TUint8*) &iCurrentConfig, sizeof(iCurrentConfig));\r
-       p[0]= (TAny*)(&descr);\r
-       ss.SendReceive(PicoMsgRetrieveConfig, &p[0]);\r
-\r
-       iCurrentLConfig.Save();\r
-}\r
-\r
-\r
-void CPicolAppUi::NotifyEmuDeath()\r
-{\r
-       StopGame();\r
-       if(iQuitting) {\r
-               DEBUGPRINT(_L("[app] Exit (NotifyEmuDeath)"));\r
-               iCurrentLConfig.Save();\r
-               RProcess me;\r
-               me.Terminate(0);\r
-       }\r
-}\r
-\r
-\r
-void CPicolAppUi::NotifyForcedExit()\r
-{\r
-       DEBUGPRINT(_L("[app] Exit (NotifyForcedExit)"));\r
-       StopGame();\r
-       RProcess me;\r
-       me.Terminate(0);\r
-}\r
-\r
-\r
-TBool CPicolAppUi::EmuRunning() const\r
-{\r
-       return iEmuRunning;\r
-}\r
-\r
-\r
-void CPicolAppUi::StopGame()\r
-{\r
-       // in case we have busyMsg and process crashes\r
-       CEikonEnv::Static()->BusyMsgCancel();\r
-\r
-       ss.Close();\r
-       if(iGameRunner) delete iGameRunner;\r
-       iGameRunner = NULL;\r
-       if(iExitForcer) delete iExitForcer;\r
-       iExitForcer = NULL;\r
-       if(iThreadWatcher1) delete iThreadWatcher1;\r
-       iThreadWatcher1 = NULL;\r
-       iROMLoaded  = EFalse;\r
-       iEmuRunning = EFalse;\r
-}\r
-\r
-\r
-void CPicolAppUi::RunGameL()\r
-{\r
-       TInt res = KErrNone;\r
-\r
-       // do one connection attemt to emu and ask it to quit if we succeed\r
-       res = ss.Connect();\r
-       if(res == KErrNone) {\r
-               ss.Send(PicoMsgQuit, 0);\r
-               ss.Close();\r
-       }\r
-\r
-       iGameRunner = CGameRunner::NewL(*this);\r
-\r
-       // Connect to the server\r
-       // we don't want to do complex asynchronous stuff here, so we just\r
-       // wait and do several connection attempts\r
-       User::After(200000);\r
-       for(TInt attempt=0; attempt < 10; attempt++) {\r
-               res = ss.Connect();\r
-               if(res == KErrNone) break;\r
-               User::After(200000);\r
-       }\r
-\r
-       if(res != KErrNone) {\r
-               CEikonEnv::Static()->BusyMsgCancel();\r
-               CEikonEnv::Static()->InfoWinL(_L("Error"), _L("Failed to communicate with the emulation process."));\r
-               StopGame();\r
-               RProcess me;\r
-               me.Terminate(2);\r
-       }\r
-\r
-       // now we are successfully connected, that means emu process' helper-communication thread is running.\r
-       // we have to keep an eye on it too, because if it crashes, symbian OS leaves it's process\r
-       // alive, but it becomes useless without it's communication thread so we have to detect it's death.\r
-       iThreadWatcher1 = CThreadWatcher::NewL(*this, KServerName);\r
-\r
-       // send initial config\r
-       SendConfig();\r
-}\r
-\r
-\r
-/*\r
-void CPicolAppUi::HandleScreenDeviceChangedL()\r
-{\r
-       // does not receive when emu is in foreground\r
-       if(iCoeEnv->ScreenDevice()->CurrentScreenMode() == 0) { // flip open\r
-               // regain focus\r
-               //iCoeEnv->BringOwnerToFront();\r
-\r
-       }\r
-//     ss.Send(PicoMsgFlipChange, 0);\r
-}\r
-*/\r
-\r
-void CPicolAppUi::HandleApplicationSpecificEventL(TInt aType, const TWsEvent& aEvent)\r
-{\r
-       DEBUGPRINT(_L("[app] event from server: %i"), aEvent.Type());\r
-\r
-       switch (aEvent.Type())\r
-       {\r
-               case EEventKeyCfgDone:\r
-                       RetrieveConfig();\r
-                       break;\r
-               \r
-               case EEventGamePaused:\r
-                       iEmuRunning = EFalse;\r
-                       break;\r
-       }\r
-}\r
-\r
-////////////////////////////////////////////////////////////////\r
-//\r
-// class CEPicolAppView\r
-//\r
-////////////////////////////////////////////////////////////////\r
-\r
-void CEPicolAppView::ConstructL(const TRect& aRect)\r
-{\r
-       CreateWindowL();\r
-       SetRect(aRect);\r
-       ActivateL();\r
-\r
-               /*\r
-                * Load background image\r
-                */\r
-/*\r
-       TBuf<1> name = _L("*");\r
-       TRAPD(err, iBgImage = CEikonEnv::Static()->CreateBitmapL(name, EMbmEdoomDoom));\r
-       if (iBgImage)\r
-       {\r
-               iImagePosition.iX = (aRect.Size().iWidth - iBgImage->SizeInPixels().iWidth) / 2;\r
-               iImagePosition.iY = (aRect.Size().iHeight - iBgImage->SizeInPixels().iHeight) / 2;\r
-       }\r
-*/\r
-}\r
-\r
-CEPicolAppView::~CEPicolAppView()\r
-{\r
-       //if (iBgImage) delete iBgImage;\r
-}\r
-\r
-\r
-void CEPicolAppView::Draw(const TRect& aRect) const\r
-{\r
-       CWindowGc& gc = SystemGc();\r
-\r
-       //if (iBgImage)\r
-       //{\r
-       //      gc.DrawBitmap(iImagePosition, iBgImage);\r
-       //      DrawUtils::ClearBetweenRects(gc, Rect(), TRect(iImagePosition, iBgImage->SizeInPixels()));\r
-       //}\r
-       //else\r
-               gc.Clear();//aRect);\r
-}\r
-\r
-\r
-////////////////////////////////////////////////////////////////\r
-//\r
-// class CPicolViewBase\r
-//\r
-////////////////////////////////////////////////////////////////\r
-\r
-void CPicolViewBase::ViewActivatedL(const TVwsViewId& /*aPrevViewId*/, TUid /*aCustomMessageId*/, const TDesC8& /*aCustomMessage*/)\r
-{\r
-       TPixelsAndRotation sizeAndRotation;\r
-       CEikonEnv::Static()->ScreenDevice()->GetDefaultScreenSizeAndRotation(sizeAndRotation);\r
-       CEikonEnv::Static()->ScreenDevice()->SetScreenSizeAndRotation(sizeAndRotation);\r
-       //iAppViewCtl.MakeVisible(ETrue);\r
-}\r
-\r
-void CPicolViewBase::ViewDeactivated()\r
-{\r
-       //iAppViewCtl.MakeVisible(EFalse);\r
-}\r
-\r
-\r
-////////////////////////////////////////////////////////////////\r
-//\r
-// class CPicolFOView\r
-//\r
-////////////////////////////////////////////////////////////////\r
-\r
-TVwsViewId CPicolFOView::ViewId() const\r
-{\r
-       return TVwsViewId(KUidPicolApp, KUidPicolFOView);\r
-}\r
-\r
-TVwsViewIdAndMessage CPicolFOView::ViewScreenDeviceChangedL()\r
-{\r
-       // only handle change to FC mode when emu process is running\r
-       if(static_cast<CPicolAppUi*>(CEikonEnv::Static()->AppUi())->EmuRunning())\r
-                return TVwsViewIdAndMessage(TVwsViewId(KUidPicolApp, KUidPicolFCView));\r
-       else return MCoeView::ViewScreenDeviceChangedL();\r
-}\r
-\r
-TBool CPicolFOView::ViewScreenModeCompatible(TInt aScreenMode)\r
-{\r
-       return (aScreenMode == EScreenModeFlipOpen);\r
-}\r
-\r
-void CPicolFOView::ViewActivatedL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage)\r
-{\r
-       DEBUGPRINT(_L("[app] FO"));\r
-       CPicolViewBase::ViewActivatedL(aPrevViewId, aCustomMessageId, aCustomMessage);\r
-       CEikonEnv::Static()->AppUiFactory()->MenuBar()->MakeVisible(ETrue);\r
-\r
-       iAppViewCtl.SetRect(static_cast<CEikAppUi*>(CEikonEnv::Static()->AppUi())->ClientRect());\r
-}\r
-\r
-\r
-////////////////////////////////////////////////////////////////\r
-//\r
-// class CPicolFCView\r
-//\r
-////////////////////////////////////////////////////////////////\r
-\r
-TVwsViewId CPicolFCView::ViewId() const\r
-{\r
-       return TVwsViewId(KUidPicolApp, KUidPicolFCView);\r
-}\r
-\r
-TVwsViewIdAndMessage CPicolFCView::ViewScreenDeviceChangedL()\r
-{\r
-       return TVwsViewIdAndMessage(TVwsViewId(KUidPicolApp, KUidPicolFOView));\r
-}\r
-\r
-TBool CPicolFCView::ViewScreenModeCompatible(TInt aScreenMode)\r
-{\r
-       return (aScreenMode == EScreenModeFlipClosed);\r
-}\r
-\r
-void CPicolFCView::ViewActivatedL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage)\r
-{\r
-       DEBUGPRINT(_L("[app] FC"));\r
-       CPicolViewBase::ViewActivatedL(aPrevViewId, aCustomMessageId, aCustomMessage);\r
-       CEikonEnv::Static()->AppUiFactory()->MenuBar()->MakeVisible(EFalse);\r
-       //iAppViewCtl.ChangeLayout(ETrue);\r
-       iAppViewCtl.SetRect(CEikonEnv::Static()->ScreenDevice()->SizeInPixels());\r
-}\r
-\r
-\r
-////////////////////////////////////////////////////////////////\r
-//\r
-// framework\r
-//\r
-////////////////////////////////////////////////////////////////\r
-\r
-GLDEF_C TInt E32Dll(TDllReason)\r
-{\r
-       return KErrNone;\r
-}\r
-\r
-\r
-EXPORT_C CApaApplication* NewApplication()\r
-{\r
-       return new CPicolApplication;\r
-}\r
-\r
-\r
-TUid CPicolApplication::AppDllUid() const\r
-{\r
-       return KUidPicolApp;\r
-}\r
-\r
diff --git a/platform/uiq2/launcher/App.h b/platform/uiq2/launcher/App.h
deleted file mode 100644 (file)
index 1ac6526..0000000
+++ /dev/null
@@ -1,178 +0,0 @@
-/*******************************************************************\r
- *\r
- *     File:           App.h\r
- *\r
- *     Author:         Peter van Sebille (peter@yipton.net)\r
- *\r
- *  Modified/adapted for picodriveN by notaz, 2006\r
- *\r
- *  (c) Copyright 2006, notaz\r
- *     (c) Copyright 2001, Peter van Sebille\r
- *     All Rights Reserved\r
- *\r
- *******************************************************************/\r
-\r
-#ifndef __APP_H\r
-#define __APP_H\r
-\r
-#include <coecntrl.h>\r
-#include <coeccntx.h>\r
-#include <coemain.h>\r
-\r
-#include <eikappui.h>\r
-#include <eikapp.h>\r
-#include <eikdoc.h>\r
-\r
-#include "Engine.h"\r
-#include "../ClientServer.h"\r
-#include "SimpleClient.h"\r
-#include "picodriven.hrh"\r
-\r
-const TUid KUidPicolApp    = { 0x1000C193 };\r
-const TUid KUidPicolFOView = { 0x1000C194 };\r
-const TUid KUidPicolFCView = { 0x1000C195 };\r
-\r
-enum\r
-{\r
-  EScreenModeFlipOpen = 0,\r
-  EScreenModeFlipClosed\r
-};\r
-\r
-\r
-//class CWsBitmap;\r
-\r
-\r
-class CPicolDocument : public CEikDocument\r
-{\r
-public:\r
-       ~CPicolDocument();\r
-       CPicolDocument(CEikApplication& aApp);\r
-       void ConstructL();\r
-\r
-private: // from CEikDocument\r
-       CEikAppUi* CreateAppUiL();\r
-};\r
-\r
-\r
-class CEPicolAppView : public CCoeControl // , public MCoeControlBrushContext\r
-{\r
-public:\r
-       ~CEPicolAppView();\r
-       void ConstructL(const TRect& aRect);\r
-\r
-private:\r
-       void Draw(const TRect& aRect) const;\r
-\r
-       //CWsBitmap*    iBgImage;\r
-       //TPoint                iImagePosition;\r
-};\r
-\r
-\r
-class CPicolViewBase : public CBase, public MCoeView\r
-{\r
- public:\r
-\r
-  CPicolViewBase(CEPicolAppView& aAppViewCtl) : iAppViewCtl(aAppViewCtl) {}\r
-  //~CPicolViewBase();\r
-  \r
- protected:            \r
-\r
-  // implements MCoeView:\r
-  virtual void ViewActivatedL(const TVwsViewId& /*aPrevViewId*/, TUid /*aCustomMessageId*/, const TDesC8& /*aCustomMessage*/);\r
-  virtual void ViewDeactivated();\r
-  //virtual void ViewConstructL();\r
-  \r
-  CEPicolAppView& iAppViewCtl;\r
-};\r
-\r
-\r
-class CPicolFOView : public CPicolViewBase\r
-{\r
- public:\r
-\r
-  CPicolFOView(CEPicolAppView& aAppViewCtl) : CPicolViewBase(aAppViewCtl) {}\r
-  //~CPicolFOView();\r
-  virtual TVwsViewId ViewId() const;\r
-  virtual TVwsViewIdAndMessage ViewScreenDeviceChangedL();\r
-  virtual TBool ViewScreenModeCompatible(TInt aScreenMode);\r
-  virtual void ViewActivatedL(const TVwsViewId& /*aPrevViewId*/, TUid /*aCustomMessageId*/, const TDesC8& /*aCustomMessage*/);\r
-};\r
-\r
-\r
-class CPicolFCView : public CPicolViewBase\r
-{\r
- public:\r
-\r
-  CPicolFCView(CEPicolAppView& aAppViewCtl) : CPicolViewBase(aAppViewCtl) {}\r
-  //~CPicolFCView();\r
-  virtual TVwsViewId ViewId() const;\r
-  virtual TVwsViewIdAndMessage ViewScreenDeviceChangedL();\r
-  virtual TBool ViewScreenModeCompatible(TInt aScreenMode);\r
-  virtual void ViewActivatedL(const TVwsViewId& /*aPrevViewId*/, TUid /*aCustomMessageId*/, const TDesC8& /*aCustomMessage*/);\r
-};\r
-\r
-\r
-\r
-class CPicolAppUi : public CEikAppUi, public MGameWatcher\r
-{\r
-public:\r
-       CPicolAppUi();\r
-       void ConstructL();\r
-       ~CPicolAppUi();\r
-\r
-public:                        // implements MGameWatcher\r
-       void NotifyEmuDeath();\r
-       void NotifyForcedExit();\r
-\r
-       TBool EmuRunning() const;\r
-\r
-protected: // from CEikAppUi\r
-       void HandleCommandL(TInt aCommand);\r
-       void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane);\r
-       void HandleSystemEventL(const TWsEvent& aEvent);\r
-\r
-protected:             // new stuf\r
-       void DisplayAboutDialogL();\r
-       void DisplayOpenROMDialogL();\r
-       void DisplayConfigDialogL();\r
-       void DisplayDebugDialogL();\r
-\r
-       void StopGame();\r
-       void RunGameL();\r
-       void SendConfig();\r
-       void RetrieveConfig();\r
-\r
-       CGameRunner*                    iGameRunner;\r
-       CExitForcer*                    iExitForcer;            // makes sure emu process exits\r
-       CThreadWatcher*                 iThreadWatcher1;        // emu process helper thread watcher\r
-    RServSession                       ss;\r
-\r
-private:\r
-       //void HandleScreenDeviceChangedL();\r
-       //void HandleWsEventL(const TWsEvent& aEvent, CCoeControl* aDestination);\r
-       virtual void HandleApplicationSpecificEventL(TInt aType, const TWsEvent& aEvent);\r
-\r
-private:\r
-       TBool                           iQuitting;\r
-       TBool                           iROMLoaded;\r
-       TBool                           iEmuRunning;\r
-       TBool                           iAfterConfigDialog;\r
-       TTime                           iConfigDialogClosed;\r
-       TPicoConfig                     iCurrentConfig;\r
-       TPLauncherConfig        iCurrentLConfig;\r
-\r
-       CEPicolAppView*         iAppView;\r
-       CPicolFOView*           iFOView;\r
-       CPicolFCView*           iFCView;\r
-};\r
-\r
-\r
-\r
-class CPicolApplication : public CEikApplication\r
-{\r
-private: // from CApaApplication\r
-       CApaDocument* CreateDocumentL();\r
-       TUid AppDllUid() const;\r
-};\r
-\r
-#endif\r
diff --git a/platform/uiq2/launcher/CSimpleTextParser.cpp b/platform/uiq2/launcher/CSimpleTextParser.cpp
deleted file mode 100644 (file)
index 865e35e..0000000
+++ /dev/null
@@ -1,477 +0,0 @@
-/*******************************************************************\r
- *\r
- *     File:           CSimpleTextParser.cpp\r
- *\r
- *     Author:         Peter van Sebille (peter@yipton.net)\r
- *\r
- *     (c) Copyright 2002, Peter van Sebille\r
- *     All Rights Reserved\r
- *\r
- *******************************************************************/\r
-\r
-#include "CSimpleTextParser.h"\r
-\r
-enum\r
-{\r
-       EBadTag,\r
-       EBadZeroLengthTag,\r
-       EBadIntegerParam,\r
-       EBadAlignmentParam,\r
-       EBadRgbColorParam\r
-};\r
-\r
-void Panic(TInt aPanic)\r
-{\r
-       User::Panic(_L("STP"), aPanic);\r
-}\r
-\r
-CSimpleTextFormatParser* CSimpleTextFormatParser::NewLC()\r
-{\r
-       CSimpleTextFormatParser*        self = new(ELeave)CSimpleTextFormatParser;\r
-       CleanupStack::PushL(self);\r
-       self->ConstructL();\r
-       return self;\r
-}\r
-\r
-CSimpleTextFormatParser::~CSimpleTextFormatParser()\r
-{\r
-       delete iParaFormat;\r
-}\r
-\r
-void CSimpleTextFormatParser::ConstructL()\r
-{\r
-       iParaFormat = CParaFormat::NewL();\r
-}\r
-\r
-\r
-void CSimpleTextFormatParser::SetBold(TBool aEnable)\r
-{\r
-       iCharFormat.iFontSpec.iFontStyle.SetStrokeWeight(aEnable ? EStrokeWeightBold : EStrokeWeightNormal);\r
-       iCharMask.ClearAll();\r
-       iCharMask.SetAttrib(EAttFontStrokeWeight);\r
-       iRichText->ApplyCharFormatL(iCharFormat, iCharMask, TextPos(), 0);\r
-}\r
-\r
-void CSimpleTextFormatParser::SetItalic(TBool aEnable)\r
-{\r
-       iCharFormat.iFontSpec.iFontStyle.SetPosture(aEnable ? EPostureItalic : EPostureUpright);\r
-       iCharMask.ClearAll();\r
-       iCharMask.SetAttrib(EAttFontPosture);\r
-       iRichText->ApplyCharFormatL(iCharFormat, iCharMask, TextPos(), 0);\r
-}\r
-\r
-void CSimpleTextFormatParser::SetUnderLine(TBool aEnable)\r
-{\r
-       iCharFormat.iFontPresentation.iUnderline = aEnable ? EUnderlineOn : EUnderlineOff;\r
-       iCharMask.ClearAll();\r
-       iCharMask.SetAttrib(EAttFontUnderline);\r
-       iRichText->ApplyCharFormatL(iCharFormat, iCharMask, TextPos(), 0);\r
-}\r
-\r
-void CSimpleTextFormatParser::SetHiddenText(TBool aEnable)\r
-{\r
-       iCharFormat.iFontPresentation.iHiddenText = aEnable;\r
-       iCharMask.ClearAll();\r
-       iCharMask.SetAttrib(EAttFontHiddenText);\r
-       iRichText->ApplyCharFormatL(iCharFormat, iCharMask, TextPos(), 0);\r
-}\r
-\r
-TRgb CSimpleTextFormatParser::ForegroundColor()\r
-{\r
-       iCharMask.ClearAll();\r
-       iCharMask.SetAttrib(EAttColor);\r
-       iRichText->GetCharFormat(iCharFormat, iCharMask, TextPos(), 0);\r
-       return iCharFormat.iFontPresentation.iTextColor;\r
-}\r
-\r
-void CSimpleTextFormatParser::SetForegroundColor(const TRgb& aColor)\r
-{\r
-       iCharFormat.iFontPresentation.iTextColor = aColor;\r
-       iCharMask.ClearAll();\r
-       iCharMask.SetAttrib(EAttColor);\r
-       iRichText->ApplyCharFormatL(iCharFormat, iCharMask, TextPos(), 0);\r
-}\r
-\r
-void CSimpleTextFormatParser::SetBackgroundColor(const TRgb& aColor)\r
-{\r
-       iParaFormat->iFillColor = aColor;\r
-       iParaMask.ClearAll();\r
-       iParaMask.SetAttrib(EAttFillColor);\r
-       iRichText->ApplyParaFormatL(iParaFormat, iParaMask, ParaPos(), 0);\r
-}\r
-\r
-void CSimpleTextFormatParser::NewParagraph()\r
-{\r
-       iCurrentPara++;\r
-       iRichText->AppendParagraphL();\r
-       AppendTextL(_L(""));\r
-}\r
-\r
-\r
-void CSimpleTextFormatParser::SetAlignment(CParaFormat::TAlignment aAlignment)\r
-{\r
-       iParaFormat->iHorizontalAlignment = aAlignment;\r
-       iParaMask.ClearAll();\r
-       iParaMask.SetAttrib(EAttAlignment);\r
-       iRichText->ApplyParaFormatL(iParaFormat, iParaMask, ParaPos(), 0);\r
-}\r
-\r
-\r
-void CSimpleTextFormatParser::SetFontHeight(TInt aHeight)\r
-{\r
-       iCharFormat.iFontSpec.iHeight = (aHeight * KTwipsPerInch)/KPointsPerInch;\r
-       iCharMask.ClearAll();\r
-       iCharMask.SetAttrib(EAttFontHeight);\r
-       iRichText->ApplyCharFormatL(iCharFormat, iCharMask, TextPos(), 0);\r
-}\r
-\r
-void CSimpleTextFormatParser::SetFontName(const TDesC& aName)\r
-{\r
-       iCharFormat.iFontSpec.iTypeface.iName = aName;\r
-       iCharFormat.iFontSpec.iTypeface.SetAttributes(0);\r
-       iCharFormat.iFontSpec.iTypeface.SetIsProportional(ETrue);\r
-       iCharMask.ClearAll();\r
-       iCharMask.SetAttrib(EAttFontTypeface);\r
-       iRichText->ApplyCharFormatL(iCharFormat, iCharMask, TextPos(), 0);\r
-}\r
-\r
-\r
-/*\r
- * Character formatting:\r
- * <b>                         Bold on\r
- * </b>                                Bold of\r
- * <i>                         Italic on\r
- * </i>                                Italic off\r
- * <u>                         Underline on\r
- * </u>                                Underline off\r
- * <h>                         Hidden text on          **doesn't work**\r
- * </h>                                Hidden text off         **doesn't work**\r
- * <f=name>                    Fontname: name (type: string)\r
- * <s=size>                    Fontsize: size (type: integer)\r
- * <fg=color>          Foreground color: color (type: color)\r
- * </fg>                       Restore foreground color\r
- *\r
- * Paragraph formatting:\r
- * <p>                         New paragraph - will reset both character & paragraph formatting to defaults\r
- * <a=align>           Alignment: aling (type: alignement)\r
- * <bg=color>          Background color: color (type: color) **doesn't work**\r
- *\r
- * Special characters:\r
- * </<>                                The character: <\r
- *\r
- * Types:\r
- * - string:\r
- * - integer:          Either decimal or hexidecimal value\r
- * - color:                    Either integer specifing rgb value, or (r,g,b) in which r, g and b are of type integer\r
- * - align:                    element of enumeration {center, left, right}\r
- *\r
- * Comments:\r
- * The syntax/parser is fairly simplistic. The parser is not trying to match a tag like \r
- * <tag> </tag> as XML/HTML do. Basically, when it encounters a tag (e.g., <b>) it will \r
- * simply instruct the the editor to apply the formatting from the current position as \r
- * specified by the tag (e.g., enable bold). For example, <b><b>Hello</b>World</b> results\r
- * in Hello displayed in a Bold font and World in a normal font.\r
- *\r
- * The only case where state is maintained is when using <fg=color> and </fg>. The current\r
- * fg color is stored when parsing <fg=color> and restored when doing </fg>. Again, <fg> and \r
- * </fg> don't have the XML/HTML <tag> </tag> behavior. For example:\r
- *       <fg=red>Peter<fg=blue>was</fg></fg>here\r
- * results in "Peter" displayed in red, "was" displayed in blue and "here" displayed in red.\r
- * It literally goes like this:\r
- *   1) <fg=red>  --> apply editor text color red, previous color = whatever the editor's text color is now\r
- *   2) <fg=blue> --> apply editor text color blue, previous color = whatever the editor's text color \r
- *                    is now --> red\r
- *   3) </fg>     --> apply editor text to previous color --> red\r
- *   4) </fg>     --> apply editor text to previous color --> red\r
- *\r
- * What you probably wanted was:\r
- *       <fg=red>Peter</fg><fg=blue>was</fg>here\r
- * Now "Peter" is displayed in red, "was" in blue and "here" in the default editor's color\r
- */\r
-\r
-static TUint32 ParseInteger(const TDesC& aString)\r
-{\r
-       TUint32         val = 0;\r
-       TBool           parsed = EFalse;\r
-       if (aString.Length() > 2)\r
-       {\r
-               if ((aString[0] == '0') && ((aString[0] == 'x') || (aString[0] == 'X')))\r
-               {\r
-                       TLex    lex(aString.Right(aString.Length()-2));\r
-                       if (lex.Val(val, EHex) != KErrNone)\r
-                       {\r
-                               __ASSERT_DEBUG(ETrue, Panic(EBadIntegerParam));\r
-                       }\r
-                       parsed = ETrue;\r
-               }\r
-       }\r
-       if (!parsed)\r
-       {\r
-               TLex    lex(aString);\r
-               if (lex.Val(val, EDecimal) != KErrNone)\r
-               {\r
-                       __ASSERT_DEBUG(ETrue, Panic(EBadIntegerParam));\r
-               }\r
-       }\r
-       return val;\r
-}\r
-\r
-static TRgb ParseColor(const TDesC& aString)\r
-{\r
-       if (aString.Length() > 0)\r
-       {\r
-               if (aString[0] == 'R')\r
-               {\r
-                       if (aString.Compare(_L("RgbBlack")) == 0)\r
-                               return KRgbBlack;\r
-                       else if (aString.Compare(_L("RgbDarkGray")) == 0)\r
-                               return KRgbDarkGray;\r
-                       else if (aString.Compare(_L("RgbDarkRed")) == 0)\r
-                               return KRgbDarkRed;\r
-                       else if (aString.Compare(_L("RgbDarkGreen")) == 0)\r
-                               return KRgbDarkGreen;\r
-                       else if (aString.Compare(_L("RgbDarkYellow")) == 0)\r
-                               return KRgbDarkYellow;\r
-                       else if (aString.Compare(_L("RgbDarkBlue")) == 0)\r
-                               return KRgbDarkBlue;\r
-                       else if (aString.Compare(_L("RgbDarkMagenta")) == 0)\r
-                               return KRgbDarkMagenta;\r
-                       else if (aString.Compare(_L("RgbDarkCyan")) == 0)\r
-                               return KRgbDarkCyan;\r
-                       else if (aString.Compare(_L("RgbRed")) == 0)\r
-                               return KRgbRed;\r
-                       else if (aString.Compare(_L("RgbGreen")) == 0)\r
-                               return KRgbGreen;\r
-                       else if (aString.Compare(_L("RgbYellow")) == 0)\r
-                               return KRgbYellow;\r
-                       else if (aString.Compare(_L("RgbBlue")) == 0)\r
-                               return KRgbBlue;\r
-                       else if (aString.Compare(_L("RgbMagenta")) == 0)\r
-                               return KRgbMagenta;\r
-                       else if (aString.Compare(_L("RgbCyan")) == 0)\r
-                               return KRgbCyan;\r
-                       else if (aString.Compare(_L("RgbGray")) == 0)\r
-                               return KRgbGray;\r
-                       else if (aString.Compare(_L("RgbWhite")) == 0)\r
-                               return KRgbWhite;\r
-                       else\r
-                       {\r
-                               __ASSERT_DEBUG(ETrue, Panic(EBadRgbColorParam));\r
-                       }\r
-               }\r
-               return ParseInteger(aString);\r
-       }\r
-       __ASSERT_DEBUG(ETrue, Panic(EBadRgbColorParam));\r
-\r
-       return KRgbBlack;\r
-}\r
-\r
-\r
-\r
-static CParaFormat::TAlignment ParseAlignment(const TDesC& aString)\r
-{\r
-       if (aString.Compare(_L("center")) == 0)\r
-       {\r
-               return CParaFormat::ECenterAlign;\r
-       }\r
-       else if (aString.Compare(_L("left")) == 0)\r
-       {\r
-               return CParaFormat::ELeftAlign;\r
-       }\r
-       else if (aString.Compare(_L("right")) == 0)\r
-       {\r
-               return CParaFormat::ERightAlign;\r
-       }\r
-       __ASSERT_DEBUG(ETrue, Panic(EBadAlignmentParam));\r
-\r
-       return CParaFormat::ECenterAlign;\r
-}\r
-\r
-void CSimpleTextFormatParser::ParseTagL(const TDesC& aTag)\r
-{\r
-       TInt    tagLength = aTag.Length();\r
-       if (tagLength == 0)\r
-       {\r
-               __ASSERT_DEBUG(ETrue, Panic(EBadZeroLengthTag));\r
-               return;\r
-       }\r
-\r
-       TPtrC   param(_L(""));\r
-       TInt pos = aTag.Find(_L("="));\r
-       if (pos>0)\r
-       {\r
-               param.Set(aTag.Right(aTag.Length()-pos-1));\r
-               tagLength = pos;\r
-       }\r
-       TPtrC   tag = aTag.Left(tagLength);\r
-\r
-//     RDebug::Print(_L("tag=%S, param=%S"), &tag, &param);\r
-\r
-       switch (tagLength)\r
-       {\r
-               case 1:\r
-               {\r
-                       if (tag.Compare(_L("a")) == 0)\r
-                               SetAlignment(ParseAlignment(param));\r
-                       else if (tag.Compare(_L("b")) == 0)\r
-                               SetBold();\r
-                       else if (tag.Compare(_L("f")) == 0)\r
-                               SetFontName(param);\r
-                       else if (tag.Compare(_L("h")) == 0)\r
-                               SetHiddenText();\r
-                       else if (tag.Compare(_L("i")) == 0)\r
-                               SetItalic();\r
-                       else if (tag.Compare(_L("p")) == 0)\r
-                               NewParagraph();\r
-                       else if (tag.Compare(_L("s")) == 0)\r
-                               SetFontHeight(ParseInteger(param));\r
-                       else if (tag.Compare(_L("u")) == 0)\r
-                               SetUnderLine();\r
-                       else\r
-                       {\r
-                               __ASSERT_DEBUG(ETrue, Panic(EBadTag));\r
-                       }\r
-                       break;\r
-               }\r
-               \r
-               case 2:\r
-               {\r
-                       if (tag.Compare(_L("/b")) == 0)\r
-                               SetBold(EFalse);\r
-                       if (tag.Compare(_L("bg")) == 0)\r
-                               SetBackgroundColor(ParseColor(param));\r
-                       if (tag.Compare(_L("fg")) == 0)\r
-                       {\r
-                               iPrevFgColor = ForegroundColor();\r
-                               SetForegroundColor(ParseColor(param));\r
-                       }\r
-                       else if (tag.Compare(_L("/h")) == 0)\r
-                               SetHiddenText(EFalse);\r
-                       else if (tag.Compare(_L("/i")) == 0)\r
-                               SetItalic(EFalse);\r
-                       else if (tag.Compare(_L("/u")) == 0)\r
-                               SetUnderLine(EFalse);\r
-                       else if (tag.Compare(_L("/<")) == 0)\r
-                               AppendTextL(_L("<"));\r
-                       break;\r
-               }\r
-               case 3:\r
-               {\r
-                       if (tag.Compare(_L("/fg")) == 0)\r
-                               SetForegroundColor(iPrevFgColor);\r
-                       break;\r
-               }\r
-               default:\r
-                       ;\r
-       }\r
-}\r
-\r
-void CSimpleTextFormatParser::ParseL(const TDesC& aSimpleText, CRichText& aRichText)\r
-{\r
-       iRichText = &aRichText;\r
-       iCurrentPara = 0;\r
-\r
-       TBool   done = EFalse;\r
-       TPtrC simpleText(aSimpleText);\r
-       do\r
-       {\r
-               TInt pos = simpleText.Locate('<');\r
-               if (pos > 0)\r
-               {\r
-                       AppendTextL(simpleText.Left(pos));\r
-                       simpleText.Set(simpleText.Right(simpleText.Length() - pos));\r
-               }\r
-               else if (pos == 0)\r
-               {\r
-                       pos = simpleText.Locate('>');\r
-                       if (pos<=0)\r
-                               User::Leave(KErrArgument);\r
-                       ParseTagL(simpleText.Mid(1, pos-1));\r
-                       simpleText.Set(simpleText.Right(simpleText.Length() - pos - 1));\r
-               }\r
-               else\r
-               {\r
-                       AppendTextL(simpleText);\r
-                       done = ETrue;\r
-               }\r
-       } while (!done);\r
-}\r
-\r
-\r
-TInt CSimpleTextFormatParser::TextPos()\r
-{\r
-       return iRichText->DocumentLength();\r
-#if 0\r
-       TInt pos, length;\r
-       pos = iRichText->CharPosOfParagraph(length, iCurrentPara);\r
-       return pos+length-1;\r
-#endif\r
-}\r
-\r
-TInt CSimpleTextFormatParser::ParaPos()\r
-{\r
-       return TextPos();\r
-#if 0\r
-       TInt pos, length;\r
-       pos = iRichText->CharPosOfParagraph(length, iCurrentPara);\r
-       return pos+length-1;\r
-#endif\r
-}\r
-\r
-\r
-void CSimpleTextFormatParser::AppendTextL(const TDesC& aText)\r
-{\r
-//     RDebug::Print(_L("text=%S"), &aText);\r
-       iRichText->InsertL(TextPos(), aText);\r
-}\r
-\r
-\r
-#if 0\r
-void CTestDialog::ShowTextL(CRichText& aRichText)\r
-{\r
-       aRichText.Reset();\r
-\r
-       TCharFormat                     charFormat;\r
-       TCharFormatMask         charMask;\r
-       aRichText.GetCharFormat(charFormat, charMask, 0, 0);\r
-\r
-       TInt para = 0;\r
-       AppendTextL(_L("http://www.yipton.net"), aRichText);\r
-\r
-       para++;\r
-       aRichText.AppendParagraphL();\r
-\r
-       CParaFormat*    paraFormat = CParaFormat::NewLC();\r
-       TParaFormatMask paraMask;\r
-       aRichText.GetParaFormatL(paraFormat, paraMask, ParaPos(aRichText, para), 0);\r
-       paraFormat->iHorizontalAlignment = CParaFormat::ECenterAlign;\r
-       paraMask.ClearAll();\r
-       paraMask.SetAttrib(EAttAlignment);\r
-       aRichText.ApplyParaFormatL(paraFormat, paraMask, ParaPos(aRichText, para), 0);\r
-\r
-       charFormat.iFontPresentation.iUnderline = EUnderlineOn;\r
-       charFormat.iFontSpec.iFontStyle.SetPosture(EPostureItalic);\r
-       charMask.ClearAll();\r
-       charMask.SetAttrib(EAttFontPosture);\r
-       charMask.SetAttrib(EAttFontUnderline);\r
-       aRichText.ApplyCharFormatL(charFormat, charMask, TextPos(aRichText, para));\r
-       AppendTextL(_L("mailto:Peter is here"), aRichText, para);\r
-\r
-       para++;\r
-       aRichText.AppendParagraphL();\r
-\r
-       TFontSpec       fontSpec(_L("edmunds"), 20 * KPointsPerInch);\r
-//     CFont*  font = NULL;\r
-//     iCoeEnv->ScreenDevice()->GetNearestFontInTwips(font, fontSpec);\r
-\r
-       charFormat.iFontSpec = fontSpec;\r
-       charMask.ClearAll();\r
-       charMask.SetAttrib(EAttFontHeight);\r
-       charMask.SetAttrib(EAttFontTypeface);\r
-       aRichText.ApplyCharFormatL(charFormat, charMask, TextPos(aRichText, para));\r
-       AppendTextL(_L("mailto:Peter is here"), aRichText, para);\r
-\r
-       CleanupStack::PopAndDestroy();\r
-}\r
-\r
-#endif\r
diff --git a/platform/uiq2/launcher/CSimpleTextParser.h b/platform/uiq2/launcher/CSimpleTextParser.h
deleted file mode 100644 (file)
index 6f6b76c..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************\r
- *\r
- *     File:           CSimpleTextParser.h\r
- *\r
- *     Author:         Peter van Sebille (peter@yipton.net)\r
- *\r
- *  Modified/adapted for picodriveN by notaz, 2006\r
- *\r
- *  (c) Copyright 2006, notaz\r
- *     (c) Copyright 2002, Peter van Sebille\r
- *     All Rights Reserved\r
- *\r
- *******************************************************************/\r
-\r
-#ifndef __CSIMPLE_TEXT_PARSER_H\r
-#define __CSIMPLE_TEXT_PARSER_H\r
-\r
-#include <e32def.h>\r
-#include <txtrich.h>                           // CRichText\r
-#include <eikrted.h>                           // CEikRichTextEditor\r
-\r
-class CSimpleTextFormatParser : public CBase\r
-{\r
-public:\r
-       static CSimpleTextFormatParser* NewLC();\r
-       void ParseL(const TDesC& aPSTText, CRichText& aRichText);\r
-\r
-protected:\r
-       CSimpleTextFormatParser(){}\r
-       ~CSimpleTextFormatParser();\r
-       void ConstructL();\r
-\r
-       void ParseTagL(const TDesC& aTag);\r
-\r
-       TRgb ForegroundColor();\r
-       void SetBold(TBool aEnable=ETrue);\r
-       void SetItalic(TBool aEnable=ETrue);\r
-       void SetUnderLine(TBool aEnable=ETrue);\r
-       void SetFontHeight(TInt aHeight);\r
-       void SetFontName(const TDesC& aName);\r
-       void SetHiddenText(TBool aEnable=ETrue);\r
-       void SetForegroundColor(const TRgb& aColor);\r
-\r
-       void NewParagraph();\r
-       void SetAlignment(CParaFormat::TAlignment aAlignment);\r
-       void SetBackgroundColor(const TRgb& aColor);\r
-\r
-       void AppendTextL(const TDesC& aText);\r
-       TInt TextPos();\r
-       TInt ParaPos();\r
-\r
-\r
-       CRichText*                      iRichText;\r
-       TCharFormat                     iCharFormat;\r
-       TCharFormatMask         iCharMask;\r
-       CParaFormat*            iParaFormat;\r
-       TParaFormatMask         iParaMask;\r
-       TInt                            iCurrentPara;\r
-       TRgb                            iPrevFgColor;\r
-};\r
-\r
-#endif                 /* __CSIMPLE_TEXT_PARSER_H */\r
diff --git a/platform/uiq2/launcher/Dialogs.cpp b/platform/uiq2/launcher/Dialogs.cpp
deleted file mode 100644 (file)
index 847d7b0..0000000
+++ /dev/null
@@ -1,473 +0,0 @@
-/*******************************************************************\r
- *\r
- *     File:           Dialogs.cpp\r
- *\r
- *     Author:         Peter van Sebille (peter@yipton.net)\r
- *\r
- *  Modified/adapted for picodriveN by notaz, 2006\r
- *\r
- *  (c) Copyright 2006, notaz\r
- *     (c) Copyright 2002, Peter van Sebille\r
- *     All Rights Reserved\r
- *\r
- *******************************************************************/\r
-\r
-#include "Dialogs.h"\r
-#include "Engine.h"\r
-#include "picodriven.hrh"\r
-#include "picodriven.rsg"\r
-\r
-#include "../version.h"\r
-#include "CSimpleTextParser.h"\r
-#include <txtrich.h>                           // CRichText\r
-#include <eikrted.h>                           // CEikRichTextEditor\r
-#include <qikvertoptionbuttonlist.h> // CEikHorOptionButtonList\r
-#include <eikopbut.h>   // CEikOptionButton\r
-#include <QuartzKeys.h> // EQuartzKeyTwoWayDown\r
-\r
-\r
-/************************************************\r
- *\r
- * config Dialog\r
- *\r
- ************************************************/\r
-\r
-CPicoConfigDialog::CPicoConfigDialog(TPicoConfig &cfg, TPLauncherConfig &cfgl) : config(cfg), config_l(cfgl)\r
-{\r
-}\r
-\r
-void CPicoConfigDialog::PostLayoutDynInitL()\r
-{\r
-       CEikHorOptionButtonList *buttons_rot   = (CEikHorOptionButtonList*) Control( ECtlOptRotation );\r
-       CEikHorOptionButtonList *buttons_disp  = (CEikHorOptionButtonList*) Control( ECtlOptScreenMode );\r
-       CEikCheckBox            *chkbox_altrend= (CEikCheckBox*)            Control( ECtlOptUseAltRend );\r
-       CEikCheckBox            *chkbox_acctmng= (CEikCheckBox*)            Control( ECtlOptUseAccTiming );\r
-       CEikCheckBox            *chkbox_sram   = (CEikCheckBox*)            Control( ECtlOptUseSRAM );\r
-       CEikCheckBox            *chkbox_fps    = (CEikCheckBox*)            Control( ECtlOptShowFPS );\r
-       CEikCheckBox            *chkbox_sound  = (CEikCheckBox*)            Control( ECtlOptEnableSound );\r
-       CEikCheckBox            *chkbox_z80    = (CEikCheckBox*)            Control( ECtlOptEmulateZ80 );\r
-       CEikCheckBox            *chkbox_ym2612 = (CEikCheckBox*)            Control( ECtlOptEmulateYM2612 );\r
-       CEikCheckBox            *chkbox_sn76496= (CEikCheckBox*)            Control( ECtlOptEmulateSN76496 );\r
-       CEikChoiceListBase      *combo_sndq    = (CEikChoiceListBase*)      Control( ECtlOptSndQuality );\r
-       CEikCheckBox            *chkbox_6bpad  = (CEikCheckBox*)            Control( ECtlOpt6ButtonPad );\r
-       CEikCheckBox            *chkbox_gzipst = (CEikCheckBox*)            Control( ECtlOptGzipStates );\r
-       CEikCheckBox            *chkbox_motvol = (CEikCheckBox*)            Control( ECtlOptMotDontUseVol );\r
-       CEikCheckBox            *chkbox_accsprt= (CEikCheckBox*)            Control( ECtlOptUseAccSprites );\r
-       CEikChoiceListBase      *combo_region  = (CEikChoiceListBase*)      Control( ECtlOptRegion );\r
-       CEikOptionButton        *opt_fit2      = (CEikOptionButton*)        buttons_disp->ComponentControl( TPicoConfig::PMFit2 );\r
-\r
-       buttons_rot ->SetButtonById(ECtlOptRotation0 + config.iScreenRotation);\r
-       buttons_disp->SetButtonById(ECtlOptScreenModeCenter + config.iScreenMode);\r
-       chkbox_sram   ->SetState(config.iFlags & 1     ? CEikButtonBase::ESet : CEikButtonBase::EClear);\r
-       chkbox_fps    ->SetState(config.iFlags & 2     ? CEikButtonBase::ESet : CEikButtonBase::EClear);\r
-       chkbox_sound  ->SetState(config.iFlags & 4     ? CEikButtonBase::ESet : CEikButtonBase::EClear);\r
-       chkbox_motvol ->SetState(config.iFlags & 0x40  ? CEikButtonBase::ESet : CEikButtonBase::EClear);\r
-       chkbox_gzipst ->SetState(config.iFlags & 0x80  ? CEikButtonBase::ESet : CEikButtonBase::EClear);\r
-       chkbox_z80    ->SetState(config.iPicoOpt & 4   ? CEikButtonBase::ESet : CEikButtonBase::EClear);\r
-       chkbox_ym2612 ->SetState(config.iPicoOpt & 1   ? CEikButtonBase::ESet : CEikButtonBase::EClear);\r
-       chkbox_sn76496->SetState(config.iPicoOpt & 2   ? CEikButtonBase::ESet : CEikButtonBase::EClear);\r
-       chkbox_altrend->SetState(config.iPicoOpt & 0x10? CEikButtonBase::ESet : CEikButtonBase::EClear);\r
-       chkbox_6bpad  ->SetState(config.iPicoOpt & 0x20? CEikButtonBase::ESet : CEikButtonBase::EClear);\r
-       chkbox_acctmng->SetState(config.iPicoOpt & 0x40? CEikButtonBase::ESet : CEikButtonBase::EClear);\r
-       chkbox_accsprt->SetState(config.iPicoOpt & 0x80? CEikButtonBase::ESet : CEikButtonBase::EClear);\r
-\r
-       // hide "fit2" if we are not in 0 or 180 mode\r
-       if(config.iScreenRotation != TPicoConfig::PRot0 && config.iScreenRotation != TPicoConfig::PRot180) opt_fit2->MakeVisible(EFalse);\r
-       // dim some stuff for alternative renderer\r
-       if(config.iPicoOpt & 0x10) {\r
-               buttons_disp->SetDimmed(ETrue);\r
-               ((CEikOptionButton*)(buttons_rot->ComponentControl(TPicoConfig::PRot0)))->SetDimmed(ETrue);\r
-               ((CEikOptionButton*)(buttons_rot->ComponentControl(TPicoConfig::PRot180)))->SetDimmed(ETrue);\r
-       }\r
-       // dim accurate sprites\r
-       if(config.iPicoOpt & 0x10) {\r
-               chkbox_accsprt->SetState(CEikButtonBase::EClear);\r
-               chkbox_accsprt->SetDimmed(ETrue);\r
-       }\r
-\r
-       TInt sel = (config.iPicoOpt&8) ? 4 : 0;\r
-       sel+= (config.iFlags>>3)&3;\r
-       combo_sndq->SetCurrentItem(sel);\r
-       switch(config.PicoRegion) {\r
-               case 1: sel = 4; break;\r
-               case 2: sel = 3; break;\r
-               case 4: sel = 2; break;\r
-               case 8: sel = 1; break;\r
-               default:sel = 0; // auto\r
-       }\r
-       combo_region->SetCurrentItem(sel);\r
-}\r
-\r
-TBool CPicoConfigDialog::OkToExitL(TInt aButtonId)\r
-{\r
-       if(aButtonId != EEikBidOk) return ETrue;\r
-\r
-       CEikHorOptionButtonList *buttons_rot   = (CEikHorOptionButtonList*) Control( ECtlOptRotation );\r
-       CEikHorOptionButtonList *buttons_disp  = (CEikHorOptionButtonList*) Control( ECtlOptScreenMode );\r
-       CEikCheckBox            *chkbox_altrend= (CEikCheckBox*)            Control( ECtlOptUseAltRend );\r
-       CEikCheckBox            *chkbox_acctmng= (CEikCheckBox*)            Control( ECtlOptUseAccTiming );\r
-       CEikCheckBox            *chkbox_sram   = (CEikCheckBox*)            Control( ECtlOptUseSRAM );\r
-       CEikCheckBox            *chkbox_fps    = (CEikCheckBox*)            Control( ECtlOptShowFPS );\r
-       CEikCheckBox            *chkbox_sound  = (CEikCheckBox*)            Control( ECtlOptEnableSound );\r
-       CEikCheckBox            *chkbox_z80    = (CEikCheckBox*)            Control( ECtlOptEmulateZ80 );\r
-       CEikCheckBox            *chkbox_ym2612 = (CEikCheckBox*)            Control( ECtlOptEmulateYM2612 );\r
-       CEikCheckBox            *chkbox_sn76496= (CEikCheckBox*)            Control( ECtlOptEmulateSN76496 );\r
-       CEikChoiceListBase      *combo_sndq    = (CEikChoiceListBase*)      Control( ECtlOptSndQuality );\r
-       CEikCheckBox            *chkbox_6bpad  = (CEikCheckBox*)            Control( ECtlOpt6ButtonPad );\r
-       CEikCheckBox            *chkbox_gzipst = (CEikCheckBox*)            Control( ECtlOptGzipStates );\r
-       CEikCheckBox            *chkbox_motvol = (CEikCheckBox*)            Control( ECtlOptMotDontUseVol );\r
-       CEikCheckBox            *chkbox_accsprt= (CEikCheckBox*)            Control( ECtlOptUseAccSprites );\r
-       CEikChoiceListBase      *combo_region  = (CEikChoiceListBase*)      Control( ECtlOptRegion );\r
-\r
-       config.iScreenRotation = (TPicoConfig::TPicoScreenRotation) (buttons_rot->LabeledButtonId() - ECtlOptRotation0);\r
-       config.iScreenMode = (TPicoConfig::TPicoScreenMode) (buttons_disp->LabeledButtonId() - ECtlOptScreenModeCenter);\r
-\r
-       if(chkbox_sram   ->State() == CEikButtonBase::ESet) config.iFlags |= 1;     else config.iFlags   &= ~1;\r
-       if(chkbox_fps    ->State() == CEikButtonBase::ESet) config.iFlags |= 2;     else config.iFlags   &= ~2;\r
-       if(chkbox_sound  ->State() == CEikButtonBase::ESet) config.iFlags |= 4;     else config.iFlags   &= ~4;\r
-       if(chkbox_motvol ->State() == CEikButtonBase::ESet) config.iFlags |= 0x40;  else config.iFlags   &= ~0x40;\r
-       if(chkbox_gzipst ->State() == CEikButtonBase::ESet) config.iFlags |= 0x80;  else config.iFlags   &= ~0x80;\r
-       if(chkbox_z80    ->State() == CEikButtonBase::ESet) config.iPicoOpt |= 4;   else config.iPicoOpt &= ~4;\r
-       if(chkbox_ym2612 ->State() == CEikButtonBase::ESet) config.iPicoOpt |= 1;   else config.iPicoOpt &= ~1;\r
-       if(chkbox_sn76496->State() == CEikButtonBase::ESet) config.iPicoOpt |= 2;   else config.iPicoOpt &= ~2;\r
-       if(chkbox_altrend->State() == CEikButtonBase::ESet) config.iPicoOpt |= 0x10;else config.iPicoOpt &= ~0x10;\r
-       if(chkbox_6bpad  ->State() == CEikButtonBase::ESet) config.iPicoOpt |= 0x20;else config.iPicoOpt &= ~0x20;\r
-       if(chkbox_acctmng->State() == CEikButtonBase::ESet) config.iPicoOpt |= 0x40;else config.iPicoOpt &= ~0x40;\r
-       if(chkbox_accsprt->State() == CEikButtonBase::ESet) config.iPicoOpt |= 0x80;else config.iPicoOpt &= ~0x80;\r
-\r
-       TInt sel = combo_sndq->CurrentItem();\r
-       if(sel > 3) { config.iPicoOpt |= 8; sel-=4; } else config.iPicoOpt &= ~8;\r
-       config.iFlags &= ~0x18;\r
-       config.iFlags |= (sel<<3)&0x18;\r
-\r
-       switch(combo_region->CurrentItem()) {\r
-               case 4: config.PicoRegion = 1; break;\r
-               case 3: config.PicoRegion = 2; break;\r
-               case 2: config.PicoRegion = 4; break;\r
-               case 1: config.PicoRegion = 8; break;\r
-               default:config.PicoRegion = 0; // auto\r
-       }\r
-\r
-       return ETrue;\r
-}\r
-\r
-// simple GUI stuff needs lots of code\r
-void CPicoConfigDialog::HandleControlStateChangeL(TInt aControlId)\r
-{\r
-       if(aControlId == ECtlOptEnableSound) {\r
-               CEikCheckBox *chkbox_sound  = (CEikCheckBox*) Control( ECtlOptEnableSound );\r
-               CEikCheckBox *chkbox_z80    = (CEikCheckBox*) Control( ECtlOptEmulateZ80 );\r
-               CEikCheckBox *chkbox_ym2612 = (CEikCheckBox*) Control( ECtlOptEmulateYM2612 );\r
-               CEikCheckBox *chkbox_sn76496= (CEikCheckBox*) Control( ECtlOptEmulateSN76496 );\r
-\r
-               if(chkbox_sound->State() == CEikButtonBase::ESet) {\r
-                       // check all sound chips too, but only if they all are not set\r
-                       if((chkbox_z80->State() | chkbox_ym2612->State() | chkbox_sn76496->State()) == CEikButtonBase::EClear) { // (==0)\r
-                               chkbox_z80    ->SetState(CEikButtonBase::ESet);\r
-                               chkbox_ym2612 ->SetState(CEikButtonBase::ESet);\r
-                               chkbox_sn76496->SetState(CEikButtonBase::ESet);\r
-                               chkbox_z80    ->DrawDeferred();\r
-                               chkbox_ym2612 ->DrawDeferred();\r
-                               chkbox_sn76496->DrawDeferred();\r
-                       }\r
-               } else {\r
-                       // clear everything, but only if everything is set\r
-                       if((chkbox_z80->State() & chkbox_ym2612->State() & chkbox_sn76496->State()) == CEikButtonBase::ESet) { // (==1)\r
-                               chkbox_z80    ->SetState(CEikButtonBase::EClear);\r
-                               chkbox_ym2612 ->SetState(CEikButtonBase::EClear);\r
-                               chkbox_sn76496->SetState(CEikButtonBase::EClear);\r
-                               chkbox_z80    ->DrawDeferred();\r
-                               chkbox_ym2612 ->DrawDeferred();\r
-                               chkbox_sn76496->DrawDeferred();\r
-                       }\r
-               }\r
-       } else if(aControlId == ECtlOptUseAltRend) {\r
-               CEikCheckBox            *chkbox_altrend= (CEikCheckBox*)            Control( ECtlOptUseAltRend );\r
-               CEikCheckBox            *chkbox_accsprt= (CEikCheckBox*)            Control( ECtlOptUseAccSprites );\r
-               CEikHorOptionButtonList *buttons_rot   = (CEikHorOptionButtonList*) Control( ECtlOptRotation );\r
-               CEikHorOptionButtonList *buttons_disp  = (CEikHorOptionButtonList*) Control( ECtlOptScreenMode );\r
-\r
-               TBool dimmed = chkbox_altrend->State() == CEikButtonBase::ESet;\r
-               // show/hide more stuff for alternative renderer\r
-               buttons_disp->SetDimmed(dimmed);\r
-               chkbox_accsprt->SetDimmed(dimmed);\r
-               ((CEikOptionButton*)(buttons_rot->ComponentControl(TPicoConfig::PRot0)))->SetDimmed(dimmed);\r
-               ((CEikOptionButton*)(buttons_rot->ComponentControl(TPicoConfig::PRot180)))->SetDimmed(dimmed);\r
-               if(dimmed && buttons_rot->LabeledButtonId() != ECtlOptRotation90 && buttons_rot->LabeledButtonId() != ECtlOptRotation270) {\r
-                       buttons_rot->SetButtonById(ECtlOptRotation90);\r
-                       aControlId = ECtlOptRotation; // cause rotation update\r
-               }\r
-               buttons_disp->SetButtonById(ECtlOptScreenModeCenter);\r
-               chkbox_accsprt->DrawDeferred();\r
-               buttons_disp->DrawDeferred();\r
-               buttons_rot->DrawDeferred();\r
-       }\r
-       if(aControlId == ECtlOptRotation) {\r
-               CEikHorOptionButtonList *buttons_rot   = (CEikHorOptionButtonList*) Control( ECtlOptRotation );\r
-               CEikHorOptionButtonList *buttons_disp  = (CEikHorOptionButtonList*) Control( ECtlOptScreenMode );\r
-               CEikOptionButton        *opt_fit2      = (CEikOptionButton*)        buttons_disp->ComponentControl( TPicoConfig::PMFit2 );\r
-\r
-               if(buttons_rot->LabeledButtonId() == ECtlOptRotation0 || buttons_rot->LabeledButtonId() == ECtlOptRotation180) {\r
-                       opt_fit2->MakeVisible(ETrue);\r
-                       opt_fit2->DrawDeferred();\r
-               } else {\r
-                       if(opt_fit2->State() == CEikButtonBase::ESet) {\r
-                               buttons_disp->SetButtonById(ECtlOptScreenModeFit);\r
-                               buttons_disp->DrawDeferred();\r
-                       }\r
-                       opt_fit2->MakeVisible(EFalse);\r
-               }\r
-       }\r
-}\r
-\r
-\r
-/*************************************************************\r
-*\r
-* Credits dialog\r
-*\r
-**************************************************************/\r
-\r
-void CCreditsDialog::PreLayoutDynInitL()\r
-{\r
-       CDesCArrayFlat* desArray = CEikonEnv::Static()->ReadDesCArrayResourceL(iMessageResourceID);\r
-       CleanupStack::PushL(desArray);\r
-\r
-       TInt iLength;\r
-       TInt count = desArray->Count();\r
-       for (TInt i=0 ;i < count; i++)\r
-       {\r
-               iLength = static_cast<CEikGlobalTextEditor*>(Control(ECtlCredits))->TextLength();\r
-               static_cast<CEikGlobalTextEditor*>(Control(ECtlCredits))->Text()->InsertL(iLength, desArray->operator[](i));\r
-               iLength = static_cast<CEikGlobalTextEditor*>(Control(ECtlCredits))->TextLength();\r
-               static_cast<CEikGlobalTextEditor*>(Control(ECtlCredits))->Text()->InsertL(iLength, CEditableText::ELineBreak);\r
-       }\r
-       CleanupStack::PopAndDestroy(desArray);\r
-}\r
-\r
-void CCreditsDialog::PostLayoutDynInitL()\r
-{\r
-       static_cast<CEikGlobalTextEditor*>(Control(ECtlCredits))->CreateScrollBarFrameL();\r
-       static_cast<CEikGlobalTextEditor*>(Control(ECtlCredits))->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto);\r
-}\r
-\r
-TKeyResponse CCreditsDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)\r
-{\r
-       if (aType == EEventKey)\r
-       {\r
-               if (aKeyEvent.iCode == EQuartzKeyTwoWayDown)\r
-               {\r
-                       static_cast<CEikGlobalTextEditor*>(Control(ECtlCredits))->MoveDisplayL(TCursorPosition::EFLineDown);\r
-                       static_cast<CEikGlobalTextEditor*>(Control(ECtlCredits))->UpdateScrollBarsL();\r
-                       return EKeyWasConsumed;\r
-               }\r
-               else if (aKeyEvent.iCode == EQuartzKeyTwoWayUp)\r
-               {\r
-                       static_cast<CEikGlobalTextEditor*>(Control(ECtlCredits))->MoveDisplayL(TCursorPosition::EFLineUp);\r
-                       static_cast<CEikGlobalTextEditor*>(Control(ECtlCredits))->UpdateScrollBarsL();\r
-                       return EKeyWasConsumed;\r
-               }\r
-       }\r
-       return CEikDialog::OfferKeyEventL(aKeyEvent, aType);\r
-}\r
-\r
-\r
-/*************************************************************\r
-*\r
-* Debug dialog\r
-*\r
-**************************************************************/\r
-\r
-CDebugDialog::CDebugDialog(char *t)\r
-{\r
-       Mem::Copy(iText, t, 1024);\r
-       iText[1023] = 0;\r
-}\r
-\r
-void CDebugDialog::PreLayoutDynInitL()\r
-{\r
-       char *p = iText, *line = iText;\r
-       TBool end=0;\r
-       TBuf<128> tbuf;\r
-       CEikGlobalTextEditor *editor = static_cast<CEikGlobalTextEditor*>(Control(ECtlDebugEdit));\r
-\r
-       while(!end) {\r
-               while(*p && *p != '\r' && *p != '\n') p++;\r
-               if(!*p) end=1;\r
-               *p = 0;\r
-               TPtrC8 ptr((TUint8*) line);\r
-               tbuf.Copy(ptr);\r
-               editor->Text()->InsertL(editor->TextLength(), tbuf);\r
-               editor->Text()->InsertL(editor->TextLength(), CEditableText::ELineBreak);\r
-               line = ++p;\r
-       }\r
-}\r
-\r
-void CDebugDialog::PostLayoutDynInitL()\r
-{\r
-       static_cast<CEikGlobalTextEditor*>(Control(ECtlDebugEdit))->CreateScrollBarFrameL();\r
-       static_cast<CEikGlobalTextEditor*>(Control(ECtlDebugEdit))->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto);\r
-}\r
-\r
-TKeyResponse CDebugDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)\r
-{\r
-       if (aType == EEventKey)\r
-       {\r
-               if (aKeyEvent.iCode == EQuartzKeyTwoWayDown)\r
-               {\r
-                       static_cast<CEikGlobalTextEditor*>(Control(ECtlDebugEdit))->MoveDisplayL(TCursorPosition::EFLineDown);\r
-                       static_cast<CEikGlobalTextEditor*>(Control(ECtlDebugEdit))->UpdateScrollBarsL();\r
-                       return EKeyWasConsumed;\r
-               }\r
-               else if (aKeyEvent.iCode == EQuartzKeyTwoWayUp)\r
-               {\r
-                       static_cast<CEikGlobalTextEditor*>(Control(ECtlDebugEdit))->MoveDisplayL(TCursorPosition::EFLineUp);\r
-                       static_cast<CEikGlobalTextEditor*>(Control(ECtlDebugEdit))->UpdateScrollBarsL();\r
-                       return EKeyWasConsumed;\r
-               }\r
-       }\r
-       return CEikDialog::OfferKeyEventL(aKeyEvent, aType);\r
-}\r
-\r
-\r
-/************************************************\r
- *\r
- * SimpleTextInfoDialog\r
- *\r
- ************************************************/\r
-\r
-\r
-CSimpleTextInfoDialog::CSimpleTextInfoDialog(TInt aTextIdOne, TInt aRichTextCtlIdOne, TInt aTextIdTwo, TInt aRichTextCtlIdTwo, TBool aSimpleTextResIdOneIsArray, TBool aSimpleTextResIdTwoIsArray)\r
-       : iSimpleTextResIdOne(aTextIdOne),\r
-         iSimpleTextResIdTwo(aTextIdTwo),\r
-         iRichTextCtlIdOne(aRichTextCtlIdOne),\r
-         iRichTextCtlIdTwo(aRichTextCtlIdTwo),\r
-         iSimpleTextResIdOneIsArray(aSimpleTextResIdOneIsArray),\r
-         iSimpleTextResIdTwoIsArray(aSimpleTextResIdTwoIsArray),\r
-         iSetDialogBackground(ETrue)\r
-{\r
-}\r
-\r
-void CSimpleTextInfoDialog::PreLayoutDynInitL()\r
-{\r
-       CEikRichTextEditor*             richTextEditor;\r
-       \r
-       if (iRichTextCtlIdOne != -1)\r
-       {\r
-               richTextEditor=STATIC_CAST(CEikRichTextEditor*, Control(iRichTextCtlIdOne));\r
-               PreLayoutDynInitRichTextL(*richTextEditor, iRichTextCtlIdOne, iSimpleTextResIdOne);\r
-       }\r
-\r
-       if (iRichTextCtlIdTwo != -1)\r
-       {\r
-               richTextEditor=STATIC_CAST(CEikRichTextEditor*, Control(iRichTextCtlIdTwo));\r
-               richTextEditor->Border().SetType(ENone);\r
-               PreLayoutDynInitRichTextL(*richTextEditor, iRichTextCtlIdTwo, iSimpleTextResIdTwo);\r
-       }\r
-}\r
-\r
-\r
-void CSimpleTextInfoDialog::PreLayoutDynInitRichTextL(CEikRichTextEditor& aRichTextEditor, TInt aRichTextCtlId, TInt aSimpleTextResId)\r
-{\r
-       iEikonEnv->BusyMsgL(_L("Opening"));\r
-       aRichTextEditor.SetEdwinSizeObserver(this);\r
-       if (iSetDialogBackground)\r
-               aRichTextEditor.SetBackgroundColorL(iEikonEnv->Color(EColorDialogBackground));\r
-       aRichTextEditor.SetSize(aRichTextEditor.Size()); // Set the size of the edwin\r
-\r
-               // no scrollbars for us\r
-       aRichTextEditor.CreateScrollBarFrameL(); // Create the scrollbars\r
-       aRichTextEditor.ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, iWantVertScrollbar ? CEikScrollBarFrame::EAuto: CEikScrollBarFrame::EOff);\r
-\r
-       ShowTextL(*aRichTextEditor.RichText(), aRichTextCtlId, aSimpleTextResId);\r
-\r
-       aRichTextEditor.UpdateAllFieldsL(); // Updates all the fields in the document\r
-\r
-       aRichTextEditor.UpdateScrollBarsL();\r
-}\r
-\r
-\r
-void CSimpleTextInfoDialog::PostLayoutDynInitL()\r
-{\r
-       Layout();\r
-       iEikonEnv->BusyMsgCancel();\r
-}\r
-\r
-TBool CSimpleTextInfoDialog::HandleEdwinSizeEventL(CEikEdwin* aEdwin, TEdwinSizeEvent aEventType, TSize aDesirableEdwinSize)\r
-{\r
-       if ((aEventType == EEventSizeChanging))\r
-               aEdwin->SetSize(aDesirableEdwinSize);\r
-       return EFalse;\r
-}\r
-\r
-void CSimpleTextInfoDialog::ShowTextL(CRichText& aRichText, TInt /*aRichTextCtlId*/, TInt aResId)\r
-{\r
-       if (aResId != -1)\r
-       {\r
-               if ( ((aResId == iSimpleTextResIdOne) && (iSimpleTextResIdOneIsArray)) ||\r
-                    ((aResId == iSimpleTextResIdTwo) && (iSimpleTextResIdTwoIsArray))\r
-                  )\r
-               {\r
-                       CDesCArrayFlat* desArray = CEikonEnv::Static()->ReadDesCArrayResourceL(aResId);\r
-                       CleanupStack::PushL(desArray);\r
-\r
-                       CSimpleTextFormatParser* parser = CSimpleTextFormatParser::NewLC();\r
-\r
-                       TInt    count = desArray->Count();\r
-                       for (TInt i=0 ;i<count ; i++)\r
-                               parser->ParseL(desArray->operator[](i), aRichText);\r
-\r
-                       CleanupStack::PopAndDestroy(parser);\r
-                       CleanupStack::PopAndDestroy(desArray);\r
-               }\r
-               else\r
-               {\r
-                       HBufC*          text =  CEikonEnv::Static()->AllocReadResourceLC(aResId);\r
-                       ShowSimpleTextL(*text, aRichText);\r
-                       CleanupStack::PopAndDestroy(text);\r
-               }\r
-       }\r
-}\r
-\r
-void CSimpleTextInfoDialog::ShowSimpleTextL(const TDesC& aSimpleText, CRichText& aRichText)\r
-{\r
-       CSimpleTextFormatParser* parser = CSimpleTextFormatParser::NewLC();\r
-       parser->ParseL(aSimpleText, aRichText);\r
-\r
-       CleanupStack::PopAndDestroy(parser);\r
-}\r
-\r
-\r
-\r
-/************************************************\r
- *\r
- * About Dialog\r
- *\r
- ************************************************/\r
-\r
-CAboutDialog::CAboutDialog() : CSimpleTextInfoDialog(-1, ECtlAboutVersion, R_SIMPLE_TEXT_ABOUT_LINKS, ECtlAboutLinks)\r
-{\r
-}\r
-\r
-void CAboutDialog::ShowTextL(CRichText& aRichText, TInt aRichTextCtlId, TInt aResId)\r
-{\r
-       if (aRichTextCtlId == ECtlAboutLinks)\r
-               CSimpleTextInfoDialog::ShowTextL(aRichText, aRichTextCtlId, aResId);\r
-       else\r
-       {\r
-               TBuf<16>        versionText;\r
-               TBuf<512>       text;\r
-\r
-               #if (KPicoBuildNumber != 0)\r
-                       versionText.Format(_L("%d.%d%d"), KPicoMajorVersionNumber, KPicoMinorVersionNumber, KPicoBuildNumber);\r
-               #else\r
-                       versionText.Format(_L("%d.%d"), KPicoMajorVersionNumber, KPicoMinorVersionNumber);\r
-               #endif\r
-\r
-               HBufC*          aboutFormat =   CEikonEnv::Static()->AllocReadResourceLC(R_SIMPLE_TEXT_ABOUT);\r
-               text.Format(*aboutFormat, &versionText);\r
-\r
-               ShowSimpleTextL(text, aRichText);\r
-\r
-               CleanupStack::PopAndDestroy(aboutFormat);\r
-       }\r
-}\r
diff --git a/platform/uiq2/launcher/Dialogs.h b/platform/uiq2/launcher/Dialogs.h
deleted file mode 100644 (file)
index c8076e6..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-/*******************************************************************\r
- *\r
- *     File:           Dialogs.h\r
- *\r
- *     Author:         Peter van Sebille (peter@yipton.net)\r
- *\r
- *  Modified/adapted for picodriveN by notaz, 2006\r
- *\r
- *  (c) Copyright 2006, notaz\r
- *     (c) Copyright 2002, Peter van Sebille\r
- *     All Rights Reserved\r
- *\r
- *******************************************************************/\r
-\r
-#ifndef __DIALOGS_H\r
-#define __DIALOGS_H\r
-\r
-#include <eikenv.h>\r
-#include <eikdialg.h>\r
-#include <eiktxlbx.h>\r
-#include <eiktxlbm.h>\r
-#include <eikdlgtb.h>\r
-#include <eiklabel.h>\r
-#include <eikchlst.h>\r
-#include <eikchkbx.h>\r
-#include <eikedwob.h>\r
-\r
-#include "../ClientServer.h"\r
-\r
-class CRichText;\r
-class CEikRichTextEditor;\r
-class TPLauncherConfig;\r
-\r
-/************************************************\r
- *\r
- * CSimpleTextInfo Dialog\r
- *\r
- ************************************************/\r
-\r
-class CSimpleTextInfoDialog : public CEikDialog, public MEikEdwinSizeObserver\r
-{\r
-public:\r
-       CSimpleTextInfoDialog(TInt aTextIdOne = -1, TInt aRichTextCtlIdOne = -1, \r
-               TInt aTextIdTwo = -1, TInt aRichTextCtlIdTwo = -1,\r
-               TBool aSimpleTextResIdOneIsArray = EFalse, TBool aSimpleTextResIdTwoIsArray = EFalse\r
-               );\r
-       void SetDialogBackground(TBool aEnable){iSetDialogBackground=aEnable;}\r
-       void WantVertScrollbar(TBool aEnable){iWantVertScrollbar=aEnable;}\r
-public:                        // implements MEikEdwinSizeObserver\r
-       virtual TBool HandleEdwinSizeEventL(CEikEdwin* aEdwin, TEdwinSizeEvent aEventType, TSize aDesirableEdwinSize);\r
-\r
-protected: // framework\r
-    void PreLayoutDynInitL();\r
-       void PostLayoutDynInitL();\r
-\r
-protected:     // new stuff\r
-       virtual void ShowTextL(CRichText& aRichText, TInt aRichTextCtlId, TInt aResId);\r
-       virtual void PreLayoutDynInitRichTextL(CEikRichTextEditor& aRichTextEditor, TInt aRichTextCtlId, TInt aResId);\r
-\r
-       void ShowSimpleTextL(const TDesC& aSimpleText, CRichText& aRichText);\r
-\r
-       TInt    iSimpleTextResIdOne;\r
-       TInt    iSimpleTextResIdTwo;\r
-       TInt    iRichTextCtlIdOne;\r
-       TInt    iRichTextCtlIdTwo;\r
-       TBool   iSimpleTextResIdOneIsArray;\r
-       TBool   iSimpleTextResIdTwoIsArray;\r
-       TBool   iSetDialogBackground;\r
-       TBool   iWantVertScrollbar;\r
-};\r
-\r
-\r
-/************************************************\r
- *\r
- * config Dialog\r
- *\r
- ************************************************/\r
-\r
-class CPicoConfigDialog : public CEikDialog\r
-{\r
-public:\r
-       CPicoConfigDialog(TPicoConfig &cfg, TPLauncherConfig &cfgl);\r
-\r
-protected: // framework\r
-    void PostLayoutDynInitL();\r
-       void HandleControlStateChangeL(TInt aControlId);\r
-       TBool OkToExitL(TInt aButtonId);\r
-\r
-       TPicoConfig &config;\r
-       TPLauncherConfig &config_l;\r
-};\r
-\r
-\r
-/************************************************\r
- *\r
- * About Dialog\r
- *\r
- ************************************************/\r
-\r
-class CAboutDialog : public CSimpleTextInfoDialog\r
-{\r
-public:\r
-       CAboutDialog();\r
-protected:     // from CSimpleTextInfoDialog\r
-       virtual void ShowTextL(CRichText& aRichText, TInt aRichTextCtlId, TInt aResId);\r
-};\r
-\r
-/*************************************************************\r
-*\r
-* Credits dialog\r
-*\r
-**************************************************************/\r
-\r
-class CCreditsDialog : public CEikDialog\r
-{\r
-public:\r
-       TInt iMessageResourceID;\r
-       \r
-protected:\r
-       void PreLayoutDynInitL();\r
-       void PostLayoutDynInitL();\r
-       TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);\r
-};\r
-\r
-/*************************************************************\r
-*\r
-* Debug dialog\r
-*\r
-**************************************************************/\r
-\r
-class CDebugDialog : public CEikDialog\r
-{\r
-public:\r
-       CDebugDialog(char *t);\r
-\r
-protected:\r
-       char iText[1024];\r
-       void PreLayoutDynInitL();\r
-       void PostLayoutDynInitL();\r
-       TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);\r
-};\r
-\r
-\r
-\r
-#endif // __DIALOGS_H\r
diff --git a/platform/uiq2/launcher/Engine.cpp b/platform/uiq2/launcher/Engine.cpp
deleted file mode 100644 (file)
index 489cd4f..0000000
+++ /dev/null
@@ -1,256 +0,0 @@
-/*******************************************************************\r
- *\r
- *     File:           Engine.cpp\r
- *\r
- *     Author:         Peter van Sebille (peter@yipton.net)\r
- *\r
- *  Modified/adapted for picodriveN by notaz, 2006\r
- *\r
- *  (c) Copyright 2006, notaz\r
- *     (c) Copyright 2002, Peter van Sebille\r
- *     All Rights Reserved\r
- *\r
- *******************************************************************/\r
-\r
-#include "Engine.h"\r
-#include <w32std.h>\r
-#include <eikenv.h>\r
-//#include <eikdll.h>\r
-\r
-#include "../version.h"\r
-\r
-\r
-CGameRunner::~CGameRunner()\r
-{\r
-       Cancel();\r
-\r
-       RProcess process;\r
-       if(process.Open(iProcessId) == KErrNone) {\r
-               process.Terminate(1);\r
-               process.Close();\r
-       }\r
-}\r
-\r
-CGameRunner::CGameRunner(MGameWatcher& aGameWatcher)\r
-: CActive(CActive::EPriorityStandard), iGameWatcher(aGameWatcher)\r
-{\r
-}\r
-\r
-\r
-CGameRunner* CGameRunner::NewL(MGameWatcher& aGameWatcher)\r
-{\r
-       CGameRunner* self = new(ELeave) CGameRunner(aGameWatcher);\r
-       CleanupStack::PushL(self);\r
-       self->ConstructL();\r
-       CleanupStack::Pop();                    // self\r
-       return self;\r
-}\r
-\r
-void CGameRunner::ConstructL()\r
-{\r
-       RProcess newProcess, thisProcess;\r
-\r
-       // make path to picosmall\r
-       TBuf<KMaxFileName> exePath;\r
-       TBuf<KMaxFileName*3> tmpbuff; // hopefully large enough\r
-       thisProcess.CommandLine(tmpbuff);\r
-       TInt pos = tmpbuff.Find(_L(" "));\r
-       if(pos == KErrNotFound) pos = tmpbuff.Length();\r
-       for(pos--; pos > 2; pos--)\r
-               if(tmpbuff[pos] == '\\') break;\r
-       if(pos > 2) {\r
-               exePath.Copy(tmpbuff.Ptr(), pos+1);\r
-               exePath.Append(_L("PICOSMALL.EXE"));\r
-       }\r
-\r
-       DEBUGPRINT(_L("[app] starting EXE: %S"), &exePath);\r
-       if(newProcess.Create(exePath, _L(""))) {\r
-               CEikonEnv::Static()->InfoWinL(_L("Error"), _L("Failed to start emulation process."));\r
-               thisProcess.Terminate(1);\r
-       }\r
-\r
-       iProcessId = newProcess.Id();\r
-       DEBUGPRINT(_L("[app] newProcess.Id(): %d"), iProcessId);\r
-\r
-       CActiveScheduler::Add(this);\r
-       newProcess.SetOwner(thisProcess); // Warning: phone strangely reboots when attempting to get owner after thisProcess exits\r
-       newProcess.Logon(iStatus);\r
-\r
-       SetActive();\r
-\r
-       newProcess.Resume(); // start execution\r
-       newProcess.Close();\r
-}\r
-\r
-void CGameRunner::RunL()\r
-{\r
-       iGameWatcher.NotifyEmuDeath();\r
-}\r
-\r
-void CGameRunner::DoCancel()\r
-{\r
-       RProcess process;\r
-       if(process.Open(iProcessId) == KErrNone) {\r
-               process.LogonCancel(iStatus);\r
-               process.Close();\r
-       }\r
-}\r
-\r
-\r
-// CExitForcer\r
-CExitForcer::~CExitForcer()\r
-{\r
-       Cancel();\r
-}\r
-\r
-CExitForcer::CExitForcer(MGameWatcher& aGameWatcher) : CActive(CActive::EPriorityStandard), iGameWatcher(aGameWatcher)\r
-{\r
-}\r
-\r
-\r
-CExitForcer* CExitForcer::NewL(MGameWatcher& aGameWatcher, TInt ms)\r
-{\r
-       CExitForcer* self = new(ELeave) CExitForcer(aGameWatcher);\r
-       CleanupStack::PushL(self);\r
-       self->ConstructL(ms);\r
-       CleanupStack::Pop();                    // self\r
-       return self;\r
-}\r
-\r
-void CExitForcer::ConstructL(TInt ms)\r
-{\r
-       CActiveScheduler::Add(this);\r
-       iTimer.CreateLocal();\r
-       iTimer.After(iStatus, ms*1000);\r
-       SetActive();\r
-}\r
-\r
-void CExitForcer::RunL()\r
-{\r
-       iGameWatcher.NotifyForcedExit();\r
-}\r
-\r
-void CExitForcer::DoCancel()\r
-{\r
-       if(iTimer.Handle()) {\r
-               iTimer.Cancel();\r
-               iTimer.Close();\r
-       }\r
-}\r
-\r
-\r
-// CThreadWatcher\r
-CThreadWatcher::~CThreadWatcher()\r
-{\r
-       Cancel();\r
-}\r
-\r
-CThreadWatcher::CThreadWatcher(MGameWatcher& aGameWatcher, const TDesC& aName)\r
-: CActive(CActive::EPriorityStandard), iGameWatcher(aGameWatcher), iName(aName)\r
-{\r
-}\r
-\r
-\r
-CThreadWatcher* CThreadWatcher::NewL(MGameWatcher& aGameWatcher, const TDesC& aName)\r
-{\r
-       CThreadWatcher* self = new(ELeave) CThreadWatcher(aGameWatcher, aName);\r
-       CleanupStack::PushL(self);\r
-       self->ConstructL();\r
-       CleanupStack::Pop();                    // self\r
-       return self;\r
-}\r
-\r
-void CThreadWatcher::ConstructL()\r
-{\r
-       CActiveScheduler::Add(this);\r
-       RThread thread;\r
-       if(thread.Open(iName) == KErrNone) {\r
-               thread.Logon(iStatus);\r
-               thread.Close();\r
-               SetActive();\r
-       }\r
-}\r
-\r
-void CThreadWatcher::RunL()\r
-{\r
-       iGameWatcher.NotifyEmuDeath();\r
-}\r
-\r
-void CThreadWatcher::DoCancel()\r
-{\r
-       RThread thread;\r
-       if(thread.Open(iName) == KErrNone) {\r
-               thread.LogonCancel(iStatus);\r
-               thread.Close();\r
-       }\r
-}\r
-\r
-\r
-// config\r
-TPLauncherConfig::TPLauncherConfig(TPicoConfig &cfg)\r
-: iEmuConfig(cfg)\r
-{\r
-       iLastROMFile.Copy(_L("C:\\"));\r
-\r
-       // ini\r
-       TBuf<KMaxFileName*3> tmpbuff; // hopefully large enough\r
-       RProcess me;\r
-       me.CommandLine(tmpbuff);\r
-       TInt pos = tmpbuff.Find(_L(" "));\r
-       if(pos == KErrNotFound) pos = tmpbuff.Length();\r
-       if(pos > 3) {\r
-               iIniFileName.Copy(tmpbuff.Ptr(), pos-3);\r
-               iIniFileName.Append(_L("ini"));\r
-       }\r
-       //DEBUGPRINT(_L("[app] made ini: %S"), &iIniFileName);\r
-}\r
-\r
-\r
-void TPLauncherConfig::Load()\r
-{\r
-       RFile file;\r
-\r
-       if(!file.Open(CEikonEnv::Static()->FsSession(), iIniFileName, 0))\r
-       {\r
-               TInt version;\r
-               TPckg<TInt>                     pkg_version(version);\r
-               TPckg<TBool>            pkg_Pad(iPad);\r
-               TBuf8<KMaxFileName> pad0; // reserved for future use (6 words)\r
-               TPtr8                           picoCfg((TUint8*) &iEmuConfig, sizeof(iEmuConfig));\r
-\r
-               file.Read(pkg_version);\r
-               file.Read(pkg_Pad);\r
-               file.Read(pad0, 24);\r
-               file.Read(pad0, KMaxFileName);\r
-               file.Read(picoCfg);\r
-\r
-               TBuf8<KMaxFileName> file8(pad0.Ptr()); // take as zero terminated string\r
-               iLastROMFile.Copy(file8);\r
-               //DEBUGPRINT(_L("[app] iLastROMFile (%i): %S"), iLastROMFile.Length(), &iLastROMFile);\r
-\r
-               file.Close();\r
-       }\r
-}\r
-\r
-void TPLauncherConfig::Save()\r
-{\r
-       RFile file;\r
-\r
-       if(!file.Replace(CEikonEnv::Static()->FsSession(), iIniFileName, EFileWrite)) {\r
-               TInt version = (KPicoMajorVersionNumber<<24)+(KPicoMinorVersionNumber<<16);\r
-               TPckgC<TInt>            pkg_version(version);\r
-               TPckgC<TBool>           pkg_Pad(iPad);\r
-               TBuf8<KMaxFileName> pad0; pad0.FillZ(KMaxFileName);\r
-               TBuf8<KMaxFileName> file8; file8.Copy(iLastROMFile);\r
-               TPtrC8                          picoCfg((TUint8*) &iEmuConfig, sizeof(iEmuConfig));\r
-\r
-               file.Write(pkg_version);\r
-               file.Write(pkg_Pad);                    // 0x0004\r
-               file.Write(pad0, 24);                   // 0x0008, reserved for future use (6 words)\r
-               file.Write(file8);                              // 0x0020\r
-               file.Write(pad0, KMaxFileName-file8.Length());\r
-               file.Write(picoCfg);                    // 0x0120\r
-\r
-               file.Close();\r
-       }\r
-}\r
diff --git a/platform/uiq2/launcher/Engine.h b/platform/uiq2/launcher/Engine.h
deleted file mode 100644 (file)
index 052edc8..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************\r
- *\r
- *     File:           Engine.h\r
- *\r
- *     Author:         Peter van Sebille (peter@yipton.net)\r
- *\r
- *  Modified/adapted for picodriveN by notaz, 2006\r
- *\r
- *  (c) Copyright 2006, notaz\r
- *     (c) Copyright 2002, Peter van Sebille\r
- *     All Rights Reserved\r
- *\r
- *******************************************************************/\r
-\r
-#ifndef __ENGINE_H\r
-#define __ENGINE_H\r
-\r
-#include <e32base.h>\r
-#include <etel.h>\r
-\r
-#include "../ClientServer.h"\r
-\r
-class RFs;\r
-\r
-#ifdef __DEBUG_PRINT\r
-       #define DEBUGPRINT(x...) RDebug::Print(x)\r
-#else\r
-       #define DEBUGPRINT(x...)\r
-#endif\r
-\r
-\r
-class MGameWatcher\r
-{\r
-public:\r
-       virtual void NotifyEmuDeath() = 0;\r
-       virtual void NotifyForcedExit() = 0;\r
-};\r
-\r
-\r
-class CGameRunner : public CActive\r
-{\r
-public:\r
-       static CGameRunner* NewL(MGameWatcher& aGameWatcher);\r
-       ~CGameRunner();\r
-\r
-       void KillAfter(TInt ms);\r
-\r
-protected:\r
-       CGameRunner(MGameWatcher& aGameWatcher);\r
-       void ConstructL();\r
-\r
-       virtual void RunL();\r
-       virtual void DoCancel();\r
-\r
-       MGameWatcher&           iGameWatcher;\r
-       TProcessId                      iProcessId;\r
-};\r
-\r
-\r
-class CExitForcer : public CActive\r
-{\r
-public:\r
-       static CExitForcer* NewL(MGameWatcher& aGameWatcher, TInt ms);\r
-       ~CExitForcer();\r
-\r
-protected:\r
-       CExitForcer(MGameWatcher& aGameWatcher);\r
-       void ConstructL(TInt ms);\r
-\r
-       virtual void RunL();\r
-       virtual void DoCancel();\r
-\r
-       MGameWatcher&           iGameWatcher;\r
-       RTimer                          iTimer;\r
-};\r
-\r
-\r
-class CThreadWatcher : public CActive\r
-{\r
-public:\r
-       static CThreadWatcher* NewL(MGameWatcher& aGameWatcher, const TDesC& aName);\r
-       ~CThreadWatcher();\r
-\r
-protected:\r
-       CThreadWatcher(MGameWatcher& aGameWatcher, const TDesC& aName);\r
-       void ConstructL();\r
-\r
-       virtual void RunL();\r
-       virtual void DoCancel();\r
-\r
-       MGameWatcher&           iGameWatcher;\r
-       const TDesC&            iName; // thread name\r
-};\r
-\r
-\r
-// configuration emu process doesn't care about\r
-class TPLauncherConfig {\r
-public:\r
-       TPLauncherConfig(TPicoConfig &cfg);\r
-       void Load();\r
-       void Save();\r
-\r
-       TBool                   iPad; // was iPauseOnCall\r
-       TFileName               iLastROMFile;\r
-       TPicoConfig             &iEmuConfig;\r
-\r
-private:\r
-       TFileName               iIniFileName;\r
-};\r
-\r
-\r
-#endif\r
diff --git a/platform/uiq2/launcher/PICODRIVEN.ARMI b/platform/uiq2/launcher/PICODRIVEN.ARMI
deleted file mode 100644 (file)
index 11a1031..0000000
+++ /dev/null
@@ -1,1070 +0,0 @@
-\r
-# CWD \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\\r
-# MMPFile \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICODRIVEN.MMP\r
-# Target PICODRIVEN.APP\r
-# TargetType APP\r
-# BasicTargetType DLL\r
-# MakefileType GNU\r
-\r
-ERASE = @erase 2>>nul\r
-\r
-# EPOC DEFINITIONS\r
-\r
-EPOCBLD = ..\..\..\..\..\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICODRIVEN\ARMI\r
-EPOCTRG = ..\..\..\..\..\EPOC32\RELEASE\ARMI\r
-EPOCLIB = ..\..\..\..\..\EPOC32\RELEASE\ARMI\r
-EPOCLINK = ..\..\..\..\..\EPOC32\RELEASE\ARMI\r
-EPOCSTATLINK = ..\..\..\..\..\EPOC32\RELEASE\ARMI\r
-EPOCASSPLINK = ..\..\..\..\..\EPOC32\RELEASE\MARM\r
-EPOCDATA = \DEV\UIQ21\EPOC32\DATA\r
-EPOCINC = \DEV\UIQ21\EPOC32\INCLUDE\r
-TRGDIR = Z\SYSTEM\APPS\PICODRIVEN\r
-DATADIR = Z\SYSTEM\DATA\r
-\r
-EPOCBLDUREL = $(EPOCBLD)\UREL\r
-EPOCTRGUREL = $(EPOCTRG)\UREL\r
-EPOCLIBUREL = $(EPOCLIB)\UREL\r
-EPOCLINKUREL = $(EPOCLINK)\UREL\r
-EPOCSTATLINKUREL = $(EPOCSTATLINK)\UREL\r
-EPOCASSPLINKUREL = $(EPOCASSPLINK)\UREL\r
-\r
-EPOCBLDUDEB = $(EPOCBLD)\UDEB\r
-EPOCTRGUDEB = $(EPOCTRG)\UDEB\r
-EPOCLIBUDEB = $(EPOCLIB)\UREL\r
-EPOCLINKUDEB = $(EPOCLINK)\UREL\r
-EPOCSTATLINKUDEB = $(EPOCSTATLINK)\UDEB\r
-EPOCASSPLINKUDEB = $(EPOCASSPLINK)\UREL\r
-\r
-# EPOC PSEUDOTARGETS\r
-\r
-UREL : MAKEWORKUREL RESOURCEUREL\r
-\r
-UDEB : MAKEWORKUDEB RESOURCEUDEB\r
-\r
-ALL : UREL UDEB\r
-\r
-CLEAN CLEANALL : CLEANBUILD CLEANRELEASE CLEANLIBRARY\r
-\r
-\r
-\r
-WHAT WHATALL : WHATUREL WHATUDEB\r
-\r
-RESOURCE RESOURCEALL : RESOURCEUREL RESOURCEUDEB\r
-\r
-CLEANBUILD CLEANBUILDALL : CLEANBUILDUREL CLEANBUILDUDEB\r
-\r
-CLEANRELEASE CLEANRELEASEALL : CLEANRELEASEUREL CLEANRELEASEUDEB\r
-\r
-MAKEWORK MAKEWORKALL : MAKEWORKUREL MAKEWORKUDEB\r
-\r
-LISTING LISTINGALL : LISTINGUREL LISTINGUDEB\r
-\r
-MAKEWORK : MAKEWORKLIBRARY\r
-\r
-RESOURCEUREL RESOURCEUDEB : GENERIC_RESOURCE\r
-\r
-\r
-# must set both PATH and Path to make it work correctly\r
-Path:=X:\DEV\UIQ21\EPOC32\gcc\bin;$(Path)\r
-PATH:=$(Path)\r
-\r
-INCDIR  = -I "." -I "..\..\..\..\..\EPOC32\INCLUDE"\r
-\r
-GCCFLAGS=-march=armv4t -mthumb-interwork \\r
-               -pipe -c -nostdinc -Wall -Wno-ctor-dtor-privacy -Wno-unknown-pragmas \r
-\r
-GCCDEFS = -D__SYMBIAN32__ -D__GCC32__ -D__EPOC32__ -D__MARM__ -D__MARM_ARMI__ -D__DLL__ $(USERDEFS) -D__DEBUG_PRINT\r
-\r
-GCCUREL = gcc -s -fomit-frame-pointer -O $(GCCFLAGS) -DNDEBUG -D_UNICODE $(GCCDEFS)\r
-GCCUDEB = gcc -g -O $(GCCFLAGS) -D_DEBUG -D_UNICODE $(GCCDEFS)\r
-\r
-\r
-UREL : \\r
-       $(EPOCTRGUREL)\PICODRIVEN.APP\r
-\r
-UDEB : \\r
-       $(EPOCTRGUDEB)\PICODRIVEN.APP\r
-\r
-\r
-RESOURCEUREL : MAKEWORKUREL\r
-RESOURCEUDEB : MAKEWORKUDEB\r
-\r
-LIBRARY : MAKEWORKLIBRARY\r
-\r
-FREEZE :\r
-\r
-CLEANLIBRARY :\r
-\r
-\r
-GENERIC_RESOURCE : GENERIC_MAKEWORK\r
-\r
-# REAL TARGET - BUILD VARIANT UREL\r
-\r
-WHATUREL : WHATGENERIC\r
-\r
-CLEANUREL : CLEANBUILDUREL CLEANRELEASEUREL\r
-\r
-CLEANBUILDUREL : \r
-       @perl -S ermdir.pl "$(EPOCBLDUREL)"\r
-\r
-CLEANRELEASEUREL : CLEANGENERIC\r
-\r
-\r
-UREL_RELEASEABLES1= \\r
-       \DEV\UIQ21\EPOC32\RELEASE\ARMI\UREL\PICODRIVEN.APP \\r
-       \DEV\UIQ21\EPOC32\RELEASE\ARMI\UREL\PICODRIVEN.APP.MAP\r
-\r
-WHATUREL:\r
-       @echo $(UREL_RELEASEABLES1)\r
-\r
-CLEANRELEASEUREL:\r
-       -$(ERASE) $(UREL_RELEASEABLES1)\r
-\r
-LISTINGUREL : MAKEWORKUREL \\r
-       LISTINGURELAPP \\r
-       LISTINGURELCSIMPLETEXTPARSER \\r
-       LISTINGURELDIALOGS \\r
-       LISTINGURELENGINE \\r
-       LISTINGURELSIMPLECLIENT\r
-\r
-LIBSUREL= \\r
-       $(EPOCSTATLINKUREL)\EDLLSTUB.LIB \\r
-       $(EPOCSTATLINKUREL)\EGCC.LIB \\r
-       $(EPOCLINKUREL)\EUSER.LIB \\r
-       $(EPOCLINKUREL)\WS32.LIB \\r
-       $(EPOCLINKUREL)\EFSRV.LIB \\r
-       $(EPOCLINKUREL)\APPARC.LIB \\r
-       $(EPOCLINKUREL)\CONE.LIB \\r
-       $(EPOCLINKUREL)\EIKCOCTL.LIB \\r
-       $(EPOCLINKUREL)\EIKCORE.LIB \\r
-       $(EPOCLINKUREL)\EIKDLG.LIB \\r
-       $(EPOCLINKUREL)\EIKCTL.LIB \\r
-       $(EPOCLINKUREL)\EIKFILE.LIB \\r
-       $(EPOCLINKUREL)\EGUL.LIB \\r
-       $(EPOCLINKUREL)\ETEXT.LIB \\r
-       $(EPOCLINKUREL)\GDI.LIB\r
-\r
-$(EPOCTRGUREL)\PICODRIVEN.APP : $(EPOCBLDUREL)\PICODRIVEN.in $(EPOCSTATLINKUREL)\EDLL.LIB $(LIBSUREL)\r
-       dlltool -m arm_interwork --output-def "$(EPOCBLDUREL)\PICODRIVEN.inf" "$(EPOCBLDUREL)\PICODRIVEN.in"\r
-       perl -S makedef.pl -Deffile "$(EPOCBLDUREL)\PICODRIVEN.inf" -1 NewApplication__Fv "$(EPOCBLD)\PICODRIVEN.def"\r
-       -$(ERASE) "$(EPOCBLDUREL)\PICODRIVEN.inf"\r
-       dlltool -m arm_interwork --def "$(EPOCBLD)\PICODRIVEN.def" \\r
-               --output-exp "$(EPOCBLDUREL)\PICODRIVEN.exp" \\r
-               --dllname "PICODRIVEN[1000c193].APP"\r
-       ld  -s -e _E32Dll -u _E32Dll "$(EPOCBLDUREL)\PICODRIVEN.exp" --dll \\r
-               --base-file "$(EPOCBLDUREL)\PICODRIVEN.bas" -o "$(EPOCBLDUREL)\PICODRIVEN.APP" \\r
-               "$(EPOCSTATLINKUREL)\EDLL.LIB" --whole-archive "$(EPOCBLDUREL)\PICODRIVEN.in" \\r
-               --no-whole-archive $(LIBSUREL) $(USERLDFLAGS)\r
-       -$(ERASE) "$(EPOCBLDUREL)\PICODRIVEN.exp"\r
-       -$(ERASE) "$(EPOCBLDUREL)\PICODRIVEN.APP"\r
-       dlltool -m arm_interwork \\r
-               --def "$(EPOCBLD)\PICODRIVEN.def" \\r
-               --dllname "PICODRIVEN[1000c193].APP" \\r
-               --base-file "$(EPOCBLDUREL)\PICODRIVEN.bas" \\r
-               --output-exp "$(EPOCBLDUREL)\PICODRIVEN.exp" \r
-       -$(ERASE) "$(EPOCBLDUREL)\PICODRIVEN.bas"\r
-       ld  -s -e _E32Dll -u _E32Dll --dll \\r
-               "$(EPOCBLDUREL)\PICODRIVEN.exp" \\r
-               -Map "$(EPOCTRGUREL)\PICODRIVEN.APP.map" -o "$(EPOCBLDUREL)\PICODRIVEN.APP" \\r
-               "$(EPOCSTATLINKUREL)\EDLL.LIB" --whole-archive "$(EPOCBLDUREL)\PICODRIVEN.in" \\r
-               --no-whole-archive $(LIBSUREL) $(USERLDFLAGS)\r
-       -$(ERASE) "$(EPOCBLDUREL)\PICODRIVEN.exp"\r
-       petran  "$(EPOCBLDUREL)\PICODRIVEN.APP" "$@" \\r
-                -nocall -uid1 0x10000079 -uid2 0x100039ce -uid3 0x1000c193\r
-       -$(ERASE) "$(EPOCBLDUREL)\PICODRIVEN.APP"\r
-\r
-OBJECTSUREL= \\r
-       $(EPOCBLDUREL)\APP.o \\r
-       $(EPOCBLDUREL)\CSIMPLETEXTPARSER.o \\r
-       $(EPOCBLDUREL)\DIALOGS.o \\r
-       $(EPOCBLDUREL)\ENGINE.o \\r
-       $(EPOCBLDUREL)\SIMPLECLIENT.o\r
-\r
-$(EPOCBLDUREL)\PICODRIVEN.in : $(OBJECTSUREL)\r
-       if exist "$@" del "$@"\r
-       ar cr $@ $^\r
-\r
-\r
-# REAL TARGET - BUILD VARIANT UDEB\r
-\r
-WHATUDEB : WHATGENERIC\r
-\r
-CLEANUDEB : CLEANBUILDUDEB CLEANRELEASEUDEB\r
-\r
-CLEANBUILDUDEB : \r
-       @perl -S ermdir.pl "$(EPOCBLDUDEB)"\r
-\r
-CLEANRELEASEUDEB : CLEANGENERIC\r
-\r
-\r
-UDEB_RELEASEABLES1= \\r
-       \DEV\UIQ21\EPOC32\RELEASE\ARMI\UDEB\PICODRIVEN.APP \\r
-       \DEV\UIQ21\EPOC32\RELEASE\ARMI\UDEB\PICODRIVEN.APP.MAP\r
-\r
-WHATUDEB:\r
-       @echo $(UDEB_RELEASEABLES1)\r
-\r
-CLEANRELEASEUDEB:\r
-       -$(ERASE) $(UDEB_RELEASEABLES1)\r
-\r
-LISTINGUDEB : MAKEWORKUDEB \\r
-       LISTINGUDEBAPP \\r
-       LISTINGUDEBCSIMPLETEXTPARSER \\r
-       LISTINGUDEBDIALOGS \\r
-       LISTINGUDEBENGINE \\r
-       LISTINGUDEBSIMPLECLIENT\r
-\r
-LIBSUDEB= \\r
-       $(EPOCSTATLINKUDEB)\EDLLSTUB.LIB \\r
-       $(EPOCSTATLINKUDEB)\EGCC.LIB \\r
-       $(EPOCLINKUDEB)\EUSER.LIB \\r
-       $(EPOCLINKUDEB)\WS32.LIB \\r
-       $(EPOCLINKUDEB)\EFSRV.LIB \\r
-       $(EPOCLINKUDEB)\APPARC.LIB \\r
-       $(EPOCLINKUDEB)\CONE.LIB \\r
-       $(EPOCLINKUDEB)\EIKCOCTL.LIB \\r
-       $(EPOCLINKUDEB)\EIKCORE.LIB \\r
-       $(EPOCLINKUDEB)\EIKDLG.LIB \\r
-       $(EPOCLINKUDEB)\EIKCTL.LIB \\r
-       $(EPOCLINKUDEB)\EIKFILE.LIB \\r
-       $(EPOCLINKUDEB)\EGUL.LIB \\r
-       $(EPOCLINKUDEB)\ETEXT.LIB \\r
-       $(EPOCLINKUDEB)\GDI.LIB\r
-\r
-$(EPOCTRGUDEB)\PICODRIVEN.APP : $(EPOCBLDUDEB)\PICODRIVEN.in $(EPOCSTATLINKUDEB)\EDLL.LIB $(LIBSUDEB)\r
-       dlltool -m arm_interwork --output-def "$(EPOCBLDUDEB)\PICODRIVEN.inf" "$(EPOCBLDUDEB)\PICODRIVEN.in"\r
-       perl -S makedef.pl -Deffile "$(EPOCBLDUDEB)\PICODRIVEN.inf" -1 NewApplication__Fv "$(EPOCBLD)\PICODRIVEN.def"\r
-       -$(ERASE) "$(EPOCBLDUDEB)\PICODRIVEN.inf"\r
-       dlltool -m arm_interwork --def "$(EPOCBLD)\PICODRIVEN.def" \\r
-               --output-exp "$(EPOCBLDUDEB)\PICODRIVEN.exp" \\r
-               --dllname "PICODRIVEN[1000c193].APP"\r
-       ld  -s -e _E32Dll -u _E32Dll "$(EPOCBLDUDEB)\PICODRIVEN.exp" --dll \\r
-               --base-file "$(EPOCBLDUDEB)\PICODRIVEN.bas" -o "$(EPOCBLDUDEB)\PICODRIVEN.APP" \\r
-               "$(EPOCSTATLINKUDEB)\EDLL.LIB" --whole-archive "$(EPOCBLDUDEB)\PICODRIVEN.in" \\r
-               --no-whole-archive $(LIBSUDEB) $(USERLDFLAGS)\r
-       -$(ERASE) "$(EPOCBLDUDEB)\PICODRIVEN.exp"\r
-       -$(ERASE) "$(EPOCBLDUDEB)\PICODRIVEN.APP"\r
-       dlltool -m arm_interwork \\r
-               --def "$(EPOCBLD)\PICODRIVEN.def" \\r
-               --dllname "PICODRIVEN[1000c193].APP" \\r
-               --base-file "$(EPOCBLDUDEB)\PICODRIVEN.bas" \\r
-               --output-exp "$(EPOCBLDUDEB)\PICODRIVEN.exp" \r
-       -$(ERASE) "$(EPOCBLDUDEB)\PICODRIVEN.bas"\r
-       ld  -e _E32Dll -u _E32Dll --dll \\r
-               "$(EPOCBLDUDEB)\PICODRIVEN.exp" \\r
-               -Map "$(EPOCTRGUDEB)\PICODRIVEN.APP.map" -o "$(EPOCBLDUDEB)\PICODRIVEN.APP" \\r
-               "$(EPOCSTATLINKUDEB)\EDLL.LIB" --whole-archive "$(EPOCBLDUDEB)\PICODRIVEN.in" \\r
-               --no-whole-archive $(LIBSUDEB) $(USERLDFLAGS)\r
-       -$(ERASE) "$(EPOCBLDUDEB)\PICODRIVEN.exp"\r
-       objcopy -X "$(EPOCBLDUDEB)\PICODRIVEN.APP" "$(EPOCTRGUDEB)\PICODRIVEN.sym"\r
-       petran  "$(EPOCBLDUDEB)\PICODRIVEN.APP" "$@" \\r
-                -nocall -uid1 0x10000079 -uid2 0x100039ce -uid3 0x1000c193\r
-       -$(ERASE) "$(EPOCBLDUDEB)\PICODRIVEN.APP"\r
-\r
-OBJECTSUDEB= \\r
-       $(EPOCBLDUDEB)\APP.o \\r
-       $(EPOCBLDUDEB)\CSIMPLETEXTPARSER.o \\r
-       $(EPOCBLDUDEB)\DIALOGS.o \\r
-       $(EPOCBLDUDEB)\ENGINE.o \\r
-       $(EPOCBLDUDEB)\SIMPLECLIENT.o\r
-\r
-$(EPOCBLDUDEB)\PICODRIVEN.in : $(OBJECTSUDEB)\r
-       if exist "$@" del "$@"\r
-       ar cr $@ $^\r
-\r
-\r
-# SOURCES\r
-\r
-# Resource Z\SYSTEM\APPS\PICODRIVEN\PICODRIVEN.RSC\r
-\r
-DEPEND= \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BADEF.RH \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKCDLG.RSG \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKCOCTL.RSG \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKCOLOR.HRH \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKCORE.RSG \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKCTL.RSG \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKDLG.RSG \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKFILE.RSG \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKMISC.RSG \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKON.HRH \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKON.RH \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKON.RSG \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKPRINT.RSG \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\GULFTFLG.HRH \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\UIKON.HRH \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\UIKON.RH \\r
-       \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICODRIVEN.HRH\r
-\r
-GENERIC_RESOURCE : $(EPOCDATA)\Z\SYSTEM\APPS\PICODRIVEN\PICODRIVEN.RSC\r
-\r
-$(EPOCDATA)\Z\SYSTEM\APPS\PICODRIVEN\PICODRIVEN.RSC : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICODRIVEN.RSS $(DEPEND)\r
-       perl -S epocrc.pl -I "." -I "." -I- -I "..\..\..\..\..\EPOC32\INCLUDE" -D__DEBUG_PRINT -DLANGUAGE_SC -u "\DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICODRIVEN.RSS" -o$@  -h"\DEV\UIQ21\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICODRIVEN\ARMI\PICODRIVEN.rsg" -t"\DEV\UIQ21\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICODRIVEN\ARMI"  -l"Z\SYSTEM\APPS\PICODRIVEN:\DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER"\r
-       perl -S ecopyfile.pl "\DEV\UIQ21\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICODRIVEN\ARMI\PICODRIVEN.rsg" "\DEV\UIQ21\EPOC32\INCLUDE\PICODRIVEN.RSG"\r
-\r
-# Aif PICODRIVEN.AIF\r
-\r
-DEPEND= \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\AIFTOOL.RH\r
-\r
-GENERIC_RESOURCE : $(EPOCDATA)\Z\SYSTEM\APPS\PICODRIVEN\PICODRIVEN.AIF\r
-\r
-$(EPOCDATA)\Z\SYSTEM\APPS\PICODRIVEN\PICODRIVEN.AIF : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICODRIVENAIF.RSS $(DEPEND) \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICON20X16.BMP \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICON20X16M.BMP \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICON32X32.BMP \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICON32X32M.BMP\r
-       perl -S epocaif.pl -o$@ "\DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICODRIVENAIF.RSS" \\r
-               -t"\DEV\UIQ21\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICODRIVEN\ARMI"  -l"$(TRGDIR):\DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER"\\r
-               -b"\\r
-               /c8\DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICON20X16.BMP\\r
-               /c8\DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICON20X16M.BMP\\r
-               /c8\DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICON32X32.BMP\\r
-               /c8\DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICON32X32M.BMP" \\r
-                -I "." -I- -I "..\..\..\..\..\EPOC32\INCLUDE" -I "..\..\..\..\..\EPOC32\INCLUDE"\r
-\r
-# Source APP.CPP\r
-\r
-$(EPOCBLDUREL)\APP.lis $(EPOCBLDUREL)\APP.o \\r
-$(EPOCBLDUDEB)\APP.lis $(EPOCBLDUDEB)\APP.o \\r
-: \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\APACMDLN.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\APADEF.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\APAFLREC.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\APAID.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\APGTASK.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\APPARC.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BADESCA.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BAERRHAN.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BAMDESCA.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BARSC.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BASCHED.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BITBASE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BITDEV.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BITDEV.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BITMAP.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BITSTD.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BTDEFCOMMPORT.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BTDEVICE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BTDEVICE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BTDEVICE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BTMANCLIENT.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BTREGISTRY.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BTSDP.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BTSDP.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BTTYPES.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BTTYPES.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BTUIUTILOBSERVER.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\C32COMM.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\C32COMM.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\CDBCOLS.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\CDBLEN.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\CDBPREFTABLE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\COEAUI.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\COEAUIB.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\COECCNTX.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\COECNTRL.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\COECOBS.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\COEDEF.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\COEHELP.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\COEINPUT.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\COEMAIN.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\COEUTILS.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\COEVIEW.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\COMMDB.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\COMMDB.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\COMMDB.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\D32COMM.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\D32COMM.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\D32DBMS.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\D32DBMS.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\DIAL.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\DIAL.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32BASE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32BASE.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32DEF.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32DES16.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32DES8.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32HAL.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32KEYS.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32PCCD.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32STD.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32STD.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32STD.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32SVR.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32UID.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32VER.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKALIGN.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKAMNT.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKAPP.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKAPPUI.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKAUFTY.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKBCTRL.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKBGFTY.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKBTGPC.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKBTGRP.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKBUTB.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKCDLG.RSG \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKCFDLG.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKCHKBX.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKCHLST.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKCLB.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKCMOBS.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKCOCTL.RSG \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKCOLOR.HRH \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKCORE.RSG \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKCTGRP.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKCTL.RSG \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKDEF.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKDGFTY.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKDIALG.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKDLG.RSG \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKDLGTB.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKDOC.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKDPOBS.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKEDWOB.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKENV.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKENV.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKFCTRY.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKFILE.RSG \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKLABEL.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKLBED.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKLBI.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKLBM.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKLBO.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKLBV.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKLBVO.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKLBX.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKLIBRY.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKMENUB.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKMENUP.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKMISC.RSG \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKMOBS.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKON.HRH \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKON.RSG \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKPRINT.RSG \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKSBFRM.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKSBOBS.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKSCBUT.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKSCRLB.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKTXLBM.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKTXLBX.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKVCURS.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\ETEL.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\ETEL.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\F32FILE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\F32FILE.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FAXDEFN.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FBS.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FLDBASE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FLDBLTIN.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FLDINFO.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FLDSET.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FNTSTORE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FRMLAYDT.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FRMPARAM.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FRMTLAY.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FRMVIS.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\GDI.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\GDI.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\GRAPHICSACCELERATOR.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\GULALIGN.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\GULBORDR.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\GULCOLOR.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\GULDEF.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\GULFTFLG.HRH \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\GULUTIL.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\LAFMAIN.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\LAFPUBLC.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\OPENFONT.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\PICODRIVEN.RSG \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\QBTSELECTDLG.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\QIKSHUTTER.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32BUF.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32BUF.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32MEM.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32MEM.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32PAGE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32PAGE.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32SHARE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32SHARE.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32STD.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32STD.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32STOR.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32STOR.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32STRM.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32STRM.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\SACLIENT.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\SACLS.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\SAVARSET.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\SAVENOTF.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\T32WLD.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TAGMA.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTETEXT.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTETEXT.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTFMLYR.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTFMLYR.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTFMSTM.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTFRMAT.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTFRMAT.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTLAYDC.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTSTYLE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTSTYLE.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\UIKON.HRH \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\VWSDEF.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\W32STD.H \\r
-       \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\CLIENTSERVER.H \\r
-       \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\APP.H \\r
-       \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\DIALOGS.H \\r
-       \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\ENGINE.H \\r
-       \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICODRIVEN.HRH \\r
-       \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\SIMPLECLIENT.H\r
-\r
-$(EPOCBLDUREL)\APP.o : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\App.cpp\r
-       $(GCCUREL) -I "." $(INCDIR) -o $@ ".\App.cpp"\r
-\r
-LISTINGURELAPP : $(EPOCBLDUREL)\APP.lis\r
-       perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\APP.lst.ARMI\r
-\r
-$(EPOCBLDUREL)\APP.lis : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\App.cpp\r
-       $(GCCUREL) -Wa,-adln -I "." $(INCDIR) -o nul: ".\App.cpp" > $@\r
-\r
-$(EPOCBLDUDEB)\APP.o : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\App.cpp\r
-       $(GCCUDEB) -I "." $(INCDIR) -o $@ ".\App.cpp"\r
-\r
-LISTINGUDEBAPP : $(EPOCBLDUDEB)\APP.lis\r
-       perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\APP.lst.ARMI\r
-\r
-$(EPOCBLDUDEB)\APP.lis : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\App.cpp\r
-       $(GCCUDEB) -Wa,-adln -I "." $(INCDIR) -o nul: ".\App.cpp" > $@\r
-\r
-\r
-\r
-# Source CSIMPLETEXTPARSER.CPP\r
-\r
-$(EPOCBLDUREL)\CSIMPLETEXTPARSER.lis $(EPOCBLDUREL)\CSIMPLETEXTPARSER.o \\r
-$(EPOCBLDUDEB)\CSIMPLETEXTPARSER.lis $(EPOCBLDUDEB)\CSIMPLETEXTPARSER.o \\r
-: \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\APADEF.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\APAID.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\APPARC.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BADESCA.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BAMDESCA.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BARSC.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BASCHED.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BITBASE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BITDEV.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BITDEV.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BITMAP.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BITSTD.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\COECNTRL.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\COECOBS.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\COEDEF.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\COEHELP.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\COEINPUT.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\COEMAIN.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32BASE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32BASE.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32DEF.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32DES16.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32DES8.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32HAL.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32KEYS.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32PCCD.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32STD.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32STD.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32SVR.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKBCTRL.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKBUTB.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKCOLOR.HRH \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKEDWIN.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKEDWOB.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKGTED.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKON.HRH \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKRTED.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKSBFRM.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKSBOBS.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKSCBUT.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKSCRLB.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\F32FILE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\F32FILE.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FBS.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FEPBASE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FLDBASE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FLDBLTIN.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FLDINFO.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FLDSET.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FNTSTORE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FRMFRAME.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FRMLAYDT.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FRMPARAM.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FRMTLAY.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FRMTVIEW.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FRMVIS.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\GDI.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\GDI.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\GRAPHICSACCELERATOR.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\GULALIGN.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\GULBORDR.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\GULDEF.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\GULFTFLG.HRH \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\GULUTIL.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\LAFPUBLC.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\MEDOBSRV.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\MPARSER.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\OPENFONT.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32BUF.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32BUF.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32PAGE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32PAGE.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32SHARE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32SHARE.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32STD.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32STD.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32STOR.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32STOR.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32STRM.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32STRM.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TAGMA.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTETEXT.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTETEXT.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTFMLYR.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTFMLYR.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTFMSTM.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTFRMAT.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTFRMAT.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTGLOBL.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTGLOBL.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTLAYDC.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTMFMTX.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTMRTSR.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTRICH.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTRICH.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTSTYLE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTSTYLE.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\UIKON.HRH \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\W32STD.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\W32STD.H \\r
-       \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\CSIMPLETEXTPARSER.H\r
-\r
-$(EPOCBLDUREL)\CSIMPLETEXTPARSER.o : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\Csimpletextparser.cpp\r
-       $(GCCUREL) -I "." $(INCDIR) -o $@ ".\Csimpletextparser.cpp"\r
-\r
-LISTINGURELCSIMPLETEXTPARSER : $(EPOCBLDUREL)\CSIMPLETEXTPARSER.lis\r
-       perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\CSIMPLETEXTPARSER.lst.ARMI\r
-\r
-$(EPOCBLDUREL)\CSIMPLETEXTPARSER.lis : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\Csimpletextparser.cpp\r
-       $(GCCUREL) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Csimpletextparser.cpp" > $@\r
-\r
-$(EPOCBLDUDEB)\CSIMPLETEXTPARSER.o : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\Csimpletextparser.cpp\r
-       $(GCCUDEB) -I "." $(INCDIR) -o $@ ".\Csimpletextparser.cpp"\r
-\r
-LISTINGUDEBCSIMPLETEXTPARSER : $(EPOCBLDUDEB)\CSIMPLETEXTPARSER.lis\r
-       perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\CSIMPLETEXTPARSER.lst.ARMI\r
-\r
-$(EPOCBLDUDEB)\CSIMPLETEXTPARSER.lis : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\Csimpletextparser.cpp\r
-       $(GCCUDEB) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Csimpletextparser.cpp" > $@\r
-\r
-\r
-\r
-# Source DIALOGS.CPP\r
-\r
-$(EPOCBLDUREL)\DIALOGS.lis $(EPOCBLDUREL)\DIALOGS.o \\r
-$(EPOCBLDUDEB)\DIALOGS.lis $(EPOCBLDUDEB)\DIALOGS.o \\r
-: \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\APACMDLN.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\APADEF.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\APAFLREC.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\APAID.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\APPARC.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BADESCA.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BAERRHAN.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BAMDESCA.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BARSC.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BASCHED.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BITBASE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BITDEV.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BITDEV.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BITMAP.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BITSTD.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\C32COMM.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\C32COMM.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\COECCNTX.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\COECNTRL.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\COECOBS.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\COEDEF.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\COEHELP.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\COEINPUT.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\COEMAIN.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\D32COMM.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\D32COMM.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32BASE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32BASE.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32DEF.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32DES16.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32DES8.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32HAL.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32KEYS.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32PCCD.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32STD.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32STD.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32STD.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32SVR.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32VER.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKALIGN.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKAMNT.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKAUFTY.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKBCTRL.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKBGFTY.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKBTGPC.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKBTGRP.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKBUTB.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKCHKBX.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKCHLST.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKCMOBS.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKCOLOR.HRH \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKCTGRP.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKDEF.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKDGFTY.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKDIALG.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKDLGTB.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKDPOBS.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKEDWIN.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKEDWOB.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKENV.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKENV.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKFCTRY.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKGTED.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKHOPBT.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKLABEL.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKLBED.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKLBM.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKLBO.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKLBV.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKLBVO.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKLBX.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKLIBRY.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKON.HRH \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKOPBUT.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKRTED.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKSBFRM.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKSBOBS.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKSCBUT.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKSCRLB.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKTXLBM.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKTXLBX.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKVCURS.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\ETEL.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\ETEL.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\F32FILE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\F32FILE.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FAXDEFN.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FBS.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FEPBASE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FLDBASE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FLDBLTIN.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FLDINFO.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FLDSET.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FNTSTORE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FRMFRAME.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FRMLAYDT.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FRMPARAM.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FRMTLAY.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FRMTVIEW.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FRMVIS.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\GDI.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\GDI.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\GRAPHICSACCELERATOR.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\GULALIGN.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\GULBORDR.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\GULCOLOR.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\GULDEF.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\GULFTFLG.HRH \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\GULUTIL.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\LAFMAIN.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\LAFPUBLC.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\MEDOBSRV.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\MPARSER.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\OPENFONT.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\PICODRIVEN.RSG \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\QIKSHUTTER.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\QIKVERTOPTIONBUTTONLIST.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\QUARTZKEYS.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32BUF.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32BUF.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32PAGE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32PAGE.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32SHARE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32SHARE.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32STD.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32STD.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32STOR.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32STOR.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32STRM.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32STRM.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TAGMA.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTETEXT.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTETEXT.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTFMLYR.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTFMLYR.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTFMSTM.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTFRMAT.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTFRMAT.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTGLOBL.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTGLOBL.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTLAYDC.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTMFMTX.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTMRTSR.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTRICH.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTRICH.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTSTYLE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTSTYLE.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\UIKON.HRH \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\W32STD.H \\r
-       \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\CLIENTSERVER.H \\r
-       \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\CSIMPLETEXTPARSER.H \\r
-       \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\DIALOGS.H \\r
-       \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\ENGINE.H \\r
-       \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICODRIVEN.HRH \\r
-       \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\VERSION.H\r
-\r
-$(EPOCBLDUREL)\DIALOGS.o : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\Dialogs.cpp\r
-       $(GCCUREL) -I "." $(INCDIR) -o $@ ".\Dialogs.cpp"\r
-\r
-LISTINGURELDIALOGS : $(EPOCBLDUREL)\DIALOGS.lis\r
-       perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\DIALOGS.lst.ARMI\r
-\r
-$(EPOCBLDUREL)\DIALOGS.lis : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\Dialogs.cpp\r
-       $(GCCUREL) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Dialogs.cpp" > $@\r
-\r
-$(EPOCBLDUDEB)\DIALOGS.o : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\Dialogs.cpp\r
-       $(GCCUDEB) -I "." $(INCDIR) -o $@ ".\Dialogs.cpp"\r
-\r
-LISTINGUDEBDIALOGS : $(EPOCBLDUDEB)\DIALOGS.lis\r
-       perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\DIALOGS.lst.ARMI\r
-\r
-$(EPOCBLDUDEB)\DIALOGS.lis : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\Dialogs.cpp\r
-       $(GCCUDEB) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Dialogs.cpp" > $@\r
-\r
-\r
-\r
-# Source ENGINE.CPP\r
-\r
-$(EPOCBLDUREL)\ENGINE.lis $(EPOCBLDUREL)\ENGINE.o \\r
-$(EPOCBLDUDEB)\ENGINE.lis $(EPOCBLDUDEB)\ENGINE.o \\r
-: \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\APACMDLN.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\APADEF.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\APAFLREC.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\APAID.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BADESCA.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BAERRHAN.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BAMDESCA.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BARSC.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BASCHED.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BITBASE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BITDEV.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BITDEV.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BITMAP.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BITSTD.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\C32COMM.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\C32COMM.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\COEDEF.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\COEMAIN.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\D32COMM.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\D32COMM.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32BASE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32BASE.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32DEF.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32DES16.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32DES8.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32HAL.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32KEYS.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32PCCD.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32STD.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32STD.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32STD.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32SVR.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32VER.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKAMNT.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKAUFTY.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKCOLOR.HRH \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKDEF.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKDGFTY.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKENV.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKFCTRY.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKLIBRY.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\EIKVCURS.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\ETEL.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\ETEL.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\F32FILE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\F32FILE.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FAXDEFN.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FBS.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FLDBASE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FLDBLTIN.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FLDINFO.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FLDSET.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FNTSTORE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FRMLAYDT.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FRMPARAM.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FRMTLAY.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FRMVIS.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\GDI.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\GDI.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\GRAPHICSACCELERATOR.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\GULALIGN.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\GULBORDR.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\GULCOLOR.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\GULDEF.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\LAFMAIN.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\OPENFONT.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32BUF.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32BUF.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32PAGE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32PAGE.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32SHARE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32SHARE.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32STD.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32STD.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32STOR.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32STOR.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32STRM.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32STRM.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TAGMA.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTETEXT.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTETEXT.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTFMLYR.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTFMLYR.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTFMSTM.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTFRMAT.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTFRMAT.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTLAYDC.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTSTYLE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\TXTSTYLE.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\UIKON.HRH \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\W32STD.H \\r
-       \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\CLIENTSERVER.H \\r
-       \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\ENGINE.H \\r
-       \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\VERSION.H\r
-\r
-$(EPOCBLDUREL)\ENGINE.o : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\Engine.cpp\r
-       $(GCCUREL) -I "." $(INCDIR) -o $@ ".\Engine.cpp"\r
-\r
-LISTINGURELENGINE : $(EPOCBLDUREL)\ENGINE.lis\r
-       perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\ENGINE.lst.ARMI\r
-\r
-$(EPOCBLDUREL)\ENGINE.lis : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\Engine.cpp\r
-       $(GCCUREL) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Engine.cpp" > $@\r
-\r
-$(EPOCBLDUDEB)\ENGINE.o : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\Engine.cpp\r
-       $(GCCUDEB) -I "." $(INCDIR) -o $@ ".\Engine.cpp"\r
-\r
-LISTINGUDEBENGINE : $(EPOCBLDUDEB)\ENGINE.lis\r
-       perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\ENGINE.lst.ARMI\r
-\r
-$(EPOCBLDUDEB)\ENGINE.lis : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\Engine.cpp\r
-       $(GCCUDEB) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Engine.cpp" > $@\r
-\r
-\r
-\r
-# Source SIMPLECLIENT.CPP\r
-\r
-$(EPOCBLDUREL)\SIMPLECLIENT.lis $(EPOCBLDUREL)\SIMPLECLIENT.o \\r
-$(EPOCBLDUDEB)\SIMPLECLIENT.lis $(EPOCBLDUDEB)\SIMPLECLIENT.o \\r
-: \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BITBASE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BITDEV.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BITDEV.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BITMAP.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\BITSTD.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32BASE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32BASE.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32DEF.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32DES16.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32DES8.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32HAL.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32KEYS.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32PCCD.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32STD.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32STD.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\E32SVR.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\F32FILE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\F32FILE.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FBS.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\FNTSTORE.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\GDI.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\GDI.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\GRAPHICSACCELERATOR.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\OPENFONT.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32STD.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32STD.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32STRM.H \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\S32STRM.INL \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\W32STD.H \\r
-       \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\CLIENTSERVER.H \\r
-       \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\SIMPLECLIENT.H \\r
-       \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\VERSION.H\r
-\r
-$(EPOCBLDUREL)\SIMPLECLIENT.o : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\Simpleclient.cpp\r
-       $(GCCUREL) -I "." $(INCDIR) -o $@ ".\Simpleclient.cpp"\r
-\r
-LISTINGURELSIMPLECLIENT : $(EPOCBLDUREL)\SIMPLECLIENT.lis\r
-       perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\SIMPLECLIENT.lst.ARMI\r
-\r
-$(EPOCBLDUREL)\SIMPLECLIENT.lis : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\Simpleclient.cpp\r
-       $(GCCUREL) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Simpleclient.cpp" > $@\r
-\r
-$(EPOCBLDUDEB)\SIMPLECLIENT.o : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\Simpleclient.cpp\r
-       $(GCCUDEB) -I "." $(INCDIR) -o $@ ".\Simpleclient.cpp"\r
-\r
-LISTINGUDEBSIMPLECLIENT : $(EPOCBLDUDEB)\SIMPLECLIENT.lis\r
-       perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\SIMPLECLIENT.lst.ARMI\r
-\r
-$(EPOCBLDUDEB)\SIMPLECLIENT.lis : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\Simpleclient.cpp\r
-       $(GCCUDEB) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Simpleclient.cpp" > $@\r
-\r
-\r
-\r
-ROMFILE:\r
-       @echo file=\DEV\UIQ21\EPOC32\RELEASE\ARMI\##BUILD##\PICODRIVEN.APP SYSTEM\APPS\PICODRIVEN\PICODRIVEN.APP \r
-\r
-GENERIC_RELEASEABLES1= \\r
-       $(EPOCDATA)\Z\SYSTEM\APPS\PICODRIVEN\PICODRIVEN.AIF \\r
-       $(EPOCDATA)\Z\SYSTEM\APPS\PICODRIVEN\PICODRIVEN.RSC \\r
-       $(EPOCINC)\PICODRIVEN.RSG \\r
-       \DEV\UIQ21\EPOC32\LOCALISATION\AIF\DEV\PICODRIVEN\AIF\PICODRIVEN.RPP \\r
-       \DEV\UIQ21\EPOC32\LOCALISATION\AIF\DEV\PICODRIVEN\AIF\PICON20X16.BMP \\r
-       \DEV\UIQ21\EPOC32\LOCALISATION\AIF\DEV\PICODRIVEN\AIF\PICON20X16M.BMP \\r
-       \DEV\UIQ21\EPOC32\LOCALISATION\AIF\DEV\PICODRIVEN\AIF\PICON32X32.BMP \\r
-       \DEV\UIQ21\EPOC32\LOCALISATION\AIF\DEV\PICODRIVEN\AIF\PICON32X32M.BMP \\r
-       \DEV\UIQ21\EPOC32\LOCALISATION\DEV\PICODRIVEN\RSC\PICODRIVEN.RPP \\r
-       \DEV\UIQ21\EPOC32\LOCALISATION\GROUP\PICODRIVEN.INFO\r
-\r
-WHATGENERIC:\r
-       @echo $(GENERIC_RELEASEABLES1)\r
-\r
-CLEANGENERIC:\r
-       -$(ERASE) $(GENERIC_RELEASEABLES1)\r
-\r
-# Rules to create all necessary directories\r
-\r
-GENERIC_MAKEWORK : \\r
-       \DEV\UIQ21\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICODRIVEN\ARMI \\r
-       \DEV\UIQ21\EPOC32\DATA\Z\SYSTEM\APPS\PICODRIVEN \\r
-       \DEV\UIQ21\EPOC32\INCLUDE\r
-MAKEWORKLIBRARY : \\r
-       \DEV\UIQ21\EPOC32\RELEASE\ARMI\UREL\r
-MAKEWORKUDEB : \\r
-       \DEV\UIQ21\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICODRIVEN\ARMI\UDEB \\r
-       \DEV\UIQ21\EPOC32\RELEASE\ARMI\UDEB\r
-MAKEWORKUREL : \\r
-       \DEV\UIQ21\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICODRIVEN\ARMI\UREL \\r
-       \DEV\UIQ21\EPOC32\RELEASE\ARMI\UREL\r
-\r
-\DEV\UIQ21\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICODRIVEN\ARMI \\r
-\DEV\UIQ21\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICODRIVEN\ARMI\UDEB \\r
-\DEV\UIQ21\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICODRIVEN\ARMI\UREL \\r
-\DEV\UIQ21\EPOC32\DATA\Z\SYSTEM\APPS\PICODRIVEN \\r
-\DEV\UIQ21\EPOC32\INCLUDE \\r
-\DEV\UIQ21\EPOC32\RELEASE\ARMI\UDEB \\r
-\DEV\UIQ21\EPOC32\RELEASE\ARMI\UREL \\r
-:\r
-       perl -S emkdir.pl $@\r
-\r
diff --git a/platform/uiq2/launcher/PicoN20x16.bmp b/platform/uiq2/launcher/PicoN20x16.bmp
deleted file mode 100644 (file)
index 859f6d0..0000000
Binary files a/platform/uiq2/launcher/PicoN20x16.bmp and /dev/null differ
diff --git a/platform/uiq2/launcher/PicoN20x16m.bmp b/platform/uiq2/launcher/PicoN20x16m.bmp
deleted file mode 100644 (file)
index 578b643..0000000
Binary files a/platform/uiq2/launcher/PicoN20x16m.bmp and /dev/null differ
diff --git a/platform/uiq2/launcher/PicoN32x32.bmp b/platform/uiq2/launcher/PicoN32x32.bmp
deleted file mode 100644 (file)
index 292e1c2..0000000
Binary files a/platform/uiq2/launcher/PicoN32x32.bmp and /dev/null differ
diff --git a/platform/uiq2/launcher/PicoN32x32m.bmp b/platform/uiq2/launcher/PicoN32x32m.bmp
deleted file mode 100644 (file)
index 69f15e9..0000000
Binary files a/platform/uiq2/launcher/PicoN32x32m.bmp and /dev/null differ
diff --git a/platform/uiq2/launcher/PicodriveN.hrh b/platform/uiq2/launcher/PicodriveN.hrh
deleted file mode 100644 (file)
index c2a4aee..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-\r
-enum TAppMenuCommands\r
-{\r
-       // Emu menu\r
-       EEikCmdPicoLoadState = 10000,\r
-       EEikCmdPicoSaveState,\r
-       EEikCmdPicoLoadROM,\r
-       EEikCmdPicoResume,\r
-       EEikCmdPicoReset,\r
-       EEikCmdPicoKeys,\r
-       EEikCmdPicoSettings,\r
-\r
-       // Frameskip menu\r
-       EEikCmdPicoFrameskipAuto,\r
-       EEikCmdPicoFrameskip0,\r
-       EEikCmdPicoFrameskip1,\r
-       EEikCmdPicoFrameskip2,\r
-       EEikCmdPicoFrameskip4,\r
-       EEikCmdPicoFrameskip8,\r
-\r
-       // Debug menu\r
-       EEikCmdPicoDebugKillEmu,\r
-       EEikCmdPicoDebugInfo,\r
-\r
-       // config Dialog\r
-       // pages\r
-       ECtlOptPageMain,\r
-       ECtlOptPageSound,\r
-       ECtlOptPageMisc,\r
-       // main page\r
-       ECtlOptRotationLabel,\r
-       ECtlOptRotation,\r
-       ECtlOptRotation0,\r
-       ECtlOptRotation90,\r
-       ECtlOptRotation180,\r
-       ECtlOptRotation270,\r
-       ECtlOptScreenModeLabel,\r
-       ECtlOptScreenMode,\r
-       ECtlOptScreenModeCenter,\r
-       ECtlOptScreenModeFit,\r
-       ECtlOptScreenModeFit2,\r
-       ECtlOptUseAltRend,\r
-       ECtlOptUseAccTiming,\r
-       ECtlOptUseAccSprites,\r
-       ECtlOptShowFPS,\r
-       // sound page\r
-       ECtlOptEnableSound,\r
-       ECtlOptChipSelLabel,\r
-       ECtlOptEmulateZ80,\r
-       ECtlOptEmulateYM2612,\r
-       ECtlOptEmulateSN76496,\r
-       ECtlOptSndQLabel,\r
-       ECtlOptSndQuality,\r
-       // misc page\r
-       ECtlOpt6ButtonPad,\r
-       ECtlOptGzipStates,\r
-       ECtlOptUseSRAM,\r
-       ECtlOptMotDontUseVol,\r
-       ECtlOptRegionLabel,\r
-       ECtlOptRegion,\r
-       // credits\r
-       ECtlCredits,\r
-       // debug\r
-       ECtlDebugEdit\r
-};\r
-\r
-\r
-#define ECtlAboutVersion       1\r
-#define ECtlAboutLinks         2\r
-\r
diff --git a/platform/uiq2/launcher/PicodriveN.mmp b/platform/uiq2/launcher/PicodriveN.mmp
deleted file mode 100644 (file)
index 6362860..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-TARGET                 PicodriveN.app\r
-TARGETTYPE             app\r
-TARGETPATH             \system\Apps\PicodriveN\r
-UID                            0x100039CE 0x1000C193\r
-\r
-\r
-USERINCLUDE     .\r
-\r
-SYSTEMINCLUDE  \epoc32\include\r
-\r
-SOURCEPATH      .\r
-SOURCE                 App.cpp\r
-SOURCE                 Engine.cpp\r
-SOURCE                 Dialogs.cpp\r
-SOURCE                 CSimpleTextParser.cpp\r
-SOURCE                 SimpleClient.cpp\r
-\r
-LIBRARY                        EUSER.LIB WS32.LIB EFSRV.LIB\r
-LIBRARY                        APPARC.LIB CONE.LIB\r
-LIBRARY                        EIKCOCTL.LIB EIKCORE.LIB EIKDLG.LIB EIKCTL.LIB\r
-LIBRARY                        EIKFILE.LIB // CEikFileOpenDialog\r
-LIBRARY                        EGUL.LIB  // CColorList\r
-LIBRARY                        ETEXT.LIB // TCharFormat\r
-LIBRARY                        GDI.LIB   // TTypeface\r
-\r
-//LIBRARY                      ETEL.LIB\r
-//LIBRARY                      APGRFX.LIB FBSCLI.LIB bafl.lib BITGDI.LIB   \r
-\r
-SOURCEPATH             .\r
-RESOURCE        PicodriveN.rss\r
-\r
-//MACRO                        __DEBUG_PRINT\r
-\r
-AIF  PicodriveN.aif . PicodriveNAif.rss c8 PicoN20x16.bmp PicoN20x16m.bmp PicoN32x32.bmp PicoN32x32m.bmp\r
diff --git a/platform/uiq2/launcher/PicodriveN.rss b/platform/uiq2/launcher/PicodriveN.rss
deleted file mode 100644 (file)
index d4db38a..0000000
+++ /dev/null
@@ -1,474 +0,0 @@
-NAME PDN\r
-\r
-#include <eikon.rh>\r
-#include <eikon.rsg>\r
-#include "picodriven.hrh"\r
-\r
-\r
-RESOURCE RSS_SIGNATURE { }\r
-\r
-RESOURCE TBUF { buf=""; }\r
-\r
-RESOURCE EIK_APP_INFO\r
-       {\r
-       menubar=r_app_menubar;\r
-       hotkeys=r_app_hotkeys;\r
-       }\r
-\r
-RESOURCE HOTKEYS r_app_hotkeys\r
-    {\r
-    control=\r
-        {\r
-        HOTKEY { command=EEikCmdExit; key='e'; }\r
-        };\r
-    }\r
-\r
-RESOURCE MENU_BAR r_app_menubar\r
-    {\r
-    titles=\r
-        {\r
-        MENU_TITLE { menu_pane=r_app_emu_menu; txt="Emu"; },\r
-        MENU_TITLE { menu_pane=r_app_frameskip_menu; txt="Frameskip"; }\r
-#ifdef __DEBUG_PRINT\r
-        ,MENU_TITLE { menu_pane=r_app_debug_menu; txt="Debug"; }\r
-#endif\r
-               };\r
-    }\r
-\r
-RESOURCE MENU_PANE r_app_emu_menu\r
-       {\r
-       items=\r
-               {\r
-               MENU_ITEM { command=EEikCmdPicoLoadState; txt="Load state";  flags=EEikMenuItemDimmed; },\r
-               MENU_ITEM { command=EEikCmdPicoSaveState; txt="Save state";  flags=EEikMenuItemDimmed; },\r
-               MENU_ITEM { command=EEikCmdPicoLoadROM;   txt="Load new ROM"; },\r
-               MENU_ITEM { command=EEikCmdPicoResume;    txt="Resume game"; flags=EEikMenuItemDimmed; },\r
-               MENU_ITEM { command=EEikCmdPicoReset;     txt="Reset game";  flags=EEikMenuItemDimmed; },\r
-               MENU_ITEM { command=EEikCmdPicoKeys;      txt="Configure keys"; },\r
-               MENU_ITEM { command=EEikCmdPicoSettings;  txt="Settings"; },\r
-               MENU_ITEM { command=EEikCmdHelpAbout;     txt="About";       flags=EEikMenuItemSeparatorAfter; },\r
-               MENU_ITEM { command=EEikCmdExit;          txt="Exit"; }\r
-        };\r
-    }\r
-\r
-RESOURCE MENU_PANE r_app_frameskip_menu\r
-       {\r
-       items=\r
-               {\r
-               MENU_ITEM { command=EEikCmdPicoFrameskipAuto; txt="Auto"; flags=EEikMenuItemRadioStart | EEikMenuItemSeparatorAfter; },\r
-               MENU_ITEM { command=EEikCmdPicoFrameskip0;    txt="0";    flags=EEikMenuItemRadioMiddle; },\r
-               MENU_ITEM { command=EEikCmdPicoFrameskip1;    txt="1";    flags=EEikMenuItemRadioMiddle; },\r
-               MENU_ITEM { command=EEikCmdPicoFrameskip2;    txt="2";    flags=EEikMenuItemRadioMiddle; },\r
-               MENU_ITEM { command=EEikCmdPicoFrameskip4;    txt="4";    flags=EEikMenuItemRadioMiddle; },\r
-               MENU_ITEM { command=EEikCmdPicoFrameskip8;    txt="8";    flags=EEikMenuItemRadioEnd; }\r
-        };\r
-    }\r
-\r
-RESOURCE MENU_PANE r_app_debug_menu\r
-       {\r
-       items=\r
-               {\r
-               MENU_ITEM { command=EEikCmdPicoDebugKillEmu; txt="Kill emu proc"; },\r
-               MENU_ITEM { command=EEikCmdPicoDebugInfo;    txt="info"; }\r
-        };\r
-    }\r
-\r
-\r
-\r
-/**************************************\r
- *\r
- * about dialog\r
- *\r
- **************************************/\r
-\r
-RESOURCE DIALOG r_dialog_about\r
-{\r
-       title = "About";\r
-       buttons = r_buttons_continue_credits;\r
-       flags = EEikDialogFlagWait;\r
-       items =\r
-       {\r
-               DLG_LINE\r
-               {\r
-                       itemflags = EQikDlgItemUseFullWidth | EQikDlgItemDenselyPacked;\r
-                       type = EEikCtRichTextEditor;\r
-                       id = ECtlAboutVersion;\r
-                       control = RTXTED\r
-                       {\r
-                               flags = EEikEdwinResizable | EEikEdwinNoAutoSelection | EEikEdwinReadOnly | EEikEdwinWidthInPixels;\r
-                               numlines = 4;\r
-                       };\r
-               },\r
-               DLG_LINE\r
-               {\r
-                       itemflags = EQikDlgItemUseFullWidth | EQikDlgItemDenselyPacked;\r
-                       type = EEikCtRichTextEditor;\r
-                       id = ECtlAboutLinks;\r
-                       control = RTXTED\r
-                       {\r
-                               flags = EEikEdwinResizable | EEikEdwinNoAutoSelection | EEikEdwinReadOnly | EEikEdwinWidthInPixels | 0x00200000;\r
-                               numlines = 4;\r
-                       };\r
-               }\r
-       };\r
-}\r
-\r
-RESOURCE DLG_BUTTONS r_buttons_continue_credits\r
-{\r
-       buttons =\r
-       {\r
-               DLG_BUTTON { id = EEikBidYes; button = CMBUT { txt = "Credits"; }; },\r
-               DLG_BUTTON { id = EEikBidCancel; button = CMBUT { txt = "Continue"; }; flags=EEikLabeledButtonIsDefault; }\r
-       };\r
-}\r
-\r
-\r
-RESOURCE TBUF r_simple_text_about_links\r
-{\r
-       buf= \r
-               "<f=Corinna><s=11><u>Email</u>: notasas@gmail.com"\\r
-               "<p><f=Corinna><s=11><u>Web</u>:<p>http://notaz.atspace.com"\\r
-               "<p><f=Corinna><s=11><u>Dave's Web</u>:<p>http://www.finalburn.com";\r
-}\r
-\r
-\r
-RESOURCE TBUF r_simple_text_about\r
-{\r
-       buf= \r
-               "<f=Polo><s=26><a=center><fg=RgbDarkBlue>PicodriveN"\\r
-               "<p><f=Polo><s=10><a=center>for UIQ2"\\r
-               "<p> <p><f=Corinna><s=12>Version %S, by notaz."\\r
-               "<p><s=6> <p><s=10>Port based on PicoDrive 0.030 for Pocket PC by Dave";\r
-}\r
-\r
-\r
-RESOURCE DIALOG r_dialog_credits\r
-{\r
-       title = "Credits and thanks";\r
-       buttons = R_EIK_BUTTONS_DONE;\r
-       flags = EEikDialogFlagWait;\r
-       items = \r
-       {\r
-               DLG_LINE\r
-               {\r
-                       type = EEikCtGlobalTextEditor;\r
-                       id = ECtlCredits;\r
-                       control = GTXTED\r
-                       { \r
-                               width = 150; height = 200; numlines = 26; flags = EEikEdwinReadOnly | EEikEdwinNoAutoSelection | EEikEdwinDisplayOnly;\r
-                       };\r
-               }\r
-       };\r
-}\r
-\r
-\r
-RESOURCE ARRAY r_tbuf_credits\r
-{\r
-  items=\r
-  {\r
-       LBUF{txt="This emulator uses code from these people / projects:";},\r
-       LBUF{txt="";},\r
-       LBUF{txt="Dave";},\r
-       LBUF{txt="- Cyclone 68000 core, Pico emulation library";},\r
-       LBUF{txt="Homepage: http://www.finalburn.com/";},\r
-       LBUF{txt="E-mail: david(atsymbol)finalburn.com";},\r
-       LBUF{txt="";},\r
-       LBUF{txt="Reesy & FluBBa";},\r
-       LBUF{txt="- DrZ80, the Z80 emulator written in ARM assembly.";},\r
-       LBUF{txt="Homepage: http://reesy.gp32x.de/";},\r
-       LBUF{txt="E-mail: drsms_reesy(atsymbol)yahoo.co.uk";},\r
-       LBUF{txt="";},\r
-       LBUF{txt="Tatsuyuki Satoh, Jarek Burczynski, MultiArcadeMachineEmulator (MAME) development";},\r
-       LBUF{txt="- software implementation of Yamaha FM sound generator and";},\r
-       LBUF{txt="Texas Instruments SN76489 / SN76496 programmable tone / noise generator";},\r
-       LBUF{txt="Homepage: http://www.mame.net/";},\r
-       LBUF{txt="";},\r
-       LBUF{txt="Additional thanks:";},\r
-       LBUF{txt="- Peter van Sebille for ECompXL and his various open-source Symbian projects to learn from.";},\r
-       LBUF{txt="- Steve Fischer for his open-source Motorola projects.";},\r
-       LBUF{txt="- Charles MacDonald (http://cgfm2.emuviews.com/) for old but still very useful info about genesis hardware.";},\r
-       LBUF{txt="- Stéphane Dallongeville for creating Gens and making it open-source.";},\r
-       LBUF{txt="- Steve Snake for all that he has done for Genesis emulation scene.";},\r
-       LBUF{txt="- Bart Trzynadlowski for his SSFII and 68000 docs.";},\r
-       LBUF{txt="- Haze for his research (http://haze.mameworld.info).";},\r
-       LBUF{txt="- The development team behind \"Symbian GCC Improvement Project \" (http://www.inf.u-szeged.hu/symbian-gcc/) for their updated compile tools.";},\r
-       LBUF{txt="- Mark and Jean-loup for zlib library.";},\r
-       LBUF{txt="- Reesy for also finding some Cyclone bugs.";},\r
-       LBUF{txt="- Inder for the icons.";}\r
-  };\r
-}\r
-\r
-\r
-/**************************************\r
- *\r
- * debug dialog\r
- *\r
- **************************************/\r
-\r
-RESOURCE DIALOG r_dialog_debug\r
-{\r
-       title = "debug";\r
-       buttons = R_EIK_BUTTONS_DONE;\r
-       flags = EEikDialogFlagWait;\r
-       items = \r
-       {\r
-               DLG_LINE\r
-               {\r
-                       type = EEikCtGlobalTextEditor;\r
-                       id = ECtlDebugEdit;\r
-                       control = GTXTED\r
-                       { \r
-                               width = 150; height = 200; numlines = 26; flags = EEikEdwinReadOnly | EEikEdwinNoAutoSelection | EEikEdwinDisplayOnly;\r
-                       };\r
-               }\r
-       };\r
-}\r
-\r
-\r
-/**************************************\r
- *\r
- * config dialog\r
- *\r
- **************************************/\r
-\r
-RESOURCE DIALOG r_pico_config\r
-{\r
-   title   = "Settings";\r
-   buttons = R_EIK_BUTTONS_CANCEL_OK;\r
-   flags   = EEikDialogFlagWait;\r
-   pages   = r_pico_config_pages;\r
-}\r
-\r
-RESOURCE ARRAY r_pico_config_pages\r
-{\r
-   items = {\r
-      PAGE\r
-      {\r
-         id    = ECtlOptPageMain;\r
-         text  = "Main";\r
-         lines = r_pico_config_page_main;\r
-      },\r
-      PAGE\r
-      {\r
-         id    = ECtlOptPageSound;\r
-         text  = "Sound";\r
-         lines = r_pico_config_page_sound;\r
-      },\r
-      PAGE\r
-      {\r
-         id    = ECtlOptPageMisc;\r
-         text  = "Misc";\r
-         lines = r_pico_config_page_misc;\r
-      }\r
-   };\r
-}\r
-\r
-\r
-RESOURCE ARRAY r_pico_config_page_main\r
-{\r
-   items = {\r
-      DLG_LINE\r
-      {\r
-             id      = ECtlOptRotationLabel;\r
-          type    = EEikCtLabel;\r
-          prompt  = "Screen Rotation";\r
-          control = LABEL { horiz_align = EEikLabelAlignHLeft; };\r
-      },\r
-      DLG_LINE\r
-      {\r
-         id      = ECtlOptRotation;\r
-         type    = EEikCtHorOptionButList;\r
-         control = HOROPBUT\r
-         {\r
-            array_id = r_pico_config_rotation_buttons;\r
-         };\r
-      },\r
-      DLG_LINE\r
-      {\r
-             id      = ECtlOptScreenModeLabel;\r
-          type    = EEikCtLabel;\r
-          prompt  = "Screen Mode";\r
-          control = LABEL { horiz_align = EEikLabelAlignHLeft; };\r
-      },\r
-      DLG_LINE\r
-      {\r
-         id      = ECtlOptScreenMode;\r
-         type    = EEikCtHorOptionButList;\r
-         control = HOROPBUT\r
-         {\r
-            array_id = r_pico_config_screenmode_buttons;\r
-         };\r
-      },\r
-      DLG_LINE\r
-      {\r
-         id     = ECtlOptUseAltRend;\r
-         type   = EEikCtCheckBox;\r
-         prompt = "Fast renderer (inaccurate)";\r
-      },\r
-      DLG_LINE\r
-      {\r
-         id     = ECtlOptUseAccTiming;\r
-         type   = EEikCtCheckBox;\r
-         prompt = "Accurate timing (slower)";\r
-      },\r
-      DLG_LINE\r
-      {\r
-         id     = ECtlOptUseAccSprites;\r
-         type   = EEikCtCheckBox;\r
-         prompt = "Accurate sprites (slower)";\r
-      },\r
-      DLG_LINE\r
-      {\r
-         id     = ECtlOptShowFPS;\r
-         type   = EEikCtCheckBox;\r
-         prompt = "Show FPS";\r
-      }\r
-   };\r
-}\r
-\r
-\r
-RESOURCE ARRAY r_pico_config_page_sound\r
-{\r
-   items = {\r
-      DLG_LINE\r
-      {\r
-         id     = ECtlOptEnableSound;\r
-         type   = EEikCtCheckBox;\r
-         prompt = "Enable sound";\r
-      },\r
-      DLG_LINE\r
-      {\r
-            id      = ECtlOptChipSelLabel;\r
-         type    = EEikCtLabel;\r
-         prompt  = "Emulate these sound chips:";\r
-         control = LABEL { horiz_align = EEikLabelAlignHLeft; };\r
-      },\r
-      DLG_LINE\r
-      {\r
-         id     = ECtlOptEmulateZ80;\r
-         type   = EEikCtCheckBox;\r
-         prompt = "Z80";\r
-      },\r
-      DLG_LINE\r
-      {\r
-         id     = ECtlOptEmulateYM2612;\r
-         type   = EEikCtCheckBox;\r
-         prompt = "YM2612";\r
-      },\r
-      DLG_LINE\r
-      {\r
-         id     = ECtlOptEmulateSN76496;\r
-         type   = EEikCtCheckBox;\r
-         prompt = "SN76496 (PSG)";\r
-      },\r
-      DLG_LINE\r
-      {\r
-            id      = ECtlOptSndQLabel;\r
-         type    = EEikCtLabel;\r
-         prompt  = "Quality (lowest is fastest)";\r
-         control = LABEL { horiz_align = EEikLabelAlignHLeft; };\r
-      },\r
-      DLG_LINE\r
-      {\r
-         id      = ECtlOptSndQuality;\r
-         type    = EEikCtChoiceList;\r
-         prompt  = "";\r
-         control = CHOICELIST { array_id = r_pico_config_snd_quality; };\r
-         itemflags = EEikDlgItemNonFocusing;\r
-      }\r
-   };\r
-}\r
-\r
-\r
-RESOURCE ARRAY r_pico_config_page_misc\r
-{\r
-   items = {\r
-      DLG_LINE\r
-      {\r
-         id     = ECtlOpt6ButtonPad;\r
-         type   = EEikCtCheckBox;\r
-         prompt = "6 button pad";\r
-      },\r
-      DLG_LINE\r
-      {\r
-         id     = ECtlOptGzipStates;\r
-         type   = EEikCtCheckBox;\r
-         prompt = "gzip save states";\r
-      },\r
-      DLG_LINE\r
-      {\r
-         id     = ECtlOptUseSRAM;\r
-         type   = EEikCtCheckBox;\r
-         prompt = "Use SRAM saves (.srm)";\r
-      },\r
-      DLG_LINE\r
-      {\r
-         id     = ECtlOptMotDontUseVol;\r
-         type   = EEikCtCheckBox;\r
-         prompt = "Motorola: don't use volume keys for game controls";\r
-      },\r
-      DLG_LINE\r
-      {\r
-            id      = ECtlOptRegionLabel;\r
-         type    = EEikCtLabel;\r
-         prompt  = "Region:                  ";\r
-         control = LABEL { horiz_align = EEikLabelAlignHLeft; };\r
-      },\r
-      DLG_LINE\r
-      {\r
-         id      = ECtlOptRegion;\r
-         type    = EEikCtChoiceList;\r
-         prompt  = "";\r
-         control = CHOICELIST { array_id = r_pico_config_region; };\r
-         itemflags = EEikDlgItemNonFocusing;\r
-      }\r
-   };\r
-}\r
-\r
-\r
-RESOURCE ARRAY r_pico_config_rotation_buttons\r
-{\r
-   items = {\r
-     OPBUT { id = ECtlOptRotation0;    text = "0º";   },\r
-     OPBUT { id = ECtlOptRotation90;   text = "90º";  },\r
-     OPBUT { id = ECtlOptRotation180;  text = "180º";  },\r
-     OPBUT { id = ECtlOptRotation270;  text = "270º";  }\r
-   };\r
-}\r
-\r
-\r
-RESOURCE ARRAY r_pico_config_screenmode_buttons\r
-{\r
-   items = {\r
-     OPBUT { id = ECtlOptScreenModeCenter;  text = "Center"; },\r
-     OPBUT { id = ECtlOptScreenModeFit;     text = "Fit";    },\r
-     OPBUT { id = ECtlOptScreenModeFit2;    text = "Fit2";   }\r
-   };\r
-}\r
-\r
-\r
-RESOURCE ARRAY r_pico_config_snd_quality\r
-{\r
-   items = {\r
-     LBUF { txt = "8000Hz mono";          },\r
-     LBUF { txt = "11025Hz mono";         },\r
-     LBUF { txt = "16000Hz mono";         },\r
-     LBUF { txt = "22050Hz mono";         },\r
-     LBUF { txt = "8000Hz stereo";        },\r
-     LBUF { txt = "11025Hz stereo";       },\r
-     LBUF { txt = "16000Hz stereo";       },\r
-     LBUF { txt = "22050Hz stereo";       }\r
-   };\r
-}\r
-\r
-\r
-RESOURCE ARRAY r_pico_config_region\r
-{\r
-   items = {\r
-     LBUF { txt = "Auto";        },\r
-     LBUF { txt = "Europe";      },\r
-     LBUF { txt = "USA";         },\r
-     LBUF { txt = "Japan PAL";   },\r
-     LBUF { txt = "Japan NTSC";  }\r
-   };\r
-}\r
diff --git a/platform/uiq2/launcher/PicodriveNAif.rss b/platform/uiq2/launcher/PicodriveNAif.rss
deleted file mode 100644 (file)
index d39cf28..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <aiftool.rh>\r
-\r
-RESOURCE AIF_DATA\r
-{\r
-    app_uid=0x1000C193;\r
-    caption_list=\r
-        { \r
-        CAPTION { code=ELangEnglish; caption="PicodriveN"; }\r
-        };\r
-    num_icons=2;\r
-    embeddability=KAppNotEmbeddable;\r
-    newfile=KAppDoesNotSupportNewFile;\r
-}\r
-\r
diff --git a/platform/uiq2/launcher/SimpleClient.cpp b/platform/uiq2/launcher/SimpleClient.cpp
deleted file mode 100644 (file)
index e653721..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-\r
-// needed for client interface\r
-#include "../version.h"\r
-#include "../ClientServer.h"\r
-#include "SimpleClient.h"\r
-\r
-\r
-// Connect to the  server - default number of message slots = 4\r
-TInt RServSession::Connect()\r
-{\r
-       TInt r=CreateSession(KServerName,Version(),kDefaultMessageSlots);\r
-       return(r); \r
-}\r
-\r
-       \r
-// Return the client side version number.\r
-TVersion RServSession::Version(void) const\r
-{\r
-       return(TVersion(KPicoMajorVersionNumber,KPicoMinorVersionNumber,0));\r
-}\r
-\r
-\r
-TInt RServSession::SendReceive(TInt aFunction, TAny* aPtr) const\r
-{\r
-       return RSessionBase::SendReceive(aFunction, aPtr);\r
-}\r
-\r
-\r
-TInt RServSession::Send(TInt aFunction, TAny* aPtr) const\r
-{\r
-       return RSessionBase::Send(aFunction, aPtr);\r
-}\r
-\r
diff --git a/platform/uiq2/launcher/SimpleClient.h b/platform/uiq2/launcher/SimpleClient.h
deleted file mode 100644 (file)
index 11cd7a0..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef __SERVSESSION_H__\r
-#define __SERVSESSION_H__\r
-\r
-#include <e32base.h>\r
-\r
-\r
-//**********************************\r
-// RServSession\r
-//**********************************\r
-\r
-class RServSession : public RSessionBase\r
-{\r
-public:\r
-       RServSession() {}\r
-       TInt Connect();\r
-       TVersion Version() const;\r
-       TInt SendReceive(TInt aFunction,TAny* aPtr) const;\r
-       TInt Send(TInt aFunction,TAny* aPtr) const;\r
-};\r
-\r
-\r
-#endif\r
-\r
diff --git a/platform/uiq2/launcher/nicemake.c b/platform/uiq2/launcher/nicemake.c
deleted file mode 100644 (file)
index bb48c05..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <string.h>\r
-\r
-\r
-void targetname(char *dest, char *src)\r
-{\r
-       char *p, *p1;\r
-\r
-       if(strlen(src) < 5 || src[0] == '\t') return;\r
-\r
-       // goto string end\r
-       for(p=src; *p && *p != ' ' && *p != '\r'; p++);\r
-       // goto start\r
-       for(p1=p; p1 > src && *p1 != '\\'; p1--); p1++;\r
-       if(p-p1 > 0) {\r
-               strncpy(dest, p1, p-p1);\r
-               dest[p-p1] = 0;\r
-       }\r
-}\r
-\r
-\r
-int main(int argc, char *argv[])\r
-{\r
-       FILE *f = 0, *fo = 0;\r
-       unsigned char buff[512], buff2[128], outname[512];\r
-       buff2[0] = 0;\r
-\r
-       if(argc != 2) {\r
-               printf("usage: %s <makefile>\n\n", argv[0]);\r
-               return 1;\r
-       }\r
-       \r
-       f = fopen(argv[1], "r");\r
-       if(!f) {\r
-               printf("%s: couldn't open %s\n", argv[0], argv[1]);\r
-               return 2;\r
-       }\r
-\r
-       strcpy(outname, argv[1]);\r
-       strcat(outname, ".out");\r
-       fo = fopen(outname, "w");\r
-       if(!fo) {\r
-               fclose(f);\r
-               printf("%s: couldn't open %s for writing\n", argv[0], outname);\r
-               return 3;\r
-       }\r
-\r
-\r
-       while(!feof(f)) {\r
-               fgets(buff, 512, f);\r
-               if(!strncmp(buff, "\t$(GCCUREL)", 11) && !strchr(buff, '>')) {\r
-                       fprintf(fo, "\t@echo %s: gcc\n\t@$(GCCUREL)", buff2);\r
-                       fputs(buff+11, fo);\r
-               } else if(!strncmp(buff, "\tperl -S ecopyfile.pl", 21) && !strchr(buff, '>')) {\r
-                       fprintf(fo, "\t@echo %s: perl -S ecopyfile.pl\n\t@perl", buff2);\r
-                       fputs(buff+5, fo);\r
-               } else if(!strncmp(buff, "\tperl -S epocrc.pl", 18) && !strchr(buff, '>')) {\r
-                       fprintf(fo, "\t@echo %s: perl -S epocrc.pl\n\t@perl", buff2);\r
-                       fputs(buff+5, fo);\r
-               } else if(!strncmp(buff, "\tperl -S epocaif.pl", 19) && !strchr(buff, '>')) {\r
-                       fprintf(fo, "\t@echo %s: perl -S epocaif.pl\n\t@perl", buff2);\r
-                       fputs(buff+5, fo);\r
-               } else if(!strncmp(buff, "\tperl -S emkdir.pl", 18) && !strchr(buff, '>')) {\r
-                       fprintf(fo, "\t@echo %s: perl -S emkdir.pl\n\t@perl", buff2);\r
-                       fputs(buff+5, fo);\r
-               } else if(!strncmp(buff, "\tperl -S makedef.pl", 18) && !strchr(buff, '>')) {\r
-                       fprintf(fo, "\t@echo %s: perl -S makedef.pl\n\t@perl", buff2);\r
-                       fputs(buff+5, fo);\r
-               } else if(!strncmp(buff, "\tld ", 4) && !strchr(buff, '>')) {\r
-                       fprintf(fo, "\t@echo %s: ld\n\t@ld ", buff2);\r
-                       fputs(buff+4, fo);\r
-               } else if(!strncmp(buff, "\tar ", 4) && !strchr(buff, '>')) {\r
-                       fprintf(fo, "\t@echo %s: ar\n\t@ar ", buff2);\r
-                       fputs(buff+4, fo);\r
-               } else if(!strncmp(buff, "\tif exist ", 10) && !strchr(buff, '>')) {\r
-                       fprintf(fo, "\t@echo %s: if exist (del?)\n\t@if exist ", buff2);\r
-                       fputs(buff+10, fo);\r
-               } else if(!strncmp(buff, "\tdlltool ", 9) && !strchr(buff, '>')) {\r
-                       fprintf(fo, "\t@echo %s: dlltool\n\t@dlltool ", buff2);\r
-                       fputs(buff+9, fo);\r
-               } else if(!strncmp(buff, "\tpetran ", 8) && !strchr(buff, '>')) {\r
-                       fprintf(fo, "\t@echo %s: petran\n\t@petran ", buff2);\r
-                       fputs(buff+8, fo);\r
-               } else {\r
-                       // try to get new targetname\r
-                       targetname(buff2, buff);\r
-                       fputs(buff, fo);\r
-               }\r
-       }\r
-\r
-\r
-       // done!\r
-       fclose(f);\r
-       fclose(fo);\r
-\r
-       remove(argv[1]);\r
-       rename(outname, argv[1]);\r
-\r
-       return 0;\r
-}\r
diff --git a/platform/uiq2/launcher/nicemake.exe b/platform/uiq2/launcher/nicemake.exe
deleted file mode 100644 (file)
index 95c7317..0000000
Binary files a/platform/uiq2/launcher/nicemake.exe and /dev/null differ
diff --git a/platform/uiq2/launcher/quploadpicol.cmd b/platform/uiq2/launcher/quploadpicol.cmd
deleted file mode 100644 (file)
index 7cc4f14..0000000
+++ /dev/null
@@ -1 +0,0 @@
-@..\..\..\..\qconsole-1.60\qtty-1.60\release\qtty --qc-addr P800 --qc-channel 5 --user qconsole --pass server --cmds "put d:\system\apps\picodriven\PICODRIVEN.APP ..\..\..\..\..\epoc32\release\armi\urel\PICODRIVEN.APP" "put d:\system\apps\picodriven\PICODRIVEN.rsc ..\..\..\..\..\epoc32\data\z\system\apps\PicodriveN\PICODRIVEN.rsc" exit\r
diff --git a/platform/uiq2/main.cpp b/platform/uiq2/main.cpp
deleted file mode 100644 (file)
index d937bf7..0000000
+++ /dev/null
@@ -1,1183 +0,0 @@
-// mainloop with window server event handling\r
-// event polling mechnism was taken from\r
-// Peter van Sebille's projects\r
-\r
-// (c) Copyright 2006, notaz\r
-// All Rights Reserved\r
-\r
-#include <hal.h>\r
-\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <sys/time.h>\r
-\r
-#include "debug.h"\r
-\r
-#include "pico/picoInt.h"\r
-#include "vid.h"\r
-#include "SimpleServer.h"\r
-#include "ClientServer.h"\r
-//#include "polledAS.h"\r
-#include "audio.h"\r
-\r
-#include <EZlib.h>\r
-#include "zlib/gzio_symb.h"\r
-\r
-\r
-#define BENCHMARK\r
-//#define TEST_FRAMEBUFF\r
-\r
-// keycodes we care about\r
-enum TPxxxKeyCodes {\r
-    EKeyPxxxPower    = EKeyDevice0,             //0xF842\r
-    EKeyPxxxBrowser  = EKeyApplication0,\r
-    EKeyPxxxCamera   = EKeyApplication1,\r
-    EKeyPxxxJogUp    = EKeyDevice1,\r
-    EKeyPxxxJogDown  = EKeyDevice2,\r
-    EKeyPxxxJogLeft  = EKeyDevice3,\r
-    EKeyPxxxJogRight = EKeyDevice9,\r
-    EKeyPxxxJogInward= EKeyDevice8,\r
-       // FC keys\r
-    //EKeyPxxxFcOk     = EKeyDevice8, // don't care about FC keycodes\r
-};\r
-// EKeyScreenDimension1 ~ EStdKeyF24 is sent when flip is closed,\r
-// EKeyScreenDimension0 ~ EStdKeyF23 when opened\r
-\r
-enum TMotAKeyCodes {\r
-    EKeyMotAUp       = EKeyDevice4,             //0xF846\r
-    EKeyMotADown     = EKeyDevice5,\r
-    EKeyMotALeft     = EKeyDevice6,\r
-    EKeyMotARight    = EKeyDevice7,\r
-    EKeyMotASelect   = EKeyDevice8,\r
-    EKeyMotAButton1  = EKeyApplicationA,\r
-    EKeyMotAButton2  = EKeyApplicationB,\r
-    EKeyMotAHome     = EKeyApplication0,\r
-    EKeyMotAShortcut = EKeyApplication1,\r
-    EKeyMotAVoice    = EKeyDeviceA,\r
-    EKeyMotACamera   = EKeyDeviceB,\r
-    EKeyMotAVolUp    = EKeyIncVolume,\r
-    EKeyMotAVolDn    = EKeyDecVolume,\r
-    EKeyMotASend     = EKeyYes,\r
-    EKeyMotAEnd      = EKeyNo,\r
-};\r
-\r
-// scancodes we care about\r
-enum TPxxxScanCodes {\r
-    EScanPxxxPower    = EStdKeyDevice0,                 // 0xa4\r
-    EScanPxxxBrowser  = EStdKeyApplication0,\r
-    EScanPxxxCamera   = EStdKeyApplication1,\r
-    EScanPxxxJogUp    = EStdKeyDevice1,\r
-    EScanPxxxJogDown  = EStdKeyDevice2,\r
-    EScanPxxxJogLeft  = EStdKeyDeviceE, // not consistent\r
-    EScanPxxxJogRight = EStdKeyDeviceD,\r
-    EScanPxxxJogInward= EStdKeyDevice8,\r
-       // FC keys\r
-       EScanPxxxFcOk      = EStdKeyDeviceF,\r
-       EScanPxxxFcBack    = EStdKeyDevice3,\r
-       EScanPxxxFcC       = EStdKeyDeviceA,\r
-       EScanPxxxFcMenu    = EStdKeyDevice9,\r
-       EScanPxxxFc0       = '0',\r
-       EScanPxxxFc1       = '1',\r
-       EScanPxxxFc2       = '2',\r
-       EScanPxxxFc3       = '3',\r
-       EScanPxxxFc4       = '4',\r
-       EScanPxxxFc5       = '5',\r
-       EScanPxxxFc6       = '6',\r
-       EScanPxxxFc7       = '7',\r
-       EScanPxxxFc8       = '8',\r
-       EScanPxxxFc9       = '9',\r
-       EScanPxxxFcHash    = EStdKeyHash,\r
-       EScanPxxxFcAsterisk= EStdKeyNkpAsterisk,\r
-};\r
-\r
-enum TMotAScanCodes {\r
-    EScanMotAUp       = EStdKeyDevice4,\r
-    EScanMotADown     = EStdKeyDevice5,\r
-    EScanMotALeft     = EStdKeyDevice6,\r
-    EScanMotARight    = EStdKeyDevice7,\r
-    EScanMotASelect   = EStdKeyDevice8,\r
-    EScanMotAButton1  = EStdKeyApplicationA,\r
-    EScanMotAButton2  = EStdKeyApplicationB,\r
-    EScanMotAHome     = EStdKeyApplication0,\r
-    EScanMotAShortcut = EStdKeyApplication1,\r
-    EScanMotAVoice    = EStdKeyDeviceA,\r
-    EScanMotACamera   = EStdKeyDeviceB,\r
-    EScanMotAVolUp    = EStdKeyIncVolume,\r
-    EScanMotAVolDn    = EStdKeyDecVolume,\r
-    EScanMotASend     = EStdKeyYes,\r
-    EScanMotAEnd      = EStdKeyNo,\r
-       // some extra codes, don't know if these are actually used\r
-       EScanMotAExtra    = EStdKeyApplicationC,\r
-       EScanMotAEsc      = EStdKeyApplicationD,\r
-       EScanMotAStart    = EStdKeyApplicationE,\r
-       EScanMotASelect2  = EStdKeyApplicationF,\r
-};\r
-\r
-\r
-// list of key names and codes\r
-TPicoKeyConfigEntry keyConfigPXXX[] = {\r
-       { EKeyPxxxPower,     EScanPxxxPower,     0, -1, -1, "POWER" },     // 0\r
-       { EKeyPxxxBrowser,   EScanPxxxBrowser,   0, -1, -1, "BROWSER" },\r
-       { EKeyPxxxCamera,    EScanPxxxCamera,    0, -1, -1, "CAMERA" },\r
-       { EKeyPxxxJogUp,     EScanPxxxJogUp,     2, -1, -1, "JOG@UP" },\r
-       { EKeyPxxxJogDown,   EScanPxxxJogDown,   2, -1, -1, "JOG@DOWN" },\r
-       { EKeyPxxxJogLeft,       EScanPxxxJogLeft,   0, -1, -1, "JOG@LEFT" },  // 5\r
-       { EKeyPxxxJogRight,  EScanPxxxJogRight,  0, -1, -1, "JOG@RIGHT" },\r
-       { 0,                 EScanPxxxJogInward, 0, -1, -1, "JOG@INWARD" },\r
-       { 0,                 EScanPxxxFcOk,      0, -1, -1, "FC@OK" },\r
-       { 0,                 EScanPxxxFcBack,    0, -1, -1, "FC@BACK" },\r
-       { 0,                 EScanPxxxFcC,       0, -1, -1, "FC@C" },      // 10\r
-       { 0,                 EScanPxxxFcMenu,    0, -1, -1, "FC@MENU" },\r
-       { 0,                 EScanPxxxFc0,       0, -1, -1, "FC@0" },\r
-       { 0,                 EScanPxxxFc1,       0, -1, -1, "FC@1" },\r
-       { 0,                 EScanPxxxFc2,       0, -1, -1, "FC@2" },\r
-       { 0,                 EScanPxxxFc3,       0, -1, -1, "FC@3" },\r
-       { 0,                 EScanPxxxFc4,       0, -1, -1, "FC@4" },\r
-       { 0,                 EScanPxxxFc5,       0, -1, -1, "FC@5" },\r
-       { 0,                 EScanPxxxFc6,       0, -1, -1, "FC@6" },\r
-       { 0,                 EScanPxxxFc7,       0, -1, -1, "FC@7" },\r
-       { 0,                 EScanPxxxFc8,       0, -1, -1, "FC@8" },\r
-       { 0,                 EScanPxxxFc9,       0, -1, -1, "FC@9" },\r
-       { 0,                 EScanPxxxFcHash,    0, -1, -1, "FC@HASH" },\r
-       { 0,                 EScanPxxxFcAsterisk,0, -1, -1, "FC@AST" },\r
-       { 0,                 0,                  0,  0,  0, 0 }\r
-};\r
-\r
-// Motorola A92x & A1000 support\r
-TPicoKeyConfigEntry keyConfigMotA[] = {\r
-       { EKeyMotAUp,        EScanMotAUp,        0, -1, -1, "UP" },      // 0\r
-       { EKeyMotADown,      EScanMotADown,      0, -1, -1, "DOWN" },\r
-       { EKeyMotALeft,      EScanMotALeft,      0, -1, -1, "LEFT" },\r
-       { EKeyMotARight,     EScanMotARight,     0, -1, -1, "RIGHT" },\r
-       { EKeyMotASelect,    EScanMotASelect,    0, -1, -1, "SELECT" },\r
-       { EKeyMotAButton1,   EScanMotAButton1,   0, -1, -1, "BUTTON1" }, // 5\r
-       { EKeyMotAButton2,   EScanMotAButton2,   0, -1, -1, "BUTTON2" },\r
-       { EKeyMotAHome,      EScanMotAHome,      0, -1, -1, "HOME" },\r
-       { EKeyMotAShortcut,  EScanMotAShortcut,  0, -1, -1, "SHORTCUT" },\r
-       { EKeyMotAVoice,     EScanMotAVoice,     0, -1, -1, "VOICE" },\r
-       { EKeyMotACamera,    EScanMotACamera,    0, -1, -1, "CAMERA" },  // 10\r
-       { EKeyMotAVolUp,     EScanMotAVolUp,     0, -1, -1, "VOL@UP" },\r
-       { EKeyMotAVolDn,     EScanMotAVolDn,     0, -1, -1, "VOL@DOWN" },\r
-       { EKeyMotASend,      EScanMotASend,      0, -1, -1, "SEND" },\r
-       { EKeyMotAEnd,       EScanMotAEnd,       0, -1, -1, "END" },\r
-       { 0,                 EScanMotAExtra,     0, -1, -1, "EXTRA" },\r
-       { 0,                 EScanMotAEsc,       0, -1, -1, "ESC" },\r
-       { 0,                 EScanMotAStart,     0, -1, -1, "START" },\r
-       { 0,                 EScanMotASelect2,   0, -1, -1, "SELECT" },\r
-       { 0,                 0,                  0,  0,  0, 0 }\r
-};\r
-\r
-\r
-// list of areas\r
-TPicoAreaConfigEntry areaConfig[] = {\r
-       { TRect(  0,   0,   0,   0) },\r
-       // small corner bottons\r
-       { TRect(  0,   0,  15,  15) },\r
-       { TRect(192,   0, 207,  15) },\r
-       { TRect(  0, 304,  15, 319) },\r
-       { TRect(192, 304, 207, 319) },\r
-       // normal buttons\r
-       { TRect(  0,   0,  68,  63) },\r
-       { TRect( 69,   0, 138,  63) },\r
-       { TRect(139,   0, 207,  63) },\r
-       { TRect(  0,  64,  68, 127) },\r
-       { TRect( 69,  64, 138, 127) },\r
-       { TRect(139,  64, 207, 127) },\r
-       { TRect(  0, 128,  68, 191) },\r
-       { TRect( 69, 128, 138, 191) },\r
-       { TRect(139, 128, 207, 191) },\r
-       { TRect(  0, 192,  68, 255) },\r
-       { TRect( 69, 192, 138, 255) },\r
-       { TRect(139, 192, 207, 255) },\r
-       { TRect(  0, 256,  68, 319) },\r
-       { TRect( 69, 256, 138, 319) },\r
-       { TRect(139, 256, 207, 319) },\r
-       { TRect(  0,   0,   0,   0) }\r
-};\r
-\r
-// PicoPad[] format: SACB RLDU\r
-const char *actionNames[] = {\r
-       "UP", "DOWN", "LEFT", "RIGHT", "B", "C", "A", "START",\r
-       0, 0, 0, 0, 0, 0, 0, 0, // Z, Y, X, MODE (enabled only when needed), ?, ?, ?, ?\r
-       0, 0, 0, 0, 0, 0, "NEXT@SAVE@SLOT", "PREV@SAVE@SLOT", // ?, ?, ?, ?, mot_vol_up, mot_vol_down, next_slot, prev_slot\r
-       0, 0, "PAUSE@EMU", "SAVE@STATE", "LOAD@STATE", "FRAMESKIP@8", "AUTO@FRAMESKIP", "DONE" // ?, switch_renderer\r
-};\r
-\r
-\r
-// globals are allowed, so why not to (ab)use them?\r
-TInt machineUid = 0;\r
-int gamestate = PGS_Paused, gamestate_prev = PGS_Paused;\r
-TPicoConfig currentConfig;\r
-TPicoKeyConfigEntry *keyConfig = 0;                    // currently used keys\r
-static char noticeMsg[64];                                     // notice msg to draw\r
-static timeval noticeMsgTime = { 0, 0 };       // when started showing\r
-static RLibrary gameAudioLib;                          // audio object library\r
-static _gameAudioNew gameAudioNew;                     // audio object maker\r
-static IGameAudio *gameAudio = 0;                      // the audio object itself\r
-static TProcessId launcherProcessId;\r
-static int reset_timing, state_slot = 0;\r
-extern const char *RomFileName;\r
-extern int pico_was_reset;     \r
-#ifdef TEST_FRAMEBUFF\r
-static TUint8 *iFrameBuffer = 0;\r
-#endif\r
-\r
-// some forward declarations\r
-static void MainInit();\r
-static void MainExit();\r
-static void CheckForLauncher();\r
-static void DumpMemInfo();\r
-\r
-// just for a nicer grouping of WS related stuff\r
-class CGameWindow\r
-{\r
-public:\r
-       static void ConstructResourcesL();\r
-       static void FreeResources();\r
-       static void DoKeys(timeval &time);\r
-       static void DoKeysConfig(TUint &which);\r
-       static void RunEvents(TUint32 which);\r
-       static void SendClientWsEvent(TInt type);\r
-\r
-       static RWsSession                               iWsSession;\r
-       static RWindowGroup                             iWsWindowGroup;\r
-       static RWindow                                  iWsWindow;\r
-       static CWsScreenDevice*                 iWsScreen;\r
-       static CWindowGc*                               iWindowGc;\r
-       static TRequestStatus                   iWsEventStatus;\r
-       static TThreadId                                iLauncherThreadId;\r
-       static RDirectScreenAccess*             iDSA;\r
-       static TRequestStatus                   iDSAstatus;\r
-};\r
-\r
-\r
-void SkipFrame(int do_sound)\r
-{\r
-  PicoSkipFrame=1;\r
-  PicoFrame();\r
-  PicoSkipFrame=0;\r
-\r
-  if(do_sound && PsndOut) {\r
-    PsndOut = gameAudio->NextFrameL();\r
-       if(!PsndOut) { // sound output problems?\r
-      strcpy(noticeMsg, "SOUND@OUTPUT@ERROR;@SOUND@DISABLED");\r
-      gettimeofday(&noticeMsgTime, 0);\r
-       }\r
-  }\r
-\r
-/*\r
-  int total=0;\r
-\r
-  // V-Blanking period:\r
-  if (Pico.video.reg[1]&0x20) SekInterrupt(6); // Set IRQ\r
-  Pico.video.status|=0x88; // V-Int happened / go into vblank\r
-  total+=SekRun(18560);\r
-\r
-  // Active Scan:\r
-  if (Pico.video.reg[1]&0x40) Pico.video.status&=~8; // Come out of vblank if display is enabled\r
-  SekInterrupt(0); // Clear IRQ\r
-  total+=SekRun(127969-total);\r
-*/\r
-}\r
-\r
-\r
-void TargetEpocGameL()\r
-{\r
-       char buff[24]; // fps count c string\r
-       struct timeval tval; // timing\r
-       int thissec = 0, frames_done = 0, frames_shown = 0;\r
-       int target_fps, target_frametime, too_fast, too_fast_time;\r
-       int i, underflow;\r
-       TRawEvent blevent;\r
-\r
-       MainInit();\r
-       buff[0] = 0;\r
-\r
-       // just to keep the backlight on..\r
-       blevent.Set(TRawEvent::EActive);\r
-\r
-       // loop?\r
-       for(;;) {\r
-               if(gamestate == PGS_Running) {\r
-                       // prepare window and stuff\r
-                       CGameWindow::ConstructResourcesL();\r
-\r
-                       // if the system has something to do, it should better do it now\r
-                       User::After(50000);\r
-                       //CPolledActiveScheduler::Instance()->Schedule();\r
-\r
-                       // pal/ntsc might have changed, reset related stuff\r
-                       if(Pico.m.pal) {\r
-                               target_fps = 50;\r
-                               if(!noticeMsgTime.tv_sec) strcpy(noticeMsg, "PAL@SYSTEM@/@50@FPS");\r
-                       } else {\r
-                               target_fps = 60;\r
-                               if(!noticeMsgTime.tv_sec) strcpy(noticeMsg, "NTSC@SYSTEM@/@60@FPS");\r
-                       }\r
-                       target_frametime = 1000000/target_fps;\r
-                       if(!noticeMsgTime.tv_sec && pico_was_reset)\r
-                               gettimeofday(&noticeMsgTime, 0);\r
-\r
-                       pico_was_reset = too_fast = 0;\r
-                       reset_timing = 1;\r
-\r
-                       while(gamestate == PGS_Running) {\r
-                               gettimeofday(&tval, 0);\r
-                               if(reset_timing) {\r
-                                       reset_timing = 0;\r
-                                       thissec = tval.tv_sec;\r
-                                       frames_done = tval.tv_usec/target_frametime;\r
-                               }\r
-\r
-                               // show notice message?\r
-                               char *notice = 0;\r
-                               if(noticeMsgTime.tv_sec) {\r
-                                       if((tval.tv_sec*1000000+tval.tv_usec) - (noticeMsgTime.tv_sec*1000000+noticeMsgTime.tv_usec) > 2000000) // > 2.0 sec\r
-                                                noticeMsgTime.tv_sec = noticeMsgTime.tv_usec = 0;\r
-                                       else notice = noticeMsg;\r
-                               }\r
-\r
-                               // second changed?\r
-                               if(thissec != tval.tv_sec) {\r
-#ifdef BENCHMARK\r
-                                       static int bench = 0, bench_fps = 0, bench_fps_s = 0, bfp = 0, bf[4];\r
-                                       if(++bench == 10) {\r
-                                               bench = 0;\r
-                                               bench_fps_s = bench_fps;\r
-                                               bf[bfp++ & 3] = bench_fps;\r
-                                               bench_fps = 0;\r
-                                       }\r
-                                       bench_fps += frames_shown;\r
-                                       sprintf(buff, "%02i/%02i/%02i", frames_shown, bench_fps_s, (bf[0]+bf[1]+bf[2]+bf[3])>>2);\r
-#else\r
-                                       if(currentConfig.iFlags & 2) \r
-                                               sprintf(buff, "%02i/%02i", frames_shown, frames_done);\r
-#endif\r
-                                       thissec = tval.tv_sec;\r
-                                       if((thissec & 7) == 7) UserSvr::AddEvent(blevent);\r
-                                       // in is quite common for this implementation to leave 1 fame unfinished\r
-                                       // when second changes. This creates sound clicks, so it's probably better to\r
-                                       // skip that frame and render sound\r
-                                       if(PsndOut && frames_done < target_fps && frames_done > target_fps-5) {\r
-                                               SkipFrame(1); frames_done++;\r
-                                       }\r
-                                       // try to prevent sound buffer underflows by making sure we did _exactly_\r
-                                       // target_fps sound updates and copying last samples over and over again\r
-                                       if(PsndOut && frames_done < target_fps)\r
-                                               for(; frames_done < target_fps; frames_done++) {\r
-                                                       PsndOut = gameAudio->DupeFrameL(underflow);\r
-                                                       if(!PsndOut) { // sound output problems?\r
-                                                               strcpy(noticeMsg, "SOUND@OUTPUT@ERROR;@SOUND@DISABLED");\r
-                                                               gettimeofday(&noticeMsgTime, 0);\r
-                                                               break;\r
-                                                       }\r
-                                                       if(underflow) break;\r
-                                               }\r
-                                       frames_done = frames_shown = 0;\r
-                               }\r
-\r
-                               if(currentConfig.iFrameskip >= 0) { // frameskip enabled\r
-                                       for(i = 0; i < currentConfig.iFrameskip; i++) {\r
-                                               SkipFrame(frames_done < target_fps); frames_done++;\r
-                                               CGameWindow::DoKeys(tval);\r
-                                       }\r
-                               } else if(tval.tv_usec > (frames_done+1)*target_frametime) { // auto frameskip\r
-                                       // no time left for this frame - skip\r
-                                       SkipFrame(1); frames_done++;\r
-                                       CGameWindow::DoKeys(tval);\r
-                                       too_fast = 0;\r
-                                       continue;\r
-                               } else if(tval.tv_usec < (too_fast_time=frames_done*target_frametime)) { // we are too fast\r
-                                       if(++too_fast > 2) { User::After(too_fast_time-tval.tv_usec); too_fast = 0; }// sleep, but only if we are _really_ fast\r
-                               }\r
-\r
-                               // draw\r
-                               vidDrawFrame(notice, buff, frames_shown);\r
-                               if(PsndOut && frames_done < target_fps) {\r
-                                       PsndOut = gameAudio->NextFrameL();\r
-                                       if(!PsndOut) { // sound output problems?\r
-                                               strcpy(noticeMsg, "SOUND@OUTPUT@ERROR;@SOUND@DISABLED");\r
-                                               gettimeofday(&noticeMsgTime, 0);\r
-                                       }\r
-                               }\r
-                               frames_done++; frames_shown++;\r
-                               CGameWindow::DoKeys(tval);\r
-                       }\r
-\r
-                       // save SRAM\r
-                       if((currentConfig.iFlags & 1) && SRam.changed) {\r
-                               saveLoadGame(0, 1);\r
-                               SRam.changed = 0;\r
-                       }\r
-                       CGameWindow::SendClientWsEvent(EEventGamePaused);\r
-                       CGameWindow::FreeResources();\r
-               } else if(gamestate == PGS_Paused) {\r
-                       for(i = 0; gamestate == PGS_Paused; i++) {\r
-                               User::After(250000);\r
-                               if(!(i & 0x7F)) CheckForLauncher(); // every 32 secs\r
-                       }\r
-               } else if(gamestate == PGS_KeyConfig) {\r
-                       // prepare window and stuff\r
-                       CGameWindow::ConstructResourcesL();\r
-\r
-                       TUint whichAction = 0;\r
-                       while(gamestate == PGS_KeyConfig) {\r
-                               vidKeyConfigFrame(whichAction, CGameWindow::iWsScreen->CurrentScreenMode());\r
-                               CGameWindow::DoKeysConfig(whichAction);\r
-                               User::After(200000);\r
-                       }\r
-\r
-                       CGameWindow::SendClientWsEvent(EEventKeyCfgDone);\r
-                       CGameWindow::SendClientWsEvent(EEventGamePaused);\r
-                       CGameWindow::FreeResources();\r
-               } else if(gamestate == PGS_DebugHeap) {\r
-                       #ifdef __DEBUG_PRINT\r
-                       TInt cells = User::CountAllocCells();\r
-                       TInt mem;\r
-                       User::AllocSize(mem);\r
-                       DEBUGPRINT(_L("worker: cels=%d, size=%d KB"), cells, mem/1024);\r
-                       gamestate = gamestate_prev;\r
-                       #endif\r
-               } else if(gamestate == PGS_Quit) {\r
-                       break;\r
-               }\r
-       }\r
-\r
-       MainExit();\r
-}\r
-\r
-\r
-// gameAudio default "maker", which simply leaves\r
-IGameAudio *gameAudioNew_failer(TInt aRate, TBool aStereo, TInt aPcmFrames, TInt aBufferedFrames)\r
-{\r
-       User::Leave(1);\r
-       return 0; // shouldn't happen\r
-}\r
-\r
-\r
-// main initialization\r
-static void MainInit()\r
-{\r
-       RProcess thisProcess, launcherProcess;\r
-       TInt err = KErrGeneral;\r
-\r
-       DEBUGPRINT(_L("\r\n\r\nstarting.."));\r
-\r
-       //CPolledActiveScheduler::NewL(); // create Polled AS for the sound engine\r
-\r
-       // get launcher id\r
-       if(thisProcess.Owner(launcherProcess) == KErrNone) {\r
-               launcherProcessId = launcherProcess.Id();\r
-               launcherProcess.Close(); // messing with launcherProcess too much strangely reboots my phone\r
-       } else {\r
-               DEBUGPRINT(_L("%i: couldn't find owner, terminating.."), thisProcess.Id());\r
-               thisProcess.Terminate(1);\r
-       }\r
-\r
-       // also get launcher thread id (for sending events, nasty way)\r
-       TFindThread findThread;\r
-       TFullName dummy1;\r
-       RThread  tmpThread;\r
-       RProcess tmpProcess;\r
-\r
-       while(findThread.Next(dummy1) == KErrNone)\r
-       {\r
-               tmpThread.Open(findThread);\r
-               tmpThread.Process(tmpProcess);\r
-               if(tmpProcess.Id() == launcherProcessId) {\r
-                       CGameWindow::iLauncherThreadId = tmpThread.Id();\r
-                       break;\r
-               }\r
-               tmpThread.Close();\r
-               tmpProcess.Close();\r
-       }\r
-\r
-       // start event listening thread, which waits for GUI commands\r
-       if(StartThread() < 0) {\r
-               // communication thread failed to start, we serve no purpose now, so suicide\r
-               DEBUGPRINT(_L("%i: StartThread() failed, terminating.."), thisProcess.Id());\r
-               thisProcess.Terminate(1);\r
-       }\r
-\r
-       HAL::Get(HALData::EMachineUid, machineUid); // find out the machine UID\r
-\r
-       // get current dir\r
-       TFileName pfName = thisProcess.FileName();\r
-       TParse parse;\r
-       parse.Set(pfName, 0, 0);\r
-       TPtrC currDir = parse.DriveAndPath();\r
-       DEBUGPRINT(_L("current dir: %S"), &currDir);\r
-\r
-       static TPtrC audio_dlls[] = { _L("audio_motorola.dll"), _L("audio_mediaserver.dll") };\r
-\r
-       // find our audio object maker\r
-       for(TInt i=0; i < 2; i++) {\r
-               DEBUGPRINT(_L("trying audio DLL: %S"), &audio_dlls[i]);\r
-               err = gameAudioLib.Load(audio_dlls[i], currDir);\r
-               if(err == KErrNone) { // great, we loaded a dll!\r
-                       gameAudioNew = (_gameAudioNew) gameAudioLib.Lookup(1);\r
-                       if(!gameAudioNew) {\r
-                               gameAudioLib.Close();\r
-                               err = KErrGeneral;\r
-                               DEBUGPRINT(_L("  loaded, but Lookup(1) failed."));\r
-                       } else\r
-                               break; // done\r
-               } else\r
-                       DEBUGPRINT(_L("  load failed! (%i)"), err);;\r
-       }\r
-\r
-       if(err != KErrNone)\r
-                gameAudioNew = gameAudioNew_failer;\r
-       else DEBUGPRINT(_L("  audio dll loaded!"));;\r
-\r
-       DumpMemInfo();\r
-\r
-       // try to start pico\r
-       DEBUGPRINT(_L("PicoInit();"));\r
-       PicoInit();\r
-\r
-#ifdef TEST_FRAMEBUFF\r
-       iFrameBuffer = (TUint8 *) malloc(208*320*4);\r
-#endif\r
-}\r
-\r
-\r
-// does not return\r
-static void MainExit()\r
-{\r
-       RProcess thisProcess;\r
-\r
-       DEBUGPRINT(_L("%i: cleaning up.."), thisProcess.Id());\r
-\r
-       // save SRAM\r
-       if((currentConfig.iFlags & 1) && SRam.changed) {\r
-               saveLoadGame(0, 1);\r
-               SRam.changed = 0;\r
-       }\r
-\r
-       PicoExit();\r
-\r
-       if(gameAudio) delete gameAudio;\r
-\r
-       if(gameAudioLib.Handle()) gameAudioLib.Close();\r
-\r
-       // Polled AS\r
-       //delete CPolledActiveScheduler::Instance();\r
-\r
-       DEBUGPRINT(_L("%i: terminating.."), thisProcess.Id());  \r
-       thisProcess.Terminate(0);\r
-}\r
-\r
-\r
-static void CheckForLauncher()\r
-{\r
-       RProcess launcherProcess;\r
-\r
-       // check for launcher, we are useless without it\r
-       if(launcherProcess.Open(launcherProcessId) != KErrNone || launcherProcess.ExitCategory().Length() != 0) {\r
-               #ifdef __DEBUG_PRINT\r
-               RProcess thisProcess;\r
-               DEBUGPRINT(_L("%i: launcher process is gone, terminating.."), thisProcess.Id());\r
-               if(launcherProcess.Handle()) {\r
-                               TExitCategoryName ecn = launcherProcess.ExitCategory();\r
-                       DEBUGPRINT(_L("%i: launcher exit category: %S"), thisProcess.Id(), &ecn);\r
-                       launcherProcess.Close();\r
-               }\r
-               #endif\r
-               MainExit();\r
-       }\r
-       launcherProcess.Close();\r
-}\r
-\r
-\r
-void DumpMemInfo()\r
-{\r
-       TInt    ramSize, ramSizeFree, romSize;\r
-       \r
-       HAL::Get(HALData::EMemoryRAM, ramSize);\r
-       HAL::Get(HALData::EMemoryRAMFree, ramSizeFree);\r
-       HAL::Get(HALData::EMemoryROM, romSize);\r
-\r
-       DEBUGPRINT(_L("ram=%dKB, ram_free=%dKB, rom=%dKB"), ramSize/1024, ramSizeFree/1024, romSize/1024);\r
-}\r
-\r
-\r
-\r
-TInt E32Main()\r
-{\r
-       // first thing's first\r
-       RThread().SetExceptionHandler(&ExceptionHandler, -1);\r
-\r
-       //TInt pc, sp;\r
-       //asm volatile ("str pc, %0" : "=m" (pc) );\r
-       //asm volatile ("str sp, %0" : "=m" (sp) );\r
-       //RDebug::Print(_L("executing @ 0x%08x, sp=0x%08x"), pc, sp);\r
-\r
-/*\r
-       RDebug::Print(_L("Base     Bottom   Top      Size     RW Name"));\r
-       TBuf<4> l_r(_L("R")), l_w(_L("W")), l_d(_L("-"));\r
-       RChunk chunk;\r
-       TFullName chunkname;\r
-       TFindChunk findChunk(_L("*"));\r
-       while( findChunk.Next(chunkname) != KErrNotFound ) {\r
-               chunk.Open(findChunk);\r
-               RDebug::Print(_L("%08x %08x %08x %08x %S%S %S"), chunk.Base(), chunk.Base()+chunk.Bottom(), chunk.Base()+chunk.Top(), chunk.Size(), chunk.IsReadable() ? &l_r : &l_d, chunk.IsWritable() ? &l_w : &l_d, &chunkname);\r
-               chunk.Close();\r
-       }\r
-*/\r
-\r
-       CTrapCleanup* cleanup=CTrapCleanup::New();\r
-\r
-       TRAPD(error, TargetEpocGameL());\r
-\r
-       __ASSERT_ALWAYS(!error, User::Panic(_L("Picosmall"), error));\r
-       delete cleanup;\r
-\r
-       return 0;\r
-}\r
-\r
-\r
-void CGameWindow::ConstructResourcesL()\r
-{\r
-\r
-       // connect to window server\r
-       // tried to create it globally and not re-connect everytime,\r
-       // but my window started to lose focus strangely\r
-       User::LeaveIfError(iWsSession.Connect());\r
-\r
-       //       * Tell the Window Server not to mess about with our process priority\r
-       //       * Also, because of the way legacy games are written, they never sleep\r
-       //       * and thus never voluntarily yield the CPU. We set our process priority\r
-       //       * to EPriorityForeground and hope that a Telephony application on\r
-       //       * this device runs at EPriorityForeground as well. If not, tough! ;-)\r
-\r
-       CGameWindow::iWsSession.ComputeMode(RWsSession::EPriorityControlDisabled);\r
-       RProcess me;\r
-       me.SetPriority(EPriorityForeground);\r
-\r
-       iWsScreen=new(ELeave) CWsScreenDevice(iWsSession);\r
-       User::LeaveIfError(iWsScreen->Construct());\r
-//     User::LeaveIfError(iWsScreen->CreateContext(iWindowGc));\r
-\r
-       iWsWindowGroup=RWindowGroup(iWsSession);\r
-       User::LeaveIfError(iWsWindowGroup.Construct((TUint32)&iWsWindowGroup));\r
-       //iWsWindowGroup.SetOrdinalPosition(0);\r
-       //iWsWindowGroup.SetName(KServerWGName);\r
-       iWsWindowGroup.EnableScreenChangeEvents(); // flip events (EEventScreenDeviceChanged)\r
-       iWsWindowGroup.EnableFocusChangeEvents(); // EEventFocusGroupChanged\r
-       iWsWindowGroup.SetOrdinalPosition(0, 1); // TInt aPos, TInt aOrdinalPriority\r
-\r
-       iWsWindow=RWindow(iWsSession);\r
-       User::LeaveIfError(iWsWindow.Construct(iWsWindowGroup, (TUint32)&iWsWindow));\r
-       iWsWindow.SetSize(iWsScreen->SizeInPixels());\r
-       iWsWindow.PointerFilter(EPointerFilterDrag, 0);\r
-       iWsWindow.SetPointerGrab(ETrue);\r
-       iWsWindow.SetVisible(ETrue);\r
-       iWsWindow.Activate();\r
-\r
-       // request access through RDirectScreenAccess api, but don't care about the result\r
-       RRegion *dsa_region = 0;\r
-       iDSA = new(ELeave) RDirectScreenAccess(iWsSession);\r
-       if(iDSA->Construct() == KErrNone)\r
-               iDSA->Request(dsa_region, iDSAstatus, iWsWindow);\r
-       DEBUGPRINT(_L("DSA: %i"), dsa_region ? dsa_region->Count() : -1);\r
-\r
-       // now get the screenbuffer\r
-       TScreenInfoV01                  screenInfo;\r
-       TPckg<TScreenInfoV01>   sI(screenInfo);\r
-       UserSvr::ScreenInfo(sI);\r
-\r
-       if(!screenInfo.iScreenAddressValid)\r
-               User::Leave(KErrNotSupported);\r
-\r
-#ifndef TEST_FRAMEBUFF\r
-       TUint8 *iFrameBuffer = (TUint8*) screenInfo.iScreenAddress;\r
-#endif\r
-       TInt p800 = 0;\r
-\r
-       switch(machineUid)\r
-       {\r
-               case 0x101f6b26: // A9xx & A10xx\r
-               case 0x101f6b27: // Chinese A10xx\r
-               case 0x101fd279: // P3x\r
-                  iFrameBuffer += 32;\r
-                  keyConfig = keyConfigMotA;\r
-                  break;\r
-               case 0x101f408b: // P800\r
-                  p800 = 1;\r
-               //case 0x101fb2ae: // P900\r
-               //case 0x10200ac6: // P910\r
-               default:        \r
-                  keyConfig = keyConfigPXXX;\r
-                  break;\r
-       }\r
-       DEBUGPRINT(_L("framebuffer=0x%08x (%dx%d)"), iFrameBuffer,\r
-                                       screenInfo.iScreenSize.iWidth, screenInfo.iScreenSize.iHeight);\r
-\r
-       // vidInit\r
-       User::LeaveIfError(vidInit(iWsScreen->DisplayMode(), iFrameBuffer, p800));\r
-\r
-       // register for keyevents\r
-       for(TPicoKeyConfigEntry *e = keyConfig; e->name; e++) {\r
-               // release all keys\r
-               e->flags &= ~1;\r
-               if(e->flags & 0x80) {\r
-                       // key disabled\r
-                       e->handle1 = e->handle2 = -1;\r
-                       continue;\r
-               }\r
-               e->handle1 = iWsWindowGroup.CaptureKeyUpAndDowns(e->scanCode, 0, 0, 2);\r
-               // although we only use UpAndDown events, register simple events too,\r
-               // just to prevent fireing their default actions.\r
-               if(e->keyCode) e->handle2 = iWsWindowGroup.CaptureKey(e->keyCode, 0, 0, 2); // priority of 1 is not enough on my phone\r
-       }\r
-\r
-       // try to start the audio engine\r
-       static int PsndRate_old = 0, PicoOpt_old = 0, pal_old = 0;\r
-\r
-       if(gamestate == PGS_Running && (currentConfig.iFlags & 4)) {\r
-               TInt err = 0;\r
-               if(PsndRate != PsndRate_old || (PicoOpt&11) != (PicoOpt_old&11) || Pico.m.pal != pal_old) {\r
-                       // if rate changed, reset all enabled chips, else reset only those chips, which were recently enabled\r
-                       //sound_reset(PsndRate != PsndRate_old ? PicoOpt : (PicoOpt&(PicoOpt^PicoOpt_old)));\r
-                       sound_rerate();\r
-               }\r
-               if(!gameAudio || PsndRate != PsndRate_old || ((PicoOpt&8) ^ (PicoOpt_old&8)) || Pico.m.pal != pal_old) { // rate or stereo or pal/ntsc changed\r
-                       if(gameAudio) delete gameAudio; gameAudio = 0;\r
-                       DEBUGPRINT(_L("starting audio: %i len: %i stereo: %i, pal: %i"), PsndRate, PsndLen, PicoOpt&8, Pico.m.pal);\r
-                       TRAP(err, gameAudio = gameAudioNew(PsndRate, (PicoOpt&8) ? 1 : 0, PsndLen, Pico.m.pal ? 10 : 12));\r
-               }\r
-               if( gameAudio)\r
-                       TRAP(err, PsndOut = gameAudio->ResumeL());\r
-               if(err) {\r
-                       if(gameAudio) delete gameAudio;\r
-                       gameAudio = 0;\r
-                       PsndOut = 0;\r
-                       strcpy(noticeMsg, "SOUND@STARTUP@FAILED");\r
-                       gettimeofday(&noticeMsgTime, 0);\r
-               }\r
-               PsndRate_old = PsndRate;\r
-               PicoOpt_old  = PicoOpt;\r
-               pal_old = Pico.m.pal;\r
-       } else {\r
-               if(gameAudio) delete gameAudio;\r
-               gameAudio = 0;\r
-               PsndOut = 0;\r
-       }\r
-\r
-       // start key WS event polling\r
-       iWsSession.EventReady(&iWsEventStatus);\r
-       DEBUGPRINT(_L("CGameWindow::ConstructResourcesL() finished."));\r
-}\r
-\r
-\r
-void CGameWindow::FreeResources()\r
-{\r
-       if(gameAudio) gameAudio->Pause();\r
-\r
-       // free RDirectScreenAccess stuff\r
-       iDSA->Cancel();\r
-       iDSA->Close();\r
-       delete iDSA;\r
-       iDSA = NULL;\r
-\r
-       iWsSession.EventReadyCancel();\r
-\r
-       for(TPicoKeyConfigEntry *e = keyConfig; e->name; e++) {\r
-               if(e->handle2 >= 0) iWsWindowGroup.CancelCaptureKey(e->handle2);\r
-               if(e->handle1 >= 0) iWsWindowGroup.CancelCaptureKeyUpAndDowns(e->handle1);\r
-       }\r
-\r
-       if(iWsWindow.WsHandle())\r
-               iWsWindow.Close();\r
-\r
-       if(iWsWindowGroup.WsHandle())\r
-               iWsWindowGroup.Close();\r
-\r
-       // these must be deleted before calling iWsSession.Close()\r
-//     delete iWindowGc;\r
-//     iWindowGc = NULL;\r
-\r
-       delete iWsScreen;\r
-       iWsScreen = NULL;\r
-\r
-       // emu might change renderer by itself, so we may need to sync config\r
-       if(PicoOpt != currentConfig.iPicoOpt) {\r
-               currentConfig.iFlags |= 0x80;\r
-               CGameWindow::SendClientWsEvent(EEventKeyCfgDone);\r
-       }\r
-\r
-       if(iWsSession.WsHandle())\r
-               iWsSession.Close();\r
-       \r
-       vidFree();\r
-\r
-#ifdef TEST_FRAMEBUFF\r
-       FILE *tmp = fopen("d:\\temp\\screen.raw", "wb");\r
-       fwrite(iFrameBuffer, 1, 208*320*4, tmp);\r
-       fclose(tmp);\r
-#endif\r
-}\r
-\r
-\r
-void CGameWindow::DoKeys(timeval &time)\r
-{\r
-       TWsEvent iWsEvent;\r
-       TInt iWsEventType;\r
-       unsigned long allActions = 0;\r
-       static unsigned long areaActions = 0, forceUpdate = 0;\r
-       int i, nEvents;\r
-\r
-       // detect if user is holding power button\r
-       static timeval powerPushed = { 0, 0 };\r
-       if(powerPushed.tv_sec) {\r
-               if((time.tv_sec*1000000+time.tv_usec) - (powerPushed.tv_sec*1000000+powerPushed.tv_usec) > 1000000) { // > 1 sec\r
-                       gamestate = PGS_Paused;\r
-                       powerPushed.tv_sec = powerPushed.tv_usec = 0;\r
-               }\r
-       }\r
-\r
-       for(nEvents = 0; iWsEventStatus != KRequestPending; nEvents++)\r
-       {\r
-               iWsSession.GetEvent(iWsEvent);\r
-               iWsEventType = iWsEvent.Type();\r
-\r
-               // pointer events?\r
-               if(iWsEventType == EEventPointer) {\r
-                       if(iWsEvent.Pointer()->iType == TPointerEvent::EButton1Up) {\r
-                               areaActions = 0; // remove all directionals\r
-                       } else { // if(iWsEvent.Pointer()->iType == TPointerEvent::EButton1Down) {\r
-                               TPoint p = iWsEvent.Pointer()->iPosition;\r
-                               const TPicoAreaConfigEntry *e = areaConfig + 1;\r
-                               for(i = 0; !e->rect.IsEmpty(); e++, i++)\r
-                                       if(e->rect.Contains(p)) {\r
-                                               areaActions = currentConfig.iAreaBinds[i];\r
-                                               break;\r
-                                       }\r
-                       }\r
-               }\r
-               else if(iWsEventType == EEventKeyDown || iWsEventType == EEventKeyUp) {\r
-                       TInt iScanCode = iWsEvent.Key()->iScanCode;\r
-\r
-                       for(TPicoKeyConfigEntry *e = keyConfig; e->name; e++)\r
-                               if(iScanCode == e->scanCode) {\r
-                                       if(iWsEventType == EEventKeyDown) e->flags |=  1;\r
-                                       else if((e->flags & 2) == 0)      e->flags &= ~1;\r
-                                       break;\r
-                               }\r
-\r
-                       // power?\r
-                       if(iScanCode == EScanPxxxPower || iScanCode == EScanMotAEnd) {\r
-                               if(iWsEventType == EEventKeyDown)\r
-                                        powerPushed = time;\r
-                               else powerPushed.tv_sec = powerPushed.tv_usec = 0;\r
-                       }\r
-               }\r
-               else if(iWsEventType == EEventScreenDeviceChanged) {\r
-                       // we have the priority, so the launcher will not be able to process this, but it has to\r
-                       User::After(500000);\r
-                       reset_timing = 1;\r
-               }\r
-               else if(iWsEventType == EEventFocusGroupChanged) {\r
-                       TInt launcherGrpId = iWsSession.FindWindowGroupIdentifier(0, iLauncherThreadId);\r
-                       TInt focusGrpId = iWsSession.GetFocusWindowGroup();\r
-                       DEBUGPRINT(_L("EEventFocusGroupChanged: %i, our: %i, launcher: %i"),\r
-                                               focusGrpId, iWsWindowGroup.Identifier(), launcherGrpId);\r
-                       // if it is not us and not launcher that got focus, pause emu\r
-                       if(focusGrpId != iWsWindowGroup.Identifier() && focusGrpId != launcherGrpId)\r
-                               gamestate = PGS_Paused;\r
-               }\r
-\r
-               iWsEventStatus = KRequestPending;\r
-               iWsSession.EventReady(&iWsEventStatus);\r
-       }\r
-\r
-       if(nEvents || forceUpdate) {\r
-               allActions = areaActions;\r
-               forceUpdate = 0;\r
-\r
-               // add all pushed button actions\r
-               i = 0;\r
-               for(TPicoKeyConfigEntry *e = keyConfig; e->name; e++, i++) {\r
-                       if(e->flags & 1) allActions |= currentConfig.iKeyBinds[i];\r
-                       if((e->flags& 3) == 3) forceUpdate = 1;\r
-                       if(e->flags & 2) e->flags &= ~1;\r
-               }\r
-\r
-               PicoPad[0] = (unsigned short) allActions;\r
-               if(allActions & 0xFFFF0000) {\r
-                       RunEvents(allActions >> 16);\r
-                       areaActions = 0;\r
-               }\r
-       }\r
-}\r
-\r
-\r
-void CGameWindow::DoKeysConfig(TUint &which)\r
-{\r
-       TWsEvent iWsEvent;\r
-       int i;\r
-\r
-       // to detect if user is holding power button\r
-       static int powerIters = 0;\r
-\r
-       while(iWsEventStatus != KRequestPending)\r
-       {\r
-               TUint currentActCode = 1 << which;\r
-\r
-               iWsSession.GetEvent(iWsEvent);\r
-\r
-               // pointer events?\r
-               if(iWsEvent.Type() == EEventPointer) {\r
-                       TPoint p = iWsEvent.Pointer()->iPosition;\r
-                       TRect prev(190, 112, 208, 126);\r
-                       TRect next(190, 194, 208, 208);\r
-\r
-                       if(iWsEvent.Pointer()->iType == TPointerEvent::EButton1Down) {\r
-                                    if(prev.Contains(p)) do { which = (which-1) & 0x1F; } while(!actionNames[which]);\r
-                               else if(next.Contains(p)) do { which = (which+1) & 0x1F; } while(!actionNames[which]);\r
-                               else if(which == 31) gamestate = PGS_Paused; // done\r
-                               else {\r
-                                       const TPicoAreaConfigEntry *e = areaConfig + 1;\r
-                                       for(i = 0; e->rect != TRect(0,0,0,0); e++, i++)\r
-                                               if(e->rect.Contains(p)) {\r
-                                                       currentConfig.iAreaBinds[i] ^= currentActCode;\r
-                                                       break;\r
-                                               }\r
-                               }\r
-                       }\r
-               }\r
-               else if(iWsEvent.Type() == EEventKeyDown || iWsEvent.Type() == EEventKeyUp)\r
-               {\r
-                       //if(iWsEvent.Type() == EEventKey)\r
-                       //      DEBUGPRINT(_L("iWsEvent.Key()->iCode=0x%08x"), iWsEvent.Key()->iCode);\r
-\r
-                       //if(iWsEvent.Type() == EEventKeyDown)\r
-                       //      DEBUGPRINT(_L("EEventKeyDown iScanCode=0x%08x"), iWsEvent.Key()->iScanCode);\r
-\r
-                       //if(iWsEvent.Type() == EEventKeyUp)\r
-                       //      DEBUGPRINT(_L("EEventKeyUp   iScanCode=0x%08x"), iWsEvent.Key()->iScanCode);\r
-\r
-                       // key events?\r
-                       if(iWsEvent.Type() == EEventKeyDown) {\r
-                               if(iWsScreen->CurrentScreenMode() == 1 && iWsEvent.Key()->iScanCode == EScanPxxxJogUp) {\r
-                                       do { which = (which-1) & 0x1F; } while(!actionNames[which]);\r
-                               } else if(iWsScreen->CurrentScreenMode() == 1 && iWsEvent.Key()->iScanCode == EScanPxxxJogDown) {\r
-                                       do { which = (which+1) & 0x1F; } while(!actionNames[which]);\r
-                               } else if(which == 31) {\r
-                                       gamestate = PGS_Paused;\r
-                                       if(iWsScreen->CurrentScreenMode()) // flip closed\r
-                                               vidDrawFCconfigDone();\r
-                               } else {\r
-                                       i = 0;\r
-                                       for(TPicoKeyConfigEntry *e = keyConfig; e->name; e++, i++)\r
-                                               if(iWsEvent.Key()->iScanCode == e->scanCode)\r
-                                                       if(!(e->flags&0x40)) currentConfig.iKeyBinds[i] ^= currentActCode;\r
-                               }\r
-                       }\r
-\r
-                       // power?\r
-                       if(iWsEvent.Key()->iScanCode == EScanPxxxPower || iWsEvent.Key()->iScanCode == EScanMotAEnd)\r
-                       {\r
-                                        if(iWsEvent.Type() == EEventKeyDown) powerIters = 1;\r
-                               else if(iWsEvent.Type() == EEventKeyUp)   powerIters = 0;\r
-                       }\r
-               }\r
-               else if(iWsEvent.Type() == EEventScreenDeviceChanged) {\r
-                       // trying to fix the P910 problem when something steals focus (and returns it after a while?)\r
-                       User::After(300000);\r
-               }\r
-               else if(iWsEvent.Type() == EEventFocusGroupChanged) {\r
-                       TInt launcherGrpId = iWsSession.FindWindowGroupIdentifier(0, iLauncherThreadId);\r
-                       TInt focusGrpId = iWsSession.GetFocusWindowGroup();\r
-                       DEBUGPRINT(_L("EEventFocusGroupChanged: %i, our: %i, launcher: %i"),\r
-                                               focusGrpId, iWsWindowGroup.Identifier(), launcherGrpId);\r
-                       // if it is not us and not launcher that got focus, exit config mode\r
-                       if(focusGrpId != iWsWindowGroup.Identifier() && focusGrpId != launcherGrpId) {\r
-                               // don't give up that easily. May be the focus will be given back.\r
-                               for (int i = 0; i < 4; i++) {\r
-                                       User::After(200000);\r
-                                       focusGrpId = iWsSession.GetFocusWindowGroup();\r
-                                       if(focusGrpId == iWsWindowGroup.Identifier() || focusGrpId == launcherGrpId) break;\r
-                               }\r
-                               if(focusGrpId != iWsWindowGroup.Identifier() && focusGrpId != launcherGrpId) \r
-                                       // we probably should give up now\r
-                                       gamestate = PGS_Paused;\r
-                       }\r
-               }\r
-\r
-               iWsEventStatus = KRequestPending;\r
-               iWsSession.EventReady(&iWsEventStatus);\r
-       }\r
-\r
-       if(powerIters) { // iterations when power was down\r
-               powerIters++;\r
-               if(powerIters > 5) {\r
-                       gamestate = PGS_Paused;\r
-                       powerIters = 0;\r
-               }\r
-       }\r
-}\r
-\r
-\r
-void CGameWindow::RunEvents(TUint32 which)\r
-{\r
-       if(which & 0x4000) currentConfig.iFrameskip = -1;\r
-       if(which & 0x2000) currentConfig.iFrameskip =  8;\r
-       if(which & 0x1800) { // save or load (but not both)\r
-               if(PsndOut) gameAudio->Pause(); // this may take a while, so we pause sound output\r
-\r
-               vidDrawNotice((which & 0x1000) ? "LOADING@GAME" : "SAVING@GAME");\r
-               saveLoadGame(which & 0x1000);\r
-\r
-               if(PsndOut) PsndOut = gameAudio->ResumeL();\r
-               reset_timing = 1;\r
-       }\r
-       if(which & 0x0400) gamestate = PGS_Paused;\r
-       if(which & 0x0200) { // switch renderer\r
-               if(currentConfig.iScreenMode == TPicoConfig::PMCenter && !noticeMsgTime.tv_sec &&\r
-                       (currentConfig.iScreenRotation == TPicoConfig::PRot90 || currentConfig.iScreenRotation == TPicoConfig::PRot270)) {\r
-\r
-                       PicoOpt^=0x10;\r
-                       vidInit(iWsScreen->DisplayMode(), 0, 0, 1);\r
-\r
-                       strcpy(noticeMsg, (PicoOpt&0x10) ? "ALT@RENDERER" : "DEFAULT@RENDERER");\r
-                       gettimeofday(&noticeMsgTime, 0);\r
-               }\r
-       }\r
-       if(which & 0x00c0) {\r
-               if(which&0x0080) {\r
-                       state_slot -= 1;\r
-                       if(state_slot < 0) state_slot = 9;\r
-               } else {\r
-                       state_slot += 1;\r
-                       if(state_slot > 9) state_slot = 0;\r
-               }\r
-               sprintf(noticeMsg, "SAVE@SLOT@%i@SELECTED", state_slot);\r
-               gettimeofday(&noticeMsgTime, 0);\r
-       }\r
-       if(which & 0x0020) if(gameAudio) gameAudio->ChangeVolume(0); // for Motorolas (broken?)\r
-       if(which & 0x0010) if(gameAudio) gameAudio->ChangeVolume(1);\r
-}\r
-\r
-\r
-// send event to launcher windowgroup (WS session MUST be alive)\r
-void CGameWindow::SendClientWsEvent(TInt type)\r
-{\r
-       if(!iWsSession.Handle()) {\r
-               DEBUGPRINT(_L("SendClientWsEvent(%i) called on dead iWsSession."), type);\r
-               return;\r
-       }\r
-\r
-       TWsEvent event;\r
-       event.SetType(type);\r
-       event.SetTimeNow();\r
-\r
-       TInt launcherGrpId = iWsSession.FindWindowGroupIdentifier(0, iLauncherThreadId);\r
-       if(launcherGrpId != KErrNotFound)\r
-                iWsSession.SendEventToWindowGroup(launcherGrpId, event);\r
-       else DEBUGPRINT(_L("failed to send event %i to launcher."), event.Type());\r
-}\r
-\r
-\r
-size_t gzRead2(void *p, size_t _size, size_t _n, void *file)\r
-{\r
-       return gzread(file, p, _n);\r
-}\r
-\r
-\r
-size_t gzWrite2(void *p, size_t _size, size_t _n, void *file)\r
-{\r
-       return gzwrite(file, p, _n);\r
-}\r
-\r
-\r
-// this function is shared between both threads\r
-int saveLoadGame(int load, int sram)\r
-{\r
-       int res = 0;\r
-\r
-       if(!RomFileName) return -1;\r
-\r
-       // make save filename\r
-       char saveFname[KMaxFileName];\r
-       strcpy(saveFname, RomFileName);\r
-       saveFname[KMaxFileName-8] = 0;\r
-       if(saveFname[strlen(saveFname)-4] == '.') saveFname[strlen(saveFname)-4] = 0;\r
-       if(sram) strcat(saveFname, ".srm");\r
-       else {\r
-               if(state_slot > 0 && state_slot < 10) sprintf(saveFname, "%s.%i", saveFname, state_slot);\r
-               strcat(saveFname, ".mds");\r
-       }\r
-       \r
-       DEBUGPRINT(_L("saveLoad (%i, %i): %S"), load, sram, DO_CONV(saveFname));\r
-\r
-       if(sram) {\r
-               FILE *sramFile;\r
-               int sram_size = SRam.end-SRam.start+1;\r
-               if(SRam.reg_back & 4) sram_size=0x2000;\r
-               if(!SRam.data) return 0; // SRam forcefully disabled for this game\r
-               if(load) {\r
-                       sramFile = fopen(saveFname, "rb");\r
-                       if(!sramFile) return -1;\r
-                       fread(SRam.data, 1, sram_size, sramFile);\r
-                       fclose(sramFile);\r
-               } else {\r
-                       // sram save needs some special processing\r
-                       // see if we have anything to save\r
-                       for(; sram_size > 0; sram_size--)\r
-                               if(SRam.data[sram_size-1]) break;\r
-                       \r
-                       if(sram_size) {\r
-                               sramFile = fopen(saveFname, "wb");\r
-                               res = fwrite(SRam.data, 1, sram_size, sramFile);\r
-                               res = (res != sram_size) ? -1 : 0;\r
-                               fclose((FILE *) sramFile);\r
-                       }\r
-               }\r
-               return res;\r
-       } else {\r
-               void *PmovFile = NULL;\r
-               // try gzip first\r
-               if(currentConfig.iFlags & 0x80) {\r
-                       strcat(saveFname, ".gz");\r
-                       if( (PmovFile = gzopen(saveFname, load ? "rb" : "wb")) ) {\r
-                               areaRead  = gzRead2;\r
-                               areaWrite = gzWrite2;\r
-                               if(!load) gzsetparams(PmovFile, 9, Z_DEFAULT_STRATEGY);\r
-                       } else\r
-                               saveFname[strlen(saveFname)-3] = 0;\r
-               }\r
-               if(!PmovFile) { // gzip failed or was disabled\r
-                       if( (PmovFile = fopen(saveFname, load ? "rb" : "wb")) ) {\r
-                               areaRead  = fread;\r
-                               areaWrite = fwrite;\r
-                       }\r
-               }\r
-               if(PmovFile) {\r
-                       PmovState(load ? 6 : 5, PmovFile);\r
-                       strcpy(noticeMsg, load ? "GAME@LOADED" : "GAME@SAVED");\r
-                       if(areaRead == gzRead2)\r
-                                gzclose(PmovFile);\r
-                       else fclose ((FILE *) PmovFile);\r
-                       PmovFile = 0;\r
-               } else {\r
-                       strcpy(noticeMsg, load ? "LOAD@FAILED" : "SAVE@FAILED");\r
-                       res = -1;\r
-               }\r
-\r
-               gettimeofday(&noticeMsgTime, 0);\r
-               return res;\r
-       }\r
-}\r
-\r
-// static class members\r
-RWsSession                             CGameWindow::iWsSession;\r
-RWindowGroup                   CGameWindow::iWsWindowGroup;\r
-RWindow                                        CGameWindow::iWsWindow;\r
-CWsScreenDevice*               CGameWindow::iWsScreen = NULL;\r
-CWindowGc*                             CGameWindow::iWindowGc = NULL;\r
-TRequestStatus                 CGameWindow::iWsEventStatus = KRequestPending;\r
-TThreadId                              CGameWindow::iLauncherThreadId = 0;\r
-RDirectScreenAccess*   CGameWindow::iDSA;\r
-TRequestStatus                 CGameWindow::iDSAstatus = KRequestPending;\r
diff --git a/platform/uiq2/port_config.h b/platform/uiq2/port_config.h
deleted file mode 100644 (file)
index 6ed28b1..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-// port specific settings\r
-\r
-#ifndef PORT_CONFIG_H\r
-#define PORT_CONFIG_H\r
-\r
-// draw2.c\r
-#define START_ROW  1 // which row of tiles to start rendering at?\r
-#define END_ROW   27 // ..end\r
-\r
-// pico.c\r
-#define CAN_HANDLE_240_LINES   0\r
-\r
-// common debug\r
-#if defined(__DEBUG_PRINT)\r
-void dprintf(char *format, ...);\r
-#else\r
-#define dprintf(x...)\r
-#endif\r
-\r
-\r
-#endif //PORT_CONFIG_H\r
diff --git a/platform/uiq2/port_config.s b/platform/uiq2/port_config.s
deleted file mode 100644 (file)
index cb6592a..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-.equiv START_ROW,              1\r
-.equiv END_ROW,                27\r
diff --git a/platform/uiq2/qconn.cmd b/platform/uiq2/qconn.cmd
deleted file mode 100644 (file)
index 96220c2..0000000
+++ /dev/null
@@ -1 +0,0 @@
-@..\..\..\qconsole-1.60\qtty-1.60\release\qtty --qc-addr P800 --qc-channel 5 --user qconsole --pass server
\ No newline at end of file
diff --git a/platform/uiq2/quploadpico.cmd b/platform/uiq2/quploadpico.cmd
deleted file mode 100644 (file)
index 7ef2241..0000000
+++ /dev/null
@@ -1 +0,0 @@
-@..\..\..\qconsole-1.60\qtty-1.60\release\qtty --qc-addr P800 --qc-channel 5 --user qconsole --pass server --cmds "put d:\system\apps\picodriven\PICOSMALL.EXE PICOSMALL.EXE" exit\r
diff --git a/platform/uiq2/quploadpicol.cmd b/platform/uiq2/quploadpicol.cmd
deleted file mode 100644 (file)
index 1482b2f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-@..\..\..\qconsole-1.60\qtty-1.60\release\qtty --qc-addr P800 --qc-channel 5 --user qconsole --pass server --cmds "put d:\system\apps\picodriven\PICODRIVEN.APP launcher\PICODRIVEN.APP" "put d:\system\apps\picodriven\PICODRIVEN.rsc launcher\PICODRIVEN.rsc" exit\r
diff --git a/platform/uiq2/version.h b/platform/uiq2/version.h
deleted file mode 100644 (file)
index ab1bd1e..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-// version number\r
-\r
-#ifndef __VERSION_H\r
-#define __VERSION_H\r
-\r
-#define KPicoMajorVersionNumber 0\r
-#define KPicoMinorVersionNumber 93\r
-#define KPicoBuildNumber 0\r
-\r
-#endif                 /* __VERSION_H */\r
diff --git a/platform/uiq2/vid.cpp b/platform/uiq2/vid.cpp
deleted file mode 100644 (file)
index 7b3b7ae..0000000
+++ /dev/null
@@ -1,1017 +0,0 @@
-// EmuScan routines for Pico, also simple text and shape drawing routines.\r
-\r
-// (c) Copyright 2006, notaz\r
-// All Rights Reserved\r
-\r
-#include "vid.h"\r
-#include "ClientServer.h"\r
-#include "SimpleServer.h"\r
-#include "pico\picoInt.h"\r
-#include "blit.h"\r
-#include "debug.h"\r
-\r
-// global stuff\r
-extern TPicoConfig currentConfig;\r
-extern TPicoKeyConfigEntry *keyConfig;\r
-extern TPicoAreaConfigEntry areaConfig[];\r
-extern const char * actionNames[];\r
-\r
-// main framebuffer\r
-static void *screenbuff = 0; // pointer to real device video memory\r
-//static\r
-unsigned short *framebuff = 0;  // temporary buffer in sega native BGR format\r
-const  int framebuffsize  = (8+320)*(8+208+8)*2; // actual framebuffer size (in bytes+to support new rendering mode)\r
-static int framebuff_offs = 0; // where to start copying (in pixels)\r
-static int framebuff_len  = 0; // how much of the framebuffer actually needs to be copied (in pixels)\r
-static int fc_lines, fc_inc; // lines, inc for "0 fit2" mode\r
-\r
-// drawer function pointers\r
-void (*drawTextFps)(const char *text) = 0;\r
-void (*drawTextNotice)(const char *text) = 0;\r
-\r
-// blitter\r
-void (*vidBlit)(int full) = 0;\r
-void (*vidBlitKeyCfg)(int full) = 0;\r
-\r
-// stuff for rendermode2\r
-static unsigned short cram_high[0x40];\r
-static unsigned short dt_dmask=0x0333;\r
-unsigned short color_redM2 = 0x022F;\r
-\r
-// colors\r
-const unsigned short color_red     = 0x022F;\r
-const unsigned short color_red_dim = 0x0004;\r
-const unsigned short color_green   = 0x01F1;\r
-const unsigned short color_blue    = 0x0F11;\r
-const unsigned short color_grey    = 0x0222;\r
-\r
-// other\r
-int txtheight_fit = 138;\r
-\r
-// bitmasks\r
-static const unsigned long mask_numbers[] = {\r
-       0x12244800, // 47 2F /\r
-       0x69999600, // 48 30 0\r
-       0x26222200, // 49 31 1\r
-       0x69168F00, // 50 32 2\r
-       0x69219600, // 51 33 3\r
-       0x266AF200, // 52 34 4\r
-       0xF8E11E00, // 53 35 5\r
-       0x68E99600, // 54 36 6\r
-       0x71222200, // 55 37 7\r
-       0x69699600, // 56 38 8\r
-       0x69719600, // 57 39 9\r
-       0x04004000, // 58 3A :\r
-       0x04004400, // 59 3B ;\r
-       0x01242100, // 60 3C <\r
-       0x00707000, // 61 3D =\r
-       0x04212400, // 62 3E >\r
-       0x69240400, // 63 3F ?\r
-       0x00000000, // 64 40 @ [used instead of space for now]\r
-       0x22579900, // 65 41 A\r
-       0xE9E99E00, // 66 42 B\r
-       0x69889600, // 67 43 C\r
-       0xE9999E00, // 68 44 D\r
-       0xF8E88F00, // 69 45 E\r
-       0xF8E88800, // 70 46 F\r
-       0x698B9700, // 71 47 G\r
-       0x99F99900, // 72 48 H\r
-       0x44444400, // 73 49 I\r
-       0x11119600, // 74 4A J\r
-       0x9ACCA900, // 75 4B K\r
-       0x88888F00, // 76 4C L\r
-       0x9F999900, // 77 4D M\r
-       0x9DDBB900, // 78 4E N\r
-       0x69999600, // 79 4F O\r
-       0xE99E8800, // 80 50 P\r
-       0x6999A500, // 81 51 Q\r
-       0xE99E9900, // 82 52 R\r
-       0x69429600, // 83 53 S\r
-       0x72222200, // 84 54 T\r
-       0x99999600, // 85 55 U\r
-       0x55552200, // 86 56 V\r
-       0x9999F900, // 87 57 W\r
-       0x55225500, // 88 58 X\r
-       0x55222200, // 89 59 Y\r
-       0xF1248F00, // 90 5A Z\r
-};\r
-\r
-\r
-////////////////////////////////\r
-// Cram functions\r
-\r
-inline int EmuCramNull(int cram)\r
-{\r
-  User::Panic(_L("Cram called!!"), 0);\r
-  return cram;\r
-}\r
-\r
-\r
-////////////////////////////////\r
-// PicoScan functions in "center" mode\r
-\r
-int EmuScanCenter0(unsigned int num, unsigned short *sdata)\r
-{\r
-  //unsigned short *vidmem=framebuff;\r
-\r
-  //unsigned short *sp, *sto;\r
-  //sp=sdata+56; sto=sdata+264; vidmem += num*208;\r
-\r
-  //do { *vidmem++ = *sp++; } while(sp < sto);\r
-  memcpy(framebuff + num*208, sdata+56, 208*2); // memcpy gives ~1 fps (~2 with optimized memcpy)\r
-\r
-  return 0;\r
-}\r
-\r
-\r
-int EmuScanCenter90(unsigned int num, unsigned short *sdata)\r
-{\r
-  // ignore top and bottom lines\r
-  if(num < 8)   return 7-num;     // skip first 8 lines\r
-  if(num > 215) return 223+8-num; // this should not happen, just in case\r
-\r
-  num -= 8;\r
-  if(!num) {\r
-       if(Pico.video.reg[12]&1) { // copy less in 32-col mode\r
-         framebuff_offs= 0;\r
-      framebuff_len = 208*320;\r
-       } else {\r
-         framebuff_offs= 208*32;\r
-      framebuff_len = 208*256;\r
-       }\r
-  }\r
-\r
-  unsigned short *vidmem=framebuff;\r
-  vidmem += 207-num; // adjust x\r
-\r
-  // do less copy in 32-column mode\r
-  unsigned short *sp, *sto;\r
-  int pixels;\r
-  if(!(Pico.video.reg[12]&1))\r
-       { sp=sdata+32; sto=sdata+288; pixels = 288; vidmem += 32*208; }\r
-  else { sp=sdata;    sto=sdata+320; pixels = 320; }\r
-\r
-  do { *vidmem = *sp++; vidmem+=208; } while(sp < sto);\r
-\r
-  if(num == 207) return 16; // skip bottom of this frame and top of next\r
-\r
-  return 0;\r
-}\r
-\r
-\r
-int EmuScanCenter180(unsigned int num, unsigned short *sdata)\r
-{\r
-  unsigned short *vidmem=framebuff;\r
-\r
-  unsigned short *sp, *sto;\r
-  sp=sdata+56; sto=sdata+264; vidmem += (224-num)*208;\r
-\r
-  do { *(--vidmem) = *sp++; } while(sp < sto); // reversed\r
-\r
-  return 0;\r
-}\r
-\r
-\r
-int EmuScanCenter270(unsigned int num, unsigned short *sdata)\r
-{\r
-  // ignore top and bottom lines\r
-  if(num < 8)   return 7-num;     // skip first 8 lines\r
-  if(num > 215) return 223-num+8;\r
-\r
-  num -= 8;\r
-  if(num > 207) return 0;\r
-  if(!num) {\r
-       if(Pico.video.reg[12]&1) {\r
-         framebuff_offs= 0;\r
-      framebuff_len = 208*320;\r
-       } else {\r
-         framebuff_offs= 208*32;\r
-      framebuff_len = 208*256;\r
-       }\r
-  }\r
-\r
-  unsigned short *vidmem=framebuff+320*208;\r
-  vidmem -= 208-num; // adjust x\r
-\r
-  // do less copy in 32-column mode\r
-  unsigned short *sp, *sto;\r
-  if(!(Pico.video.reg[12]&1))\r
-       { sp=sdata+32; sto=sdata+288; vidmem -= 32*208; }\r
-  else { sp=sdata;    sto=sdata+320; }\r
-\r
-  do { *vidmem = *sp++; vidmem-=208; } while(sp < sto);\r
-\r
-  if(num == 207) return 16; // skip bottom of this frame and top of next\r
-\r
-  return 0;\r
-}\r
-\r
-\r
-\r
-////////////////////////////////\r
-// PicoScan functions in "fit" mode\r
-\r
-static int EmuScanFit0(unsigned int num, unsigned short *sdata)\r
-{\r
-  // 0.65, 145 lines in normal mode; 0.8125, 182 lines in 32-column mode\r
-\r
-  // draw this line? (ARM4s don't support division, so do some tricks here)\r
-  static int u = 0, num2 = 0;\r
-  if(!num) {\r
-    u = num2 = 0;\r
-       if(currentConfig.iScreenMode == TPicoConfig::PMFit) {\r
-      if(Pico.video.reg[12]&1) { // 32 col mode? This can change on any frame\r
-        fc_inc = 6500;\r
-           txtheight_fit = 138;\r
-        framebuff_len = 208*145;\r
-           memset(framebuff+208*145, 0, 208*37*2);\r
-      } else {\r
-        fc_inc = 8125;\r
-           txtheight_fit = 175;\r
-        framebuff_len = 208*182;\r
-      }\r
-       }\r
-  }\r
-  u += fc_inc;\r
-  if(u < 10000) return 0;\r
-  u -= 10000;\r
-\r
-  unsigned short *vidmem=framebuff;\r
-\r
-  int slen;\r
-  unsigned short *sp;\r
-  if(!(Pico.video.reg[12]&1))\r
-       { sp=sdata+32; slen=256; }\r
-  else { sp=sdata;    slen=320; }\r
-\r
-  vidmem += num2*208;\r
-/*\r
-  int i=0;\r
-  while(sp < sto) {\r
-       i += inc;\r
-    if(i >= 10000) {\r
-         *vidmem++ = *sp;\r
-         i -= 10000;\r
-       }\r
-       sp++;\r
-  }\r
-*/\r
-  PicuShrink(vidmem, 208, sp, slen);\r
-\r
-  num2++;\r
-\r
-  // calculate how many lines pico engine should skip,\r
-  // making sure this func will be called on scanline 0\r
-  int skip = 0;\r
-  while(u+fc_inc < 10000 && num+skip != 223) { u+=fc_inc; skip++; }\r
-\r
-  return skip;\r
-}\r
-\r
-int EmuScanFit90(unsigned int num, unsigned short *sdata)\r
-{\r
-  // 0.9285\r
-\r
-  // draw this line?\r
-  static int u = 0, num2 = 0;\r
-  if(!num) {\r
-    u = num2 = 0;\r
-       if(Pico.video.reg[12]&1) {\r
-         framebuff_offs= 0;\r
-      framebuff_len = 208*320;\r
-       } else {\r
-         framebuff_offs= 208*32;\r
-      framebuff_len = 208*256;\r
-       }\r
-  }\r
-  u += 9285;\r
-  if(u < 10000) return 0;\r
-  u -= 10000;\r
-\r
-  unsigned short *vidmem=framebuff;\r
-  vidmem += 207-num2; // adjust x\r
-\r
-  // do less copy in 32-column mode\r
-  unsigned short *sp, *sto;\r
-  if(!(Pico.video.reg[12]&1))\r
-       { sp=sdata+32; sto=sdata+288; vidmem += 32*208; }\r
-  else { sp=sdata;    sto=sdata+320; }\r
-\r
-  do { *vidmem = *sp++; vidmem+=208; } while(sp < sto);\r
-\r
-  num2++;\r
-\r
-  // skip next line?\r
-  if(u+9285 < 10000 && num != 223) { u+=9285; return 1; }\r
-\r
-  return 0;\r
-}\r
-\r
-int EmuScanFit180(unsigned int num, unsigned short *sdata)\r
-{\r
-  // 0.65, 145 lines in normal mode; 0.8125, 182 lines in 32-column mode\r
-\r
-  // draw this line? (ARM4s don't support division)\r
-  static int u = 0, num2 = 0;\r
-  if(!num) {\r
-    u = num2 = 0;\r
-       if(currentConfig.iScreenMode == TPicoConfig::PMFit) {\r
-      if(Pico.video.reg[12]&1) { // 32 col mode? This can change on any frame\r
-           fc_lines = 145;\r
-        fc_inc = 6500;\r
-           txtheight_fit = 138;\r
-        framebuff_len = 208*145;\r
-           memset(framebuff+208*145, 0, 208*37*2);\r
-      } else {\r
-        fc_lines = 182;\r
-        fc_inc = 8125;\r
-           txtheight_fit = 175;\r
-        framebuff_len = 208*182;\r
-      }\r
-    }\r
-  }\r
-  u += fc_inc;\r
-  if(u < 10000) return 0;\r
-  u -= 10000;\r
-\r
-  unsigned short *vidmem=framebuff;\r
-\r
-  int slen;\r
-  unsigned short *sp;\r
-  if(!(Pico.video.reg[12]&1))\r
-       { sp=sdata+32; slen=256; }\r
-  else { sp=sdata;    slen=320; }\r
-\r
-  vidmem += (fc_lines-num2)*208;\r
-\r
-  PicuShrinkReverse(vidmem, 208, sp, slen);\r
-\r
-  num2++;\r
-\r
-  // skip some lines?\r
-  int skip = 0;\r
-  while(u+fc_inc < 10000 && num+skip != 223) { u+=fc_inc; skip++; }\r
-\r
-  return skip;\r
-}\r
-\r
-int EmuScanFit270(unsigned int num, unsigned short *sdata)\r
-{\r
-  // 0.9285\r
-\r
-  // draw this line?\r
-  static int u = 0, num2 = 0;\r
-  if(!num) {\r
-    u = num2 = 0;\r
-       if(Pico.video.reg[12]&1) {\r
-         framebuff_offs= 0;\r
-      framebuff_len = 208*320;\r
-       } else {\r
-         framebuff_offs= 208*32;\r
-      framebuff_len = 208*256;\r
-       }\r
-  }\r
-  u += 9285;\r
-  if(u < 10000) return 0;\r
-  u -= 10000;\r
-\r
-  unsigned short *vidmem=framebuff+320*208;\r
-  vidmem -= 208-num2; // adjust x\r
-\r
-  // do less copy in 32-column mode\r
-  unsigned short *sp, *sto;\r
-  if(!(Pico.video.reg[12]&1))\r
-       { sp=sdata+32; sto=sdata+288; vidmem -= 32*208; }\r
-  else { sp=sdata;    sto=sdata+320; }\r
-\r
-  do { *vidmem = *sp++; vidmem-=208; } while(sp < sto);\r
-\r
-  num2++;\r
-\r
-  // skip next line?\r
-  if(u+9285 < 10000 && num != 223) { u+=9285; return 1; }\r
-\r
-  return 0;\r
-}\r
-\r
-\r
-////////////////////////////////\r
-// text drawers\r
-// warning: text must be at least 1px away from screen borders\r
-\r
-void drawTextM2(int x, int y, const char *text, long color)\r
-{\r
-       unsigned short *vidmem=framebuff;\r
-       int charmask, i, cx = x, cy;\r
-       unsigned short *l, *le;\r
-\r
-       // darken the background (left border)\r
-       for(l=vidmem+(cx-1)+(y-1)*328, le=vidmem+(cx-1)+(y+7)*328; l < le; l+=328)\r
-               *l = (*l >> 2) & dt_dmask;\r
-\r
-       for(const char *p=text; *p; p++) {\r
-               cy = y;\r
-               charmask = *(mask_numbers + (*p - 0x2F));\r
-\r
-               for(l = vidmem+cx+(y-1)*328, le = vidmem+cx+(y+7)*328; l < le; l+=328-4) {\r
-                       *l = (*l >> 2) & dt_dmask; l++; *l = (*l >> 2) & dt_dmask; l++;\r
-                       *l = (*l >> 2) & dt_dmask; l++; *l = (*l >> 2) & dt_dmask; l++;\r
-                       *l = (*l >> 2) & dt_dmask;\r
-               }\r
-\r
-               for(i=0; i < 24; i++) {\r
-                       // draw dot. Is this fast?\r
-                       if(charmask&0x80000000) *( vidmem + (cx+(i&3)) + (cy+(i>>2))*328 ) = color;\r
-                       charmask <<= 1;\r
-               }\r
-               cx += 5;\r
-       }\r
-}\r
-\r
-void drawText0(int x, int y, const char *text, long color)\r
-{\r
-       unsigned short *vidmem=framebuff;\r
-       int charmask, i, cx = x, cy;\r
-       unsigned short *l, *le, dmask=0x0333;\r
-\r
-       // darken the background (left border)\r
-       for(l=vidmem+(cx-1)+(y-1)*208, le=vidmem+(cx-1)+(y+7)*208; l < le; l+=208)\r
-               *l = (*l >> 2) & dmask;\r
-\r
-       for(const char *p=text; *p; p++) {\r
-               cy = y;\r
-               charmask = *(mask_numbers + (*p - 0x2F));\r
-\r
-               for(l = vidmem+cx+(y-1)*208, le = vidmem+cx+(y+7)*208; l < le; l+=208-4) {\r
-                       *l = (*l >> 2) & dmask; l++; *l = (*l >> 2) & dmask; l++;\r
-                       *l = (*l >> 2) & dmask; l++; *l = (*l >> 2) & dmask; l++;\r
-                       *l = (*l >> 2) & dmask;\r
-               }\r
-\r
-               for(i=0; i < 24; i++) {\r
-                       // draw dot. Is this fast?\r
-                       if(charmask&0x80000000) *( vidmem + (cx+(i&3)) + (cy+(i>>2))*208 ) = color;\r
-                       charmask <<= 1;\r
-               }\r
-               cx += 5;\r
-       }\r
-}\r
-\r
-void drawText90(int x, int y, const char *text, long color)\r
-{\r
-       unsigned short *vidmem=framebuff;\r
-       unsigned short *l, *le, dmask=0x0333;\r
-       int charmask, i, cx, cy = y;\r
-\r
-       for(l=vidmem+(x+1)+(cy-1)*208, le=vidmem+(x-7)+(cy-1)*208; l > le; l--)\r
-               *l = (*l >> 2) & dmask;\r
-\r
-       for(const char *p=text; *p; p++) {\r
-               cx = x;\r
-               charmask = *(mask_numbers + (*p - 0x2F));\r
-\r
-               for(l = vidmem+(x+1)+(cy)*208, le = vidmem+(x+1)+(cy+5)*208; l < le; l+=208+7) {\r
-                       *l = (*l >> 2) & dmask; l--; *l = (*l >> 2) & dmask; l--;\r
-                       *l = (*l >> 2) & dmask; l--; *l = (*l >> 2) & dmask; l--;\r
-                       *l = (*l >> 2) & dmask; l--; *l = (*l >> 2) & dmask; l--;\r
-                       *l = (*l >> 2) & dmask; l--; *l = (*l >> 2) & dmask;\r
-               }\r
-\r
-               for(i=0; i < 24; i++) {\r
-                       if(charmask&0x80000000) *( vidmem + (cy+(i&3))*208 + (cx-(i>>2)) ) = color;\r
-                       charmask <<= 1;\r
-               }\r
-               cy += 5;\r
-       }\r
-}\r
-\r
-void drawText180(int x, int y, const char *text, long color)\r
-{\r
-       unsigned short *vidmem=framebuff;\r
-       int charmask, i, cx = x, cy;\r
-       unsigned short *l, *le, dmask=0x0333;\r
-\r
-       for(l=vidmem+(cx+1)+(y+1)*208, le=vidmem+(cx+1)+(y-7)*208; l > le; l-=208)\r
-               *l = (*l >> 2) & dmask;\r
-\r
-       for(const char *p=text; *p; p++) {\r
-               cy = y;\r
-               charmask = *(mask_numbers + (*p - 0x2F));\r
-\r
-               for(l = vidmem+cx+(y+1)*208, le = vidmem+cx+(y-8)*208; l > le; l-=208-4) {\r
-                       *l = (*l >> 2) & dmask; l--; *l = (*l >> 2) & dmask; l--;\r
-                       *l = (*l >> 2) & dmask; l--; *l = (*l >> 2) & dmask; l--;\r
-                       *l = (*l >> 2) & dmask;\r
-               }\r
-\r
-               for(i=0; i < 24; i++) {\r
-                       if(charmask&0x80000000) *( vidmem + (cx-(i&3)) + (cy-(i>>2))*208 ) = color;\r
-                       charmask <<= 1;\r
-               }\r
-               cx -= 5;\r
-       }\r
-}\r
-\r
-void drawText270(int x, int y, const char *text, long color)\r
-{\r
-       unsigned short *vidmem=framebuff;\r
-       int charmask, i, cx, cy = y;\r
-       unsigned short *l, *le, dmask=0x0333;\r
-\r
-       for(l=vidmem+(x-1)+(cy+1)*208, le=vidmem+(x+7)+(cy+1)*208; l < le; l++)\r
-               *l = (*l >> 2) & dmask;\r
-\r
-       for(const char *p=text; *p; p++) {\r
-               cx = x;\r
-               charmask = *(mask_numbers + (*p - 0x2F));\r
-\r
-               for(l = vidmem+(x-1)+(cy)*208, le = vidmem+(x-1)+(cy-5)*208; l > le; l-=208+7) {\r
-                       *l = (*l >> 2) & dmask; l++; *l = (*l >> 2) & dmask; l++;\r
-                       *l = (*l >> 2) & dmask; l++; *l = (*l >> 2) & dmask; l++;\r
-                       *l = (*l >> 2) & dmask; l++; *l = (*l >> 2) & dmask; l++;\r
-                       *l = (*l >> 2) & dmask; l++; *l = (*l >> 2) & dmask;\r
-               }\r
-\r
-               for(i=0; i < 24; i++) {\r
-                       if(charmask&0x80000000) *( vidmem + (cy-(i&3))*208 + (cx+(i>>2)) ) = color;\r
-                       charmask <<= 1;\r
-               }\r
-               cy -= 5;\r
-       }\r
-}\r
-\r
-void drawTextFpsM2(const char *text)\r
-{\r
-       if(!text) return;\r
-       drawTextM2((Pico.video.reg[12]&1) ? 256 : 224, 200, text, color_redM2);\r
-}\r
-\r
-void drawTextFps0(const char *text)\r
-{\r
-       if(!text) return;\r
-       drawText0(176, 216, text, color_red);\r
-}\r
-\r
-void drawTextFpsFit0(const char *text)\r
-{\r
-       if(!text) return;\r
-       drawText0(176, txtheight_fit, text, color_red);\r
-}\r
-\r
-void drawTextFps90(const char *text)\r
-{\r
-       if(!text) return;\r
-       drawText90(10, 256, text, color_red);\r
-}\r
-\r
-void drawTextFps180(const char *text)\r
-{\r
-       if(!text) return;\r
-       drawText180(32, 8, text, color_red);\r
-}\r
-\r
-void drawTextFps270(const char *text)\r
-{\r
-       if(!text) return;\r
-       drawText270(200, 64, text, color_red);\r
-}\r
-\r
-void drawTextNoticeM2(const char *text)\r
-{\r
-       if(!text) return;\r
-       drawTextM2(20, 200, text, color_redM2);\r
-}\r
-\r
-void drawTextNotice0(const char *text)\r
-{\r
-       if(!text) return;\r
-       drawText0(2, 216, text, color_red);\r
-}\r
-\r
-void drawTextNoticeFit0(const char *text)\r
-{\r
-       if(!text) return;\r
-       drawText0(2, txtheight_fit, text, color_red);\r
-}\r
-\r
-void drawTextNotice90(const char *text)\r
-{\r
-       if(!text) return;\r
-       drawText90(10, 34, text, color_red);\r
-}\r
-\r
-void drawTextNotice180(const char *text)\r
-{\r
-       if(!text) return;\r
-       drawText180(206, 8, text, color_red);\r
-}\r
-\r
-void drawTextNotice270(const char *text)\r
-{\r
-       if(!text) return;\r
-       drawText270(200, 286, text, color_red);\r
-}\r
-\r
-\r
-////////////////////////////////\r
-// misc drawers\r
-\r
-// draws rect with width - 1 and height - 1\r
-void drawRect(const TRect &rc, unsigned short color)\r
-{\r
-       if(rc.iTl.iX - rc.iBr.iX && rc.iTl.iY - rc.iBr.iY) {\r
-               int stepX = rc.iTl.iX < rc.iBr.iX ? 1 : -1;\r
-               int stepY = rc.iTl.iY < rc.iBr.iY ? 1 : -1;\r
-               \r
-               for(int x = rc.iTl.iX;; x += stepX) {\r
-                       *(framebuff + rc.iTl.iY*208 + x) = *(framebuff + (rc.iBr.iY - stepY)*208 + x) = color;\r
-                       if(x == rc.iBr.iX - stepX) break;\r
-               }\r
-               \r
-               for(int y = rc.iTl.iY;; y += stepY) {\r
-                       *(framebuff + y*208 + rc.iTl.iX) = *(framebuff + y*208 + rc.iBr.iX - stepX) = color;\r
-                       if(y == rc.iBr.iY - stepY) break;\r
-               }\r
-       }\r
-}\r
-\r
-// draws fullsize filled rect\r
-void drawRectFilled(const TRect rc, unsigned short color)\r
-{\r
-       if(rc.iTl.iX - rc.iBr.iX && rc.iTl.iY - rc.iBr.iY) {\r
-               int stepX = rc.iTl.iX < rc.iBr.iX ? 1 : -1;\r
-               int stepY = rc.iTl.iY < rc.iBr.iY ? 1 : -1;\r
-               \r
-               for(int y = rc.iTl.iY;; y += stepY) {\r
-                       for(int x = rc.iTl.iX;; x += stepX) {\r
-                               *(framebuff + y*208 + x) = *(framebuff + y*208 + x) = color;\r
-                               if(x == rc.iBr.iX) break;\r
-                       }\r
-                       if(y == rc.iBr.iY) break;\r
-               }\r
-       }\r
-}\r
-\r
-// direction: -1 left, 1 right\r
-void drawArrow0(TPoint p, int direction, unsigned short color)\r
-{\r
-       int width = 11;\r
-       int x = p.iX;\r
-       int y = p.iY;\r
-\r
-       for(; width > 0; x+=direction, y++, width -=2)\r
-               for(int i=0; i < width; i++)\r
-                       *(framebuff + x + y*208 + i*208) = color;\r
-}\r
-\r
-void drawArrow90(TPoint p, int direction, unsigned short color)\r
-{\r
-       int width = 11;\r
-       int x = p.iX - width;\r
-       int y = p.iY;\r
-\r
-       for(; width > 0; x++, y+=direction, width -=2)\r
-               for(int i=0; i < width; i++)\r
-                       *(framebuff + x + y*208 + i) = color;\r
-}\r
-\r
-\r
-// copies temporary framebuff to real device framebuffer\r
-void vidBlitRGB444(int full)\r
-{\r
-       unsigned short *ps;\r
-       unsigned short *pd;\r
-       int pixels;\r
-       if(full) {\r
-               ps = framebuff;\r
-               pd = (unsigned short *) screenbuff;\r
-               pixels = 208*320;\r
-       } else {\r
-               ps = framebuff + framebuff_offs;\r
-               pd = (unsigned short *) screenbuff + framebuff_offs;\r
-               pixels = framebuff_len;\r
-       }\r
-\r
-       vidConvCpyRGB444(pd, ps, pixels);\r
-       //for(unsigned short *ps_end = ps + pixels; ps < ps_end; ps++)\r
-               // Convert 0000bbb0 ggg0rrr0\r
-               // to      0000rrr0 ggg0bbb0\r
-       //      *pd++ = ((*ps&0x000F)<<8) | (*ps&0x00F0) | ((*ps&0x0F00)>>8);\r
-}\r
-\r
-void vidBlitRGB565(int full)\r
-{\r
-       unsigned short *ps;\r
-       unsigned short *pd;\r
-       int pixels;\r
-       if(full) {\r
-               ps = framebuff;\r
-               pd = (unsigned short *) screenbuff;\r
-               pixels = 208*320;\r
-       } else {\r
-               ps = framebuff  + framebuff_offs;\r
-               pd = (unsigned short *) screenbuff + framebuff_offs;\r
-               pixels = framebuff_len;\r
-       }\r
-\r
-       vidConvCpyRGB565(pd, ps, pixels);\r
-       //for(; ps < ps_end; ps++)\r
-               // Convert 0000bbb0 ggg0rrr0\r
-               // to      rrr00ggg 000bbb00\r
-       //      *pd++ = ((*ps&0x000F)<<12) | ((*ps&0x00F0)<<3) | ((*ps&0x0F00)>>7);\r
-}\r
-\r
-void vidBlitRGB32(int full)\r
-{\r
-       unsigned short *ps;\r
-       unsigned long  *pd;\r
-       int pixels;\r
-       if(full) {\r
-               ps = framebuff;\r
-               pd = (unsigned long *) screenbuff;\r
-               pixels = 208*320;\r
-       } else {\r
-               ps = framebuff  + framebuff_offs;\r
-               pd = (unsigned long *) screenbuff + framebuff_offs;\r
-               pixels = framebuff_len;\r
-       }\r
-\r
-       vidConvCpyRGB32(pd, ps, pixels);\r
-       //for(; ps < ps_end; ps++)\r
-               // Convert          0000bbb0 ggg0rrr0\r
-               // to  ..0 rrr00000 ggg00000 bbb00000\r
-       //      *pd++ = ((*ps&0x000F)<<20) | ((*ps&0x00F0)<<8) | ((*ps&0x0F00)>>4);\r
-}\r
-\r
-// -------- rendermode 2 ---------\r
-\r
-void vidBlit16M2(int full)\r
-{\r
-       unsigned short *ps = framebuff+328*8;\r
-       unsigned short *pd = (unsigned short *) screenbuff;\r
-\r
-       if(currentConfig.iScreenRotation == TPicoConfig::PRot90) {\r
-               if(Pico.video.reg[12]&1)\r
-                       vidConvCpyM2_16_90(pd, ps, 320/8);\r
-               else {\r
-                       if(full) memset(pd, 0, 208*32*2);\r
-                       pd += 208*32;\r
-                       vidConvCpyM2_16_90(pd, ps, 256/8);\r
-                       if(full) memset(pd + 208*256, 0, 208*32*2);\r
-               }\r
-       } else if(currentConfig.iScreenRotation == TPicoConfig::PRot270) {\r
-               if(Pico.video.reg[12]&1)\r
-                       vidConvCpyM2_16_270(pd, ps, 320/8);\r
-               else {\r
-                       if(full) memset(pd, 0, 208*32*2);\r
-                       pd += 208*32;\r
-                       ps -= 64;     // the blitter starts copying from the right border, so we need to adjust\r
-                       vidConvCpyM2_16_270(pd, ps, 256/8);\r
-                       if(full) memset(pd + 208*256, 0, 208*32*2);\r
-               }\r
-       }\r
-/*\r
-    for(int x=0; x < 320; x++)\r
-               for(int y=207; y>=0; y--) {\r
-                       *pd++ = *(ps+8+x+y*328);\r
-               }\r
-*/\r
-}\r
-\r
-void vidBlitRGB32M2(int full)\r
-{\r
-       unsigned short *ps = framebuff+328*8;\r
-       unsigned long  *pd = (unsigned long *) screenbuff;\r
-\r
-       if(currentConfig.iScreenRotation == TPicoConfig::PRot90) {\r
-               if(Pico.video.reg[12]&1)\r
-                       vidConvCpyM2_RGB32_90(pd, ps, 320/8);\r
-               else {\r
-                       if(full) memset(pd, 0, 208*32*4);\r
-                       pd += 208*32;\r
-                       vidConvCpyM2_RGB32_90(pd, ps, 256/8);\r
-                       if(full) memset(pd + 208*256, 0, 208*32*4);\r
-               }\r
-       } else if(currentConfig.iScreenRotation == TPicoConfig::PRot270) {\r
-               if(Pico.video.reg[12]&1)\r
-                       vidConvCpyM2_RGB32_270(pd, ps, 320/8);\r
-               else {\r
-                       if(full) memset(pd, 0, 208*32*4);\r
-                       pd += 208*32;\r
-                       ps -= 64;     // the blitter starts copying from the right border, so we need to adjust\r
-                       vidConvCpyM2_RGB32_270(pd, ps, 256/8);\r
-                       if(full) memset(pd + 208*256, 0, 208*32*4);\r
-               }\r
-       }\r
-}\r
-\r
-void PrepareCramRGB444M2()\r
-{\r
-       vidConvCpyRGB444(cram_high, Pico.cram, 0x40);\r
-}\r
-\r
-void PrepareCramRGB565M2()\r
-{\r
-       vidConvCpyRGB565(cram_high, Pico.cram, 0x40);\r
-}\r
-\r
-\r
-////////////////////////////////\r
-// main functions\r
-\r
-int vidInit(int displayMode, void *vidmem, int p800, int reinit)\r
-{\r
-       if(!reinit) {\r
-               // prepare framebuffer\r
-               screenbuff = (unsigned short *) vidmem;\r
-               framebuff =  (unsigned short *) malloc(framebuffsize);\r
-\r
-               if(!screenbuff) return KErrNotSupported;\r
-               if(!framebuff)  return KErrNoMemory;\r
-\r
-               // Cram function: go and hack Pico so it never gets called\r
-               PicoCram = EmuCramNull;\r
-       }\r
-\r
-       // select suitable blitter\r
-       switch(displayMode) {\r
-               case EColor4K:  vidBlit = vidBlitKeyCfg = vidBlitRGB444; break;\r
-               case EColor64K: vidBlit = vidBlitKeyCfg = vidBlitRGB565; break;\r
-               case EColor16M: vidBlit = vidBlitKeyCfg = vidBlitRGB32;  break;\r
-               default: return KErrNotSupported;\r
-       }\r
-\r
-       memset(framebuff, 0, framebuffsize);\r
-\r
-       // rendermode 2?\r
-       if(PicoOpt&0x10) {\r
-               switch(displayMode) {\r
-                       case EColor4K:\r
-                               vidBlit = vidBlit16M2;\r
-                               PicoPrepareCram = PrepareCramRGB444M2;\r
-                               PicoCramHigh = cram_high;\r
-                               color_redM2 = 0x0F22;\r
-                               dt_dmask = 0x0333;\r
-                               break;\r
-                       case EColor64K:\r
-                               vidBlit = vidBlit16M2;\r
-                               PicoPrepareCram = PrepareCramRGB565M2;\r
-                               PicoCramHigh = cram_high;\r
-                               color_redM2 = 0xF882;\r
-                               dt_dmask = 0x39e7;\r
-                               break;\r
-                       case EColor16M:\r
-                               vidBlit = vidBlitRGB32M2;\r
-                               break;\r
-               }\r
-               drawTextFps = drawTextFpsM2;\r
-               drawTextNotice = drawTextNoticeM2;\r
-               vidBlit(1);\r
-               return 0;\r
-       }\r
-\r
-       framebuff_offs = 0;\r
-       framebuff_len  = 208*320;\r
-       vidBlit(1);\r
-\r
-       // setup all orientation related stuff\r
-       if(currentConfig.iScreenRotation == TPicoConfig::PRot0) {\r
-               if(currentConfig.iScreenMode == TPicoConfig::PMCenter) {\r
-                       PicoScan = EmuScanCenter0;\r
-                       framebuff_len = 208*224;\r
-                       drawTextFps = drawTextFps0;\r
-                       drawTextNotice = drawTextNotice0;\r
-               } else {\r
-                       if(currentConfig.iScreenMode == TPicoConfig::PMFit2) {\r
-                               if(p800) {\r
-                                       fc_inc = 6518; // 0.651786 (144+2)\r
-                                       txtheight_fit = 139;\r
-                                       framebuff_len = 208*146;\r
-                               } else {\r
-                                       fc_inc = 9286; // 0.92857\r
-                                       txtheight_fit = 201;\r
-                                       framebuff_len = 208*208;\r
-                               }\r
-                       }\r
-                       PicoScan = EmuScanFit0;\r
-                       drawTextFps = drawTextFpsFit0;\r
-                       drawTextNotice = drawTextNoticeFit0;\r
-               }\r
-       } else if(currentConfig.iScreenRotation == TPicoConfig::PRot90) {\r
-               if(currentConfig.iScreenMode == TPicoConfig::PMFit)\r
-                        PicoScan = EmuScanFit90;\r
-               else PicoScan = EmuScanCenter90;\r
-               drawTextFps = drawTextFps90;\r
-               drawTextNotice = drawTextNotice90;\r
-       } else if(currentConfig.iScreenRotation == TPicoConfig::PRot180) {\r
-               if(currentConfig.iScreenMode == TPicoConfig::PMCenter) {\r
-                       PicoScan = EmuScanCenter180;\r
-                       framebuff_len = 208*224;\r
-               } else {\r
-                       if(currentConfig.iScreenMode == TPicoConfig::PMFit2) {\r
-                               if(p800) {\r
-                                       fc_inc = 6518; // 0.651786\r
-                                       fc_lines = 146;\r
-                                       framebuff_len = 208*146;\r
-                               } else {\r
-                                       fc_inc = 9286; // 0.92857\r
-                                       fc_lines = 208;\r
-                                       framebuff_len = 208*208;\r
-                               }\r
-                       }\r
-                       PicoScan = EmuScanFit180;\r
-               }\r
-               drawTextFps = drawTextFps180;\r
-               drawTextNotice = drawTextNotice180;\r
-       } else if(currentConfig.iScreenRotation == TPicoConfig::PRot270) {\r
-               if(currentConfig.iScreenMode == TPicoConfig::PMFit)\r
-                        PicoScan = EmuScanFit270;\r
-               else PicoScan = EmuScanCenter270;\r
-               drawTextFps = drawTextFps270;\r
-               drawTextNotice = drawTextNotice270;\r
-       }\r
-\r
-       return 0;\r
-}\r
-\r
-void vidFree()\r
-{\r
-       free(framebuff);\r
-       framebuff = 0;\r
-}\r
-\r
-void vidDrawFrame(char *noticeStr, char *fpsStr, int num)\r
-{\r
-       PicoFrame();\r
-       if(currentConfig.iFlags & 2)\r
-               drawTextFps(fpsStr);\r
-       drawTextNotice(noticeStr);\r
-\r
-       vidBlit(!num); // copy full frame once a second\r
-}\r
-\r
-void vidKeyConfigFrame(const TUint whichAction, TInt flipClosed)\r
-{\r
-       int i;\r
-       char buttonNames[128];\r
-       buttonNames[0] = 0;\r
-       memset(framebuff, 0, framebuffsize);\r
-\r
-       unsigned long currentActCode = 1 << whichAction;\r
-\r
-       if(flipClosed) {\r
-               drawRectFilled(TRect(56, 2, 152, 16), color_grey); // 96x14\r
-               drawArrow0(TPoint(64, 3), -1, color_green);\r
-               drawArrow0(TPoint(144, 3), 1, color_green);\r
-               drawText0(64, 20, "USE@JOG@TO@SELECT", color_red);\r
-\r
-               drawText0(68, 6, actionNames[whichAction], color_red);\r
-       } else {\r
-               // draw all "buttons" in reverse order\r
-               const TPicoAreaConfigEntry *e = areaConfig + 1; i = 0;\r
-               while(e->rect != TRect(0,0,0,0)) { e++; i++; }\r
-               for(e--, i--; e->rect != TRect(0,0,0,0); e--, i--)\r
-                       drawRect(e->rect, (currentConfig.iAreaBinds[i] & currentActCode) ? color_red : color_red_dim);\r
-       \r
-               // draw config controls\r
-               drawRectFilled(TRect(190, 112, 204, 208), color_grey);\r
-               drawArrow90(TPoint(203, 120), -1, color_green);\r
-               drawArrow90(TPoint(203, 200),  1, color_green);\r
-\r
-               drawText90(200, 124, actionNames[whichAction], color_red);\r
-       }\r
-\r
-       // draw active button names if there are any\r
-       i = 0;\r
-       for(TPicoKeyConfigEntry *e = keyConfig; e->name; e++, i++)\r
-               if(currentConfig.iKeyBinds[i] & currentActCode) {\r
-                       if(buttonNames[0]) strcat(buttonNames, ";@");\r
-                       strcat(buttonNames, e->name);\r
-               }\r
-       if(buttonNames[0]) {\r
-               if(flipClosed) {\r
-                       buttonNames[41] = 0; // only 61 chars fit\r
-                       drawText0(2, 138, buttonNames, color_blue);\r
-               } else {\r
-                       buttonNames[61] = 0;\r
-                       drawText90(12, 10, buttonNames, color_blue);\r
-               }\r
-       }\r
-\r
-       vidBlitKeyCfg(1);\r
-}\r
-\r
-void vidDrawFCconfigDone()\r
-{\r
-       drawText0(64, 20, "USE@JOG@TO@SELECT", 0); // blank prev text\r
-       drawText0(54, 30, "OPEN@FLIP@TO@CONTINUE", color_red);\r
-       vidBlitKeyCfg(1);\r
-}\r
-\r
-void vidDrawNotice(const char *txt)\r
-{\r
-       if(framebuff) {\r
-               drawTextNotice(txt);\r
-               vidBlit(1);\r
-       }\r
-}\r
diff --git a/platform/uiq2/vid.h b/platform/uiq2/vid.h
deleted file mode 100644 (file)
index 0b28cb8..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <e32base.h>\r
-\r
-// let's do it in more c-like way\r
-int  vidInit(int displayMode, void *vidmem, int p800, int reinit=0);\r
-void vidFree();\r
-void vidDrawFrame(char *noticeStr, char *fpsStr, int num);\r
-void vidKeyConfigFrame(const TUint whichAction, TInt flipClosed);\r
-void vidDrawFCconfigDone();\r
-void vidDrawNotice(const char *txt); // safe to call anytime, draws text for 1 frame\r
diff --git a/platform/uiq3/App.cpp b/platform/uiq3/App.cpp
deleted file mode 100644 (file)
index d1be510..0000000
+++ /dev/null
@@ -1,491 +0,0 @@
-/*******************************************************************\r
- *\r
- *     File:           App.cpp\r
- *\r
- *     Author:         Peter van Sebille (peter@yipton.net)\r
- *\r
- *  Modified/adapted for picodriveN by notaz, 2006\r
- *\r
- *  (c) Copyright 2006, notaz\r
- *     (c) Copyright 2002, Peter van Sebille\r
- *     All Rights Reserved\r
- *\r
- *******************************************************************/\r
-\r
-#include "App.h"\r
-// #include "picodriven.mbg" // bitmap identifiers\r
-#include "rsc/picodrive.rsg" // resource include\r
-#include <eikenv.h>\r
-#include <qbtselectdlg.h>\r
-//#include <gulutil.h>\r
-//#include <bautils.h>\r
-//#include <eikmenub.h> // CEikMenuBar\r
-#include <apgtask.h> // TApaSystemEvent\r
-#include <eikstart.h>\r
-#include <eikedwin.h>\r
-#include <s32strm.h>\r
-\r
-#include <qikappui.h>\r
-#include <qikeditcategoryobserver.h>\r
-#include <qikselectfiledlg.h>\r
-#include <qikcommand.h>\r
-\r
-#include "Dialogs.h"\r
-#include "engine/debug.h"\r
-#include "../common/emu.h"\r
-#include "emu.h"\r
-\r
-extern "C" char menuErrorMsg[];\r
-\r
-////////////////////////////////////////////////////////////////\r
-//\r
-// class CPicolAppView\r
-//\r
-////////////////////////////////////////////////////////////////\r
-\r
-// Creates and constructs the view.\r
-CPicolAppView* CPicolAppView::NewLC(CQikAppUi& aAppUi, TPicoConfig& aCurrentConfig)\r
-{\r
-       CPicolAppView* self = new (ELeave) CPicolAppView(aAppUi, aCurrentConfig);\r
-       CleanupStack::PushL(self);\r
-       return self;\r
-}\r
-\r
-/**\r
-Constructor for the view.\r
-Passes the application UI reference to the construction of the super class.\r
-\r
-KNullViewId should normally be passed as parent view for the applications \r
-default view. The parent view is the logical view that is normally activated \r
-when a go back command is issued. KNullViewId will activate the system \r
-default view. \r
-\r
-@param aAppUi Reference to the application UI\r
-*/\r
-CPicolAppView::CPicolAppView(CQikAppUi& aAppUi, TPicoConfig& aCurrentConfig) \r
-: CQikViewBase(aAppUi, KNullViewId), iCurrentConfig(aCurrentConfig)\r
-{\r
-}\r
-\r
-void CPicolAppView::ConstructL()\r
-{\r
-       BaseConstructL();\r
-}\r
-\r
-CPicolAppView::~CPicolAppView()\r
-{\r
-}\r
-\r
-\r
-/**\r
-Inherited from CQikViewBase and called upon by the UI Framework. \r
-It creates the view from resource.\r
-*/\r
-void CPicolAppView::ViewConstructL()\r
-{\r
-       // Loads information about the UI configurations this view supports\r
-       // together with definition of each view.       \r
-       ViewConstructFromResourceL(R_APP_UI_CONFIGURATIONS);\r
-       UpdateCommandList();\r
-}\r
-\r
-/**\r
-Returns the view Id\r
-\r
-@return Returns the Uid of the view\r
-*/\r
-TVwsViewId CPicolAppView::ViewId()const\r
-{\r
-       return TVwsViewId(KUidPicolApp, KUidPicolMainView);\r
-}\r
-\r
-/**\r
-Handles all commands in the view.\r
-Called by the UI framework when a command has been issued.\r
-The command Ids are defined in the .hrh file.\r
-\r
-@param aCommand The command to be executed\r
-@see CQikViewBase::HandleCommandL\r
-*/\r
-void CPicolAppView::HandleCommandL(CQikCommand& aCommand)\r
-{\r
-       TInt res;\r
-\r
-       switch(aCommand.Id())\r
-       {\r
-               case EEikCmdPicoLoadState:\r
-                       if(iROMLoaded) {\r
-                               CEikonEnv::Static()->BusyMsgL(_L("Loading State"));\r
-                               res = CPicoGameSession::Do(PicoMsgLoadState);\r
-                               CEikonEnv::Static()->BusyMsgCancel();\r
-                               // emu doesn't start to run if load fails, so we can display this\r
-                               if(res) CEikonEnv::Static()->InfoMsg(_L("Load Failed"));\r
-                       }\r
-                       break;\r
-\r
-               case EEikCmdPicoSaveState:\r
-                       if(iROMLoaded) {\r
-                               CEikonEnv::Static()->BusyMsgL(_L("Saving State"));\r
-                               res = CPicoGameSession::Do(PicoMsgSaveState);\r
-                               CEikonEnv::Static()->BusyMsgCancel();\r
-                               if(res) CEikonEnv::Static()->InfoMsg(_L("Save Failed"));\r
-                       }\r
-                       break;\r
-\r
-               case EEikCmdPicoLoadROM:\r
-                       DisplayOpenROMDialogL();\r
-                       DEBUGPRINT(_L("after DisplayOpenROMDialogL()"));\r
-                       break;\r
-\r
-               case EEikCmdPicoResume:\r
-                       CPicoGameSession::Do(PicoMsgResume);\r
-                       break;\r
-\r
-               case EEikCmdPicoReset:\r
-                       CPicoGameSession::Do(PicoMsgReset);\r
-                       break;\r
-\r
-               case EEikCmdPicoSettings:\r
-                       DisplayConfigDialogL();\r
-                       break;\r
-\r
-               case EEikCmdHelpAbout:\r
-                       DisplayAboutDialogL();\r
-                       break;\r
-\r
-               case EEikCmdPicoDebugInfo:\r
-                       DisplayDebugDialogL();\r
-                       break;\r
-\r
-               case EEikCmdPicoKeys:\r
-                       CPicoGameSession::Do(PicoMsgConfigChange, &iCurrentConfig);\r
-                       CPicoGameSession::Do(PicoMsgKeys);\r
-                       break;\r
-\r
-               case EEikCmdPicoFrameskipAuto:\r
-                       currentConfig.Frameskip = -1;\r
-                       emu_write_config(0);\r
-                       break;\r
-\r
-               case EEikCmdPicoFrameskip0:\r
-                       currentConfig.Frameskip = 0;\r
-                       emu_write_config(0);\r
-                       break;\r
-\r
-               case EEikCmdPicoFrameskip1:\r
-                       currentConfig.Frameskip = 1;\r
-                       emu_write_config(0);\r
-                       break;\r
-\r
-               case EEikCmdPicoFrameskip2:\r
-                       currentConfig.Frameskip = 2;\r
-                       emu_write_config(0);\r
-                       break;\r
-\r
-               case EEikCmdPicoFrameskip4:\r
-                       currentConfig.Frameskip = 4;\r
-                       emu_write_config(0);\r
-                       break;\r
-\r
-               case EEikCmdPicoFrameskip8:\r
-                       currentConfig.Frameskip = 8;\r
-                       emu_write_config(0);\r
-                       break;\r
-\r
-               case EEikCmdExit:\r
-                       emu_Deinit();\r
-                       CPicoGameSession::freeResources();\r
-                       //break; // this is intentional\r
-\r
-               default:\r
-                       // Go back and exit command will be passed to the CQikViewBase to handle.\r
-                       CQikViewBase::HandleCommandL(aCommand);\r
-                       break;\r
-       }\r
-}\r
-\r
-void CPicolAppView::DisplayOpenROMDialogL()\r
-{\r
-       // Array of mimetypes that the dialog shall filter on, if empty all\r
-       // mimetypes will be visible.\r
-       CDesCArray* mimeArray = new (ELeave) CDesCArrayFlat(1);\r
-       CleanupStack::PushL(mimeArray);\r
-       // Array that will be filled with the file paths that are choosen\r
-       // from the dialog. \r
-       CDesCArray* fileArray = new (ELeave) CDesCArraySeg(3);\r
-       CleanupStack::PushL(fileArray);\r
-       _LIT16(KDlgTitle, "Select a ROM file");\r
-\r
-       TPtrC8 text8((TUint8*) rom_fname_loaded);\r
-       iCurrentConfig.iLastROMFile.Copy(text8);\r
-\r
-       if( CQikSelectFileDlg::RunDlgLD( *mimeArray, *fileArray, &KDlgTitle, &iCurrentConfig.iLastROMFile) )\r
-       {\r
-               CEikonEnv::Static()->BusyMsgL(_L("Loading ROM"));\r
-               TPtrC16 file = (*fileArray)[0];\r
-               //iCurrentConfig.iLastROMFile.Copy(file);\r
-\r
-               // push the config first\r
-               CPicoGameSession::Do(PicoMsgSetAppView, this);\r
-               CPicoGameSession::Do(PicoMsgConfigChange, &iCurrentConfig);\r
-\r
-               TInt res = CPicoGameSession::Do(PicoMsgLoadROM, &file);\r
-\r
-               CEikonEnv::Static()->BusyMsgCancel();\r
-\r
-               iROMLoaded = EFalse;\r
-               switch (res)\r
-               {\r
-                       case PicoErrRomOpenFailed: {\r
-                               TBuf<64> mErrorBuff;\r
-                               TPtrC8 buff8((TUint8*) menuErrorMsg);\r
-                               mErrorBuff.Copy(buff8);\r
-                               CEikonEnv::Static()->InfoWinL(_L("Error"), mErrorBuff);\r
-                               break;\r
-                       }\r
-\r
-                       case PicoErrOutOfMem:\r
-                               CEikonEnv::Static()->InfoWinL(_L("Error"), _L("Failed to allocate memory."));\r
-                               break;\r
-\r
-                       case PicoErrEmuThread:\r
-                               CEikonEnv::Static()->InfoWinL(_L("Error"), _L("Failed to create emulation thread. Try to restart this application."));\r
-                               break;\r
-\r
-                       default:\r
-                               iROMLoaded = ETrue;\r
-                               break;\r
-               }\r
-\r
-               // errors which leave ROM loaded\r
-               switch (res)\r
-               {\r
-                       case PicoErrOutOfMemSnd:\r
-                               CEikonEnv::Static()->InfoWinL(_L("Error"), _L("Failed to allocate sound buffer, disabled sound."));\r
-                               break;\r
-\r
-                       case PicoErrGenSnd:\r
-                               CEikonEnv::Static()->InfoWinL(_L("Error"), _L("Failed to start soundsystem, disabled sound."));\r
-                               break;\r
-               }\r
-               if(res == 6 || res == 7) currentConfig.EmuOpt &= ~EOPT_EN_SOUND;\r
-\r
-               if(iROMLoaded) {\r
-                       if(iTitleAdded)\r
-                            ViewContext()->ChangeTextL(EEikCidTitleBarLabel, CPicoGameSession::iRomInternalName);\r
-                       else ViewContext()->AddTextL   (EEikCidTitleBarLabel, CPicoGameSession::iRomInternalName);\r
-                       iTitleAdded = ETrue;\r
-                       UpdateCommandList();\r
-               }\r
-       }\r
-       CleanupStack::PopAndDestroy(2, mimeArray);\r
-}\r
-\r
-\r
-void CPicolAppView::DisplayConfigDialogL()\r
-{\r
-       CPicoConfigDialog* configDialog = new(ELeave)CPicoConfigDialog(currentConfig);\r
-       emu_pack_config();\r
-       configDialog->ExecuteLD(R_PICO_CONFIG);\r
-       emu_unpack_config();\r
-       emu_write_config(0);\r
-\r
-       CPicoGameSession::Do(PicoMsgConfigChange, &currentConfig);\r
-}\r
-\r
-\r
-void CPicolAppView::DisplayAboutDialogL()\r
-{\r
-       TInt iButtonRes;\r
-       CAboutDialog* dialog = new (ELeave) CAboutDialog;\r
-\r
-       dialog->PrepareLC(R_PICO_ABOUT);\r
-       iButtonRes = dialog->RunLD();\r
-\r
-       if(iButtonRes == EEikCmdPicoAboutCreditsCmd) {\r
-               CCreditsDialog *creditsDialog = new (ELeave) CCreditsDialog();\r
-               creditsDialog->PrepareLC(R_PICO_CREDITS);\r
-               creditsDialog->RunLD();\r
-       }\r
-}\r
-\r
-#ifdef __DEBUG_PRINT\r
-extern "C" char *PDebugMain();\r
-#endif\r
-\r
-void CPicolAppView::DisplayDebugDialogL()\r
-{\r
-#ifdef __DEBUG_PRINT\r
-       CDebugDialog* dialog = new (ELeave) CDebugDialog(PDebugMain());\r
-\r
-       dialog->PrepareLC(R_PICO_DEBUG);\r
-       dialog->RunLD();\r
-#endif\r
-}\r
-\r
-void CPicolAppView::UpdateCommandList()\r
-{\r
-       CQikCommandManager& commandManager = CQikCommandManager::Static(*iCoeEnv);\r
-       CQikCommand *cmd_fs[10];\r
-       Mem::FillZ(cmd_fs, sizeof(CQikCommand*)*10);\r
-\r
-       CQikCommand* cmd_reset  = commandManager.Command(*this, EEikCmdPicoReset);\r
-       CQikCommand* cmd_savest = commandManager.Command(*this, EEikCmdPicoSaveState);\r
-       CQikCommand* cmd_loadst = commandManager.Command(*this, EEikCmdPicoLoadState);\r
-       CQikCommand* cmd_resume = commandManager.Command(*this, EEikCmdPicoResume);\r
-       cmd_fs[0]  = commandManager.Command(*this, EEikCmdPicoFrameskipAuto);\r
-       cmd_fs[1]  = commandManager.Command(*this, EEikCmdPicoFrameskip0);\r
-       cmd_fs[2]  = commandManager.Command(*this, EEikCmdPicoFrameskip1);\r
-       cmd_fs[3]  = commandManager.Command(*this, EEikCmdPicoFrameskip2);\r
-       cmd_fs[5]  = commandManager.Command(*this, EEikCmdPicoFrameskip4);\r
-       cmd_fs[9]  = commandManager.Command(*this, EEikCmdPicoFrameskip8);\r
-\r
-       TBool dimmed = !CPicoGameSession::iEmuRunning || !iROMLoaded;\r
-       cmd_reset ->SetDimmed(dimmed);\r
-       cmd_savest->SetDimmed(dimmed);\r
-       cmd_loadst->SetDimmed(dimmed);\r
-       cmd_resume->SetDimmed(dimmed);\r
-\r
-       // frameskip\r
-       TInt fs_index = currentConfig.Frameskip + 1;\r
-       if (fs_index >= 0 && fs_index < 10 && cmd_fs[fs_index])\r
-       {\r
-               cmd_fs[fs_index]->SetChecked(ETrue);\r
-       }\r
-}\r
-\r
-\r
-////////////////////////////////////////////////////////////////\r
-//\r
-// class CPicolAppUi\r
-//\r
-////////////////////////////////////////////////////////////////\r
-\r
-\r
-void CPicolAppUi::ConstructL()\r
-{\r
-       BaseConstructL();\r
-\r
-       // Create the view and add it to the framework\r
-       iAppView = CPicolAppView::NewLC(*this, ((CPicolDocument *)Document())->iCurrentConfig);\r
-       AddViewL(*iAppView);\r
-       CleanupStack::Pop(iAppView);\r
-}\r
-\r
-\r
-////////////////////////////////////////////////////////////////\r
-//\r
-// CPicolDocument\r
-//\r
-////////////////////////////////////////////////////////////////\r
-\r
-\r
-CPicolDocument::CPicolDocument(CQikApplication& aApp)\r
-: CQikDocument(aApp)\r
-{\r
-}\r
-\r
-CQikAppUi* CPicolDocument::CreateAppUiL()\r
-{\r
-       return new(ELeave) CPicolAppUi;\r
-}\r
-\r
-/**\r
-Called by the framework when ::SaveL has been called.\r
-*/\r
-void CPicolDocument::StoreL(CStreamStore& aStore, CStreamDictionary& aStreamDic) const\r
-{\r
-#if 0\r
-       RStoreWriteStream stream;\r
-\r
-       TStreamId preferenceId = stream.CreateLC(aStore);\r
-       aStreamDic.AssignL(KUidPicolStore, preferenceId);\r
-\r
-       // Externalize preference\r
-       stream << iCurrentConfig;\r
-\r
-       // Ensures that any buffered data is written to aStore\r
-       stream.CommitL();\r
-       CleanupStack::PopAndDestroy(); // stream\r
-#endif\r
-/*\r
-       // tmp\r
-       TInt res;\r
-       RFile logFile;\r
-       res = logFile.Replace(CEikonEnv::Static()->FsSession(), _L("C:\\Shared\\pico.cfg"), EFileWrite|EFileShareAny);\r
-       if(!res) {\r
-               logFile.Write(TPtr8((TUint8 *)&iCurrentConfig, sizeof(iCurrentConfig), sizeof(iCurrentConfig)));\r
-               logFile.Close();\r
-       }\r
-*/\r
-}\r
-\r
-/**\r
-Called by the framework on application start.\r
-Loads the application data from disk, i.e. domain data and preferences.\r
-*/\r
-void CPicolDocument::RestoreL(const CStreamStore& aStore, const CStreamDictionary& aStreamDic)\r
-{ \r
-#if 0\r
-       // Find the stream ID of the model data from the stream dictionary:\r
-       TStreamId preferenceId(aStreamDic.At(KUidPicolStore));\r
-       RStoreReadStream stream;\r
-       stream.OpenLC(aStore, preferenceId);\r
-       if(preferenceId != KNullStreamId)\r
-       {\r
-               // Interalize preference and model\r
-               stream >> iCurrentConfig;\r
-       }\r
-\r
-       CleanupStack::PopAndDestroy(); // stream\r
-#endif\r
-\r
-       // tmp\r
-/*     TInt res;\r
-       RFile logFile;\r
-       res = logFile.Open(CEikonEnv::Static()->FsSession(), _L("C:\\Shared\\pico.cfg"), EFileRead|EFileShareAny);\r
-       if(!res) {\r
-               TPtr8 ptr((TUint8 *)&iCurrentConfig, sizeof(iCurrentConfig), sizeof(iCurrentConfig));\r
-               logFile.Read(ptr);\r
-               logFile.Close();\r
-       }*/\r
-}\r
-\r
-////////////////////////////////////////////////////////////////\r
-//\r
-// framework\r
-//\r
-////////////////////////////////////////////////////////////////\r
-\r
-\r
-CApaDocument* CPicolApplication::CreateDocumentL()\r
-{\r
-       return new (ELeave) CPicolDocument(*this);\r
-}\r
-\r
-EXPORT_C CApaApplication* NewApplication()\r
-{\r
-       return new CPicolApplication;\r
-}\r
-\r
-\r
-TUid CPicolApplication::AppDllUid() const\r
-{\r
-       return KUidPicolApp;\r
-}\r
-\r
-\r
-extern "C" TInt my_SetExceptionHandler(TInt, TExceptionHandler, TUint32);\r
-\r
-GLDEF_C TInt E32Main()\r
-{\r
-       // doesn't work :(\r
-       User::SetExceptionHandler(ExceptionHandler, (TUint32) -1);\r
-//     my_SetExceptionHandler(KCurrentThreadHandle, ExceptionHandler, 0xffffffff);\r
-\r
-       emu_Init();\r
-\r
-       return EikStart::RunApplication(NewApplication);\r
-}\r
-\r
-\r
diff --git a/platform/uiq3/App.h b/platform/uiq3/App.h
deleted file mode 100644 (file)
index 2c1543f..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************\r
- *\r
- *     File:           App.h\r
- *\r
- *     Author:         Peter van Sebille (peter@yipton.net)\r
- *\r
- *  Modified/adapted for picodriveN by notaz, 2006\r
- *\r
- *  (c) Copyright 2006, notaz\r
- *     (c) Copyright 2001, Peter van Sebille\r
- *     All Rights Reserved\r
- *\r
- *******************************************************************/\r
-\r
-#ifndef __APP_H\r
-#define __APP_H\r
-\r
-#include <coecntrl.h>\r
-#include <coeccntx.h>\r
-#include <coemain.h>\r
-\r
-#include <qikappui.h>\r
-#include <qikapplication.h>\r
-#include <qikviewbase.h>\r
-//#include <eikapp.h>\r
-#include <qikdocument.h>\r
-\r
-#include "Engine.h"\r
-#include "picodrive.hrh"\r
-\r
-const TUid KUidPicolApp      = { 0xA00010F3 };\r
-const TUid KUidPicolMainView = { 0x00000001 };\r
-//const TUid KUidPicolFOView = { 0x1000C194 };\r
-//const TUid KUidPicolFCView = { 0x1000C195 };\r
-const TUid KUidPicolStore    = { 0x00000011 }; // store stream UID\r
-\r
-//enum\r
-//{\r
-//  EScreenModeFlipOpen = 0,\r
-//  EScreenModeFlipClosed\r
-//};\r
-\r
-\r
-extern "C" struct _currentConfig_t;\r
-\r
-class CPicolAppView : public CQikViewBase\r
-{\r
-public:\r
-       static CPicolAppView* NewLC(CQikAppUi& aAppUi, TPicoConfig &aCurrentConfig);\r
-       ~CPicolAppView();\r
-\r
-       // from CQikViewBase\r
-       TVwsViewId ViewId()const;\r
-       void HandleCommandL(CQikCommand& aCommand);\r
-       void UpdateCommandList();\r
-\r
-protected:\r
-       // from CQikViewBase\r
-       void ViewConstructL();\r
-\r
-private:\r
-       CPicolAppView(CQikAppUi& aAppUi, TPicoConfig &aCurrentConfig);\r
-       void ConstructL();\r
-\r
-protected:             // new stuf\r
-       void DisplayAboutDialogL();\r
-       void DisplayOpenROMDialogL();\r
-       void DisplayConfigDialogL();\r
-       void DisplayDebugDialogL();\r
-\r
-/*     void StopGame();\r
-       void RunGameL();*/\r
-\r
-private:\r
-       TPicoConfig                     &iCurrentConfig;\r
-       TBool                           iROMLoaded;\r
-       TBool                           iTitleAdded;\r
-};\r
-\r
-\r
-\r
-class CPicolAppUi : public CQikAppUi\r
-{\r
-public:\r
-//     CPicolAppUi();\r
-       void ConstructL();\r
-\r
-       CPicolAppView*          iAppView;\r
-};\r
-\r
-\r
-class CPicolDocument : public CQikDocument\r
-{\r
-public:\r
-       CPicolDocument(CQikApplication& aApp);\r
-       void StoreL(CStreamStore& aStore, CStreamDictionary& aStreamDic) const;\r
-       void RestoreL(const CStreamStore& aStore, const CStreamDictionary& aStreamDic);\r
-\r
-       TPicoConfig                     iCurrentConfig;\r
-\r
-private: // from CQikDocument\r
-       CQikAppUi* CreateAppUiL();\r
-};\r
-\r
-\r
-class CPicolApplication : public CQikApplication\r
-{\r
-private: // from CApaApplication\r
-       CApaDocument* CreateDocumentL();\r
-       TUid AppDllUid() const;\r
-};\r
-\r
-#endif\r
diff --git a/platform/uiq3/CSimpleTextParser.cpp b/platform/uiq3/CSimpleTextParser.cpp
deleted file mode 100644 (file)
index 865e35e..0000000
+++ /dev/null
@@ -1,477 +0,0 @@
-/*******************************************************************\r
- *\r
- *     File:           CSimpleTextParser.cpp\r
- *\r
- *     Author:         Peter van Sebille (peter@yipton.net)\r
- *\r
- *     (c) Copyright 2002, Peter van Sebille\r
- *     All Rights Reserved\r
- *\r
- *******************************************************************/\r
-\r
-#include "CSimpleTextParser.h"\r
-\r
-enum\r
-{\r
-       EBadTag,\r
-       EBadZeroLengthTag,\r
-       EBadIntegerParam,\r
-       EBadAlignmentParam,\r
-       EBadRgbColorParam\r
-};\r
-\r
-void Panic(TInt aPanic)\r
-{\r
-       User::Panic(_L("STP"), aPanic);\r
-}\r
-\r
-CSimpleTextFormatParser* CSimpleTextFormatParser::NewLC()\r
-{\r
-       CSimpleTextFormatParser*        self = new(ELeave)CSimpleTextFormatParser;\r
-       CleanupStack::PushL(self);\r
-       self->ConstructL();\r
-       return self;\r
-}\r
-\r
-CSimpleTextFormatParser::~CSimpleTextFormatParser()\r
-{\r
-       delete iParaFormat;\r
-}\r
-\r
-void CSimpleTextFormatParser::ConstructL()\r
-{\r
-       iParaFormat = CParaFormat::NewL();\r
-}\r
-\r
-\r
-void CSimpleTextFormatParser::SetBold(TBool aEnable)\r
-{\r
-       iCharFormat.iFontSpec.iFontStyle.SetStrokeWeight(aEnable ? EStrokeWeightBold : EStrokeWeightNormal);\r
-       iCharMask.ClearAll();\r
-       iCharMask.SetAttrib(EAttFontStrokeWeight);\r
-       iRichText->ApplyCharFormatL(iCharFormat, iCharMask, TextPos(), 0);\r
-}\r
-\r
-void CSimpleTextFormatParser::SetItalic(TBool aEnable)\r
-{\r
-       iCharFormat.iFontSpec.iFontStyle.SetPosture(aEnable ? EPostureItalic : EPostureUpright);\r
-       iCharMask.ClearAll();\r
-       iCharMask.SetAttrib(EAttFontPosture);\r
-       iRichText->ApplyCharFormatL(iCharFormat, iCharMask, TextPos(), 0);\r
-}\r
-\r
-void CSimpleTextFormatParser::SetUnderLine(TBool aEnable)\r
-{\r
-       iCharFormat.iFontPresentation.iUnderline = aEnable ? EUnderlineOn : EUnderlineOff;\r
-       iCharMask.ClearAll();\r
-       iCharMask.SetAttrib(EAttFontUnderline);\r
-       iRichText->ApplyCharFormatL(iCharFormat, iCharMask, TextPos(), 0);\r
-}\r
-\r
-void CSimpleTextFormatParser::SetHiddenText(TBool aEnable)\r
-{\r
-       iCharFormat.iFontPresentation.iHiddenText = aEnable;\r
-       iCharMask.ClearAll();\r
-       iCharMask.SetAttrib(EAttFontHiddenText);\r
-       iRichText->ApplyCharFormatL(iCharFormat, iCharMask, TextPos(), 0);\r
-}\r
-\r
-TRgb CSimpleTextFormatParser::ForegroundColor()\r
-{\r
-       iCharMask.ClearAll();\r
-       iCharMask.SetAttrib(EAttColor);\r
-       iRichText->GetCharFormat(iCharFormat, iCharMask, TextPos(), 0);\r
-       return iCharFormat.iFontPresentation.iTextColor;\r
-}\r
-\r
-void CSimpleTextFormatParser::SetForegroundColor(const TRgb& aColor)\r
-{\r
-       iCharFormat.iFontPresentation.iTextColor = aColor;\r
-       iCharMask.ClearAll();\r
-       iCharMask.SetAttrib(EAttColor);\r
-       iRichText->ApplyCharFormatL(iCharFormat, iCharMask, TextPos(), 0);\r
-}\r
-\r
-void CSimpleTextFormatParser::SetBackgroundColor(const TRgb& aColor)\r
-{\r
-       iParaFormat->iFillColor = aColor;\r
-       iParaMask.ClearAll();\r
-       iParaMask.SetAttrib(EAttFillColor);\r
-       iRichText->ApplyParaFormatL(iParaFormat, iParaMask, ParaPos(), 0);\r
-}\r
-\r
-void CSimpleTextFormatParser::NewParagraph()\r
-{\r
-       iCurrentPara++;\r
-       iRichText->AppendParagraphL();\r
-       AppendTextL(_L(""));\r
-}\r
-\r
-\r
-void CSimpleTextFormatParser::SetAlignment(CParaFormat::TAlignment aAlignment)\r
-{\r
-       iParaFormat->iHorizontalAlignment = aAlignment;\r
-       iParaMask.ClearAll();\r
-       iParaMask.SetAttrib(EAttAlignment);\r
-       iRichText->ApplyParaFormatL(iParaFormat, iParaMask, ParaPos(), 0);\r
-}\r
-\r
-\r
-void CSimpleTextFormatParser::SetFontHeight(TInt aHeight)\r
-{\r
-       iCharFormat.iFontSpec.iHeight = (aHeight * KTwipsPerInch)/KPointsPerInch;\r
-       iCharMask.ClearAll();\r
-       iCharMask.SetAttrib(EAttFontHeight);\r
-       iRichText->ApplyCharFormatL(iCharFormat, iCharMask, TextPos(), 0);\r
-}\r
-\r
-void CSimpleTextFormatParser::SetFontName(const TDesC& aName)\r
-{\r
-       iCharFormat.iFontSpec.iTypeface.iName = aName;\r
-       iCharFormat.iFontSpec.iTypeface.SetAttributes(0);\r
-       iCharFormat.iFontSpec.iTypeface.SetIsProportional(ETrue);\r
-       iCharMask.ClearAll();\r
-       iCharMask.SetAttrib(EAttFontTypeface);\r
-       iRichText->ApplyCharFormatL(iCharFormat, iCharMask, TextPos(), 0);\r
-}\r
-\r
-\r
-/*\r
- * Character formatting:\r
- * <b>                         Bold on\r
- * </b>                                Bold of\r
- * <i>                         Italic on\r
- * </i>                                Italic off\r
- * <u>                         Underline on\r
- * </u>                                Underline off\r
- * <h>                         Hidden text on          **doesn't work**\r
- * </h>                                Hidden text off         **doesn't work**\r
- * <f=name>                    Fontname: name (type: string)\r
- * <s=size>                    Fontsize: size (type: integer)\r
- * <fg=color>          Foreground color: color (type: color)\r
- * </fg>                       Restore foreground color\r
- *\r
- * Paragraph formatting:\r
- * <p>                         New paragraph - will reset both character & paragraph formatting to defaults\r
- * <a=align>           Alignment: aling (type: alignement)\r
- * <bg=color>          Background color: color (type: color) **doesn't work**\r
- *\r
- * Special characters:\r
- * </<>                                The character: <\r
- *\r
- * Types:\r
- * - string:\r
- * - integer:          Either decimal or hexidecimal value\r
- * - color:                    Either integer specifing rgb value, or (r,g,b) in which r, g and b are of type integer\r
- * - align:                    element of enumeration {center, left, right}\r
- *\r
- * Comments:\r
- * The syntax/parser is fairly simplistic. The parser is not trying to match a tag like \r
- * <tag> </tag> as XML/HTML do. Basically, when it encounters a tag (e.g., <b>) it will \r
- * simply instruct the the editor to apply the formatting from the current position as \r
- * specified by the tag (e.g., enable bold). For example, <b><b>Hello</b>World</b> results\r
- * in Hello displayed in a Bold font and World in a normal font.\r
- *\r
- * The only case where state is maintained is when using <fg=color> and </fg>. The current\r
- * fg color is stored when parsing <fg=color> and restored when doing </fg>. Again, <fg> and \r
- * </fg> don't have the XML/HTML <tag> </tag> behavior. For example:\r
- *       <fg=red>Peter<fg=blue>was</fg></fg>here\r
- * results in "Peter" displayed in red, "was" displayed in blue and "here" displayed in red.\r
- * It literally goes like this:\r
- *   1) <fg=red>  --> apply editor text color red, previous color = whatever the editor's text color is now\r
- *   2) <fg=blue> --> apply editor text color blue, previous color = whatever the editor's text color \r
- *                    is now --> red\r
- *   3) </fg>     --> apply editor text to previous color --> red\r
- *   4) </fg>     --> apply editor text to previous color --> red\r
- *\r
- * What you probably wanted was:\r
- *       <fg=red>Peter</fg><fg=blue>was</fg>here\r
- * Now "Peter" is displayed in red, "was" in blue and "here" in the default editor's color\r
- */\r
-\r
-static TUint32 ParseInteger(const TDesC& aString)\r
-{\r
-       TUint32         val = 0;\r
-       TBool           parsed = EFalse;\r
-       if (aString.Length() > 2)\r
-       {\r
-               if ((aString[0] == '0') && ((aString[0] == 'x') || (aString[0] == 'X')))\r
-               {\r
-                       TLex    lex(aString.Right(aString.Length()-2));\r
-                       if (lex.Val(val, EHex) != KErrNone)\r
-                       {\r
-                               __ASSERT_DEBUG(ETrue, Panic(EBadIntegerParam));\r
-                       }\r
-                       parsed = ETrue;\r
-               }\r
-       }\r
-       if (!parsed)\r
-       {\r
-               TLex    lex(aString);\r
-               if (lex.Val(val, EDecimal) != KErrNone)\r
-               {\r
-                       __ASSERT_DEBUG(ETrue, Panic(EBadIntegerParam));\r
-               }\r
-       }\r
-       return val;\r
-}\r
-\r
-static TRgb ParseColor(const TDesC& aString)\r
-{\r
-       if (aString.Length() > 0)\r
-       {\r
-               if (aString[0] == 'R')\r
-               {\r
-                       if (aString.Compare(_L("RgbBlack")) == 0)\r
-                               return KRgbBlack;\r
-                       else if (aString.Compare(_L("RgbDarkGray")) == 0)\r
-                               return KRgbDarkGray;\r
-                       else if (aString.Compare(_L("RgbDarkRed")) == 0)\r
-                               return KRgbDarkRed;\r
-                       else if (aString.Compare(_L("RgbDarkGreen")) == 0)\r
-                               return KRgbDarkGreen;\r
-                       else if (aString.Compare(_L("RgbDarkYellow")) == 0)\r
-                               return KRgbDarkYellow;\r
-                       else if (aString.Compare(_L("RgbDarkBlue")) == 0)\r
-                               return KRgbDarkBlue;\r
-                       else if (aString.Compare(_L("RgbDarkMagenta")) == 0)\r
-                               return KRgbDarkMagenta;\r
-                       else if (aString.Compare(_L("RgbDarkCyan")) == 0)\r
-                               return KRgbDarkCyan;\r
-                       else if (aString.Compare(_L("RgbRed")) == 0)\r
-                               return KRgbRed;\r
-                       else if (aString.Compare(_L("RgbGreen")) == 0)\r
-                               return KRgbGreen;\r
-                       else if (aString.Compare(_L("RgbYellow")) == 0)\r
-                               return KRgbYellow;\r
-                       else if (aString.Compare(_L("RgbBlue")) == 0)\r
-                               return KRgbBlue;\r
-                       else if (aString.Compare(_L("RgbMagenta")) == 0)\r
-                               return KRgbMagenta;\r
-                       else if (aString.Compare(_L("RgbCyan")) == 0)\r
-                               return KRgbCyan;\r
-                       else if (aString.Compare(_L("RgbGray")) == 0)\r
-                               return KRgbGray;\r
-                       else if (aString.Compare(_L("RgbWhite")) == 0)\r
-                               return KRgbWhite;\r
-                       else\r
-                       {\r
-                               __ASSERT_DEBUG(ETrue, Panic(EBadRgbColorParam));\r
-                       }\r
-               }\r
-               return ParseInteger(aString);\r
-       }\r
-       __ASSERT_DEBUG(ETrue, Panic(EBadRgbColorParam));\r
-\r
-       return KRgbBlack;\r
-}\r
-\r
-\r
-\r
-static CParaFormat::TAlignment ParseAlignment(const TDesC& aString)\r
-{\r
-       if (aString.Compare(_L("center")) == 0)\r
-       {\r
-               return CParaFormat::ECenterAlign;\r
-       }\r
-       else if (aString.Compare(_L("left")) == 0)\r
-       {\r
-               return CParaFormat::ELeftAlign;\r
-       }\r
-       else if (aString.Compare(_L("right")) == 0)\r
-       {\r
-               return CParaFormat::ERightAlign;\r
-       }\r
-       __ASSERT_DEBUG(ETrue, Panic(EBadAlignmentParam));\r
-\r
-       return CParaFormat::ECenterAlign;\r
-}\r
-\r
-void CSimpleTextFormatParser::ParseTagL(const TDesC& aTag)\r
-{\r
-       TInt    tagLength = aTag.Length();\r
-       if (tagLength == 0)\r
-       {\r
-               __ASSERT_DEBUG(ETrue, Panic(EBadZeroLengthTag));\r
-               return;\r
-       }\r
-\r
-       TPtrC   param(_L(""));\r
-       TInt pos = aTag.Find(_L("="));\r
-       if (pos>0)\r
-       {\r
-               param.Set(aTag.Right(aTag.Length()-pos-1));\r
-               tagLength = pos;\r
-       }\r
-       TPtrC   tag = aTag.Left(tagLength);\r
-\r
-//     RDebug::Print(_L("tag=%S, param=%S"), &tag, &param);\r
-\r
-       switch (tagLength)\r
-       {\r
-               case 1:\r
-               {\r
-                       if (tag.Compare(_L("a")) == 0)\r
-                               SetAlignment(ParseAlignment(param));\r
-                       else if (tag.Compare(_L("b")) == 0)\r
-                               SetBold();\r
-                       else if (tag.Compare(_L("f")) == 0)\r
-                               SetFontName(param);\r
-                       else if (tag.Compare(_L("h")) == 0)\r
-                               SetHiddenText();\r
-                       else if (tag.Compare(_L("i")) == 0)\r
-                               SetItalic();\r
-                       else if (tag.Compare(_L("p")) == 0)\r
-                               NewParagraph();\r
-                       else if (tag.Compare(_L("s")) == 0)\r
-                               SetFontHeight(ParseInteger(param));\r
-                       else if (tag.Compare(_L("u")) == 0)\r
-                               SetUnderLine();\r
-                       else\r
-                       {\r
-                               __ASSERT_DEBUG(ETrue, Panic(EBadTag));\r
-                       }\r
-                       break;\r
-               }\r
-               \r
-               case 2:\r
-               {\r
-                       if (tag.Compare(_L("/b")) == 0)\r
-                               SetBold(EFalse);\r
-                       if (tag.Compare(_L("bg")) == 0)\r
-                               SetBackgroundColor(ParseColor(param));\r
-                       if (tag.Compare(_L("fg")) == 0)\r
-                       {\r
-                               iPrevFgColor = ForegroundColor();\r
-                               SetForegroundColor(ParseColor(param));\r
-                       }\r
-                       else if (tag.Compare(_L("/h")) == 0)\r
-                               SetHiddenText(EFalse);\r
-                       else if (tag.Compare(_L("/i")) == 0)\r
-                               SetItalic(EFalse);\r
-                       else if (tag.Compare(_L("/u")) == 0)\r
-                               SetUnderLine(EFalse);\r
-                       else if (tag.Compare(_L("/<")) == 0)\r
-                               AppendTextL(_L("<"));\r
-                       break;\r
-               }\r
-               case 3:\r
-               {\r
-                       if (tag.Compare(_L("/fg")) == 0)\r
-                               SetForegroundColor(iPrevFgColor);\r
-                       break;\r
-               }\r
-               default:\r
-                       ;\r
-       }\r
-}\r
-\r
-void CSimpleTextFormatParser::ParseL(const TDesC& aSimpleText, CRichText& aRichText)\r
-{\r
-       iRichText = &aRichText;\r
-       iCurrentPara = 0;\r
-\r
-       TBool   done = EFalse;\r
-       TPtrC simpleText(aSimpleText);\r
-       do\r
-       {\r
-               TInt pos = simpleText.Locate('<');\r
-               if (pos > 0)\r
-               {\r
-                       AppendTextL(simpleText.Left(pos));\r
-                       simpleText.Set(simpleText.Right(simpleText.Length() - pos));\r
-               }\r
-               else if (pos == 0)\r
-               {\r
-                       pos = simpleText.Locate('>');\r
-                       if (pos<=0)\r
-                               User::Leave(KErrArgument);\r
-                       ParseTagL(simpleText.Mid(1, pos-1));\r
-                       simpleText.Set(simpleText.Right(simpleText.Length() - pos - 1));\r
-               }\r
-               else\r
-               {\r
-                       AppendTextL(simpleText);\r
-                       done = ETrue;\r
-               }\r
-       } while (!done);\r
-}\r
-\r
-\r
-TInt CSimpleTextFormatParser::TextPos()\r
-{\r
-       return iRichText->DocumentLength();\r
-#if 0\r
-       TInt pos, length;\r
-       pos = iRichText->CharPosOfParagraph(length, iCurrentPara);\r
-       return pos+length-1;\r
-#endif\r
-}\r
-\r
-TInt CSimpleTextFormatParser::ParaPos()\r
-{\r
-       return TextPos();\r
-#if 0\r
-       TInt pos, length;\r
-       pos = iRichText->CharPosOfParagraph(length, iCurrentPara);\r
-       return pos+length-1;\r
-#endif\r
-}\r
-\r
-\r
-void CSimpleTextFormatParser::AppendTextL(const TDesC& aText)\r
-{\r
-//     RDebug::Print(_L("text=%S"), &aText);\r
-       iRichText->InsertL(TextPos(), aText);\r
-}\r
-\r
-\r
-#if 0\r
-void CTestDialog::ShowTextL(CRichText& aRichText)\r
-{\r
-       aRichText.Reset();\r
-\r
-       TCharFormat                     charFormat;\r
-       TCharFormatMask         charMask;\r
-       aRichText.GetCharFormat(charFormat, charMask, 0, 0);\r
-\r
-       TInt para = 0;\r
-       AppendTextL(_L("http://www.yipton.net"), aRichText);\r
-\r
-       para++;\r
-       aRichText.AppendParagraphL();\r
-\r
-       CParaFormat*    paraFormat = CParaFormat::NewLC();\r
-       TParaFormatMask paraMask;\r
-       aRichText.GetParaFormatL(paraFormat, paraMask, ParaPos(aRichText, para), 0);\r
-       paraFormat->iHorizontalAlignment = CParaFormat::ECenterAlign;\r
-       paraMask.ClearAll();\r
-       paraMask.SetAttrib(EAttAlignment);\r
-       aRichText.ApplyParaFormatL(paraFormat, paraMask, ParaPos(aRichText, para), 0);\r
-\r
-       charFormat.iFontPresentation.iUnderline = EUnderlineOn;\r
-       charFormat.iFontSpec.iFontStyle.SetPosture(EPostureItalic);\r
-       charMask.ClearAll();\r
-       charMask.SetAttrib(EAttFontPosture);\r
-       charMask.SetAttrib(EAttFontUnderline);\r
-       aRichText.ApplyCharFormatL(charFormat, charMask, TextPos(aRichText, para));\r
-       AppendTextL(_L("mailto:Peter is here"), aRichText, para);\r
-\r
-       para++;\r
-       aRichText.AppendParagraphL();\r
-\r
-       TFontSpec       fontSpec(_L("edmunds"), 20 * KPointsPerInch);\r
-//     CFont*  font = NULL;\r
-//     iCoeEnv->ScreenDevice()->GetNearestFontInTwips(font, fontSpec);\r
-\r
-       charFormat.iFontSpec = fontSpec;\r
-       charMask.ClearAll();\r
-       charMask.SetAttrib(EAttFontHeight);\r
-       charMask.SetAttrib(EAttFontTypeface);\r
-       aRichText.ApplyCharFormatL(charFormat, charMask, TextPos(aRichText, para));\r
-       AppendTextL(_L("mailto:Peter is here"), aRichText, para);\r
-\r
-       CleanupStack::PopAndDestroy();\r
-}\r
-\r
-#endif\r
diff --git a/platform/uiq3/CSimpleTextParser.h b/platform/uiq3/CSimpleTextParser.h
deleted file mode 100644 (file)
index f5bdc7c..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************\r
- *\r
- *     File:           CSimpleTextParser.h\r
- *\r
- *     Author:         Peter van Sebille (peter@yipton.net)\r
- *\r
- *     (c) Copyright 2002, Peter van Sebille\r
- *     All Rights Reserved\r
- *\r
- *******************************************************************/\r
-\r
-#ifndef __CSIMPLE_TEXT_PARSER_H\r
-#define __CSIMPLE_TEXT_PARSER_H\r
-\r
-#include <e32def.h>\r
-#include <txtrich.h>                           // CRichText\r
-#include <eikrted.h>                           // CEikRichTextEditor\r
-\r
-class CSimpleTextFormatParser : public CBase\r
-{\r
-public:\r
-       static CSimpleTextFormatParser* NewLC();\r
-       void ParseL(const TDesC& aPSTText, CRichText& aRichText);\r
-\r
-protected:\r
-       CSimpleTextFormatParser(){}\r
-       ~CSimpleTextFormatParser();\r
-       void ConstructL();\r
-\r
-       void ParseTagL(const TDesC& aTag);\r
-\r
-       TRgb ForegroundColor();\r
-       void SetBold(TBool aEnable=ETrue);\r
-       void SetItalic(TBool aEnable=ETrue);\r
-       void SetUnderLine(TBool aEnable=ETrue);\r
-       void SetFontHeight(TInt aHeight);\r
-       void SetFontName(const TDesC& aName);\r
-       void SetHiddenText(TBool aEnable=ETrue);\r
-       void SetForegroundColor(const TRgb& aColor);\r
-\r
-       void NewParagraph();\r
-       void SetAlignment(CParaFormat::TAlignment aAlignment);\r
-       void SetBackgroundColor(const TRgb& aColor);\r
-\r
-       void AppendTextL(const TDesC& aText);\r
-       TInt TextPos();\r
-       TInt ParaPos();\r
-\r
-\r
-       CRichText*                      iRichText;\r
-       TCharFormat                     iCharFormat;\r
-       TCharFormatMask         iCharMask;\r
-       CParaFormat*            iParaFormat;\r
-       TParaFormatMask         iParaMask;\r
-       TInt                            iCurrentPara;\r
-       TRgb                            iPrevFgColor;\r
-};\r
-\r
-#endif                 /* __CSIMPLE_TEXT_PARSER_H */\r
diff --git a/platform/uiq3/Dialogs.cpp b/platform/uiq3/Dialogs.cpp
deleted file mode 100644 (file)
index 923a457..0000000
+++ /dev/null
@@ -1,361 +0,0 @@
-/*******************************************************************\r
- *\r
- *     File:           Dialogs.cpp\r
- *\r
- *     Author:         Peter van Sebille (peter@yipton.net)\r
- *\r
- *  Modified/adapted for picodriveN by notaz, 2006\r
- *\r
- *  (c) Copyright 2006, notaz\r
- *     (c) Copyright 2002, Peter van Sebille\r
- *     All Rights Reserved\r
- *\r
- *******************************************************************/\r
-\r
-#include "Dialogs.h"\r
-#include "Engine.h"\r
-#include "picodrive.hrh"\r
-#include "rsc/picodrive.rsg"\r
-\r
-#include "version.h"\r
-#include "CSimpleTextParser.h"\r
-#include <txtrich.h>                           // CRichText\r
-#include <eikrted.h>                           // CEikRichTextEditor\r
-#include <qikvertoptionbuttonlist.h> // CEikHorOptionButtonList\r
-#include <eikopbut.h>   // CEikOptionButton\r
-#include <eikedwin.h>   // CEikEdwin\r
-#include <quartzkeys.h> // EQuartzKeyTwoWayDown\r
-\r
-#include <qikcommand.h>\r
-#include "../common/emu.h"\r
-\r
-\r
-/************************************************\r
- *\r
- * config Dialog\r
- *\r
- ************************************************/\r
-\r
-CPicoConfigDialog::CPicoConfigDialog(_currentConfig_t &cfg) : config(cfg)\r
-{\r
-}\r
-\r
-void CPicoConfigDialog::PostLayoutDynInitL()\r
-{\r
-       CEikHorOptionButtonList *buttons_rot   = (CEikHorOptionButtonList*) Control( ECtlOptRotation );\r
-       CEikHorOptionButtonList *buttons_disp  = (CEikHorOptionButtonList*) Control( ECtlOptScreenMode );\r
-       CEikCheckBox            *chkbox_altrend= (CEikCheckBox*)            Control( ECtlOptUseAltRend );\r
-//     CEikCheckBox            *chkbox_acctmng= (CEikCheckBox*)            Control( ECtlOptUseAccTiming );\r
-       CEikCheckBox            *chkbox_sram   = (CEikCheckBox*)            Control( ECtlOptUseSRAM );\r
-       CEikCheckBox            *chkbox_fps    = (CEikCheckBox*)            Control( ECtlOptShowFPS );\r
-       CEikCheckBox            *chkbox_sound  = (CEikCheckBox*)            Control( ECtlOptEnableSound );\r
-       CEikCheckBox            *chkbox_z80    = (CEikCheckBox*)            Control( ECtlOptEmulateZ80 );\r
-       CEikCheckBox            *chkbox_ym2612 = (CEikCheckBox*)            Control( ECtlOptEmulateYM2612 );\r
-       CEikCheckBox            *chkbox_sn76496= (CEikCheckBox*)            Control( ECtlOptEmulateSN76496 );\r
-       CEikChoiceListBase      *combo_sndq    = (CEikChoiceListBase*)      Control( ECtlOptSndQuality );\r
-       CEikCheckBox            *chkbox_6bpad  = (CEikCheckBox*)            Control( ECtlOpt6ButtonPad );\r
-       CEikCheckBox            *chkbox_gzipst = (CEikCheckBox*)            Control( ECtlOptGzipStates );\r
-//     CEikCheckBox            *chkbox_accsprt= (CEikCheckBox*)            Control( ECtlOptUseAccSprites );\r
-       CEikChoiceListBase      *combo_region  = (CEikChoiceListBase*)      Control( ECtlOptRegion );\r
-       CEikOptionButton        *opt_fit2      = (CEikOptionButton*)        buttons_disp->ComponentControl( TPicoConfig::PMFit2 );\r
-       CEikCheckBox            *chkbox_cdda   = (CEikCheckBox*)            Control( ECtlOptCDcdda );\r
-       CEikCheckBox            *chkbox_pcm    = (CEikCheckBox*)            Control( ECtlOptCDpcm );\r
-       CEikCheckBox            *chkbox_ramcart= (CEikCheckBox*)            Control( ECtlOptCDramcart );\r
-       CEikCheckBox            *chkbox_sclrot = (CEikCheckBox*)            Control( ECtlOptCDscalerot );\r
-       CEikCheckBox            *chkbox_bsync  = (CEikCheckBox*)            Control( ECtlOptCDbettersync );\r
-\r
-       buttons_rot ->SetButtonById(ECtlOptRotation0 + config.rotation);\r
-       buttons_disp->SetButtonById(ECtlOptScreenModeCenter + config.scaling);\r
-       chkbox_sram   ->SetState(config.EmuOpt & 1     ? CEikButtonBase::ESet : CEikButtonBase::EClear);\r
-       chkbox_fps    ->SetState(config.EmuOpt & 2     ? CEikButtonBase::ESet : CEikButtonBase::EClear);\r
-       chkbox_sound  ->SetState(config.EmuOpt & 4     ? CEikButtonBase::ESet : CEikButtonBase::EClear);\r
-       chkbox_gzipst ->SetState(config.EmuOpt & 8     ? CEikButtonBase::ESet : CEikButtonBase::EClear);\r
-       chkbox_z80    ->SetState(config.s_PicoOpt& 4   ? CEikButtonBase::ESet : CEikButtonBase::EClear);\r
-       chkbox_ym2612 ->SetState(config.s_PicoOpt& 1   ? CEikButtonBase::ESet : CEikButtonBase::EClear);\r
-       chkbox_sn76496->SetState(config.s_PicoOpt& 2   ? CEikButtonBase::ESet : CEikButtonBase::EClear);\r
-       chkbox_altrend->SetState(config.s_PicoOpt& 0x10? CEikButtonBase::ESet : CEikButtonBase::EClear);\r
-       chkbox_6bpad  ->SetState(config.s_PicoOpt& 0x20? CEikButtonBase::ESet : CEikButtonBase::EClear);\r
-//     chkbox_acctmng->SetState(config.s_PicoOpt& 0x40? CEikButtonBase::ESet : CEikButtonBase::EClear);\r
-//     chkbox_accsprt->SetState(config.s_PicoOpt& 0x80? CEikButtonBase::ESet : CEikButtonBase::EClear);\r
-       chkbox_cdda   ->SetState(config.s_PicoOpt&0x0800?CEikButtonBase::ESet : CEikButtonBase::EClear);\r
-       chkbox_pcm    ->SetState(config.s_PicoOpt&0x0400?CEikButtonBase::ESet : CEikButtonBase::EClear);\r
-       chkbox_ramcart->SetState(config.s_PicoOpt&0x8000?CEikButtonBase::ESet : CEikButtonBase::EClear);\r
-       chkbox_sclrot ->SetState(config.s_PicoOpt&0x1000?CEikButtonBase::ESet : CEikButtonBase::EClear);\r
-       chkbox_bsync  ->SetState(config.s_PicoOpt&0x2000?CEikButtonBase::ESet : CEikButtonBase::EClear);\r
-\r
-       // dim "fit2" if we are not in 0 or 180 mode\r
-       if (config.rotation != TPicoConfig::PRot0 && config.rotation != TPicoConfig::PRot180)\r
-               opt_fit2->SetDimmed(ETrue);\r
-       // dim some stuff for alternative renderer\r
-       if (config.s_PicoOpt & 0x10) {\r
-               // dim accurate sprites\r
-               //chkbox_accsprt->SetState(CEikButtonBase::EClear);\r
-               //chkbox_accsprt->SetDimmed(ETrue);\r
-               // dim fit\r
-               if(buttons_rot->LabeledButtonId() == ECtlOptRotation0 || buttons_rot->LabeledButtonId() == ECtlOptRotation180)\r
-                       ((CEikOptionButton*)(buttons_disp->ComponentControl(TPicoConfig::PMFit)))->SetDimmed(ETrue);\r
-       }\r
-\r
-       TInt sel = 0;\r
-       switch (config.s_PsndRate) {\r
-               case 11025: sel = 1; break;\r
-               case 16000: sel = 2; break;\r
-               case 22050: sel = 3; break;\r
-               case 44100: sel = 4; break;\r
-       }\r
-       sel += (config.s_PicoOpt&8) ? 5 : 0;\r
-       if (sel >= 10) sel = 0;\r
-       combo_sndq->SetCurrentItem(sel);\r
-\r
-       switch(config.s_PicoRegion) {\r
-               case 1: sel = 4; break;\r
-               case 2: sel = 3; break;\r
-               case 4: sel = 2; break;\r
-               case 8: sel = 1; break;\r
-               default:sel = 0; // auto\r
-       }\r
-       combo_region->SetCurrentItem(sel);\r
-}\r
-\r
-TBool CPicoConfigDialog::OkToExitL(TInt aButtonId)\r
-{\r
-       if(aButtonId != EEikBidOk) return ETrue;\r
-\r
-       CEikHorOptionButtonList *buttons_rot   = (CEikHorOptionButtonList*) Control( ECtlOptRotation );\r
-       CEikHorOptionButtonList *buttons_disp  = (CEikHorOptionButtonList*) Control( ECtlOptScreenMode );\r
-       CEikCheckBox            *chkbox_altrend= (CEikCheckBox*)            Control( ECtlOptUseAltRend );\r
-//     CEikCheckBox            *chkbox_acctmng= (CEikCheckBox*)            Control( ECtlOptUseAccTiming );\r
-       CEikCheckBox            *chkbox_sram   = (CEikCheckBox*)            Control( ECtlOptUseSRAM );\r
-       CEikCheckBox            *chkbox_fps    = (CEikCheckBox*)            Control( ECtlOptShowFPS );\r
-       CEikCheckBox            *chkbox_sound  = (CEikCheckBox*)            Control( ECtlOptEnableSound );\r
-       CEikCheckBox            *chkbox_z80    = (CEikCheckBox*)            Control( ECtlOptEmulateZ80 );\r
-       CEikCheckBox            *chkbox_ym2612 = (CEikCheckBox*)            Control( ECtlOptEmulateYM2612 );\r
-       CEikCheckBox            *chkbox_sn76496= (CEikCheckBox*)            Control( ECtlOptEmulateSN76496 );\r
-       CEikChoiceListBase      *combo_sndq    = (CEikChoiceListBase*)      Control( ECtlOptSndQuality );\r
-       CEikCheckBox            *chkbox_6bpad  = (CEikCheckBox*)            Control( ECtlOpt6ButtonPad );\r
-       CEikCheckBox            *chkbox_gzipst = (CEikCheckBox*)            Control( ECtlOptGzipStates );\r
-//     CEikCheckBox            *chkbox_accsprt= (CEikCheckBox*)            Control( ECtlOptUseAccSprites );\r
-       CEikChoiceListBase      *combo_region  = (CEikChoiceListBase*)      Control( ECtlOptRegion );\r
-       CEikCheckBox            *chkbox_cdda   = (CEikCheckBox*)            Control( ECtlOptCDcdda );\r
-       CEikCheckBox            *chkbox_pcm    = (CEikCheckBox*)            Control( ECtlOptCDpcm );\r
-       CEikCheckBox            *chkbox_ramcart= (CEikCheckBox*)            Control( ECtlOptCDramcart );\r
-       CEikCheckBox            *chkbox_sclrot = (CEikCheckBox*)            Control( ECtlOptCDscalerot );\r
-       CEikCheckBox            *chkbox_bsync  = (CEikCheckBox*)            Control( ECtlOptCDbettersync );\r
-\r
-       config.rotation = (TPicoConfig::TPicoScreenRotation) (buttons_rot->LabeledButtonId() - ECtlOptRotation0);\r
-       config.scaling  = (TPicoConfig::TPicoScreenMode) (buttons_disp->LabeledButtonId() - ECtlOptScreenModeCenter);\r
-\r
-       if(chkbox_sram   ->State() == CEikButtonBase::ESet) config.EmuOpt |= 1;     else config.EmuOpt   &= ~1;\r
-       if(chkbox_fps    ->State() == CEikButtonBase::ESet) config.EmuOpt |= 2;     else config.EmuOpt   &= ~2;\r
-       if(chkbox_sound  ->State() == CEikButtonBase::ESet) config.EmuOpt |= 4;     else config.EmuOpt   &= ~4;\r
-       if(chkbox_gzipst ->State() == CEikButtonBase::ESet) config.EmuOpt |= 8;     else config.EmuOpt   &= ~8;\r
-       if(chkbox_z80    ->State() == CEikButtonBase::ESet) config.s_PicoOpt|= 4;   else config.s_PicoOpt&= ~4;\r
-       if(chkbox_ym2612 ->State() == CEikButtonBase::ESet) config.s_PicoOpt|= 1;   else config.s_PicoOpt&= ~1;\r
-       if(chkbox_sn76496->State() == CEikButtonBase::ESet) config.s_PicoOpt|= 2;   else config.s_PicoOpt&= ~2;\r
-       if(chkbox_altrend->State() == CEikButtonBase::ESet) config.s_PicoOpt|= 0x10;else config.s_PicoOpt&= ~0x10;\r
-       if(chkbox_6bpad  ->State() == CEikButtonBase::ESet) config.s_PicoOpt|= 0x20;else config.s_PicoOpt&= ~0x20;\r
-//     if(chkbox_acctmng->State() == CEikButtonBase::ESet) config.s_PicoOpt|= 0x40;else config.s_PicoOpt&= ~0x40;\r
-//     if(chkbox_accsprt->State() == CEikButtonBase::ESet) config.s_PicoOpt|= 0x80;else config.s_PicoOpt&= ~0x80;\r
-       if(chkbox_cdda   ->State() == CEikButtonBase::ESet) config.s_PicoOpt |= 0x0800; else config.s_PicoOpt&= ~0x0800;\r
-       if(chkbox_pcm    ->State() == CEikButtonBase::ESet) config.s_PicoOpt |= 0x0400; else config.s_PicoOpt&= ~0x0400;\r
-       if(chkbox_ramcart->State() == CEikButtonBase::ESet) config.s_PicoOpt |= 0x8000; else config.s_PicoOpt&= ~0x8000;\r
-       if(chkbox_sclrot ->State() == CEikButtonBase::ESet) config.s_PicoOpt |= 0x1000; else config.s_PicoOpt&= ~0x1000;\r
-       if(chkbox_bsync  ->State() == CEikButtonBase::ESet) config.s_PicoOpt |= 0x2000; else config.s_PicoOpt&= ~0x2000;\r
-\r
-       TInt sel = combo_sndq->CurrentItem();\r
-       if(sel >= 5) { config.s_PicoOpt |= 8; sel-=5; } else config.s_PicoOpt &= ~8;\r
-       switch (sel) {\r
-               default:config.s_PsndRate =  8000; break;\r
-               case 1: config.s_PsndRate = 11025; break;\r
-               case 2: config.s_PsndRate = 16000; break;\r
-               case 3: config.s_PsndRate = 22050; break;\r
-               case 4: config.s_PsndRate = 44100; break;\r
-       }\r
-\r
-       switch (combo_region->CurrentItem()) {\r
-               case 4: config.s_PicoRegion = 1; break;\r
-               case 3: config.s_PicoRegion = 2; break;\r
-               case 2: config.s_PicoRegion = 4; break;\r
-               case 1: config.s_PicoRegion = 8; break;\r
-               default:config.s_PicoRegion = 0; // auto\r
-       }\r
-\r
-       return ETrue;\r
-}\r
-\r
-// simple GUI stuff needs lots of code\r
-void CPicoConfigDialog::HandleControlStateChangeL(TInt aControlId)\r
-{\r
-       if (aControlId == ECtlOptEnableSound)\r
-       {\r
-               CEikCheckBox *chkbox_sound  = (CEikCheckBox*) Control( ECtlOptEnableSound );\r
-               CEikCheckBox *chkbox_z80    = (CEikCheckBox*) Control( ECtlOptEmulateZ80 );\r
-               CEikCheckBox *chkbox_ym2612 = (CEikCheckBox*) Control( ECtlOptEmulateYM2612 );\r
-               CEikCheckBox *chkbox_sn76496= (CEikCheckBox*) Control( ECtlOptEmulateSN76496 );\r
-\r
-               if(chkbox_sound->State() == CEikButtonBase::ESet) {\r
-                       // check all sound chips too, but only if they all are not set\r
-                       if((chkbox_z80->State() | chkbox_ym2612->State() | chkbox_sn76496->State()) == CEikButtonBase::EClear) { // (==0)\r
-                               chkbox_z80    ->SetState(CEikButtonBase::ESet);\r
-                               chkbox_ym2612 ->SetState(CEikButtonBase::ESet);\r
-                               chkbox_sn76496->SetState(CEikButtonBase::ESet);\r
-                               chkbox_z80    ->DrawDeferred();\r
-                               chkbox_ym2612 ->DrawDeferred();\r
-                               chkbox_sn76496->DrawDeferred();\r
-                       }\r
-               } else {\r
-                       // clear everything, but only if everything is set\r
-                       if((chkbox_z80->State() & chkbox_ym2612->State() & chkbox_sn76496->State()) == CEikButtonBase::ESet) { // (==1)\r
-                               chkbox_z80    ->SetState(CEikButtonBase::EClear);\r
-                               chkbox_ym2612 ->SetState(CEikButtonBase::EClear);\r
-                               chkbox_sn76496->SetState(CEikButtonBase::EClear);\r
-                               chkbox_z80    ->DrawDeferred();\r
-                               chkbox_ym2612 ->DrawDeferred();\r
-                               chkbox_sn76496->DrawDeferred();\r
-                       }\r
-               }\r
-       }\r
-       else if(aControlId == ECtlOptUseAltRend || aControlId == ECtlOptRotation)\r
-       {\r
-               CEikCheckBox            *chkbox_altrend= (CEikCheckBox*)            Control( ECtlOptUseAltRend );\r
-//             CEikCheckBox            *chkbox_accsprt= (CEikCheckBox*)            Control( ECtlOptUseAccSprites );\r
-               CEikHorOptionButtonList *buttons_rot   = (CEikHorOptionButtonList*) Control( ECtlOptRotation );\r
-               CEikHorOptionButtonList *buttons_disp  = (CEikHorOptionButtonList*) Control( ECtlOptScreenMode );\r
-               CEikOptionButton        *opt_fit       = (CEikOptionButton*)        buttons_disp->ComponentControl( TPicoConfig::PMFit );\r
-               CEikOptionButton        *opt_fit2      = (CEikOptionButton*)        buttons_disp->ComponentControl( TPicoConfig::PMFit2 );\r
-\r
-               TBool dimmed = chkbox_altrend->State() == CEikButtonBase::ESet;\r
-               // show/hide more stuff for alternative renderer\r
-//             chkbox_accsprt->SetDimmed(dimmed);\r
-               if(buttons_rot->LabeledButtonId() == ECtlOptRotation0 || buttons_rot->LabeledButtonId() == ECtlOptRotation180) {\r
-                       opt_fit->SetDimmed(dimmed);\r
-                       if(dimmed && buttons_disp->LabeledButtonId() == ECtlOptScreenModeFit)\r
-                               buttons_disp->SetButtonById(ECtlOptScreenModeFit2);\r
-               }\r
-               else opt_fit->SetDimmed(EFalse);\r
-//             chkbox_accsprt->DrawDeferred();\r
-               buttons_disp->DrawDeferred();\r
-\r
-               if(buttons_rot->LabeledButtonId() == ECtlOptRotation0 || buttons_rot->LabeledButtonId() == ECtlOptRotation180) {\r
-                       opt_fit2->SetDimmed(EFalse);\r
-               } else {\r
-                       if(opt_fit2->State() == CEikButtonBase::ESet) {\r
-                               buttons_disp->SetButtonById(ECtlOptScreenModeFit);\r
-                               buttons_disp->DrawDeferred();\r
-                       }\r
-                       opt_fit2->SetDimmed(ETrue);\r
-               }\r
-               opt_fit2->DrawDeferred();\r
-       }\r
-}\r
-\r
-\r
-/************************************************\r
- *\r
- * About Dialog\r
- *\r
- ************************************************/\r
-\r
-void CAboutDialog::PostLayoutDynInitL()\r
-{\r
-       TBuf<16>        versionText;\r
-       TBuf<512>       text;\r
-\r
-       #if (KPicoBuildNumber != 0)\r
-               versionText.Format(_L("%d.%d%d"), KPicoMajorVersionNumber, KPicoMinorVersionNumber, KPicoBuildNumber);\r
-       #else\r
-               versionText.Format(_L("%d.%d"), KPicoMajorVersionNumber, KPicoMinorVersionNumber);\r
-       #endif\r
-\r
-       CEikRichTextEditor* richTextEd = LocateControlByUniqueHandle<CEikRichTextEditor>(ECtlPicoAboutText);\r
-       User::LeaveIfNull(richTextEd);\r
-\r
-       HBufC *aboutFormat = CEikonEnv::Static()->AllocReadResourceLC(R_PICO_TEXT_ABOUT);\r
-       CSimpleTextFormatParser *parser = CSimpleTextFormatParser::NewLC();\r
-\r
-       text.Format(*aboutFormat, &versionText);\r
-       parser->ParseL(text, *richTextEd->RichText());\r
-\r
-       richTextEd->UpdateAllFieldsL(); // Updates all the fields in the document\r
-\r
-       CleanupStack::PopAndDestroy(parser);\r
-       CleanupStack::PopAndDestroy(aboutFormat);\r
-}\r
-\r
-/*************************************************************\r
-*\r
-* Credits dialog\r
-*\r
-**************************************************************/\r
-\r
-void CCreditsDialog::PreLayoutDynInitL()\r
-{\r
-       CEikEdwin *edwin = LocateControlByUniqueHandle<CEikEdwin>(ECtlPicoCreditsText);\r
-       User::LeaveIfNull(edwin);\r
-\r
-       CDesCArrayFlat* desArray = CEikonEnv::Static()->ReadDesCArrayResourceL(R_PICO_TBUF_CREDITS);\r
-       CleanupStack::PushL(desArray);\r
-\r
-       edwin->SetTextLimit(2048); // to prevent stupid "too big" warning\r
-       TInt count = desArray->Count();\r
-       for (TInt i = 0; i < count; i++)\r
-       {\r
-               edwin->Text()->InsertL(edwin->TextLength(), desArray->operator[](i));\r
-               edwin->Text()->InsertL(edwin->TextLength(), CEditableText::ELineBreak);\r
-       }\r
-       CleanupStack::PopAndDestroy(desArray);\r
-}\r
-\r
-TKeyResponse CCreditsDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)\r
-{\r
-       if (aType == EEventKey)\r
-       {\r
-               CEikEdwin *edwin = LocateControlByUniqueHandle<CEikEdwin>(ECtlPicoCreditsText);\r
-               User::LeaveIfNull(edwin);\r
-\r
-               if (aKeyEvent.iCode == EQuartzKeyTwoWayDown)\r
-               {\r
-                       edwin->MoveDisplayL(TCursorPosition::EFLineDown);\r
-                       edwin->UpdateScrollBarsL();\r
-                       return EKeyWasConsumed;\r
-               }\r
-               else if (aKeyEvent.iCode == EQuartzKeyTwoWayUp)\r
-               {\r
-                       edwin->MoveDisplayL(TCursorPosition::EFLineUp);\r
-                       edwin->UpdateScrollBarsL();\r
-                       return EKeyWasConsumed;\r
-               }\r
-       }\r
-       return CQikSimpleDialog::OfferKeyEventL(aKeyEvent, aType);\r
-}\r
-\r
-/*************************************************************\r
-*\r
-* Debug dialog\r
-*\r
-**************************************************************/\r
-\r
-CDebugDialog::CDebugDialog(char *t)\r
-{\r
-       Mem::Copy(iText, t, 1024);\r
-       iText[1023] = 0;\r
-}\r
-\r
-void CDebugDialog::PreLayoutDynInitL()\r
-{\r
-       char *p = iText, *line = iText;\r
-       TBool end=0;\r
-       TBuf<128> tbuf;\r
-       CEikEdwin *editor = LocateControlByUniqueHandle<CEikEdwin>(ECtlPicoCreditsText);\r
-\r
-       while(!end) {\r
-               while(*p && *p != '\r' && *p != '\n') p++;\r
-               if(!*p) end=1;\r
-               *p = 0;\r
-               TPtrC8 ptr((TUint8*) line);\r
-               tbuf.Copy(ptr);\r
-               editor->Text()->InsertL(editor->TextLength(), tbuf);\r
-               editor->Text()->InsertL(editor->TextLength(), CEditableText::ELineBreak);\r
-               line = ++p;\r
-       }\r
-}\r
diff --git a/platform/uiq3/Dialogs.h b/platform/uiq3/Dialogs.h
deleted file mode 100644 (file)
index cd865ec..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************\r
- *\r
- *     File:           Dialogs.h\r
- *\r
- *     Author:         Peter van Sebille (peter@yipton.net)\r
- *\r
- *  Modified/adapted for picodriveN by notaz, 2006\r
- *\r
- *  (c) Copyright 2006, notaz\r
- *     (c) Copyright 2002, Peter van Sebille\r
- *     All Rights Reserved\r
- *\r
- *******************************************************************/\r
-\r
-#ifndef __DIALOGS_H\r
-#define __DIALOGS_H\r
-\r
-#include <eikenv.h>\r
-#include <eikdialg.h>\r
-#include <eiktxlbx.h>\r
-#include <eiktxlbm.h>\r
-#include <eikdlgtb.h>\r
-#include <eiklabel.h>\r
-#include <eikchlst.h>\r
-#include <eikchkbx.h>\r
-#include <eikedwob.h>\r
-\r
-#include <qiksimpledialog.h>\r
-\r
-\r
-/************************************************\r
- *\r
- * config Dialog\r
- *\r
- ************************************************/\r
-\r
-extern "C" struct _currentConfig_t;\r
-\r
-class CPicoConfigDialog : public CEikDialog\r
-{\r
-public:\r
-       CPicoConfigDialog(_currentConfig_t &cfg);\r
-\r
-protected: // framework\r
-    void PostLayoutDynInitL();\r
-       void HandleControlStateChangeL(TInt aControlId);\r
-       TBool OkToExitL(TInt aButtonId);\r
-\r
-       _currentConfig_t &config;\r
-};\r
-\r
-\r
-/************************************************\r
- *\r
- * About Dialog\r
- *\r
- ************************************************/\r
-\r
-class CAboutDialog : public CQikSimpleDialog\r
-{\r
-protected:     // from CQikSimpleDialog\r
-       void PostLayoutDynInitL();\r
-};\r
-\r
-/*************************************************************\r
-*\r
-* Credits dialog\r
-*\r
-**************************************************************/\r
-\r
-class CCreditsDialog : public CQikSimpleDialog\r
-{\r
-protected:     // from CQikSimpleDialog\r
-       void PreLayoutDynInitL();\r
-       TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);\r
-};\r
-\r
-/*************************************************************\r
-*\r
-* Debug dialog\r
-*\r
-**************************************************************/\r
-\r
-class CDebugDialog : public CCreditsDialog\r
-{\r
-public:\r
-       CDebugDialog(char *t);\r
-\r
-protected:\r
-       char iText[1024];\r
-       void PreLayoutDynInitL();\r
-};\r
-\r
-#endif // __DIALOGS_H\r
diff --git a/platform/uiq3/Engine.cpp b/platform/uiq3/Engine.cpp
deleted file mode 100644 (file)
index adb32b4..0000000
+++ /dev/null
@@ -1,352 +0,0 @@
-/*******************************************************************\r
- *\r
- *     File:           Engine.cpp\r
- *\r
- *     Author:         Peter van Sebille (peter@yipton.net)\r
- *\r
- *  Modified/adapted for picodriveN by notaz, 2006\r
- *\r
- *  (c) Copyright 2006, notaz\r
- *     (c) Copyright 2002, Peter van Sebille\r
- *     All Rights Reserved\r
- *\r
- *******************************************************************/\r
-\r
-\r
-#include "Engine.h"\r
-#include <w32std.h>\r
-#include <eikenv.h>\r
-#include <e32svr.h>\r
-#include <e32math.h>\r
-#include <e32uid.h>\r
-\r
-#include <string.h>\r
-\r
-#include "version.h"\r
-#include <pico/pico_int.h>\r
-#include "../common/emu.h"\r
-#include "engine/debug.h"\r
-#include "App.h"\r
-\r
-// this is where we start to break a bunch of symbian rules\r
-extern TInt machineUid;\r
-extern int gamestate, gamestate_next;\r
-extern char *loadrom_fname;\r
-extern int   loadrom_result;\r
-extern const char *actionNames[];\r
-RSemaphore initSemaphore;\r
-RSemaphore pauseSemaphore;\r
-RSemaphore loadWaitSemaphore;\r
-static CPicolAppView *appView = 0;\r
-\r
-\r
-TInt CPicoGameSession::Do(const TPicoServRqst what, TAny *param)\r
-{\r
-       switch (what)\r
-       {\r
-               case PicoMsgLoadState: \r
-                       if(!rom_loaded) return -1; // no ROM\r
-                       return emu_save_load_game(1, 0);\r
-\r
-               case PicoMsgSaveState:\r
-                       if(!rom_loaded) return -1;\r
-                       return emu_save_load_game(0, 0);\r
-\r
-               case PicoMsgLoadROM:\r
-                       return loadROM((TPtrC16 *)param);\r
-               \r
-               case PicoMsgResume:\r
-                       DEBUGPRINT(_L("resume"));\r
-                       if(rom_loaded) {\r
-                               return ChangeRunState(PGS_Running);\r
-                       }\r
-                       return 1;\r
-\r
-               case PicoMsgReset: \r
-                       if(rom_loaded) {\r
-                               return ChangeRunState(PGS_Reset);\r
-                       }\r
-                       return 1;\r
-\r
-               case PicoMsgKeys:\r
-                       return ChangeRunState(PGS_KeyConfig);\r
-\r
-               case PicoMsgPause:\r
-                       return ChangeRunState(PGS_Paused);\r
-\r
-               case PicoMsgQuit:\r
-                       DEBUGPRINT(_L("got quit msg."));\r
-                       return ChangeRunState(PGS_Quit);\r
-\r
-               // config change\r
-               case PicoMsgConfigChange:\r
-                       return changeConfig((TPicoConfig *)param);\r
-\r
-               case PicoMsgSetAppView:\r
-                       appView = (CPicolAppView *)param;\r
-                       return 1;\r
-\r
-               default:\r
-                       return 1;\r
-       }\r
-}\r
-\r
-TInt EmuThreadFunction(TAny* anArg);\r
-\r
-TInt CPicoGameSession::StartEmuThread()\r
-{\r
-       TInt res=KErrNone;\r
-       iEmuRunning = EFalse;\r
-\r
-       if (initSemaphore.Handle() > 0)\r
-               initSemaphore.Close();\r
-       initSemaphore.CreateLocal(0);\r
-       if (pauseSemaphore.Handle() <= 0)\r
-               pauseSemaphore.CreateLocal(0);\r
-       if (loadWaitSemaphore.Handle() <= 0)\r
-               loadWaitSemaphore.CreateLocal(0);\r
-\r
-       RThread thread;\r
-       if(iThreadWatcher && (res = thread.Open(iThreadWatcher->iTid)) == KErrNone) {\r
-               // should be a dead thread in some strange state.\r
-               DEBUGPRINT(_L("found thread with the same id (id=%i, RequestCount=%i), killing.."),\r
-                               (TInt32)thread.Id(), thread.RequestCount());\r
-               // what can we do in this situation? Nothing seems to help, it just stays in this state.\r
-               delete iThreadWatcher;\r
-               iThreadWatcher = 0;\r
-               thread.Kill(1);\r
-               thread.Terminate(1);\r
-               thread.Close();\r
-       }\r
-\r
-       res=thread.Create(_L("PicoEmuThread"),   // create new server thread\r
-               EmuThreadFunction, // thread's main function\r
-               KDefaultStackSize,\r
-               KMinHeapSize,\r
-               KPicoMaxHeapSize,\r
-               0 // &semaphore // passed as TAny* argument to thread function\r
-               );\r
-\r
-       if(res == KErrNone) { // thread created ok - now start it going\r
-               thread.SetPriority(EPriorityMore);\r
-               iEmuRunning = ETrue;\r
-               if (iThreadWatcher) delete iThreadWatcher;\r
-               iThreadWatcher = CThreadWatcher::NewL(thread.Id());\r
-               thread.Resume(); // start it going\r
-               DEBUGPRINT(_L("initSemaphore.Wait()"));\r
-               res = initSemaphore.Wait(3*1000*1000); // wait until it's initialized\r
-               DEBUGPRINT(_L("initSemaphore resume, ExitReason() == %i"), thread.ExitReason());\r
-               res |= thread.ExitReason();\r
-               thread.Close(); // we're no longer interested in the other thread\r
-               if(res != KErrNone) iEmuRunning = EFalse;\r
-               return res;\r
-       }\r
-\r
-       return res;\r
-}\r
-\r
-TInt CPicoGameSession::ChangeRunState(TPicoGameState newstate, TPicoGameState newstate_next)\r
-{\r
-       if (!iEmuRunning) {\r
-               gamestate = PGS_Paused;\r
-               TInt res = StartEmuThread();\r
-               if(res != KErrNone) DEBUGPRINT(_L("StartEmuThread() returned %i"), res);\r
-               if (!iEmuRunning) return PicoErrEmuThread;\r
-       }\r
-\r
-       int oldstate = gamestate;\r
-       gamestate = newstate;\r
-       gamestate_next = newstate_next ? newstate_next : PGS_Paused;\r
-       if (oldstate == PGS_Paused) pauseSemaphore.Signal();\r
-       return 0;\r
-}\r
-\r
-\r
-TInt CPicoGameSession::loadROM(TPtrC16 *pptr)\r
-{\r
-       TInt ret;\r
-       char buff[150];\r
-\r
-       // make sure emu thread is ok\r
-       ret = ChangeRunState(PGS_Paused);\r
-       if(ret) return ret;\r
-\r
-       // read the contents of the client pointer into a TPtr.\r
-       static TBuf8<KMaxFileName> writeBuf;\r
-       writeBuf.Copy(*pptr);\r
-\r
-       // push the emu thead to a load state. This is done so that it owns all file handles.\r
-       // If successful, in will enter PGS_Running state by itself.\r
-       loadrom_fname = (char *)writeBuf.PtrZ();\r
-       loadrom_result = 0;\r
-       loadWaitSemaphore.Wait(1); // make sure sem is not set\r
-       ret = ChangeRunState(PGS_ReloadRom);\r
-       if(ret) return ret;\r
-\r
-       loadWaitSemaphore.Wait(60*1000*1000);\r
-\r
-       if (loadrom_result == 0)\r
-               return PicoErrRomOpenFailed;\r
-\r
-       emu_get_game_name(buff);\r
-       TPtrC8 buff8((TUint8*) buff);\r
-       iRomInternalName.Copy(buff8);\r
-\r
-       DEBUGPRINT(_L("done waiting for ROM load"));\r
-\r
-       // debug\r
-       #ifdef __DEBUG_PRINT\r
-       TInt mem, cells = User::CountAllocCells();\r
-       User::AllocSize(mem);\r
-       DEBUGPRINT(_L("comm:   cels=%d, size=%d KB"), cells, mem/1024);\r
-       #endif\r
-\r
-       return 0;\r
-}\r
-\r
-\r
-TInt CPicoGameSession::changeConfig(TPicoConfig *aConfig)\r
-{\r
-       // 6 button pad, enable XYZM config if needed\r
-       if (PicoOpt & POPT_6BTN_PAD)\r
-       {\r
-               actionNames[8]  = "Z";\r
-               actionNames[9]  = "Y";\r
-               actionNames[10] = "X";\r
-               actionNames[11] = "MODE";\r
-       } else {\r
-               actionNames[8] = actionNames[9] = actionNames[10] = actionNames[11] = 0;\r
-       }\r
-\r
-       // if we are in center 90||270 modes, we can bind renderer switcher\r
-       if (currentConfig.scaling == TPicoConfig::PMFit &&\r
-               (currentConfig.rotation == TPicoConfig::PRot0 || currentConfig.rotation == TPicoConfig::PRot180))\r
-                        actionNames[25] = 0;\r
-       else actionNames[25] = "RENDERER";\r
-\r
-       return 0;\r
-}\r
-\r
-\r
-#ifdef __DEBUG_PRINT_FILE\r
-extern RMutex logMutex;\r
-#endif\r
-\r
-void CPicoGameSession::freeResources()\r
-{\r
-       RThread thread;\r
-       TInt i;\r
-\r
-       DEBUGPRINT(_L("CPicoGameSession::freeResources()"));\r
-\r
-       if(iThreadWatcher && thread.Open(iThreadWatcher->iTid) == KErrNone)\r
-       {\r
-               // try to stop our emu thread\r
-               gamestate = PGS_Quit;\r
-               if(pauseSemaphore.Handle() > 0)\r
-                       pauseSemaphore.Signal();\r
-\r
-               if(thread.Handle() > 0)\r
-               {\r
-                       // tried reopening thread handle here over time intervals to detect if thread is alive,\r
-                       // but would run into handle panics.\r
-\r
-                       for(i = 0; i < 8; i++) {\r
-                               User::After(100 * 1000);\r
-                               if(thread.ExitReason() != 0) break;\r
-                       }\r
-\r
-                       if(thread.ExitReason() == 0) {\r
-                               // too late, time to die\r
-                               DEBUGPRINT(_L("thread %i not responding, killing.."), (TInt32) thread.Id());\r
-                               thread.Terminate(1);\r
-                       }\r
-                       thread.Close();\r
-               }\r
-\r
-       }\r
-\r
-       if (iThreadWatcher != NULL)\r
-       {\r
-               DEBUGPRINT(_L("delete iThreadWatcher"));\r
-               delete iThreadWatcher;\r
-               DEBUGPRINT(_L("after delete iThreadWatcher"));\r
-               iThreadWatcher = NULL;\r
-       }\r
-\r
-       if (initSemaphore.Handle() > 0)\r
-               initSemaphore.Close();\r
-       if (pauseSemaphore.Handle() > 0)\r
-               pauseSemaphore.Close();\r
-       if (loadWaitSemaphore.Handle() > 0)\r
-               loadWaitSemaphore.Close();\r
-       DEBUGPRINT(_L("freeResources() returning"));\r
-#ifdef __DEBUG_PRINT_FILE\r
-       if (logMutex.Handle() > 0)\r
-               logMutex.Close();\r
-#endif\r
-}\r
-\r
-TBool CPicoGameSession::iEmuRunning = EFalse;\r
-CThreadWatcher *CPicoGameSession::iThreadWatcher = 0;\r
-TBuf<150> CPicoGameSession::iRomInternalName;\r
-\r
-\r
-// CThreadWatcher\r
-CThreadWatcher::~CThreadWatcher()\r
-{\r
-       Cancel();\r
-       DEBUGPRINT(_L("after CThreadWatcher::Cancel();"));\r
-}\r
-\r
-CThreadWatcher::CThreadWatcher(const TThreadId& aTid)\r
-: CActive(CActive::EPriorityStandard), iTid(aTid)\r
-{\r
-}\r
-\r
-\r
-CThreadWatcher* CThreadWatcher::NewL(const TThreadId& aTid)\r
-{\r
-       CThreadWatcher* self = new(ELeave) CThreadWatcher(aTid);\r
-       CleanupStack::PushL(self);\r
-       self->ConstructL();\r
-       CleanupStack::Pop();                    // self\r
-       return self;\r
-}\r
-\r
-void CThreadWatcher::ConstructL()\r
-{\r
-       CActiveScheduler::Add(this);\r
-       RThread thread;\r
-       if(thread.Open(iTid) == KErrNone) {\r
-               thread.Logon(iStatus);\r
-               thread.Close();\r
-               SetActive();\r
-       }\r
-}\r
-\r
-void CThreadWatcher::RunL()\r
-{\r
-       DEBUGPRINT(_L("CThreadWatcher::RunL()"));\r
-       CPicoGameSession::iEmuRunning = EFalse;\r
-       if(appView) appView->UpdateCommandList();\r
-       //initSemaphore.Signal(); // no point to do that here, AS can't get here if it is waiting\r
-}\r
-\r
-void CThreadWatcher::DoCancel()\r
-{\r
-       RThread thread;\r
-       DEBUGPRINT(_L("CThreadWatcher::DoCancel()"));\r
-       if(thread.Open(iTid) == KErrNone) {\r
-               DEBUGPRINT(_L("thread.LogonCancel(iStatus);"));\r
-               thread.LogonCancel(iStatus);\r
-               thread.Close();\r
-       }\r
-}\r
-\r
-extern "C" void cache_flush_d_inval_i(const void *start_addr, const void *end_addr)\r
-{\r
-       // TODO\r
-       User::IMB_Range((TAny *)start_addr, (TAny *)end_addr);\r
-}\r
-\r
diff --git a/platform/uiq3/Engine.h b/platform/uiq3/Engine.h
deleted file mode 100644 (file)
index e0a3afe..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-/*******************************************************************\r
- *\r
- *     File:           Engine.h\r
- *\r
- *     Author:         Peter van Sebille (peter@yipton.net)\r
- *\r
- *  Modified/adapted for picodriveN by notaz, 2006\r
- *\r
- *  (c) Copyright 2006, notaz\r
- *     (c) Copyright 2002, Peter van Sebille\r
- *     All Rights Reserved\r
- *\r
- *******************************************************************/\r
-\r
-#ifndef __ENGINE_H\r
-#define __ENGINE_H\r
-\r
-#include <e32base.h>\r
-\r
-class RReadStream;\r
-class RWriteStream;\r
-\r
-\r
-// engine states\r
-enum TPicoGameState {\r
-       PGS_Running = 1,\r
-       PGS_Paused,\r
-       PGS_Quit,\r
-       PGS_KeyConfig,\r
-       PGS_ReloadRom,\r
-       PGS_Reset,\r
-};\r
-\r
-enum TPicoServRqst {\r
-       PicoMsgLoadState,\r
-       PicoMsgSaveState,\r
-       PicoMsgLoadROM,\r
-       PicoMsgResume,\r
-       PicoMsgReset,\r
-       PicoMsgKeys,\r
-       PicoMsgPause,\r
-       PicoMsgQuit,\r
-       PicoMsgConfigChange,\r
-       PicoMsgSetAppView,\r
-       kDefaultMessageSlots // this is how many messages we need :)\r
-};\r
-\r
-enum TPicoGenErrors { // generic errors\r
-       PicoErrNoErr = 0, // OK\r
-       PicoErrRomOpenFailed,\r
-       PicoErrOutOfMem,\r
-       PicoErrOutOfMemSnd,\r
-       PicoErrGenSnd, // generic sound system error\r
-       PicoErrEmuThread\r
-};\r
-\r
-\r
-// needed for creating server thread.\r
-const TUint KPicoMaxHeapSize=0x00800000;\r
-\r
-// key config entry (touchpad areas)\r
-struct TPicoAreaConfigEntry {\r
-       TRect rect;\r
-       //unsigned long actions;\r
-};\r
-\r
-struct TPicoKeyConfigEntry\r
-{\r
-       unsigned short keyCode;\r
-       unsigned char scanCode;\r
-       unsigned char flags; // lsb->msb: key_down, pulse_only, ?, ?,  ?, ?, not_configurable, disabled\r
-       TInt32 handle1; // for CancelCaptureKeyUpAndDowns()\r
-       TInt32 handle2; // for CancelCaptureKey()\r
-       char *name;\r
-};\r
-\r
-\r
-// configuration data\r
-class TPicoConfig\r
-{\r
-public:\r
-//     void SetDefaults();\r
-//     void InternalizeL(RReadStream &aStream);\r
-//     void ExternalizeL(RWriteStream &aStream) const;\r
-\r
-       enum TPicoScreenRotation {\r
-               PRot0,\r
-               PRot90,\r
-               PRot180,\r
-               PRot270\r
-       };\r
-       enum TPicoScreenMode {\r
-               PMCenter,\r
-               PMFit,\r
-               PMFit2\r
-       };\r
-       enum TPicoFrameSkip {\r
-               PFSkipAuto = -1,\r
-               PFSkip0\r
-       };\r
-\r
-public:\r
-       TFileName                       iLastROMFile;   // used as tmp only\r
-};\r
-\r
-\r
-class CThreadWatcher : public CActive\r
-{\r
-public:\r
-       static CThreadWatcher* NewL(const TThreadId& aTid);\r
-       ~CThreadWatcher();\r
-\r
-       TThreadId                       iTid; // thread id\r
-\r
-protected:\r
-       CThreadWatcher(const TThreadId& aTid);\r
-       void ConstructL();\r
-\r
-       virtual void RunL();\r
-       virtual void DoCancel();\r
-};\r
-\r
-\r
-class CPicoGameSession\r
-{\r
-public:\r
-       static TInt Do(const TPicoServRqst what, TAny *param=0);\r
-       static void freeResources();\r
-\r
-       static TBool iEmuRunning;\r
-       static TBuf<150> iRomInternalName;\r
-\r
-private:\r
-       // services available\r
-       static TInt StartEmuThread();\r
-       static TInt ChangeRunState(TPicoGameState newstate, TPicoGameState newstate_next=(TPicoGameState)0);\r
-       static TInt loadROM(TPtrC16 *pptr);\r
-       static TInt changeConfig(TPicoConfig *aConfig);\r
-\r
-       static CThreadWatcher *iThreadWatcher;\r
-};\r
-\r
-#endif\r
diff --git a/platform/uiq3/Makefile b/platform/uiq3/Makefile
deleted file mode 100644 (file)
index 0f89a49..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-# makefile for uiq3_patcher_0_2.tar.gz setup, modified\r
-export CROSS = arm-none-symbianelf-\r
-APPNAME = PicoDrive\r
-VER_MAJ = 1\r
-VER_MIN = 51\r
-VENDOR = notaz\r
-UID3 = A00010F3\r
-EPOCROOT = /opt/uiq3/\r
-EPOCLIBS = qikdlg.lib etext.lib bafl.lib efsrv.lib eikctl.lib ws32.lib \\r
-       eikdlg.lib gdi.lib estor.lib hal.lib mediaclient.lib mediaclientaudiostream.lib\r
-STACK = 0x3000\r
-HEAP = 0x10,0x1000000\r
-\r
-\r
-# settings\r
-asm_memory = 1\r
-asm_render = 1\r
-asm_ym2612 = 1\r
-asm_misc = 1\r
-asm_cdpico = 1\r
-asm_cdmemory = 1\r
-asm_blit = 1\r
-use_cyclone = 1\r
-#use_musashi = 1\r
-\r
-\r
-# objects\r
-\r
-# launcher\r
-OBJS += App.o Engine.o Dialogs.o CSimpleTextParser.o emu.o\r
-# engine\r
-OBJS += engine/main.o engine/vid.o engine/polledas.o engine/audio_mediaserver.o engine/debug.o\r
-ifeq "$(asm_blit)" "1"\r
-OBJS += engine/blit_asm.o\r
-else\r
-OBJS += engine/blit.o\r
-endif\r
-# common\r
-OBJS += ../common/emu.o ../common/config.o ../common/menu.o ../common/mp3_helix.o\r
-# Pico\r
-OBJS += pico/area.o pico/cart.o pico/memory.o pico/misc.o pico/pico.o pico/sek.o \\r
-               pico/videoport.o pico/draw2.o pico/draw.o pico/patch.o pico/debug.o\r
-# Pico - CD\r
-OBJS += pico/cd/pico.o pico/cd/memory.o pico/cd/sek.o pico/cd/LC89510.o \\r
-               pico/cd/cd_sys.o pico/cd/cd_file.o pico/cd/cue.o pico/cd/gfx_cd.o \\r
-               pico/cd/area.o pico/cd/misc.o pico/cd/pcm.o pico/cd/buffering.o\r
-# Pico - Pico\r
-OBJS += pico/pico/pico.o pico/pico/memory.o pico/pico/xpcm.o\r
-# Pico - carthw\r
-OBJS += pico/carthw/carthw.o pico/carthw/svp/svp.o pico/carthw/svp/memory.o \\r
-               pico/carthw/svp/ssp16.o pico/carthw/svp/compiler.o pico/carthw/svp/stub_arm.o\r
-\r
-# Pico - sound\r
-OBJS += pico/sound/sound.o\r
-OBJS += pico/sound/mix_arm.o\r
-OBJS += pico/sound/sn76496.o pico/sound/ym2612.o\r
-# zlib\r
-OBJS += zlib/gzio.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o zlib/trees.o \\r
-       zlib/deflate.o zlib/crc32.o zlib/adler32.o zlib/zutil.o zlib/compress.o\r
-# unzip\r
-OBJS += unzip/unzip.o unzip/unzip_stream.o\r
-# CPU cores\r
-ifeq "$(use_musashi)" "1"\r
-CFLAGS += -DEMU_M68K\r
-OBJS += cpu/musashi/m68kops.o cpu/musashi/m68kcpu.o\r
-endif\r
-ifeq "$(use_cyclone)" "1"\r
-CFLAGS += -DEMU_C68K\r
-OBJS += cpu/Cyclone/proj/Cyclone.o cpu/Cyclone/tools/idle.o\r
-endif\r
-# drz80\r
-CFLAGS += -D_USE_DRZ80\r
-OBJS += cpu/DrZ80/drz80.o\r
-# helix\r
-OBJS += ../common/helix/$(CROSS)helix-mp3.a\r
-\r
-\r
-vpath %.c = ../..\r
-vpath %.s = ../..\r
-vpath %.S = ../..\r
-DIRS = platform platform/common pico pico/cd pico/pico pico/sound pico/carthw/svp \\r
-       zlib unzip cpu cpu/musashi cpu/Cyclone/proj cpu/Cyclone/tools cpu/mz80 cpu/DrZ80\r
-\r
-ICONS := $(shell echo rsc/*.bmp)\r
-APPICON = $(NAME).mbm\r
-RSCDIR = rsc\r
-REGDIR = rsc\r
-CFLAGS += -I./ -I../../\r
-CFLAGS += -DUIQ3 -DARM -DNO_SYNC\r
-CFLAGS += -D__DEBUG_PRINT\r
-CFLAGS += -mcpu=arm926ej-s -mtune=arm926ej-s -O3 -ftracer \\r
-               -fstrength-reduce -fomit-frame-pointer -fstrict-aliasing -ffast-math\r
-SFLAGS =  -march=armv5t -msoft-float -nostdinc\r
-ASFLAGS = -mcpu=arm926ej-s -mfloat-abi=soft\r
-export CFLAGS\r
-SRCRES := $(shell echo rsc/*.rss)\r
-EPOCRCFLAGS += -I./\r
-\r
-all: mkdirs sis\r
-\r
-include ../common/common_arm.mak\r
-include uiq3.mak\r
-\r
-\r
-$(NAME).mbg $(NAME).mbm : $(ICONS)\r
-       @echo "Creating multibitmap file..."\r
-       $(BMCONV) /h$(NAME).mbg $(NAME).mbm \\r
-               /c24rsc/pico18x18.bmp /8rsc/pico18x18m.bmp \\r
-               /c24rsc/pico40x40.bmp /8rsc/pico40x40m.bmp \\r
-               /c24rsc/pico64x64.bmp /8rsc/pico64x64m.bmp\r
-\r
-\r
-engine/blit_asm.o : engine/blit.s\r
-       @echo ">>>" $@\r
-       $(AS) $(ASFLAGS) $< -o $@\r
-\r
-\r
-readme.txt: ../../tools/textfilter ../base_readme.txt\r
-       ../../tools/textfilter ../base_readme.txt $@ UIQ\r
-\r
-# ----------- release -----------\r
-ifneq ($(findstring rel,$(MAKECMDGOALS)),)\r
-ifeq ($(VER),)\r
-$(error need VER)\r
-endif\r
-endif\r
-\r
-rel: picodrive.sis readme.txt\r
-       zip -9 -j ../../PicoDrive_uiq3_$(VER).zip $^\r
-       mkdir bin_to_cso_mp3\r
-       cp ../../tools/bin_to_cso_mp3/* bin_to_cso_mp3/\r
-       zip -9 -r ../../PicoDrive_uiq3_$(VER).zip bin_to_cso_mp3\r
-       rm -rf bin_to_cso_mp3\r
diff --git a/platform/uiq3/Makefile.old b/platform/uiq3/Makefile.old
deleted file mode 100644 (file)
index fa14569..0000000
+++ /dev/null
@@ -1,307 +0,0 @@
-# makefile for GCCE\r
-\r
-# settings\r
-#dprint = 1\r
-asm_memory = 1\r
-asm_render = 1\r
-asm_blit = 1\r
-#use_musashi = 1\r
-#up = 1\r
-#sis = 1\r
-\r
-# targets\r
-all: $(EPOCROOT2)epoc32 MAKEDIRS RESOURCES PicoDrive.exe\r
-\r
-clean :\r
-       @perl -S ermdir.pl _build\r
-       @erase 2>>nul rsc\*.rsc\r
-       @erase 2>>nul rsc\*.rsg\r
-       @erase 2>>nul rsc\PicoDrive.mb?\r
-\r
-\r
-# paths\r
-$(EPOCROOT2)epoc32 :\r
-       @echo Please set EPOCROOT2 environmental variable to full path to your SDK\r
-       @echo with ending slash (something like C:\Uiq_21\)\r
-       @cd : 2> NUL # do something stupid to make it silently fail\r
-\r
-# resource compiler hates drive lettered paths\r
-EPOCROOT2_NODRV = $(filter \\%,$(subst :, ,$(EPOCROOT2)))\r
-EPOCLIB = $(EPOCROOT2)EPOC32\RELEASE\ARMV5\r
-\r
-# C/C++ Compiler\r
-CC=arm-none-symbianelf-gcc\r
-\r
-# Linker\r
-LD=arm-none-symbianelf-ld\r
-\r
-# Assembler\r
-ASM=arm-none-symbianelf-as\r
-\r
-# Archiver\r
-AR=arm-none-symbianelf-ar\r
-\r
-# Strip\r
-STRIP=arm-none-symbianelf-strip\r
-\r
-# gcc config\r
-GCCDEFINES = -DNDEBUG -D_UNICODE -D__GCCE__ -D__SYMBIAN32__ -D__EPOC32__ -D__MARM__ \\r
-               -D__EABI__ -D__MARM_ARMV5__ -D__EXE__ -D__SUPPORT_CPP_EXCEPTIONS__ \\r
-               -D__MARM_ARMV5__ -D__PRODUCT_INCLUDE__=\"$(EPOCROOT2)epoc32/include/variant/UIQ_3.0.hrh\"\r
-\r
-GCCDEFINES += -D_UNZIP_SUPPORT -D__BROKEN_FWRITE\r
-\r
-# 'CSL Arm Toolchain' stuff must be specified after Symbian includes\r
-GCCINCLUDES = -I "$(EPOCROOT2)epoc32\include\variant" -I "$(EPOCROOT2)EPOC32\INCLUDE" -I "$(EPOCROOT2)EPOC32\INCLUDE\LIBC" \\r
-               -I "$(EPOCROOT2)\CSL Arm Toolchain\lib\gcc\arm-none-symbianelf\3.4.3\include" -I.\r
-\r
-# -funit-at-a-time is not compatible with SDK, it either has linker problems or does not start on device\r
-GCCCOMMFLAGS = -Wall -Wno-unknown-pragmas -fexceptions -march=armv5t -mapcs -pipe -nostdinc -msoft-float \\r
-               $(GCCINCLUDES) -include "$(EPOCROOT2)EPOC32/INCLUDE/GCCE/GCCE.h" -marm\r
-\r
-GCCCPPFLAGS = -x c++ -Wno-ctor-dtor-privacy -O3 -fno-unit-at-a-time\r
-GCCCFLAGS = -x c -O3 -fno-unit-at-a-time\r
-\r
-GCCLDFLAGS = -L"$(EPOCROOT2)CSL Arm Toolchain\arm-none-symbianelf\lib" \\r
-               -L"$(EPOCROOT2)CSL Arm Toolchain\lib\gcc\arm-none-symbianelf\3.4.3" \\r
-               --target1-abs --no-undefined -nostdlib -shared -Ttext 0x8000 -Tdata 0x400000 --default-symver\r
-\r
-# libs\r
-LIBS = \\r
-       $(EPOCLIB)\LIB\ESTLIB.dso \\r
-       $(EPOCLIB)\urel\qikalloc.lib \\r
-       $(EPOCLIB)\LIB\euser.dso \\r
-       $(EPOCLIB)\LIB\apparc.dso \\r
-       $(EPOCLIB)\LIB\cone.dso \\r
-       $(EPOCLIB)\LIB\eikcore.dso \\r
-       $(EPOCLIB)\LIB\eikcoctl.dso \\r
-       $(EPOCLIB)\LIB\qikcore.dso \\r
-       $(EPOCLIB)\LIB\qikdlg.dso \\r
-       $(EPOCLIB)\LIB\etext.dso \\r
-       $(EPOCLIB)\LIB\bafl.dso \\r
-       $(EPOCLIB)\LIB\efsrv.dso \\r
-       $(EPOCLIB)\LIB\eikctl.dso \\r
-       $(EPOCLIB)\LIB\WS32.dso \\r
-       $(EPOCLIB)\LIB\EIKDLG.dso \\r
-       $(EPOCLIB)\LIB\GDI.dso \\r
-       $(EPOCLIB)\LIB\estor.dso \\r
-       $(EPOCLIB)\LIB\EZLIB.dso \\r
-       $(EPOCLIB)\LIB\HAL.dso \\r
-       $(EPOCLIB)\LIB\mediaclient.dso \\r
-       $(EPOCLIB)\LIB\mediaclientaudiostream.dso\r
-\r
-LIBS += \\r
-       $(EPOCLIB)\LIB\qikallocdll.dso \\r
-       $(EPOCLIB)\UREL\usrt2_2.lib \\r
-       $(EPOCLIB)\LIB\dfpaeabi.dso \\r
-       $(EPOCLIB)\LIB\dfprvct2_2.dso \\r
-       $(EPOCLIB)\LIB\drtaeabi.dso \\r
-       $(EPOCLIB)\LIB\scppnwdl.dso \\r
-       $(EPOCLIB)\LIB\drtrvct2_2.dso\r
-\r
-\r
-# objects\r
-\r
-# launcher\r
-OBJECTS += _build\App.o _build\Engine.o _build\Dialogs.o _build\CSimpleTextParser.o\r
-# engine\r
-OBJECTS += _build\main.o _build\vid.o _build\polledas.o _build\audio_mediaserver.o _build\debug.o\r
-\r
-# Pico\r
-OBJECTS += _build\Area.o _build\Cart.o _build\Utils.o _build\Memory.o _build\Misc.o \\r
-               _build\Pico.o _build\Sek.o _build\VideoPort.o _build\Draw2.o _build\Draw.o\r
-# asm stuff\r
-ifeq "$(asm_render)" "1"\r
-GCCDEFINES += -D_ASM_DRAW_C\r
-OBJECTS += _build\draw_asm.o _build\draw2_asm.o\r
-endif\r
-ifeq "$(asm_memory)" "1"\r
-GCCDEFINES += -D_ASM_MEMORY_C\r
-OBJECTS += _build\memory_asm.o\r
-endif\r
-# Pico - sound\r
-OBJECTS += _build\sound.o _build\sn76496.o _build\ym2612.o\r
-# misc\r
-OBJECTS += _build\unzip.o _build\gzio_symb.o\r
-# CPU cores\r
-ifeq "$(use_musashi)" "1"\r
-GCCDEFINES += -DEMU_M68K\r
-OBJECTS += _build\m68kcpu.o _build\m68kopac.o _build\m68kopdm.o _build\m68kopnz.o _build\m68kops.o\r
-else\r
-GCCDEFINES += -DEMU_C68K\r
-OBJECTS += _build\Cyclone.o\r
-endif\r
-ifeq "$(asm_blit)" "1"\r
-OBJECTS += _build\blit_asm.o\r
-else\r
-OBJECTS += _build\blit.o\r
-endif\r
-GCCDEFINES += -D_USE_DRZ80\r
-OBJECTS += _build\DrZ80.o\r
-GCCDEFINES += -D_ASM_YM2612_C\r
-OBJECTS += _build\ym2612_asm.o\r
-\r
-\r
-\r
-# dprint\r
-ifeq "$(dprint)" "1"\r
-GCCDEFINES += -D__DEBUG_PRINT\r
-endif\r
-\r
-\r
-define crule\r
-       @echo * $<\r
-       @$(CC) -c $(GCCCOMMFLAGS) $(GCCDEFINES) $(GCCCFLAGS) $< -o $@\r
-endef\r
-\r
-define cpprule\r
-       @echo * $<\r
-       @$(CC) -c $(GCCCOMMFLAGS) $(GCCDEFINES) $(GCCCPPFLAGS) $< -o $@\r
-endef\r
-\r
-define asmrule\r
-       @echo * $<\r
-       @$(ASM) -marmv4t -mthumb-interwork -o $@ $^\r
-endef\r
-\r
-# object making rules\r
-_build\App.o     : App.cpp\r
-       $(cpprule)\r
-_build\Engine.o  : Engine.cpp\r
-       $(cpprule)\r
-_build\Dialogs.o : Dialogs.cpp\r
-       $(cpprule)\r
-_build\CSimpleTextParser.o : CSimpleTextParser.cpp\r
-       $(cpprule)\r
-\r
-_build\main.o    : engine\main.cpp\r
-       $(cpprule)\r
-_build\vid.o     : engine\vid.cpp\r
-       $(cpprule)\r
-_build\polledas.o: engine\polledas.cpp\r
-       $(cpprule)\r
-_build\audio_mediaserver.o : engine\audio_mediaserver.cpp\r
-       $(cpprule)\r
-_build\debug.o   : engine\debug.cpp\r
-       $(cpprule)\r
-_build\blit.o    : engine\blit.c\r
-       $(crule)\r
-\r
-_build\Area.o    : ..\..\Pico\Area.c\r
-       $(crule)\r
-_build\Cart.o    : ..\..\Pico\Cart.c\r
-       $(crule)\r
-_build\Draw.o    : ..\..\Pico\Draw.c\r
-       $(crule)\r
-_build\Draw2.o   : ..\..\Pico\Draw2.c\r
-       $(crule)\r
-_build\Memory.o  : ..\..\Pico\Memory.c\r
-       $(crule)\r
-_build\Misc.o    : ..\..\Pico\Misc.c\r
-       $(crule)\r
-_build\Pico.o    : ..\..\Pico\Pico.c\r
-       $(crule)\r
-_build\Sek.o     : ..\..\Pico\Sek.c\r
-       $(crule)\r
-_build\Utils.o   : ..\..\Pico\Utils.c\r
-       $(crule)\r
-_build\VideoPort.o : ..\..\Pico\VideoPort.c\r
-       $(crule)\r
-_build\sound.o   : ..\..\Pico\sound\sound.c\r
-       $(crule)\r
-_build\sn76496.o : ..\..\Pico\sound\sn76496.c\r
-       $(crule)\r
-_build\ym2612.o  : ..\..\Pico\sound\ym2612.c\r
-       $(crule)\r
-\r
-_build\unzip.o     : ..\..\unzip\unzip.c\r
-       $(crule)\r
-_build\gzio_symb.o : ..\..\zlib\gzio_symb.c\r
-       $(crule)\r
-\r
-_build\m68kcpu.o  : ..\..\musashi\m68kcpu.c\r
-       $(crule)\r
-_build\m68kopac.o : ..\..\musashi\m68kopac.c\r
-       $(crule)\r
-_build\m68kopdm.o : ..\..\musashi\m68kopdm.c\r
-       $(crule)\r
-_build\m68kopnz.o : ..\..\musashi\m68kopnz.c\r
-       $(crule)\r
-_build\m68kops.o  : ..\..\musashi\m68kops.c\r
-       $(crule)\r
-\r
-_build\Cyclone.o : ..\..\cpu\Cyclone\proj\Cyclone.s\r
-       $(asmrule)\r
-_build\DrZ80.o : ..\..\cpu\DrZ80\drz80.s\r
-       $(asmrule)\r
-_build\draw_asm.o : ..\..\Pico\draw.s\r
-       $(asmrule)\r
-_build\draw2_asm.o : ..\..\Pico\draw2.s\r
-       $(asmrule)\r
-_build\memory_asm.o : ..\..\Pico\memory.s\r
-       $(asmrule)\r
-_build\ym2612_asm.o : ..\..\Pico\sound\ym2612.s\r
-       $(asmrule)\r
-_build\blit_asm.o : engine\blit.s\r
-       $(asmrule)\r
-\r
-\r
-PicoDrive.exe : $(OBJECTS)\r
-       @echo * ld\r
-       @$(LD) $(GCCLDFLAGS) -soname PicoDrive{000a0000}[a00010f3].exe --entry _E32Startup -u _E32Startup \\r
-               $(EPOCROOT2)EPOC32\RELEASE\ARMV5\UREL\EEXE.LIB -o "_build\PicoDrive_elf.exe" -Map "_build\PicoDrive.exe.map" $(OBJECTS) $(LIBS) -lsupc++ -lgcc\r
-#      @echo * strip\r
-#      @$(STRIP) _build\PicoDrive_elf.exe\r
-       @echo * elf2e32\r
-       @elf2e32 --sid=0xa00010f3  --heap=0x00000100,0x00800000 --stack=0x00003000 \\r
-               --uid1=0x1000007a --uid2=0x100039ce --uid3=0xa00010f3 \\r
-               --capability=none --fpu=softvfp --targettype=EXE --output="$@" \\r
-               --elfinput="_build\PicoDrive_elf.exe" --linkas=PicoDrive{000a0000}[a00010f3].exe --libpath="$(EPOCLIB)\LIB"\r
-ifeq "$(sis)" "1"\r
-       @make -C _out\r
-ifeq "$(up)" "1"\r
-       @qup.cmd\r
-endif\r
-endif\r
-\r
-\r
-MAKEDIRS : _build\r
-\r
-_build :\r
-#      @echo * making build dir\r
-       @perl -S emkdir.pl $@\r
-\r
-\r
-# BitMap PicoDrive.mbm\r
-\r
-RESOURCES : rsc\PicoDrive.mbm rsc\PicoDrive.RSC rsc\PicoDrive_reg.RSC rsc\PicoDrive_loc.RSC rsc\PicoDrive.mbg\r
-\r
-rsc\PicoDrive.mbg : rsc\PicoDrive.mbm\r
-\r
-rsc\PicoDrive.mbm : rsc\pico18x18.bmp rsc\pico18x18m.bmp rsc\pico40x40.bmp rsc\pico40x40m.bmp rsc\pico64x64.bmp rsc\pico64x64m.bmp\r
-       @echo * $@\r
-       @perl -S epocmbm.pl -h"rsc\PicoDrive.mbg" -o"rsc\PicoDrive.mbm" -l"\Z\Resource\Apps\:rsc" \\r
-               -b"/c24rsc\pico18x18.bmp /8rsc\pico18x18m.bmp /c24rsc\pico40x40.bmp /8rsc\pico40x40m.bmp /c24rsc\pico64x64.bmp /8rsc\pico64x64m.bmp" -l"\Z\Resource\Apps\:rsc"\r
-       @perl -S ecopyfile.pl "rsc\PicoDrive.mbg" "$(EPOCROOT2)EPOC32\INCLUDE\PicoDrive.mbg"\r
-\r
-# Resource Z\Resource\Apps\PicoDrive.RSC\r
-\r
-rsc\PicoDrive.RSC : rsc\PicoDrive.rss picodrive.hrh\r
-       @echo * $@\r
-       @perl -S epocrc.pl -m045,046,047 -I "." -I- -I "$(EPOCROOT2_NODRV)EPOC32\include" -DLANGUAGE_SC -u "rsc\PicoDrive.rss" -o$@ \\r
-               -h"rsc\PicoDrive.rsg" -t"rsc" -l"Z\Resource\Apps:rsc"\r
-       @perl -S ecopyfile.pl "rsc\PicoDrive.rsg" "$(EPOCROOT2)EPOC32\INCLUDE\PicoDrive.RSG"\r
-\r
-# Resource Z\private\10003a3f\apps\PicoDrive_reg.RSC\r
-\r
-rsc\PicoDrive_reg.RSC : rsc\PicoDrive_reg.rss\r
-       @echo * $@\r
-       @perl -S epocrc.pl -m045,046,047 -I "." -I- -I "$(EPOCROOT2)EPOC32\include" -DLANGUAGE_SC -u "rsc\PicoDrive_reg.rss" -o$@ \\r
-       -t"rsc" -l"Z\private\10003a3f\apps:rsc"\r
-\r
-# Resource Z\Resource\Apps\PicoDrive_loc.RSC\r
-\r
-rsc\PicoDrive_loc.RSC : rsc\PicoDrive_loc.rss\r
-       @echo * $@\r
-       @perl -S epocrc.pl -m045,046,047 -I "." -I- -I "$(EPOCROOT2)EPOC32\include" -DLANGUAGE_SC -u "rsc\PicoDrive_loc.rss" -o$@ \\r
-               -t"rsc"  -l"Z\Resource\Apps:rsc"\r
diff --git a/platform/uiq3/PicoDrive.mmp b/platform/uiq3/PicoDrive.mmp
deleted file mode 100644 (file)
index 0156526..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-TARGET                 PicoDrive.exe\r
-TARGETTYPE             exe\r
-//TARGETPATH           ?\r
-UID                            0x100039CE 0xA00010F3\r
-EPOCSTACKSIZE  0x3000 // required by CQikSelectFileDlg\r
-EPOCHEAPSIZE   0x100 0x00800000 // required by large ROMs :)\r
-\r
-// resource\r
-SOURCEPATH             Rsc\r
-START RESOURCE         PicoDrive.rss\r
-HEADER\r
-TARGETPATH             \Resource\Apps\r
-LANG                   SC\r
-END\r
-\r
-START RESOURCE PicoDrive_reg.rss\r
-TARGETPATH             \private\10003a3f\apps\r
-END\r
-\r
-START RESOURCE PicoDrive_loc.rss\r
-TARGETPATH             \Resource\Apps\r
-LANG                   SC\r
-END\r
-\r
-CAPABILITY             none // SwEvent // forbidden\r
-\r
-USERINCLUDE     ..\..\r
-\r
-SYSTEMINCLUDE  \epoc32\include\r
-SYSTEMINCLUDE  \epoc32\include\libc\r
-\r
-// launcher\r
-SOURCEPATH      .\r
-SYSTEMINCLUDE  .               // for port_config.h\r
-SOURCE                 App.cpp\r
-SOURCE                 Engine.cpp\r
-SOURCE                 Dialogs.cpp\r
-SOURCE                 CSimpleTextParser.cpp\r
-\r
-// engine\r
-SOURCEPATH      engine\r
-SOURCE                 main.cpp\r
-SOURCE                 vid.cpp\r
-SOURCE                 polledas.cpp\r
-SOURCE                 debug.cpp\r
-SOURCE                 audio_mediaserver.cpp\r
-SOURCE                 blit.c\r
-\r
-// pico\r
-MACRO                  _UNZIP_SUPPORT\r
-SOURCEPATH      ..\..\Pico\r
-USERINCLUDE     ..\..\Pico\r
-SOURCE                 Area.c\r
-SOURCE                 Cart.c\r
-SOURCE                 Draw.c\r
-SOURCE                 Draw2.c\r
-SOURCE                 Memory.c\r
-SOURCE                 Misc.c\r
-SOURCE                 Pico.c\r
-SOURCE                 Sek.c\r
-SOURCE                 Utils.c\r
-SOURCE                 VideoPort.c\r
-\r
-// pico - sound\r
-SOURCEPATH      ..\..\Pico\Sound\r
-SOURCE                 sound.c\r
-SOURCE                 sn76496.c\r
-SOURCE                 ym2612.c\r
-\r
-// CPU cores\r
-MACRO                  EMU_M68K\r
-SOURCEPATH      ..\..\cpu\Musashi\r
-USERINCLUDE     ..\..\cpu\Musashi\r
-SOURCE                 m68kcpu.c\r
-SOURCE                 m68kopac.c\r
-SOURCE                 m68kopdm.c\r
-SOURCE                 m68kopnz.c\r
-SOURCE                 m68kops.c\r
-\r
-//MACRO                        _USE_MZ80\r
-//SOURCEPATH      ..\win32\z80\r
-//SOURCE                       mz80_asm.obj\r
-\r
-// misc\r
-SOURCEPATH      ..\..\unzip\r
-USERINCLUDE     ..\..\unzip\r
-SOURCE                 unzip.c\r
-SOURCEPATH      ..\..\zlib\r
-USERINCLUDE     ..\..\zlib\r
-SOURCE                 gzio_symb.c\r
-\r
-\r
-// TODO: get rid of unneeded stuff\r
-LIBRARY                        ESTLIB.LIB\r
-LIBRARY                        euser.lib \r
-LIBRARY                        apparc.lib \r
-LIBRARY                        cone.lib \r
-LIBRARY                        eikcore.lib \r
-LIBRARY                        eikcoctl.lib \r
-LIBRARY                        qikcore.lib\r
-LIBRARY                        qikdlg.lib // CQikSelectFileDlg\r
-LIBRARY                        etext.lib  // TCharFormat\r
-LIBRARY                        bafl.lib   // CDesCArrayFlat\r
-LIBRARY                        efsrv.lib\r
-LIBRARY                        eikctl.lib\r
-\r
-LIBRARY                        WS32.LIB\r
-LIBRARY                        EIKDLG.LIB\r
-//LIBRARY                      EGUL.LIB  // CColorList\r
-LIBRARY                        GDI.LIB   // TTypeface\r
-LIBRARY                        estor.lib // RWriteStream\r
-\r
-LIBRARY                        EZLIB.LIB\r
-LIBRARY                        HAL.LIB\r
-\r
-LIBRARY                        mediaclient.LIB\r
-LIBRARY                        mediaclientaudiostream.LIB\r
-\r
-\r
-\r
-STATICLIBRARY  qikalloc.lib\r
-LIBRARY                        qikallocdll.lib\r
-\r
-\r
-MACRO                  __DEBUG_PRINT\r
-MACRO                  __BROKEN_FWRITE\r
-\r
-\r
-USERINCLUDE     .\r
-START BITMAP   PicoDrive.mbm\r
-HEADER\r
-TARGETPATH             \Resource\Apps\r
-SOURCEPATH             Rsc\r
-SOURCE c24             Pico18x18.bmp\r
-SOURCE 8               Pico18x18m.bmp\r
-SOURCE c24             Pico40x40.bmp\r
-SOURCE 8               Pico40x40m.bmp\r
-SOURCE c24             Pico64x64.bmp\r
-SOURCE 8               Pico64x64m.bmp\r
-END\r
diff --git a/platform/uiq3/config.txt b/platform/uiq3/config.txt
deleted file mode 100644 (file)
index c3db1b1..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-1. Keys:\r
-\r
-If it looks confusing to you, check this tutorial first:\r
-http://notaz.atspace.com/pico_tut/\r
-\r
-There are no default settings.\r
-When you start key configuration mode, black screen with dark-red squares will\r
-appear. Also there will be little 'control' on the top with the function\r
-name in it, and arrows on the corners of it. You can tap on these corners to\r
-select a function. You can also tap on these squares to bind that function to\r
-them. This way you can associate touchpad areas with game-controls or functions.\r
-I also made a small square in every corner of the screen to be used as a virtual\r
-button for some function, like save state. You can bind it as you like. To\r
-bind phone buttons, simply select the function you need, and press a button\r
-you want. To unbind any key or touchpad area, simply push or tap it again.\r
-\r
-When finished, select 'done' and press any key. You can also press 'Power'\r
-to exit.\r
-\r
-You need to bind 'pause emu' function to be able exit game when ROM is loaded.\r
-It is bound to 'back' button by default.\r
-\r
-2. Main Settings:\r
-\r
-Here you can set the orientation of screen and the drawing mode. The "fit"\r
-option will scale the image so it better fits in the screen, but some detail\r
-will be lost. "center" displays the game at the center of the screen, but\r
-non-fitting parts are not visible then. "fit2" is simmilar to "fit" but is\r
-a bit more stretched (fit modes are only meaningful in 0 or 180 rotation\r
-modes).\r
-\r
-"Fast renderer" enables faster rendering method, but it works only with some\r
-games (some other have serious glitches or even hang).\r
-\r
-"Accurate timing" is needed for some games to run (like Red Zone). It should\r
-be kept off for all other games, because it slows emulation down. Some games\r
-also need this option for proper sound, so enable this if game has any\r
-glitches.\r
-\r
-"Accurate sprites" fixes sprite priority problems, for example if game\r
-character is in front of or behind some object it should not be, this option\r
-should fix it. This option does not work in "Fast renderer" mode.\r
-\r
-"Show FPS" shows game frames per second in format XX/YY, where XX is the\r
-number of frames shown per previous second, and YY is the number of frames\r
-emulated, but not necessarily shown. By calculating YY-XX you get the number\r
-of skipped frames per second.\r
-\r
-3. Sound settings:\r
-\r
-Sound emulation is very picky on CPU power (in most cases sound alone uses\r
-more CPU power than everything else altogether), but it is still possible to\r
-play some games. When using sound, the recommended display modes are "fit 0"\r
-and "fit 180", because these are the fastest ones. Also try "Alternative\r
-renderer", but it might cause graphical glitches. You must use auto frameskip\r
-when using sound, or else you will get stuttering sound. Also, it is\r
-recommended to exit all other non-vital apps (you can use SMan for this),\r
-disable bluetooth and any other devices your phone may have. I also noticed\r
-that simply connecting the phone battery charger strangely slows everything\r
-down.\r
-\r
-"Enable sound" tries to enable sound output on your device, but that alone is\r
-not enough to get sound. You need to enable the sound chips below:\r
-"Z80" is secondary CPU in genesis and is mostly used to control the other 2\r
-sound chips. So if you disable Z80, sound will be lost in most games, with\r
-some exceptions like Sonic1. It is possible to use Z80 for other things,\r
-some games do that and Z80 must be enabled to run them at all.\r
-\r
-"YM2612" is a fairly complex Frequency Modulation (FM) sound synthesis chip.\r
-It was the main sound output device in genesis and is horrible CPU hog when\r
-is tried to be emulated in software. Disabling it gives large speed\r
-improvement, but most of the sound is lost.\r
-\r
-"SN76496" is programmable sound generator (PSG) chip, used for various sound\r
-effects and music elements.\r
-\r
-Note: if you change sound settings AFTER loading a ROM, you may need to reset\r
-game to get sound. This is because most games initialize sound chips on\r
-startup, and this data is lost when sound chips are being enabled/disabled.\r
-\r
-4. Misc:\r
-\r
-"6 button pad" will enable 6 button gamepad emulation and will add additional\r
-X, Y, Z and MODE actions to key configuration.\r
-Note: if you enable this, games may detect that and use different button\r
-configuration, for example A ("high punch") will change to "low punch" in\r
-Mortal Kombat and you will need to bind X for "high punch".\r
-\r
-"gzip save states" enables gzip (similar to ordinary zip, but a little\r
-different) compression on your save states to save space. The compression\r
-ratio is 50-90%, so it's worth to enable this.\r
-\r
-"Use SRAM saves" option enables emulation of batery-backed save RAM some game\r
-cartridges had. RPG games used it alot, but there were some others too, like\r
-Sonic 3. If this is enabled, <ROMname>.srm files are generated when you exit\r
-the emulator or load another ROM. Format is compatible with other popular\r
-emulators (like Gens and Fusion).\r
-\r
-"Region" lets you set the region of emulated genesis machine.\r
-\r
-\r
-5. Frameskip:\r
-\r
-"Auto"  option tries to run the game in it's original speed by skipping next\r
-        frame if the previous was rendered too slow.\r
-"0"     displays every frame, thus game runs very slow, sound skips.\r
-"1"     skips every other frame. Use this for a game which is smoother, but a bit\r
-        too slow (actually depends on display mode you use).\r
-"2"     also makes the game smoother, but it will be too fast in most areas.\r
-"4","8" similar to above, but skips more frames and often becomes choppy.\r
diff --git a/platform/uiq3/emu.c b/platform/uiq3/emu.c
deleted file mode 100644 (file)
index 22b2143..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include "../common/emu.h"
-#include "../common/config.h"
-#include "../common/menu.h"
-#include "pico/pico_int.h"
-
-const char * const keyNames[] = {
-       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-};
-
-int plat_get_root_dir(char *dst, int len)
-{
-       strcpy(dst, "D:\\other\\PicoDrive\\");
-       return strlen(dst);
-}
-
-void emu_Init(void)
-{
-       int ret;
-
-       // make dirs for saves, cfgs, etc.
-       ret = mkdir("D:\\other\\PicoDrive", 0777);
-       if (ret == 0)
-       {
-               mkdir("D:\\other\\PicoDrive\\mds", 0777);
-               mkdir("D:\\other\\PicoDrive\\srm", 0777);
-               mkdir("D:\\other\\PicoDrive\\brm", 0777);
-       }
-
-       emu_prepareDefaultConfig();
-       config_readlrom("D:\\other\\PicoDrive\\config.cfg");
-       emu_read_config(0, 0);
-       //PicoInit();
-}
-
-void emu_Deinit(void)
-{
-       // saves volume and last ROM
-       emu_WriteConfig(0);
-       //PicoExit();
-}
-
-void menu_romload_prepare(const char *rom_name)
-{
-}
-
-void menu_romload_end(void)
-{
-}
-
-void emu_prepareDefaultConfig(void)
-{
-       memset(&defaultConfig, 0, sizeof(defaultConfig));
-       defaultConfig.EmuOpt    = 0x1d | 0x680; // | confirm_save, cd_leds, 16bit rend
-       defaultConfig.s_PicoOpt = 0x0f | POPT_EN_MCD_PCM|POPT_EN_MCD_CDDA|POPT_EN_SVP_DRC|POPT_ACC_SPRITES;
-       defaultConfig.s_PsndRate = 22050;
-       defaultConfig.s_PicoRegion = 0; // auto
-       defaultConfig.s_PicoAutoRgnOrder = 0x184; // US, EU, JP
-       defaultConfig.s_PicoCDBuffers = 0;
-       defaultConfig.Frameskip = -1; // auto
-       defaultConfig.volume = 80;
-       defaultConfig.scaling = 0;
-       defaultConfig.KeyBinds[0xd5] = 1<<26; // back
-}
-
-void emu_pack_config(void)
-{
-       currentConfig.s_PicoOpt = PicoOpt;
-       currentConfig.s_PsndRate = PsndRate;
-       currentConfig.s_PicoRegion = PicoRegionOverride;
-       currentConfig.s_PicoAutoRgnOrder = PicoAutoRgnOrder;
-       currentConfig.s_PicoCDBuffers = PicoCDBuffers;
-}
-
-void emu_unpack_config(void)
-{
-       PicoOpt = currentConfig.s_PicoOpt;
-       PsndRate = currentConfig.s_PsndRate;
-       PicoRegionOverride = currentConfig.s_PicoRegion;
-       PicoAutoRgnOrder = currentConfig.s_PicoAutoRgnOrder;
-       PicoCDBuffers = currentConfig.s_PicoCDBuffers;
-}
-
-/* used by config engine only, not actual menus */
-menu_entry opt_entries[] =
-{
-       { NULL,                        MB_NONE,  MA_OPT_RENDERER,      NULL, 0, 0, 0, 1, 1 },
-       { "Scaling",                   MB_RANGE, MA_OPT_SCALING,       &currentConfig.scaling,     0, 0, 2, 1, 1 },
-       { "Rotation",                  MB_RANGE, MA_OPT_ROTATION,      &currentConfig.rotation,    0, 0, 3, 1, 1 },
-       { "Accurate sprites",          MB_ONOFF, MA_OPT_ACC_SPRITES,   &PicoOpt, 0x080, 0, 0, 0, 1 },
-       { "Show FPS",                  MB_ONOFF, MA_OPT_SHOW_FPS,      &currentConfig.EmuOpt,  0x002, 0, 0, 1, 1 },
-       { NULL,                        MB_RANGE, MA_OPT_FRAMESKIP,     &currentConfig.Frameskip, 0, -1, 16, 1, 1 },
-       { "Enable sound",              MB_ONOFF, MA_OPT_ENABLE_SOUND,  &currentConfig.EmuOpt,  0x004, 0, 0, 1, 1 },
-       { NULL,                        MB_NONE,  MA_OPT_SOUND_QUALITY, NULL, 0, 0, 0, 1, 1 },
-       { NULL,                        MB_NONE,  MA_OPT_REGION,        NULL, 0, 0, 0, 1, 1 },
-       { "Use SRAM/BRAM savestates",  MB_ONOFF, MA_OPT_SRAM_STATES,   &currentConfig.EmuOpt,  0x001, 0, 0, 1, 1 },
-};
-
-#define OPT_ENTRY_COUNT (sizeof(opt_entries) / sizeof(opt_entries[0]))
-const int opt_entry_count = OPT_ENTRY_COUNT;
-
-menu_entry opt2_entries[] =
-{
-       { "Disable sprite limit",      MB_ONOFF, MA_OPT2_NO_SPRITE_LIM, &PicoOpt, 0x40000, 0, 0, 1, 1 },
-       { "Emulate Z80",               MB_ONOFF, MA_OPT2_ENABLE_Z80,    &PicoOpt, 0x00004, 0, 0, 1, 1 },
-       { "Emulate YM2612 (FM)",       MB_ONOFF, MA_OPT2_ENABLE_YM2612, &PicoOpt, 0x00001, 0, 0, 1, 1 },
-       { "Emulate SN76496 (PSG)",     MB_ONOFF, MA_OPT2_ENABLE_SN76496,&PicoOpt, 0x00002, 0, 0, 1, 1 },
-       { "gzip savestates",           MB_ONOFF, MA_OPT2_GZIP_STATES,   &currentConfig.EmuOpt, 0x0008, 0, 0, 1, 1 },
-       { "SVP dynarec",               MB_ONOFF, MA_OPT2_SVP_DYNAREC,   &PicoOpt, 0x20000, 0, 0, 1, 1 },
-       { "Disable idle loop patching",MB_ONOFF, MA_OPT2_NO_IDLE_LOOPS, &PicoOpt, 0x80000, 0, 0, 1, 1 },
-};
-
-#define OPT2_ENTRY_COUNT (sizeof(opt2_entries) / sizeof(opt2_entries[0]))
-const int opt2_entry_count = OPT2_ENTRY_COUNT;
-
-menu_entry cdopt_entries[] =
-{
-       { "CD LEDs",                   MB_ONOFF, MA_CDOPT_LEDS,         &currentConfig.EmuOpt, 0x0400, 0, 0, 1, 1 },
-       { "CDDA audio",                MB_ONOFF, MA_CDOPT_CDDA,         &PicoOpt, 0x0800, 0, 0, 1, 1 },
-       { "PCM audio",                 MB_ONOFF, MA_CDOPT_PCM,          &PicoOpt, 0x0400, 0, 0, 1, 1 },
-       { NULL,                        MB_NONE,  MA_CDOPT_READAHEAD,    NULL, 0, 0, 0, 1, 1 },
-       { "SaveRAM cart",              MB_ONOFF, MA_CDOPT_SAVERAM,      &PicoOpt, 0x8000, 0, 0, 1, 1 },
-       { "Scale/Rot. fx (slow)",      MB_ONOFF, MA_CDOPT_SCALEROT_CHIP,&PicoOpt, 0x1000, 0, 0, 1, 1 },
-       { "Better sync (slow)",        MB_ONOFF, MA_CDOPT_BETTER_SYNC,  &PicoOpt, 0x2000, 0, 0, 1, 1 },
-};
-
-#define CDOPT_ENTRY_COUNT (sizeof(cdopt_entries) / sizeof(cdopt_entries[0]))
-const int cdopt_entry_count = CDOPT_ENTRY_COUNT;
-
-menu_entry ctrlopt_entries[] =
-{
-       { "6 button pad",              MB_ONOFF, MA_OPT_6BUTTON_PAD,   &PicoOpt, 0x020, 0, 0, 1, 1 },
-       { "Turbo rate",                MB_RANGE, MA_CTRL_TURBO_RATE,   &currentConfig.turbo_rate, 0, 1, 30, 1, 1 },
-};
-
-#define CTRLOPT_ENTRY_COUNT (sizeof(ctrlopt_entries) / sizeof(ctrlopt_entries[0]))
-const int ctrlopt_entry_count = CTRLOPT_ENTRY_COUNT;
-
-me_bind_action emuctrl_actions[] =
-{
-       { "Load State     ", 1<<28 },
-       { "Save State     ", 1<<27 },
-       { "Pause Emu      ", 1<<26 },
-       { "Switch Renderer", 1<<25 },
-       { "Prev save slot ", 1<<23 },
-       { "Next save slot ", 1<<22 },
-       { "Volume down    ", 1<<21 },
-       { "Volume up      ", 1<<20 },
-       { NULL,              0     }
-};
-
-
diff --git a/platform/uiq3/engine/PolledAS.h b/platform/uiq3/engine/PolledAS.h
deleted file mode 100644 (file)
index 14d4a3f..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************\r
- *\r
- *     File:           PolledAS.h\r
- *\r
- *     Author:         Peter van Sebille (peter@yipton.net)\r
- *\r
- *     (c) Copyright 2001, Peter van Sebille\r
- *     All Rights Reserved\r
- *\r
- *******************************************************************/\r
-\r
-#ifndef __POLLED_AS_H\r
-#define __POLLED_AS_H\r
-\r
-class CPrivatePolledActiveScheduler;\r
-\r
-class CPolledActiveScheduler : public CBase\r
-{\r
-public:\r
-       ~CPolledActiveScheduler();\r
-       static CPolledActiveScheduler* NewL();\r
-       static CPolledActiveScheduler* Instance();\r
-       void Schedule();\r
-protected:\r
-       CPolledActiveScheduler(){};\r
-       void ConstructL();\r
-       CPrivatePolledActiveScheduler*  iPrivatePolledActiveScheduler;\r
-};\r
-\r
-\r
-#endif                 /* __POLLED_AS_H */\r
-\r
diff --git a/platform/uiq3/engine/audio_mediaserver.cpp b/platform/uiq3/engine/audio_mediaserver.cpp
deleted file mode 100644 (file)
index e9f77d0..0000000
+++ /dev/null
@@ -1,317 +0,0 @@
-/*******************************************************************\r
- *\r
- *     File:           Audio_mediaserver.cpp\r
- *\r
- *     Author:         Peter van Sebille (peter@yipton.net)\r
- *\r
- *  Modified/adapted for picodriveN by notaz, 2006\r
- *\r
- *  (c) Copyright 2006, notaz\r
- *     (c) Copyright 2001, Peter van Sebille\r
- *     All Rights Reserved\r
- *\r
- *******************************************************************/\r
-\r
-#include "audio_mediaserver.h"\r
-#include "debug.h"\r
-\r
-//#define DEBUG_UNDERFLOWS\r
-//#undef DEBUGPRINT\r
-//#define DEBUGPRINT(x...)\r
-\r
-\r
-const TInt KUpdatesPerSec = 10;\r
-const TInt KBlockTime = 1000000 / KUpdatesPerSec;\r
-const TInt KMaxLag = 200000; // max sound lag, lower values increase chance of underflow\r
-const TInt KMaxUnderflows = 50; // max underflows/API errors we are going allow in a row (to prevent lockups)\r
-\r
-\r
-/*******************************************\r
- *\r
- * CGameAudioMS\r
- *\r
- *******************************************/\r
-\r
-CGameAudioMS::CGameAudioMS(TInt aRate, TBool aStereo, TInt aWritesPerSec, TInt aVolume)\r
-: iRate(aRate), iStereo(aStereo), iWritesPerSec(aWritesPerSec), iVolume(aVolume)\r
-{\r
-}\r
-\r
-\r
-CGameAudioMS* CGameAudioMS::NewL(TInt aRate, TBool aStereo, TInt aWritesPerSec, TInt aVolume)\r
-{\r
-       DEBUGPRINT(_L("CGameAudioMS::NewL(%i, %i, %i, %i)"), aRate, aStereo, aWritesPerSec, aVolume);\r
-       CGameAudioMS*           self = new(ELeave) CGameAudioMS(aRate, aStereo, aWritesPerSec, aVolume);\r
-       CleanupStack::PushL(self);\r
-       self->ConstructL();\r
-       CleanupStack::Pop();            // self\r
-       return self;\r
-}\r
-\r
-\r
-CGameAudioMS::~CGameAudioMS()\r
-{\r
-       DEBUGPRINT(_L("CGameAudioMS::~CGameAudioMS()"));\r
-       if(iMdaAudioOutputStream) {\r
-               iScheduler->Schedule(); // let it finish it's stuff\r
-               iMdaAudioOutputStream->Stop();\r
-               delete iMdaAudioOutputStream;\r
-       }\r
-       if(iServer) delete iServer;\r
-\r
-       for (TInt i=0; i<KSoundBuffers; i++)\r
-               delete iSoundBuffers[i];\r
-\r
-       // Polled AS\r
-       //if(iScheduler) delete iScheduler;\r
-}\r
-\r
-\r
-void CGameAudioMS::ConstructL()\r
-{\r
-       iServer = CMdaServer::NewL();\r
-\r
-       // iScheduler = CPolledActiveScheduler::NewL();\r
-       iScheduler = CPolledActiveScheduler::Instance();\r
-\r
-       switch(iRate) {\r
-               case 11025: iMdaAudioDataSettings.iSampleRate = TMdaAudioDataSettings::ESampleRate11025Hz; break;\r
-               case 16000: iMdaAudioDataSettings.iSampleRate = TMdaAudioDataSettings::ESampleRate16000Hz; break;\r
-               case 22050: iMdaAudioDataSettings.iSampleRate = TMdaAudioDataSettings::ESampleRate22050Hz; break;\r
-               case 44100: iMdaAudioDataSettings.iSampleRate = TMdaAudioDataSettings::ESampleRate44100Hz; break;\r
-               default:    iMdaAudioDataSettings.iSampleRate = TMdaAudioDataSettings::ESampleRate8000Hz;  break;\r
-       }\r
-\r
-       iMdaAudioDataSettings.iChannels   = (iStereo) ? TMdaAudioDataSettings::EChannelsStereo : TMdaAudioDataSettings::EChannelsMono;\r
-       iMdaAudioDataSettings.iCaps       = TMdaAudioDataSettings::ESampleRateFixed | iMdaAudioDataSettings.iSampleRate;\r
-       iMdaAudioDataSettings.iFlags      = TMdaAudioDataSettings::ENoNetworkRouting;\r
-\r
-       iMaxWriteSamples = iRate / iWritesPerSec;\r
-       if (iRate % iWritesPerSec)\r
-               iMaxWriteSamples++;\r
-       int bufferedFrames = iWritesPerSec / KUpdatesPerSec;\r
-\r
-       iBufferSize = iMaxWriteSamples * (iStereo ? 4 : 2);\r
-       iBufferSize *= bufferedFrames;\r
-       for (TInt i=0 ; i<KSoundBuffers ; i++)\r
-       {\r
-               // it seems .SetLength(max) throws USER:23 panic,\r
-               // so make them a bit larger\r
-               iSoundBuffers[i] = HBufC8::NewL(iBufferSize+4);\r
-               iSoundBuffers[i]->Des().FillZ  (iBufferSize+4);\r
-       }\r
-\r
-       iCurrentBuffer = 0;\r
-       iCurrentBufferSize = 0;\r
-\r
-       DEBUGPRINT(_L("sound: iMaxWriteSamples: %i, iBufferSize: %i"), iMaxWriteSamples, iBufferSize);\r
-\r
-       // here we actually test if we can create and open CMdaAudioOutputStream at all, but really create and use it later.\r
-       iMdaAudioOutputStream = CMdaAudioOutputStream::NewL(iListener, iServer);\r
-       if (iMdaAudioOutputStream) {\r
-               if (iVolume < 0 || iVolume > iMdaAudioOutputStream->MaxVolume())\r
-                       iVolume = iMdaAudioOutputStream->MaxVolume();\r
-               delete iMdaAudioOutputStream;\r
-               iMdaAudioOutputStream = 0;\r
-       }\r
-}\r
-\r
-// returns a pointer to buffer for next frame,\r
-// to be used when iSoundBuffers are used directly\r
-TInt16 *CGameAudioMS::NextFrameL(TInt aPcmFrames)\r
-{\r
-       TInt mul = iStereo ? 4 : 2;\r
-       TInt bytes = aPcmFrames * mul;\r
-       iCurrentPosition   += bytes / 2;\r
-       iCurrentBufferSize += bytes;\r
-\r
-       if (aPcmFrames > iMaxWriteSamples) {\r
-               DEBUGPRINT(_L("too many samples: %i > %i"), aPcmFrames, iMaxWriteSamples);\r
-       }\r
-\r
-       if (iCurrentBufferSize + iMaxWriteSamples * mul > iBufferSize)\r
-       {\r
-               //DEBUGPRINT(_L("write on iCurrentBufferSize %i"), iCurrentBufferSize);\r
-               WriteBlockL();\r
-       }\r
-\r
-       iScheduler->Schedule();\r
-\r
-       if(iListener.iUnderflowed) {\r
-               if(iListener.iUnderflowed > KMaxUnderflows) {\r
-                       delete iMdaAudioOutputStream;\r
-                       iMdaAudioOutputStream = 0;\r
-                       return 0;\r
-               }\r
-               UnderflowedL(); // not again!\r
-       }\r
-\r
-       return iCurrentPosition;\r
-}\r
-\r
-void CGameAudioMS::WriteBlockL()\r
-{\r
-       iScheduler->Schedule();\r
-       // do not write until stream is open\r
-       if(!iListener.iIsOpen) WaitForOpenToCompleteL();\r
-       //if(!iListener.iHasCopied) WaitForCopyToCompleteL(); // almost never happens anyway and sometimes even deadlocks?\r
-       //iListener.iHasCopied = EFalse;\r
-       \r
-\r
-       if(!iListener.iUnderflowed) {\r
-               TInt64 delta;\r
-               // don't write if sound is lagging too much\r
-               delta = iTime - iMdaAudioOutputStream->Position().Int64();\r
-               if (delta > MAKE_TINT64(0, KMaxLag))\r
-                       // another query sometimes returns very different result\r
-                       delta = iTime - iMdaAudioOutputStream->Position().Int64();\r
-\r
-               if(delta <= MAKE_TINT64(0, KMaxLag)) {\r
-                       //RDebug::Print(_L("delta: %i"), iTime.Low() - iMdaAudioOutputStream->Position().Int64().Low());\r
-                       iSoundBuffers[iCurrentBuffer]->Des().SetLength(iCurrentBufferSize);\r
-                       iMdaAudioOutputStream->WriteL(*iSoundBuffers[iCurrentBuffer]);\r
-                       iTime += KBlockTime;\r
-               } else {\r
-                       DEBUGPRINT(_L("lag: %i"), I64LOW(delta));\r
-               }\r
-       }\r
-\r
-       if (++iCurrentBuffer == KSoundBuffers)\r
-               iCurrentBuffer = 0;\r
-       iSoundBuffers[iCurrentBuffer]->Des().SetMax();\r
-       iCurrentPosition = (TInt16*) iSoundBuffers[iCurrentBuffer]->Ptr();\r
-       iCurrentBufferSize = 0;\r
-}\r
-\r
-void CGameAudioMS::Pause()\r
-{\r
-       if(!iMdaAudioOutputStream) return;\r
-\r
-       iScheduler->Schedule(); // let it finish it's stuff\r
-       iMdaAudioOutputStream->Stop();\r
-       delete iMdaAudioOutputStream;\r
-       iMdaAudioOutputStream = 0;\r
-}\r
-\r
-// call this before doing any playback!\r
-TInt16 *CGameAudioMS::ResumeL()\r
-{\r
-       DEBUGPRINT(_L("CGameAudioMS::Resume()"));\r
-       iScheduler->Schedule();\r
-\r
-       // we act a bit strange here: simulate buffer underflow, which actually starts audio\r
-       iListener.iIsOpen = ETrue;\r
-       iListener.iUnderflowed = 1;\r
-       iListener.iLastError = 0;\r
-       iCurrentBufferSize = 0;\r
-       iCurrentPosition = (TInt16*) iSoundBuffers[iCurrentBuffer]->Ptr();\r
-       return iCurrentPosition;\r
-}\r
-\r
-// handles underflow condition\r
-void CGameAudioMS::UnderflowedL()\r
-{\r
-#ifdef DEBUG_UNDERFLOWS\r
-       DEBUGPRINT(_L("UnderflowedL()"));\r
-#endif\r
-\r
-       if (iListener.iLastError != KErrUnderflow)\r
-       {\r
-               // recreate the stream\r
-               //iMdaAudioOutputStream->Stop();\r
-               if(iMdaAudioOutputStream) delete iMdaAudioOutputStream;\r
-               iMdaAudioOutputStream = CMdaAudioOutputStream::NewL(iListener, iServer);\r
-               iMdaAudioOutputStream->Open(&iMdaAudioDataSettings);\r
-               iMdaAudioOutputStream->SetAudioPropertiesL(iMdaAudioDataSettings.iSampleRate, iMdaAudioDataSettings.iChannels);\r
-               iMdaAudioOutputStream->SetVolume(iVolume); // new in UIQ3\r
-\r
-               iListener.iIsOpen = EFalse;   // wait for it to open\r
-               //iListener.iHasCopied = ETrue; // but don't wait for last copy to complete\r
-               // let it open and feed some stuff to make it happy\r
-               User::After(0);\r
-               iScheduler->Schedule();\r
-               iListener.iLastError = 0;\r
-               if(!iListener.iIsOpen) WaitForOpenToCompleteL();\r
-       } else {\r
-               iListener.iLastError = iListener.iUnderflowed = 0;\r
-       }\r
-       iTime = iMdaAudioOutputStream->Position().Int64();\r
-}\r
-\r
-void CGameAudioMS::WaitForOpenToCompleteL()\r
-{\r
-       DEBUGPRINT(_L("CGameAudioMS::WaitForOpenToCompleteL"));\r
-       TInt    count = 20;             // 2 seconds\r
-       TInt    waitPeriod = 100 * 1000;\r
-\r
-       if(!iListener.iIsOpen) {\r
-               // it is often enough to do this\r
-               User::After(0);\r
-               iScheduler->Schedule();\r
-       }\r
-       while (!iListener.iIsOpen && --count)\r
-       {\r
-               User::After(waitPeriod);\r
-               iScheduler->Schedule();\r
-       }\r
-       if (!iListener.iIsOpen)\r
-               User::LeaveIfError(KErrNotSupported);\r
-}\r
-\r
-TInt CGameAudioMS::ChangeVolume(TInt aUp)\r
-{\r
-       //DEBUGPRINT(_L("CGameAudioMS::ChangeVolume(%i)"), aUp);\r
-\r
-       if (iMdaAudioOutputStream) {\r
-               if (aUp) {\r
-                       iVolume += 5;\r
-                       if (iVolume > iMdaAudioOutputStream->MaxVolume())\r
-                               iVolume = iMdaAudioOutputStream->MaxVolume();\r
-               } else {\r
-                       iVolume -= 5;\r
-                       if (iVolume < 0) iVolume = 0;\r
-               }\r
-               iMdaAudioOutputStream->SetVolume(iVolume);\r
-       }\r
-\r
-       return iVolume;\r
-}\r
-\r
-void TGameAudioEventListener::MaoscOpenComplete(TInt aError)\r
-{\r
-#ifdef DEBUG_UNDERFLOWS\r
-       DEBUGPRINT(_L("CGameAudioMS::MaoscOpenComplete, error=%d"), aError);\r
-#endif\r
-\r
-       iIsOpen = ETrue;\r
-       if(aError) {\r
-               iLastError = aError;\r
-               iUnderflowed++;\r
-       }\r
-       else iUnderflowed = 0;\r
-}\r
-\r
-void TGameAudioEventListener::MaoscBufferCopied(TInt aError, const TDesC8& aBuffer)\r
-{\r
-       if (aError)\r
-               DEBUGPRINT(_L("CGameAudioMS::MaoscBufferCopied, error=%d"), aError);\r
-\r
-//     iHasCopied = ETrue;\r
-\r
-       if(aError) { // shit!\r
-               iLastError = aError;\r
-               iUnderflowed++;\r
-       }\r
-}\r
-\r
-void TGameAudioEventListener::MaoscPlayComplete(TInt aError)\r
-{\r
-#ifdef DEBUG_UNDERFLOWS\r
-       DEBUGPRINT(_L("CGameAudioMS::MaoscPlayComplete: %i"), aError);\r
-#endif\r
-       if(aError) {\r
-               iLastError = aError;\r
-               iUnderflowed++; // never happened to me while testing, but just in case\r
-       }\r
-}\r
-\r
diff --git a/platform/uiq3/engine/audio_mediaserver.h b/platform/uiq3/engine/audio_mediaserver.h
deleted file mode 100644 (file)
index fc94f7c..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************\r
- *\r
- *     File:           Audio_mediaserver.h\r
- *\r
- *     Author:         Peter van Sebille (peter@yipton.net)\r
- *\r
- *  Modified/adapted for picodriveN by notaz, 2006\r
- *\r
- *  (c) Copyright 2006, notaz\r
- *     (c) Copyright 2001, Peter van Sebille\r
- *     All Rights Reserved\r
- *\r
- *******************************************************************/\r
-\r
-#ifndef __AUDIO_MEDIASERVER_H\r
-#define __AUDIO_MEDIASERVER_H\r
-\r
-#include <mda/common/audio.h>\r
-#include <mdaaudiooutputstream.h>\r
-\r
-//#include "audio.h"\r
-#include "PolledAS.h"\r
-\r
-const TInt KSoundBuffers = 4;\r
-\r
-\r
-class TGameAudioEventListener : public MMdaAudioOutputStreamCallback\r
-{\r
-public: // implements MMdaAudioOutputStreamCallback\r
-       void MaoscOpenComplete(TInt aError);\r
-       void MaoscBufferCopied(TInt aError, const TDesC8& );\r
-       void MaoscPlayComplete(TInt aError);\r
-\r
-       TBool                                   iIsOpen;\r
-//     TBool                                   iHasCopied;\r
-       TInt                                    iUnderflowed;\r
-       TInt                                    iLastError;\r
-};\r
-\r
-\r
-class CGameAudioMS // : public IGameAudio // IGameAudio MUST be specified first!\r
-{\r
-public:        // implements IGameAudio\r
-       TInt16 *NextFrameL(TInt aPcmFrames);\r
-       TInt16 *ResumeL();\r
-       void Pause();\r
-       TInt ChangeVolume(TInt aUp);\r
-\r
-public:\r
-       ~CGameAudioMS();\r
-       CGameAudioMS(TInt aRate, TBool aStereo, TInt aWritesPerSec, TInt aVolume);\r
-       static CGameAudioMS* NewL(TInt aRate, TBool aStereo, TInt aWritesPerSec, TInt aVolume);\r
-\r
-protected:\r
-       void WriteBlockL();\r
-       void UnderflowedL();\r
-       void ConstructL();\r
-\r
-protected:\r
-       void WaitForOpenToCompleteL();\r
-\r
-       TInt                                    iRate;\r
-       TBool                                   iStereo;\r
-\r
-       CMdaAudioOutputStream   *iMdaAudioOutputStream;\r
-       TMdaAudioDataSettings   iMdaAudioDataSettings;\r
-\r
-       TGameAudioEventListener iListener;\r
-\r
-       CPolledActiveScheduler  *iScheduler;\r
-\r
-       HBufC8*                                 iSoundBuffers[KSoundBuffers];\r
-       TInt                                    iWritesPerSec;                  // fps, may be more actual writes\r
-       TInt                                    iMaxWriteSamples;               // max samples per write\r
-       TInt16*                                 iCurrentPosition;\r
-       TInt                                    iCurrentBuffer;                 // active buffer\r
-       TInt                                    iCurrentBufferSize;             // bytes filled in buffer\r
-       TInt                                    iBufferSize;\r
-       CMdaServer*                             iServer;\r
-\r
-       TInt64                                  iTime;\r
-       TInt                                    iVolume;\r
-};\r
-\r
-#endif                 /* __AUDIO_MEDIASERVER_H */\r
diff --git a/platform/uiq3/engine/blit.c b/platform/uiq3/engine/blit.c
deleted file mode 100644 (file)
index 809f0f7..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-\r
-/*\r
-void vidConvCpyRGB32 (void *to, void *from, int lines, int p240)\r
-{\r
-       unsigned short *ps = (unsigned short *) from;\r
-       unsigned long  *pd = (unsigned long *) to;\r
-       int x, y;\r
-       int to_x = p240 ? 240 : 224;\r
-       if(!p240) pd += 8;\r
-\r
-       for(y = 0; y < lines; y++) // ps < ps_end; ps++)\r
-               for(x = 0; x < to_x; x++, ps++)\r
-                       // Convert          0000bbb0 ggg0rrr0\r
-                       // to  ..0 rrr00000 ggg00000 bbb00000\r
-                       *(pd+y*256+x) = ((*ps&0x000F)<<20) | ((*ps&0x00F0)<<8) | ((*ps&0x0F00)>>4);\r
-}\r
-*/\r
-\r
-// stubs\r
-void vidConvCpyRGB32  (void *to, void *from, int pixels) {}\r
-void vidConvCpyRGB32sh(void *to, void *from, int pixels) {}\r
-void vidConvCpyRGB32hi(void *to, void *from, int pixels) {}\r
-\r
-void vidConvCpy_90        (void *to, void *from, void *pal, int width) {}\r
-void vidConvCpy_270       (void *to, void *from, void *pal, int width) {}\r
-void vidConvCpy_center_0  (void *to, void *from, void *pal) {}\r
-void vidConvCpy_center_180(void *to, void *from, void *pal) {}\r
-void vidConvCpy_center2_40c_0  (void *to, void *from, void *pal, int lines) {}\r
-void vidConvCpy_center2_40c_180(void *to, void *from, void *pal, int lines) {}\r
-void vidConvCpy_center2_32c_0  (void *to, void *from, void *pal, int lines) {}\r
-void vidConvCpy_center2_32c_180(void *to, void *from, void *pal, int lines) {}\r
-\r
-void vidClear(void *to, int lines) {}\r
-\r
diff --git a/platform/uiq3/engine/blit.h b/platform/uiq3/engine/blit.h
deleted file mode 100644 (file)
index 4255b38..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// (c) Copyright 2006 notaz, All rights reserved.\r
-// Free for non-commercial use.\r
-\r
-// For commercial use, separate licencing terms must be obtained.\r
-\r
-extern "C"\r
-{\r
-       void vidConvCpyRGB32  (void *to, void *from, int pixels);\r
-       void vidConvCpyRGB32sh(void *to, void *from, int pixels);\r
-       void vidConvCpyRGB32hi(void *to, void *from, int pixels);\r
-\r
-       void vidConvCpy_90        (void *to, void *from, void *pal, int width);\r
-       void vidConvCpy_270       (void *to, void *from, void *pal, int width);\r
-       void vidConvCpy_center_0  (void *to, void *from, void *pal);\r
-       void vidConvCpy_center_180(void *to, void *from, void *pal);\r
-       void vidConvCpy_center2_40c_0  (void *to, void *from, void *pal, int lines);\r
-       void vidConvCpy_center2_40c_180(void *to, void *from, void *pal, int lines);\r
-       void vidConvCpy_center2_32c_0  (void *to, void *from, void *pal, int lines);\r
-       void vidConvCpy_center2_32c_180(void *to, void *from, void *pal, int lines);\r
-\r
-       void vidClear(void *to, int lines);\r
-}\r
diff --git a/platform/uiq3/engine/blit.s b/platform/uiq3/engine/blit.s
deleted file mode 100644 (file)
index f10a3cc..0000000
+++ /dev/null
@@ -1,724 +0,0 @@
-@ vim:filetype=armasm\r
-@ some color conversion and blitting routines\r
-\r
-@ (c) Copyright 2006, notaz\r
-@ All Rights Reserved\r
-\r
-.include "port_config.s"\r
-\r
-\r
-@ Convert 0000bbb0 ggg0rrr0 0000bbb0 ggg0rrr0\r
-@ to      00000000 rrr00000 ggg00000 bbb00000 ...\r
-\r
-@ lr =  0x00e000e0, out: r3=lower_pix, r2=higher_pix; trashes rin\r
-@ if sh==2, r8=0x00404040 (sh!=0 destroys flags!)\r
-.macro convRGB32_2 rin sh=0\r
-    and     r2,  lr, \rin, lsr #4 @ blue\r
-    and     r3,  \rin, lr\r
-    orr     r2,  r2,   r3, lsl #8         @ g0b0g0b0\r
-\r
-    mov     r3,  r2,  lsl #16             @ g0b00000\r
-    and     \rin,lr,  \rin, ror #12       @ 00r000r0 (reversed)\r
-    orr     r3,  r3,  \rin, lsr #16       @ g0b000r0\r
-.if \sh == 1\r
-    mov     r3,  r3,  ror #17             @ shadow mode\r
-.elseif \sh == 2\r
-    adds    r3,  r3,  #0x40000000         @ green\r
-    orrcs   r3,  r3,  #0xe0000000\r
-    mov     r3,  r3,  ror #8\r
-    adds    r3,  r3,  #0x40000000\r
-    orrcs   r3,  r3,  #0xe0000000\r
-    mov     r3,  r3,  ror #16\r
-    adds    r3,  r3,  #0x40000000\r
-    orrcs   r3,  r3,  #0xe0000000\r
-    mov     r3,  r3,  ror #24\r
-    orr     r3,  r3,   r3, lsr #3\r
-.else\r
-    mov     r3,  r3,  ror #16             @ r3=low\r
-    orr     r3,  r3,   r3, lsr #3\r
-.endif\r
-\r
-    str     r3, [r0], #4\r
-\r
-    mov     r2,  r2,  lsr #16\r
-    orr     r2,  r2,  \rin, lsl #16\r
-.if \sh == 1\r
-    mov     r2,  r2,  lsr #1\r
-.elseif \sh == 2\r
-    mov     r2,  r2,  ror #8\r
-    adds    r2,  r2,  #0x40000000         @ blue\r
-    orrcs   r2,  r2,  #0xe0000000\r
-    mov     r2,  r2,  ror #8\r
-    adds    r2,  r2,  #0x40000000\r
-    orrcs   r2,  r2,  #0xe0000000\r
-    mov     r2,  r2,  ror #8\r
-    adds    r2,  r2,  #0x40000000\r
-    orrcs   r2,  r2,  #0xe0000000\r
-    mov     r2,  r2,  ror #8\r
-    orr     r2,  r2,   r2,  lsr #3\r
-.else\r
-    orr     r2,  r2,   r2,  lsr #3\r
-.endif\r
-\r
-    str     r2, [r0], #4\r
-.endm\r
-\r
-\r
-.global vidConvCpyRGB32 @ void *to, void *from, int pixels\r
-\r
-vidConvCpyRGB32:\r
-    stmfd   sp!, {r4-r7,lr}\r
-\r
-    mov     r12, r2, lsr #3 @ repeats\r
-    mov     lr, #0x00e00000\r
-    orr     lr, lr, #0x00e0\r
-\r
-.loopRGB32:\r
-    subs    r12, r12, #1\r
-\r
-    ldmia    r1!, {r4-r7}\r
-    convRGB32_2 r4\r
-    convRGB32_2 r5\r
-    convRGB32_2 r6\r
-    convRGB32_2 r7\r
-\r
-    bgt     .loopRGB32\r
-\r
-    ldmfd   sp!, {r4-r7,lr}\r
-    bx      lr\r
-\r
-\r
-.global vidConvCpyRGB32sh @ void *to, void *from, int pixels\r
-\r
-vidConvCpyRGB32sh:\r
-    stmfd   sp!, {r4-r7,lr}\r
-\r
-    mov     r12, r2, lsr #3 @ repeats\r
-    mov     lr, #0x00e00000\r
-    orr     lr, lr, #0x00e0\r
-\r
-.loopRGB32sh:\r
-    subs    r12, r12, #1\r
-\r
-    ldmia    r1!, {r4-r7}\r
-    convRGB32_2 r4, 1\r
-    convRGB32_2 r5, 1\r
-    convRGB32_2 r6, 1\r
-    convRGB32_2 r7, 1\r
-\r
-    bgt     .loopRGB32sh\r
-\r
-    ldmfd   sp!, {r4-r7,lr}\r
-    bx      lr\r
-\r
-\r
-.global vidConvCpyRGB32hi @ void *to, void *from, int pixels\r
-\r
-vidConvCpyRGB32hi:\r
-    stmfd   sp!, {r4-r7,lr}\r
-\r
-    mov     r12, r2, lsr #3 @ repeats\r
-    mov     lr, #0x00e00000\r
-    orr     lr, lr, #0x00e0\r
-\r
-.loopRGB32hi:\r
-     ldmia    r1!, {r4-r7}\r
-    convRGB32_2 r4, 2\r
-    convRGB32_2 r5, 2\r
-    convRGB32_2 r6, 2\r
-    convRGB32_2 r7, 2\r
-\r
-    subs    r12, r12, #1\r
-    bgt     .loopRGB32hi\r
-\r
-    ldmfd   sp!, {r4-r7,lr}\r
-    bx      lr\r
-\r
-\r
-@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r
-\r
-@ -------- M2 stuff ---------\r
-/*\r
-.global vidConvCpy_90 @ void *to, void *from, int width\r
-\r
-vidConvCpy_90:\r
-    stmfd   sp!, {r4-r10,lr}\r
-\r
-    mov     lr, #0x00F00000\r
-    orr     lr, lr, #0x00F0\r
-\r
-    mov     r12, #224/4            @ row counter\r
-    mov     r10, r2, lsl #2        @ we do 2 pixel wide copies\r
-\r
-    add     r8,  r0, #256*4        @ parallel line\r
-    add     r1,  r1, #0x23000\r
-    add     r1,  r1, #0x00B80      @ r1+=328*223*2+8*2\r
-    mov     r9,  r1\r
-\r
-    mov     r4,  #0                @ fill bottom border\r
-    mov     r5,  #0\r
-    mov     r6,  #0\r
-    mov     r7,  #0\r
-    stmia   r0!, {r4-r7}\r
-    stmia   r0!, {r4-r7}\r
-    stmia   r8!, {r4-r7}\r
-    stmia   r8!, {r4-r7}\r
-\r
-.loopM2RGB32_90:\r
-       subs    r12, r12, #1\r
-\r
-    @ at first this loop was written differently: src pixels were fetched with ldm's and\r
-    @ dest was not sequential. It ran nearly 2 times slower. It seems it is very important\r
-    @ to do sequential memory access on those items, which we have more (to offload addressing bus?).\r
-\r
-    ldr     r4, [r1], #-328*2\r
-    ldr     r5, [r1], #-328*2\r
-    ldr     r6, [r1], #-328*2\r
-    ldr     r7, [r1], #-328*2\r
-\r
-    convRGB32_2 r4, 1\r
-    convRGB32_2 r5, 1\r
-    convRGB32_2 r6, 1\r
-    convRGB32_2 r7, 1\r
-\r
-    str     r4, [r8], #4\r
-    str     r5, [r8], #4\r
-    str     r6, [r8], #4\r
-    str     r7, [r8], #4\r
-\r
-    bne     .loopM2RGB32_90\r
-\r
-    mov     r4,  #0                @ top border\r
-    mov     r5,  #0\r
-    mov     r6,  #0\r
-    stmia   r0!, {r4-r6,r12}\r
-    stmia   r0!, {r4-r6,r12}\r
-    stmia   r8!, {r4-r6,r12}\r
-    stmia   r8!, {r4-r6,r12}\r
-\r
-    subs    r10, r10, #1\r
-    ldmeqfd sp!, {r4-r10,pc}        @ return\r
-\r
-    add     r0,  r8,  #16*4         @ set new dst pointer\r
-    add     r8,  r0,  #256*4\r
-    add     r9,  r9,  #2*2          @ fix src pointer\r
-    mov     r1,  r9\r
-\r
-    stmia   r0!, {r4-r6,r12}        @ bottom border\r
-    stmia   r0!, {r4-r6,r12}\r
-    stmia   r8!, {r4-r6,r12}\r
-    stmia   r8!, {r4-r6,r12}\r
-\r
-    mov     r12, #224/4             @ restore row counter\r
-    b       .loopM2RGB32_90\r
-\r
-\r
-\r
-@ converter for vidConvCpy_270\r
-@ lr =  0x00F000F0, out: r3=lower_pix, r2=higher_pix; trashes rin\r
-.macro convRGB32_3 rin\r
-    and     r2,  lr, \rin, lsr #4 @ blue\r
-    and     r3,  \rin, lr\r
-    orr     r2,  r2,   r3, lsl #8         @ g0b0g0b0\r
-\r
-    mov     r3,  r2,  lsl #16             @ g0b00000\r
-    and     \rin,lr,  \rin, ror #12       @ 00r000r0 (reversed)\r
-    orr     r3,  r3,  \rin, lsr #16       @ g0b000r0\r
-\r
-    mov     r2,  r2,  lsr #16\r
-    orr     r2,  r2,  \rin, lsl #16\r
-    str     r2, [r0], #4\r
-\r
-    mov     \rin,r3,  ror #16             @ r3=low\r
-.endm\r
-*/\r
-@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r
-\r
-\r
-@ takes byte-sized pixels from r3-r6, fetches from pal and stores to r7,r8,r10,lr\r
-@ r2=pal\r
-.macro mode2_4pix shift\r
-    and     r7, r11, r3, lsr #\shift\r
-    ldr     r7, [r2, r7, lsl #2]\r
-\r
-    and     r8, r11, r4, lsr #\shift\r
-    ldr     r8, [r2, r8, lsl #2]\r
-\r
-    and     r10,r11, r5, lsr #\shift\r
-    ldr     r10,[r2, r10,lsl #2]\r
-\r
-    and     lr, r11, r6, lsr #\shift\r
-    ldr     lr, [r2, lr, lsl #2]\r
-.endm\r
-\r
-@ r2=pal, r11=0xff\r
-.macro mode2_4pix_getpix0 dreg sreg\r
-    and     \dreg, r11, \sreg\r
-    ldr     \dreg, [r2, \dreg, lsl #2]\r
-.endm\r
-\r
-.macro mode2_4pix_getpix1 dreg sreg\r
-    and     \dreg, r11, \sreg, lsr #8\r
-    ldr     \dreg, [r2, \dreg, lsl #2]\r
-.endm\r
-\r
-.macro mode2_4pix_getpix2 dreg sreg\r
-    and     \dreg, r11, \sreg, lsr #16\r
-    ldr     \dreg, [r2, \dreg, lsl #2]\r
-.endm\r
-\r
-.macro mode2_4pix_getpix3 dreg sreg\r
-    and     \dreg, r11, \sreg, lsr #24\r
-    ldr     \dreg, [r2, \dreg, lsl #2]\r
-.endm\r
-\r
-@ takes byte-sized pixels from reg, fetches from pal and stores to r3-r6\r
-@ r11=0xFF, r2=pal\r
-.macro mode2_4pix2_0 reg\r
-    mode2_4pix_getpix0 r3, \reg\r
-    mode2_4pix_getpix1 r4, \reg\r
-    mode2_4pix_getpix2 r5, \reg\r
-    mode2_4pix_getpix3 r6, \reg\r
-.endm\r
-\r
-@ ...\r
-.macro mode2_4pix2_180 reg\r
-    mode2_4pix_getpix3 r3, \reg\r
-    mode2_4pix_getpix2 r4, \reg\r
-    mode2_4pix_getpix1 r5, \reg\r
-    mode2_4pix_getpix0 r6, \reg\r
-.endm\r
-\r
-@ takes byte-sized pixels from reg, fetches from pal and stores to r3-r5\r
-@ r11=0xFF, r2=pal, r10=0xfcfcfc, r6=tmp\r
-.macro mode2_4pix_to3 reg is180\r
-.if \is180\r
-    mode2_4pix_getpix3 r3, \reg\r
-    mode2_4pix_getpix2 r4, \reg\r
-.else\r
-    mode2_4pix_getpix0 r3, \reg     @ gathering loads cause a weird-hang\r
-    mode2_4pix_getpix1 r4, \reg\r
-.endif\r
-\r
-    sub     r3, r3,  r3, lsr #2     @ r3 *= 0.75\r
-    add     r3, r3,  r4, lsr #2     @ r3 += r4 * 0.25\r
-    and     r3, r3,  r10\r
-\r
-.if \is180\r
-    mode2_4pix_getpix1 r5, \reg\r
-    mode2_4pix_getpix0 r6, \reg\r
-.else\r
-    mode2_4pix_getpix2 r5, \reg\r
-    mode2_4pix_getpix3 r6, \reg\r
-.endif\r
-\r
-    mov     r4, r4,  lsr #1\r
-    add     r4, r4,  r5, lsr #1     @ r4 = (r4 + r5) / 2;\r
-@    and     r4, r4,  r10\r
-    sub     r6, r6,  r6, lsr #2     @ r6 *= 0.75\r
-    add     r5, r6,  r5, lsr #2     @ r5 = r6 + r5 * 0.25\r
-    and     r5, r5,  r10\r
-.endm\r
-\r
-\r
-@ void *to, void *from, void *pal, int width\r
-.macro vidConvCpyM2_landscape is270\r
-    stmfd   sp!, {r4-r11,lr}\r
-\r
-    mov     r11, #0xff\r
-\r
-    mov     r12, #(224/4-1)<<16    @ row counter\r
-    orr     r12, r12, r3, lsl #1   @ we do 4 pixel wide copies (right to left)\r
-\r
-.if \is270\r
-    add     r1,  r1, #324\r
-.else\r
-    add     r1,  r1, #0x11c00\r
-    add     r1,  r1, #0x00308      @ 328*224+8\r
-.endif\r
-    mov     r9,  r1\r
-\r
-    mov     r3,  #0                @ fill top border\r
-    mov     r4,  #0\r
-    mov     r5,  #0\r
-    mov     r6,  #0\r
-    stmia   r0!, {r3-r6}\r
-    stmia   r0!, {r3-r6}\r
-    add     r7,  r0, #(240+BORDER_R)*4-8*4\r
-    stmia   r7!, {r3-r6}\r
-    stmia   r7!, {r3-r6}\r
-    add     r7,  r7, #(240+BORDER_R)*4-8*4\r
-    stmia   r7!, {r3-r6}\r
-    stmia   r7!, {r3-r6}\r
-    add     r7,  r7, #(240+BORDER_R)*4-8*4\r
-    stmia   r7!, {r3-r6}\r
-    stmia   r7!, {r3-r6}\r
-\r
-0: @ .loopM2RGB32_270:\r
-       subs    r12, r12, #1<<16\r
-\r
-.if \is270\r
-    ldr     r3, [r1], #328\r
-    ldr     r4, [r1], #328\r
-    ldr     r5, [r1], #328\r
-    ldr     r6, [r1], #328\r
-.else\r
-    ldr     r3, [r1, #-328]!\r
-    ldr     r4, [r1, #-328]!\r
-    ldr     r5, [r1, #-328]!\r
-    ldr     r6, [r1, #-328]!\r
-.endif\r
-\r
-.if \is270\r
-    mode2_4pix 24\r
-.else\r
-    mode2_4pix  0\r
-.endif\r
-    stmia   r0, {r7,r8,r10,lr}\r
-    add     r0, r0, #(240+BORDER_R)*4\r
-\r
-.if \is270\r
-    mode2_4pix 16\r
-.else\r
-    mode2_4pix  8\r
-.endif\r
-    stmia   r0, {r7,r8,r10,lr}\r
-    add     r0, r0, #(240+BORDER_R)*4\r
-\r
-.if \is270\r
-    mode2_4pix  8\r
-.else\r
-    mode2_4pix 16\r
-.endif\r
-    stmia   r0, {r7,r8,r10,lr}\r
-    add     r0, r0, #(240+BORDER_R)*4\r
-\r
-.if \is270\r
-    mode2_4pix  0\r
-.else\r
-    mode2_4pix 24\r
-.endif\r
-    stmia   r0!,{r7,r8,r10,lr}\r
-    sub     r0, r0, #(240+BORDER_R)*4*3\r
-\r
-    bpl     0b @ .loopM2RGB32_270\r
-\r
-    mov     r3,  #0                @ bottom border\r
-    mov     r4,  #0\r
-    mov     r5,  #0\r
-    mov     r6,  #0\r
-    stmia   r0!, {r3-r6}\r
-    stmia   r0!, {r3-r6}\r
-    add     r0,  r0, #(240+BORDER_R)*4-8*4\r
-    stmia   r0!, {r3-r6}\r
-    stmia   r0!, {r3-r6}\r
-    add     r0,  r0, #(240+BORDER_R)*4-8*4\r
-    stmia   r0!, {r3-r6}\r
-    stmia   r0!, {r3-r6}\r
-    add     r0,  r0, #(240+BORDER_R)*4-8*4\r
-    stmia   r0!, {r3-r6}\r
-    nop                             @ phone crashes if this is commented out. Do I stress it too much?\r
-    stmia   r0!, {r3-r6}\r
-\r
-    add     r12, r12, #1<<16\r
-    subs    r12, r12, #1\r
-    ldmeqfd sp!, {r4-r11,pc}        @ return\r
-\r
-.if BORDER_R\r
-    add     r0,  r0, #BORDER_R*4\r
-.endif\r
-.if \is270\r
-    sub     r9,  r9, #4            @ fix src pointer\r
-.else\r
-    add     r9,  r9, #4\r
-.endif\r
-    mov     r1,  r9\r
-\r
-    stmia   r0!, {r3-r6}            @ top border\r
-    stmia   r0!, {r3-r6}\r
-    add     r7,  r0, #(240+BORDER_R)*4-8*4\r
-    stmia   r7!, {r3-r6}\r
-    stmia   r7!, {r3-r6}\r
-    add     r7,  r7, #(240+BORDER_R)*4-8*4\r
-    stmia   r7!, {r3-r6}\r
-    stmia   r7!, {r3-r6}\r
-    add     r7,  r7, #(240+BORDER_R)*4-8*4\r
-    stmia   r7!, {r3-r6}\r
-    stmia   r7!, {r3-r6}\r
-\r
-    orr     r12, r12, #(224/4-1)<<16 @ restore row counter\r
-    b       0b @ .loopM2RGB32_270\r
-.endm\r
-\r
-\r
-.global vidConvCpy_90 @ void *to, void *from, void *pal, int width\r
-\r
-vidConvCpy_90:\r
-    vidConvCpyM2_landscape 0\r
-\r
-\r
-.global vidConvCpy_270 @ void *to, void *from, void *pal, int width\r
-\r
-vidConvCpy_270:\r
-    vidConvCpyM2_landscape 1\r
-\r
-\r
-.global vidConvCpy_center_0 @ void *to, void *from, void *pal\r
-\r
-vidConvCpy_center_0:\r
-    stmfd   sp!, {r4-r6,r11,lr}\r
-\r
-    mov     r11, #0xff\r
-    add     r1,  r1, #8     @ not border (centering 32col here)\r
-\r
-    mov     r12, #(240/4-1)<<16\r
-    orr     r12, r12, #224\r
-\r
-.loopRGB32_c0:\r
-    ldr     lr, [r1], #4\r
-       subs    r12, r12, #1<<16\r
-\r
-    mode2_4pix2_0 lr\r
-    stmia   r0!, {r3-r6}\r
-    bpl     .loopRGB32_c0\r
-\r
-       sub     r12, r12, #1\r
-       adds    r12, r12, #1<<16\r
-    ldmeqfd sp!, {r4-r6,r11,pc} @ return\r
-.if BORDER_R\r
-    add     r0,  r0, #BORDER_R*4\r
-.endif\r
-    add     r1,  r1, #88\r
-    orr     r12, #(240/4-1)<<16\r
-    b       .loopRGB32_c0\r
-\r
-\r
-.global vidConvCpy_center_180 @ void *to, void *from, void *pal\r
-\r
-vidConvCpy_center_180:\r
-    stmfd   sp!, {r4-r6,r11,lr}\r
-\r
-    mov     r11, #0xff\r
-    add     r1,  r1, #0x11c00\r
-    add     r1,  r1, #0x002B8 @ #328*224-72\r
-\r
-    mov     r12, #(240/4-1)<<16\r
-    orr     r12, r12, #224\r
-\r
-.loopRGB32_c180:\r
-    ldr     lr, [r1, #-4]!\r
-       subs    r12, r12, #1<<16\r
-\r
-    mode2_4pix2_180 lr\r
-    stmia   r0!, {r3-r6}\r
-    bpl     .loopRGB32_c180\r
-\r
-       sub     r12, r12, #1\r
-       adds    r12, r12, #1<<16\r
-    ldmeqfd sp!, {r4-r6,r11,pc} @ return\r
-.if BORDER_R\r
-    add     r0,  r0, #BORDER_R*4\r
-.endif\r
-    sub     r1,  r1, #88\r
-    orr     r12, #(240/4-1)<<16\r
-    b       .loopRGB32_c180\r
-\r
-\r
-@ note: the following code assumes that (pal[x] & 0x030303) == 0\r
-\r
-.global vidConvCpy_center2_40c_0 @ void *to, void *from, void *pal, int lines\r
-\r
-vidConvCpy_center2_40c_0:\r
-    stmfd   sp!, {r4-r6,r10,r11,lr}\r
-\r
-    mov     r11, #0xff\r
-    mov     r10, #0xfc\r
-    orr     r10, r10, lsl #8\r
-    orr     r10, r10, lsl #8\r
-    add     r1,  r1, #8     @ border\r
-\r
-    mov     r12, #(240/3-1)<<16\r
-    orr     r12, r12, r3\r
-\r
-.loopRGB32_c2_40c_0:\r
-    ldr     lr, [r1], #4\r
-       subs    r12, r12, #1<<16\r
-\r
-    mode2_4pix_to3 lr, 0\r
-\r
-    stmia   r0!, {r3-r5}\r
-    bpl     .loopRGB32_c2_40c_0\r
-\r
-       sub     r12, r12, #1\r
-       adds    r12, r12, #1<<16\r
-    ldmeqfd sp!, {r4-r6,r10,r11,pc} @ return\r
-.if BORDER_R\r
-    add     r0,  r0, #BORDER_R*4\r
-.endif\r
-    add     r1,  r1, #8\r
-    orr     r12, #(240/3-1)<<16\r
-    b       .loopRGB32_c2_40c_0\r
-\r
-\r
-.global vidConvCpy_center2_40c_180 @ void *to, void *from, void *pal, int lines\r
-\r
-vidConvCpy_center2_40c_180:\r
-    stmfd   sp!, {r4-r6,r10,r11,lr}\r
-\r
-    mov     r11, #0xff\r
-    mov     r10, #0xfc\r
-    orr     r10, r10, lsl #8\r
-    orr     r10, r10, lsl #8\r
-\r
-    mov     r4,  #328\r
-    mla     r1,  r3, r4, r1\r
-@    add     r1,  r1, #0x11000\r
-@    add     r1,  r1, #0x00f00 @ #328*224\r
-\r
-    mov     r12, #(240/3-1)<<16\r
-    orr     r12, r12, r3\r
-\r
-.loop_c2_40c_180:\r
-    ldr     lr, [r1, #-4]!\r
-       subs    r12, r12, #1<<16\r
-\r
-    mode2_4pix_to3 lr, 1\r
-\r
-    stmia   r0!, {r3-r5}\r
-    bpl     .loop_c2_40c_180\r
-\r
-       sub     r12, r12, #1\r
-       adds    r12, r12, #1<<16\r
-    ldmeqfd sp!, {r4-r6,r10,r11,pc} @ return\r
-.if BORDER_R\r
-    add     r0,  r0, #BORDER_R*4\r
-.endif\r
-    sub     r1,  r1, #8\r
-    orr     r12, #(240/3-1)<<16\r
-    b       .loop_c2_40c_180\r
-\r
-\r
-.global vidConvCpy_center2_32c_0 @ void *to, void *from, void *pal, int lines\r
-\r
-vidConvCpy_center2_32c_0:\r
-    stmfd   sp!, {r4-r11,lr}\r
-\r
-    mov     r10, #0xfc\r
-    orr     r10, r10, lsl #8\r
-    orr     r10, r10, lsl #8\r
-    mov     r11, #0xff\r
-    add     r1,  r1, #8     @ border\r
-\r
-    mov     r12, #(240/15-1)<<16\r
-    orr     r12, r12, r3\r
-\r
-.loop_c2_32c_0:\r
-    ldmia   r1!, {r7-r9,lr}\r
-       subs    r12, r12, #1<<16\r
-\r
-    mode2_4pix2_0 r7\r
-    stmia   r0!, {r3-r6}\r
-    mode2_4pix2_0 r8\r
-    stmia   r0!, {r3-r6}\r
-    mode2_4pix2_0 r9\r
-    stmia   r0!, {r3-r6}\r
-    mode2_4pix_to3 lr, 0\r
-    stmia   r0!, {r3-r5}\r
-    bpl     .loop_c2_32c_0\r
-\r
-       sub     r12, r12, #1\r
-       adds    r12, r12, #1<<16\r
-    ldmeqfd sp!, {r4-r11,pc} @ return\r
-.if BORDER_R\r
-    add     r0,  r0, #BORDER_R*4\r
-.endif\r
-    add     r1,  r1, #64+8\r
-    orr     r12, #(240/15-1)<<16\r
-    b       .loop_c2_32c_0\r
-\r
-\r
-.global vidConvCpy_center2_32c_180 @ void *to, void *from, void *pal, int lines\r
-\r
-vidConvCpy_center2_32c_180:\r
-    stmfd   sp!, {r4-r11,lr}\r
-\r
-    mov     r10, #0xfc\r
-    orr     r10, r10, lsl #8\r
-    orr     r10, r10, lsl #8\r
-    mov     r11, #0xff\r
-\r
-    mov     r4,  #328\r
-    mla     r1,  r3, r4, r1\r
-@    add     r1,  r1, #0x11000\r
-@    add     r1,  r1, #0x00f00 @ #328*224\r
-\r
-    mov     r12, #(240/15-1)<<16\r
-    orr     r12, r12, r3\r
-\r
-.loop_c2_32c_180:\r
-    ldmdb   r1!, {r7-r9,lr}\r
-       subs    r12, r12, #1<<16\r
-\r
-    mode2_4pix2_180 lr\r
-    stmia   r0!, {r3-r6}\r
-    mode2_4pix2_180 r9\r
-    stmia   r0!, {r3-r6}\r
-    mode2_4pix2_180 r8\r
-    stmia   r0!, {r3-r6}\r
-    mode2_4pix_to3 r7, 1\r
-    stmia   r0!, {r3-r5}\r
-    bpl     .loop_c2_32c_180\r
-\r
-       sub     r12, r12, #1\r
-       adds    r12, r12, #1<<16\r
-    ldmeqfd sp!, {r4-r11,pc} @ return\r
-.if BORDER_R\r
-    add     r0,  r0, #BORDER_R*4\r
-.endif\r
-    sub     r1,  r1, #64+8\r
-    orr     r12, #(240/15-1)<<16\r
-    b       .loop_c2_32c_180\r
-\r
-\r
-@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r
-\r
-\r
-.global vidClear @ void *to, int lines\r
-\r
-vidClear:\r
-    stmfd   sp!, {lr}\r
-    mov     r12, #240/16-1\r
-    orr     r12, r1, r12, lsl #16\r
-    mov     r1, #0\r
-    mov     r2, #0\r
-    mov     r3, #0\r
-    mov     lr, #0\r
-\r
-.loopVidClear:\r
-       subs    r12, r12, #1<<16\r
-\r
-    stmia   r0!, {r1-r3,lr}\r
-    stmia   r0!, {r1-r3,lr}\r
-    stmia   r0!, {r1-r3,lr}\r
-    stmia   r0!, {r1-r3,lr}\r
-    bpl     .loopVidClear\r
-\r
-       sub     r12, r12, #1\r
-       adds    r12, r12, #1<<16\r
-    ldmeqfd sp!, {pc}        @ return\r
-.if BORDER_R\r
-    add     r0,  r0, #BORDER_R*4\r
-.endif\r
-    orr     r12, #(240/16-1)<<16\r
-    b       .loopVidClear\r
-\r
-@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r
-\r
-.equ EExecSetExceptionHandler, (90)\r
-\r
-.global my_SetExceptionHandler\r
-\r
-my_SetExceptionHandler:\r
-    mov     ip, lr\r
-    swi     EExecSetExceptionHandler\r
-\r
diff --git a/platform/uiq3/engine/debug.cpp b/platform/uiq3/engine/debug.cpp
deleted file mode 100644 (file)
index 46725f3..0000000
+++ /dev/null
@@ -1,270 +0,0 @@
-\r
-#include <e32svr.h> // RDebug\r
-#include "debug.h"\r
-\r
-//#define LOG_FILE "C:\\logs\\pico.log"\r
-#define LOG_FILE _L("D:\\pico.log")\r
-\r
-#ifdef __WINS__\r
-\r
-void ExceptionHandler(TExcType exc) {}\r
-\r
-#else\r
-\r
-static const wchar_t * const exception_names[] = {\r
-       L"General",\r
-       L"IntegerDivideByZero",\r
-       L"SingleStep",\r
-       L"BreakPoint",\r
-       L"IntegerOverflow",\r
-       L"BoundsCheck",\r
-       L"InvalidOpCode",\r
-       L"DoubleFault",\r
-       L"StackFault",\r
-       L"AccessViolation",\r
-       L"PrivInstruction",\r
-       L"Alignment",\r
-       L"PageFault",\r
-       L"FloatDenormal",\r
-       L"FloatDivideByZero",\r
-       L"FloatInexactResult",\r
-       L"FloatInvalidOperation",\r
-       L"FloatOverflow",\r
-       L"FloatStackCheck",\r
-       L"FloatUnderflow",\r
-       L"Abort",\r
-       L"Kill",\r
-       L"DataAbort",\r
-       L"CodeAbort",\r
-       L"MaxNumber",\r
-       L"InvalidVector",\r
-       L"UserInterrupt",\r
-       L"Unknown"\r
-};\r
-\r
-\r
-#if 0\r
-static void getASpace(TUint *code_start, TUint *code_end, TUint *stack_start, TUint *stack_end)\r
-{\r
-       TUint pc, sp;\r
-       RChunk chunk;\r
-       TFullName chunkname;\r
-       TFindChunk findChunk(_L("*"));\r
-\r
-       asm volatile ("str pc, %0" : "=m" (pc) );\r
-       asm volatile ("str sp, %0" : "=m" (sp) );\r
-\r
-       while( findChunk.Next(chunkname) != KErrNotFound ) {\r
-               chunk.Open(findChunk);\r
-               if((TUint)chunk.Base()+chunk.Bottom() < pc && pc < (TUint)chunk.Base()+chunk.Top()) {\r
-                       if(code_start) *code_start = (TUint)chunk.Base()+chunk.Bottom();\r
-                       if(code_end)   *code_end   = (TUint)chunk.Base()+chunk.Top();\r
-               } else\r
-               if((TUint)chunk.Base()+chunk.Bottom() < sp && sp < (TUint)chunk.Base()+chunk.Top()) {\r
-                       if(stack_start) *stack_start = (TUint)chunk.Base()+chunk.Bottom();\r
-                       if(stack_end)   *stack_end   = (TUint)chunk.Base()+chunk.Top();\r
-               }\r
-               chunk.Close();\r
-       }\r
-}\r
-#endif\r
-\r
-// tmp\r
-#if defined(__DEBUG_PRINT)\r
-extern "C" char *PDebugMain();\r
-#endif\r
-\r
-// our very own exception handler\r
-void ExceptionHandler(TExcType exc)\r
-{\r
-       DEBUGPRINT(_L("ExceptionHandler() called!!!")); // this seems to never be called\r
-\r
-#if 0\r
-       TUint lr, sp, i;\r
-       TUint stack_end = 0;                            // ending address of our stack chunk\r
-       TUint code_start = 0, code_end = 0; // starting and ending addresses of our code chunk\r
-       TUint guessed_address = 0;\r
-\r
-       asm volatile ("str lr, %0" : "=m" (lr) );\r
-       asm volatile ("str sp, %0" : "=m" (sp) );\r
-\r
-       // first get some info about the chunks we live in\r
-       getASpace(&code_start, &code_end, 0, &stack_end);\r
-\r
-       // now we begin some black magic tricks\r
-       // we go up our stack until we pass our caller address\r
-       for(; sp < stack_end; sp += 4)\r
-               if(*(TUint *)sp == lr) break;\r
-\r
-       // there might be mirored caller address\r
-       for(i = sp + 4; i < sp + 0x300 && i < stack_end; i += 4)\r
-               if(*(TUint *)i == lr) { sp = i; break; }\r
-\r
-       // aah, it is always 0x9c bytes away from the caller address in my firmware,\r
-       // don't know how to detect it in any other way\r
-       sp += 0x9c;\r
-       guessed_address = *(TUint *)sp;\r
-\r
-       // output the info\r
-       TUint exec_show = exc;\r
-       if(exec_show > 27) exec_show = 27;\r
-       TPtrC ptrExc((TUint16 *) exception_names[exec_show]);\r
-\r
-       RDebug::Print(_L("!!!Exception %i (%S) @ 0x%08x (guessed; relative=0x%08x)"), exc, &ptrExc, guessed_address, guessed_address - code_start);\r
-#ifdef __DEBUG_PRINT_FILE\r
-       DEBUGPRINT(   _L("!!!Exception %i (%S) @ 0x%08x (guessed; relative=0x%08x)"), exc, &ptrExc, guessed_address, guessed_address - code_start);\r
-#endif\r
-\r
-       TBuf<148> buff1;\r
-       TBuf<10>  buff2;\r
-       buff1.Copy(_L("  guessed stack: "));\r
-\r
-       for(sp += 4, i = 0; i < 5 && sp < stack_end; sp += 4) {\r
-               if((*(TUint *)sp >> 28) == 5) {\r
-                       if(i++) buff1.Append(_L(", "));\r
-                       buff2.Format(_L("0x%08x"), *(TUint *)sp);\r
-                       buff1.Append(buff2);\r
-               }\r
-               else if(code_start < *(TUint *)sp && *(TUint *)sp < code_end) {\r
-                       if(i++) buff1.Append(_L(", "));\r
-                       buff2.Format(_L("0x%08x"), *(TUint *)sp);\r
-                       buff1.Append(buff2);\r
-                       buff1.Append(_L(" ("));\r
-                       buff2.Format(_L("0x%08x"), *(TUint *)sp - code_start);\r
-                       buff1.Append(buff2);\r
-                       buff1.Append(_L(")"));\r
-               }\r
-       }\r
-       RDebug::Print(_L("%S"), &buff1);\r
-#ifdef __DEBUG_PRINT_FILE\r
-       DEBUGPRINT(_L("%S"), &buff1);\r
-#endif\r
-\r
-       // tmp\r
-#if defined(__DEBUG_PRINT)\r
-       char *ps, *cstr = PDebugMain();\r
-       for(ps = cstr; *ps; ps++) {\r
-         if(*ps == '\n') {\r
-           *ps = 0;\r
-           lprintf(cstr);\r
-               cstr = ps+1;\r
-         }\r
-       }\r
-#endif\r
-\r
-//     RDebug::Print(_L("Stack dump:"));\r
-//     asm volatile ("str sp, %0" : "=m" (sp) );\r
-//     for(TUint i = sp+0x400; i >= sp-16; i-=4)\r
-//             RDebug::Print(_L("%08x: %08x"), i, *(int *)i);\r
-\r
-       // more descriptive replacement of "KERN-EXEC 3" panic\r
-       buff1.Format(_L("K-EX3: %S"), &ptrExc);\r
-       User::Panic(buff1, exc);\r
-#endif\r
-}\r
-\r
-#endif // ifdef __WINS__\r
-\r
-\r
-#if 1 // def __DEBUG_PRINT_C\r
-       #include <stdarg.h> // va_*\r
-       #include <stdio.h>  // vsprintf\r
-\r
-       // debug print from c code\r
-       extern "C" void lprintf(const char *format, ...)\r
-       {\r
-               va_list args;\r
-               char    buffer[512];\r
-               int len;\r
-\r
-               va_start(args,format);\r
-               len = vsprintf(buffer,format,args);\r
-               va_end(args);\r
-               if (buffer[len-1] == '\n')\r
-                       buffer[len-1] = 0;\r
-\r
-               DEBUGPRINT(_L("%S"), DO_CONV(buffer));\r
-       }\r
-#endif\r
-\r
-\r
-#if defined(__DEBUG_PRINT) || defined(__WINS__)\r
-\r
-#ifndef __DLL__\r
-       // c string dumper for RDebug::Print()\r
-       static  TBuf<1024> sTextBuffer;\r
-       TDesC* DO_CONV(const char* s)\r
-       {\r
-               TPtrC8  text8((TUint8*) (s));\r
-               sTextBuffer.Copy(text8);\r
-               return &sTextBuffer;\r
-       }\r
-#endif\r
-\r
-#ifdef __DEBUG_PRINT_FILE\r
-       #include <f32file.h>\r
-\r
-       //static RFile logFile;\r
-//     static TBool logInited = 0;\r
-       RMutex logMutex;\r
-\r
-       static void debugPrintFileInit()\r
-       {\r
-               // try to open\r
-               logMutex.CreateLocal();\r
-               /*RFs fserv;\r
-               fserv.Connect();\r
-               RFile logFile;\r
-               logFile.Replace(fserv, LOG_FILE, EFileWrite|EFileShareAny);\r
-               logFile.Close();\r
-               fserv.Close();*/\r
-       }\r
-\r
-       // debug print to file\r
-       void debugPrintFile(TRefByValue<const TDesC> aFmt, ...)\r
-       {\r
-               if (logMutex.Handle() <= 0) debugPrintFileInit();\r
-\r
-               logMutex.Wait();\r
-               RFs fserv;\r
-               fserv.Connect();\r
-\r
-               TTime now; now.UniversalTime();\r
-               TBuf<512>  tmpBuff;\r
-               TBuf8<512> tmpBuff8;\r
-               TInt size, res;\r
-\r
-               RThread thisThread;\r
-               RFile logFile;\r
-               res = logFile.Open(fserv, LOG_FILE, EFileWrite|EFileShareAny);\r
-               if(res) goto fail1;\r
-\r
-               logFile.Size(size); logFile.Seek(ESeekStart, size);\r
-\r
-               now.FormatL(tmpBuff, _L("%H:%T:%S.%C: "));\r
-               tmpBuff8.Copy(tmpBuff);\r
-               logFile.Write(tmpBuff8);\r
-\r
-               tmpBuff8.Format(TPtr8((TUint8 *)"%03i: ", 6, 6), (TInt32) thisThread.Id());\r
-               logFile.Write(tmpBuff8);\r
-\r
-               VA_LIST args;\r
-               VA_START(args, aFmt);\r
-               tmpBuff.FormatList(aFmt, args);\r
-               VA_END(args);\r
-               tmpBuff8.Copy(tmpBuff);\r
-               logFile.Write(tmpBuff8);\r
-\r
-               logFile.Write(TPtrC8((TUint8 const *) "\n"));\r
-               logFile.Flush();\r
-               logFile.Close();\r
-               fail1:\r
-               thisThread.Close();\r
-               fserv.Close();\r
-\r
-               logMutex.Signal();\r
-       }\r
-#endif\r
-\r
-#endif\r
-\r
diff --git a/platform/uiq3/engine/debug.h b/platform/uiq3/engine/debug.h
deleted file mode 100644 (file)
index fb62cf6..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#include <e32std.h>\r
-\r
-#define __DEBUG_PRINT_C\r
-#define __DEBUG_PRINT_FILE\r
-\r
-#if defined(__DEBUG_PRINT) || defined(__WINS__)\r
-       #include <e32svr.h> // RDebug\r
-       #ifdef __DEBUG_PRINT_FILE\r
-               void debugPrintFile(TRefByValue<const TDesC> aFmt, ...);\r
-               #define DEBUGPRINT debugPrintFile\r
-       #else\r
-               #define DEBUGPRINT RDebug::Print\r
-       #endif\r
-       TDesC* DO_CONV(const char* s);\r
-       #ifdef __DEBUG_PRINT_C\r
-               #ifdef __cplusplus\r
-               extern "C"\r
-               #endif\r
-               void lprintf(const char *format, ...);\r
-       #endif\r
-#else\r
-       #define DEBUGPRINT(x...)\r
-       #undef __DEBUG_PRINT_C\r
-       #undef __DEBUG_PRINT_FILE\r
-#endif\r
-\r
-void ExceptionHandler(TExcType exc);\r
diff --git a/platform/uiq3/engine/main.cpp b/platform/uiq3/engine/main.cpp
deleted file mode 100644 (file)
index 66fee33..0000000
+++ /dev/null
@@ -1,921 +0,0 @@
-// mainloop with window server event handling\r
-// event polling mechnism was taken from\r
-// Peter van Sebille's projects\r
-\r
-// (c) Copyright 2006, notaz\r
-// All Rights Reserved\r
-\r
-#include <e32base.h>\r
-#include <hal.h>\r
-#include <e32keys.h>\r
-#include <w32std.h>\r
-\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <sys/time.h>\r
-\r
-#include "debug.h"\r
-#include "../Engine.h"\r
-\r
-#include <pico/pico_int.h>\r
-#include "../../common/emu.h"\r
-#include "../emu.h"\r
-#include "vid.h"\r
-#include "PolledAS.h"\r
-//#include "audio.h"\r
-#include "audio_mediaserver.h"\r
-\r
-//#include <ezlib.h>\r
-#include <zlib/zlib.h>\r
-\r
-\r
-//#define BENCHMARK\r
-\r
-\r
-// scancodes we care about\r
-enum TUsedScanCodes {\r
-       EStdKeyM600JogUp   = EStdKeyDevice1,\r
-       EStdKeyM600JogDown = EStdKeyDevice2,\r
-};\r
-\r
-static unsigned char keyFlags[256];   // lsb->msb: key_down, pulse_only, ?, ?,  ?, ?, not_configurable, disabled\r
-static unsigned char pressedKeys[11]; // List of pressed key scancodes, up to 10\r
-\r
-// list of areas\r
-TPicoAreaConfigEntry areaConfig[] = {\r
-       { TRect(  0,   0,   0,   0) },\r
-       // small corner bottons\r
-       { TRect(  0,   0,  15,  15) },\r
-       { TRect(224,   0, 239,  15) },\r
-       { TRect(  0, 304,  15, 319) },\r
-       { TRect(224, 304, 239, 319) },\r
-       // normal buttons\r
-       { TRect(  0,   0,  79,  63) },\r
-       { TRect( 80,   0, 159,  63) },\r
-       { TRect(160,   0, 239,  63) },\r
-       { TRect(  0,  64,  79, 127) },\r
-       { TRect( 80,  64, 159, 127) },\r
-       { TRect(160,  64, 239, 127) },\r
-       { TRect(  0, 128,  79, 191) },\r
-       { TRect( 80, 128, 159, 191) },\r
-       { TRect(160, 128, 239, 191) },\r
-       { TRect(  0, 192,  79, 255) },\r
-       { TRect( 80, 192, 159, 255) },\r
-       { TRect(160, 192, 239, 255) },\r
-       { TRect(  0, 256,  79, 319) },\r
-       { TRect( 80, 256, 159, 319) },\r
-       { TRect(160, 256, 239, 319) },\r
-       { TRect(  0,   0,   0,   0) }\r
-};\r
-\r
-// PicoPad[] format: SACB RLDU\r
-const char *actionNames[] = {\r
-       "UP", "DOWN", "LEFT", "RIGHT", "B", "C", "A", "START",\r
-       0, 0, 0, 0, 0, 0, 0, 0, // Z, Y, X, MODE (enabled only when needed), ?, ?, ?, ?\r
-       0, 0, 0, 0, "VOLUME@UP", "VOLUME@DOWN", "NEXT@SAVE@SLOT", "PREV@SAVE@SLOT", // ?, ?, ?, ?, vol_up, vol_down, next_slot, prev_slot\r
-       0, 0, "PAUSE@EMU", "SAVE@STATE", "LOAD@STATE", 0, 0, "DONE" // ?, switch_renderer, [...], "FRAMESKIP@8", "AUTO@FRAMESKIP"\r
-};\r
-\r
-\r
-// globals are allowed, so why not to (ab)use them?\r
-//TInt machineUid = 0;\r
-int gamestate = PGS_Paused, gamestate_next = PGS_Paused;\r
-char *loadrom_fname = NULL;\r
-int   loadrom_result = 0;\r
-static timeval noticeMsgTime = { 0, 0 };       // when started showing\r
-static CGameAudioMS *gameAudio = 0;                    // the audio object itself\r
-static int reset_timing = 0;\r
-static int pico_was_reset = 0;\r
-extern RSemaphore initSemaphore;\r
-extern RSemaphore pauseSemaphore;\r
-extern RSemaphore loadWaitSemaphore;\r
-\r
-// some forward declarations\r
-static void MainInit();\r
-static void MainExit();\r
-static void DumpMemInfo();\r
-\r
-\r
-class TPicoDirectScreenAccess : public MDirectScreenAccess\r
-{\r
-public: // implements MDirectScreenAccess\r
-       void Restart(RDirectScreenAccess::TTerminationReasons aReason);\r
-public: // implements MAbortDirectScreenAccess\r
-       void AbortNow(RDirectScreenAccess::TTerminationReasons aReason);\r
-};\r
-\r
-\r
-// just for a nicer grouping of WS related stuff\r
-class CGameWindow\r
-{\r
-public:\r
-       static void ConstructResourcesL(void);\r
-       static void FreeResources(void);\r
-       static void DoKeys(void);\r
-       static void DoKeysConfig(TUint &which);\r
-       static void RunEvents(TUint32 which);\r
-\r
-       static RWsSession*                              iWsSession;\r
-       static RWindowGroup                             iWsWindowGroup;\r
-       static RWindow                                  iWsWindow;\r
-       static CWsScreenDevice*                 iWsScreen;\r
-       static CWindowGc*                               iWindowGc;\r
-       static TRequestStatus                   iWsEventStatus;\r
-//     static TThreadId                                iLauncherThreadId;\r
-//     static RDirectScreenAccess*             iDSA;\r
-//     static TRequestStatus                   iDSAstatus;\r
-       static TPicoDirectScreenAccess  iPDSA;\r
-       static CDirectScreenAccess*             iDSA;\r
-};\r
-\r
-\r
-static void updateSound(int len)\r
-{\r
-       PsndOut = gameAudio->NextFrameL(len);\r
-       if(!PsndOut) { // sound output problems?\r
-               strcpy(noticeMsg, "SOUND@OUTPUT@ERROR;@SOUND@DISABLED");\r
-               gettimeofday(&noticeMsgTime, 0);\r
-       }\r
-}\r
-\r
-\r
-static void SkipFrame(void)\r
-{\r
-       PicoSkipFrame=1;\r
-       PicoFrame();\r
-       PicoSkipFrame=0;\r
-}\r
-\r
-\r
-static void simpleWait(int thissec, int lim_time)\r
-{\r
-       struct timeval tval;\r
-       int sleep = 0;\r
-\r
-       gettimeofday(&tval, 0);\r
-       if(thissec != tval.tv_sec) tval.tv_usec+=1000000;\r
-\r
-       sleep = lim_time - tval.tv_usec - 2000;\r
-       if (sleep > 0) {\r
-//             User::After((sleep = lim_time - tval.tv_usec));\r
-               User::AfterHighRes(sleep);\r
-       }\r
-}\r
-\r
-\r
-static void TargetEpocGameL()\r
-{\r
-       char buff[24]; // fps count c string\r
-       struct timeval tval; // timing\r
-       int thissec = 0, frames_done = 0, frames_shown = 0;\r
-       int target_fps, target_frametime;\r
-       int i, lim_time;\r
-\r
-       MainInit();\r
-       buff[0] = 0;\r
-\r
-       // try to start pico\r
-       DEBUGPRINT(_L("PicoInit()"));\r
-       PicoInit();\r
-       PicoDrawSetColorFormat(2);\r
-       PicoWriteSound = updateSound;\r
-\r
-       // loop?\r
-       for(;;)\r
-       {\r
-               if (gamestate == PGS_Running)\r
-               {\r
-                       #ifdef __DEBUG_PRINT\r
-                       TInt mem, cells = User::CountAllocCells();\r
-                       User::AllocSize(mem);\r
-                       DEBUGPRINT(_L("worker: cels=%d, size=%d KB"), cells, mem/1024);\r
-                       #endif\r
-\r
-                       // switch context to other thread\r
-                       User::After(50000);\r
-                       // prepare window and stuff\r
-                       CGameWindow::ConstructResourcesL();\r
-\r
-                       // if the system has something to do, it should better do it now\r
-                       User::After(50000);\r
-                       //CPolledActiveScheduler::Instance()->Schedule();\r
-\r
-                       // pal/ntsc might have changed, reset related stuff\r
-                       if(Pico.m.pal) {\r
-                               target_fps = 50;\r
-                               if(!noticeMsgTime.tv_sec) strcpy(noticeMsg, "PAL@SYSTEM@/@50@FPS");\r
-                       } else {\r
-                               target_fps = 60;\r
-                               if(!noticeMsgTime.tv_sec) strcpy(noticeMsg, "NTSC@SYSTEM@/@60@FPS");\r
-                       }\r
-                       target_frametime = 1000000/target_fps;\r
-                       if (!noticeMsgTime.tv_sec && pico_was_reset)\r
-                               gettimeofday(&noticeMsgTime, 0);\r
-\r
-                       // prepare CD buffer\r
-                       if (PicoAHW & PAHW_MCD) PicoCDBufferInit();\r
-\r
-                       pico_was_reset = 0;\r
-                       reset_timing = 1;\r
-\r
-                       while (gamestate == PGS_Running)\r
-                       {\r
-                               gettimeofday(&tval, 0);\r
-                               if(reset_timing) {\r
-                                       reset_timing = 0;\r
-                                       thissec = tval.tv_sec;\r
-                                       frames_done = tval.tv_usec/target_frametime;\r
-                               }\r
-\r
-                               // show notice message?\r
-                               char *notice = 0;\r
-                               if(noticeMsgTime.tv_sec) {\r
-                                       if((tval.tv_sec*1000000+tval.tv_usec) - (noticeMsgTime.tv_sec*1000000+noticeMsgTime.tv_usec) > 2000000) // > 2.0 sec\r
-                                                noticeMsgTime.tv_sec = noticeMsgTime.tv_usec = 0;\r
-                                       else notice = noticeMsg;\r
-                               }\r
-\r
-                               // second changed?\r
-                               if (thissec != tval.tv_sec)\r
-                               {\r
-#ifdef BENCHMARK\r
-                                       static int bench = 0, bench_fps = 0, bench_fps_s = 0, bfp = 0, bf[4];\r
-                                       if(++bench == 10) {\r
-                                               bench = 0;\r
-                                               bench_fps_s = bench_fps;\r
-                                               bf[bfp++ & 3] = bench_fps;\r
-                                               bench_fps = 0;\r
-                                       }\r
-                                       bench_fps += frames_shown;\r
-                                       sprintf(buff, "%02i/%02i/%02i", frames_shown, bench_fps_s, (bf[0]+bf[1]+bf[2]+bf[3])>>2);\r
-#else\r
-                                       if (currentConfig.EmuOpt & EOPT_SHOW_FPS) \r
-                                               sprintf(buff, "%02i/%02i", frames_shown, frames_done);\r
-#endif\r
-\r
-\r
-                                       thissec = tval.tv_sec;\r
-\r
-                                       if(PsndOut == 0 && currentConfig.Frameskip >= 0) {\r
-                                               frames_done = frames_shown = 0;\r
-                                       } else {\r
-                                               // it is quite common for this implementation to leave 1 fame unfinished\r
-                                               // when second changes, but we don't want buffer to starve.\r
-                                               if(PsndOut && frames_done < target_fps && frames_done > target_fps-5) {\r
-                                                       SkipFrame(); frames_done++;\r
-                                               }\r
-\r
-                                               frames_done  -= target_fps; if (frames_done  < 0) frames_done  = 0;\r
-                                               frames_shown -= target_fps; if (frames_shown < 0) frames_shown = 0;\r
-                                               if (frames_shown > frames_done) frames_shown = frames_done;\r
-                                       }\r
-                                       User::ResetInactivityTime();\r
-                               }\r
-\r
-\r
-                               lim_time = (frames_done+1) * target_frametime;\r
-                               if (currentConfig.Frameskip >= 0) // frameskip enabled\r
-                               {\r
-                                       for (i = 0; i < currentConfig.Frameskip && gamestate == PGS_Running; i++)\r
-                                       {\r
-                                               CGameWindow::DoKeys();\r
-                                               SkipFrame(); frames_done++;\r
-                                               if (PsndOut) { // do framelimitting if sound is enabled\r
-                                                       gettimeofday(&tval, 0);\r
-                                                       if(thissec != tval.tv_sec) tval.tv_usec+=1000000;\r
-                                                       if(tval.tv_usec < lim_time) { // we are too fast\r
-                                                               simpleWait(thissec, lim_time);\r
-                                                       }\r
-                                               }\r
-                                               lim_time += target_frametime;\r
-                                       }\r
-                               }\r
-                               else if(tval.tv_usec > lim_time) { // auto frameskip\r
-                                       // no time left for this frame - skip\r
-                                       CGameWindow::DoKeys();\r
-                                       SkipFrame(); frames_done++;\r
-                                       continue;\r
-                               }\r
-\r
-                               // we might have lost focus already\r
-                               if (gamestate != PGS_Running) break;\r
-\r
-                               CGameWindow::DoKeys();\r
-                               PicoFrame();\r
-\r
-                               // check time\r
-                               gettimeofday(&tval, 0);\r
-                               if(thissec != tval.tv_sec) tval.tv_usec+=1000000;\r
-\r
-                               // sleep if we are still too fast\r
-                               if(PsndOut != 0 || currentConfig.Frameskip < 0)\r
-                               {\r
-                                       // TODO: check if User::After() is accurate\r
-                                       gettimeofday(&tval, 0);\r
-                                       if(thissec != tval.tv_sec) tval.tv_usec+=1000000;\r
-                                       if(tval.tv_usec < lim_time)\r
-                                       {\r
-                                               // we are too fast\r
-                                               simpleWait(thissec, lim_time);\r
-                                       }\r
-                               }\r
-\r
-                               CPolledActiveScheduler::Instance()->Schedule();\r
-\r
-                               if (gamestate != PGS_Paused)\r
-                                       vidDrawFrame(notice, buff, frames_shown);\r
-\r
-                               frames_done++; frames_shown++;\r
-                       } // while\r
-\r
-                       if (PicoAHW & PAHW_MCD) PicoCDBufferFree();\r
-\r
-                       // save SRAM\r
-                       if ((currentConfig.EmuOpt & EOPT_EN_SRAM) && SRam.changed) {\r
-                               emu_save_load_game(0, 1);\r
-                               SRam.changed = 0;\r
-                       }\r
-                       CPolledActiveScheduler::Instance()->Schedule();\r
-                       CGameWindow::FreeResources();\r
-               }\r
-               else if(gamestate == PGS_Reset)\r
-               {\r
-                       PicoReset();\r
-                       pico_was_reset = 1;\r
-                       gamestate = PGS_Running;\r
-               }\r
-               else if(gamestate == PGS_ReloadRom)\r
-               {\r
-                       loadrom_result = emu_reload_rom(loadrom_fname);\r
-                       pico_was_reset = 1;\r
-                       if (loadrom_result)\r
-                               gamestate = PGS_Running;\r
-                       else {\r
-                               extern char menuErrorMsg[];\r
-                               gamestate = PGS_Paused;\r
-                               lprintf("%s\n", menuErrorMsg);\r
-                       }\r
-                       DEBUGPRINT(_L("done loading ROM, retval=%i"), loadrom_result);\r
-                       loadWaitSemaphore.Signal();\r
-                       User::After(50000);\r
-               }\r
-               else if(gamestate == PGS_Paused) {\r
-                       DEBUGPRINT(_L("pausing.."));\r
-                       pauseSemaphore.Wait();\r
-               }\r
-               else if(gamestate == PGS_KeyConfig)\r
-               {\r
-                       // switch context to other thread\r
-                       User::After(50000);\r
-                       // prepare window and stuff\r
-                       CGameWindow::ConstructResourcesL();\r
-\r
-                       TUint whichAction = 0;\r
-                       while(gamestate == PGS_KeyConfig) {\r
-                               CGameWindow::DoKeysConfig(whichAction);\r
-                               CPolledActiveScheduler::Instance()->Schedule();\r
-                               if (gamestate != PGS_Paused)\r
-                                       vidKeyConfigFrame(whichAction);\r
-                               User::After(150000);\r
-                       }\r
-\r
-                       emu_write_config(0);\r
-                       CGameWindow::FreeResources();\r
-               } else if(gamestate == PGS_Quit) {\r
-                       break;\r
-               }\r
-       }\r
-\r
-       // this thread has to close it's own handles,\r
-       // other one will crash trying to do that\r
-       PicoExit();\r
-\r
-       MainExit();\r
-}\r
-\r
-\r
-// main initialization\r
-static void MainInit()\r
-{\r
-       DEBUGPRINT(_L("\r\n\r\nstarting.."));\r
-\r
-       DEBUGPRINT(_L("CPolledActiveScheduler::NewL()"));\r
-       CPolledActiveScheduler::NewL(); // create Polled AS for the sound engine\r
-\r
-//     HAL::Get(HALData::EMachineUid, machineUid); // find out the machine UID\r
-\r
-       DumpMemInfo();\r
-\r
-//     if (pauseSemaphore.Handle() <= 0)\r
-//             pauseSemaphore.CreateLocal(0);\r
-       DEBUGPRINT(_L("initSemaphore.Signal()"));\r
-       initSemaphore.Signal();\r
-}\r
-\r
-\r
-// does not return\r
-static void MainExit()\r
-{\r
-       RThread thisThread;\r
-\r
-       DEBUGPRINT(_L("%i: cleaning up.."), (TInt32) thisThread.Id());\r
-\r
-//     pauseSemaphore.Close();\r
-\r
-       if(gameAudio) delete gameAudio;\r
-\r
-       // Polled AS\r
-       delete CPolledActiveScheduler::Instance();\r
-}\r
-\r
-static void DumpMemInfo()\r
-{\r
-       TInt    ramSize, ramSizeFree, romSize;\r
-       \r
-       HAL::Get(HALData::EMemoryRAM, ramSize);\r
-       HAL::Get(HALData::EMemoryRAMFree, ramSizeFree);\r
-       HAL::Get(HALData::EMemoryROM, romSize);\r
-\r
-       DEBUGPRINT(_L("ram=%dKB, ram_free=%dKB, rom=%dKB"), ramSize/1024, ramSizeFree/1024, romSize/1024);\r
-}\r
-\r
-\r
-extern "C" TInt my_SetExceptionHandler(TInt, TExceptionHandler, TUint32);\r
-\r
-TInt EmuThreadFunction(TAny*)\r
-{\r
-       TInt ret;\r
-       const TUint32 exs = KExceptionAbort|KExceptionKill|KExceptionUserInterrupt|KExceptionFpe|KExceptionFault|KExceptionInteger|KExceptionDebug;\r
-       \r
-       DEBUGPRINT(_L("EmuThreadFunction(), def ExceptionHandler %08x, my %08x"),\r
-               User::ExceptionHandler(), ExceptionHandler);\r
-       User::SetJustInTime(1);\r
-       ret = User::SetExceptionHandler(ExceptionHandler, exs/*(TUint32) -1*/); // does not work :(\r
-       // my_SetExceptionHandler(KCurrentThreadHandle, ExceptionHandler, 0xffffffff);\r
-       DEBUGPRINT(_L("SetExceptionHandler %i, %08x"), ret, User::ExceptionHandler());\r
-       User::ModifyExceptionMask(0, exs);\r
-\r
-       //TInt pc, sp;\r
-       //asm volatile ("str pc, %0" : "=m" (pc) );\r
-       //asm volatile ("str sp, %0" : "=m" (sp) );\r
-       //RDebug::Print(_L("executing @ 0x%08x, sp=0x%08x"), pc, sp);\r
-\r
-/*\r
-       RDebug::Print(_L("Base     Bottom   Top      Size     RW Name"));\r
-       TBuf<4> l_r(_L("R")), l_w(_L("W")), l_d(_L("-"));\r
-       RChunk chunk;\r
-       TFullName chunkname;\r
-       TFindChunk findChunk(_L("*"));\r
-       while( findChunk.Next(chunkname) != KErrNotFound ) {\r
-               chunk.Open(findChunk);\r
-               RDebug::Print(_L("%08x %08x %08x %08x %S%S %S"), chunk.Base(), chunk.Base()+chunk.Bottom(), chunk.Base()+chunk.Top(), chunk.Size(), chunk.IsReadable() ? &l_r : &l_d, chunk.IsWritable() ? &l_w : &l_d, &chunkname);\r
-               chunk.Close();\r
-       }\r
-*/\r
-\r
-       // can't do that, will crash here\r
-//     if(cleanup) {\r
-//             DEBUGPRINT(_L("found old CTrapCleanup, deleting.."));\r
-//             delete cleanup;\r
-//     }\r
-       \r
-       CTrapCleanup *cleanup = CTrapCleanup::New();\r
-\r
-       TRAPD(error, TargetEpocGameL());\r
-\r
-       __ASSERT_ALWAYS(!error, User::Panic(_L("PicoDrive"), error));\r
-       delete cleanup;\r
-\r
-       DEBUGPRINT(_L("exitting.."));   \r
-       return 1;\r
-}\r
-\r
-\r
-void TPicoDirectScreenAccess::Restart(RDirectScreenAccess::TTerminationReasons aReason)\r
-{\r
-       DEBUGPRINT(_L("TPicoDirectScreenAccess::Restart(%i)"), aReason);\r
-\r
-//     if (CGameWindow::iDSA) {\r
-//             TRAPD(error, CGameWindow::iDSA->StartL());\r
-//             if (error) DEBUGPRINT(_L("iDSA->StartL() error: %i"), error);\r
-//     }\r
-}\r
-\r
-\r
-void TPicoDirectScreenAccess::AbortNow(RDirectScreenAccess::TTerminationReasons aReason)\r
-{\r
-       DEBUGPRINT(_L("TPicoDirectScreenAccess::AbortNow(%i)"), aReason);\r
-\r
-       // the WS wants us to stop, so let's obey\r
-       gamestate = PGS_Paused;\r
-}\r
-\r
-\r
-void CGameWindow::ConstructResourcesL()\r
-{\r
-       DEBUGPRINT(_L("ConstructResourcesL()"));\r
-       // connect to window server\r
-       // tried to create it globally and not re-connect everytime,\r
-       // but my window started to lose focus strangely\r
-       iWsSession = new(ELeave) RWsSession();\r
-       User::LeaveIfError(iWsSession->Connect());\r
-\r
-       //       * Tell the Window Server not to mess about with our process priority\r
-       //       * Also, because of the way legacy games are written, they never sleep\r
-       //       * and thus never voluntarily yield the CPU. We set our process priority\r
-       //       * to EPriorityForeground and hope that a Telephony application on\r
-       //       * this device runs at EPriorityForeground as well. If not, tough! ;-)\r
-\r
-       iWsSession->ComputeMode(RWsSession::EPriorityControlDisabled);\r
-       RProcess me;\r
-       me.SetPriority(EPriorityForeground);\r
-\r
-       iWsScreen = new(ELeave) CWsScreenDevice(*iWsSession);\r
-       User::LeaveIfError(iWsScreen->Construct());\r
-//     User::LeaveIfError(iWsScreen->CreateContext(iWindowGc));\r
-\r
-       iWsWindowGroup = RWindowGroup(*iWsSession);\r
-       User::LeaveIfError(iWsWindowGroup.Construct((TUint32)&iWsWindowGroup));\r
-       //iWsWindowGroup.SetOrdinalPosition(0);\r
-       //iWsWindowGroup.SetName(KServerWGName);\r
-       iWsWindowGroup.EnableScreenChangeEvents(); // flip events (EEventScreenDeviceChanged)\r
-       iWsWindowGroup.EnableFocusChangeEvents(); // EEventFocusGroupChanged\r
-       iWsWindowGroup.SetOrdinalPosition(0, 1); // TInt aPos, TInt aOrdinalPriority\r
-\r
-       iWsWindow=RWindow(*iWsSession);\r
-       User::LeaveIfError(iWsWindow.Construct(iWsWindowGroup, (TUint32)&iWsWindow));\r
-       iWsWindow.SetSize(iWsScreen->SizeInPixels());\r
-       iWsWindow.PointerFilter(EPointerFilterDrag, 0);\r
-       iWsWindow.SetPointerGrab(ETrue);\r
-       iWsWindow.SetVisible(ETrue);\r
-       iWsWindow.Activate();\r
-\r
-#if 0\r
-       // request access through RDirectScreenAccess api, but don't care about the result\r
-       // hangs?\r
-       RRegion *dsa_region = 0;\r
-       iDSA = new(ELeave) RDirectScreenAccess(*iWsSession);\r
-       if(iDSA->Construct() == KErrNone)\r
-               iDSA->Request(dsa_region, iDSAstatus, iWsWindow);\r
-       DEBUGPRINT(_L("DSA: %i"), dsa_region ? dsa_region->Count() : -1);\r
-#endif\r
-\r
-       TInt ret;\r
-\r
-       // request access through CDirectScreenAccess\r
-       iDSA = CDirectScreenAccess::NewL(*iWsSession, *iWsScreen, iWsWindow, iPDSA);\r
-\r
-       // now get the screenbuffer\r
-       TScreenInfoV01                  screenInfo;\r
-       TPckg<TScreenInfoV01>   sI(screenInfo);\r
-       UserSvr::ScreenInfo(sI);\r
-\r
-       if(!screenInfo.iScreenAddressValid)\r
-               User::Leave(KErrNotSupported);\r
-\r
-       DEBUGPRINT(_L("framebuffer=0x%08x (%dx%d)"), screenInfo.iScreenAddress,\r
-                                       screenInfo.iScreenSize.iWidth, screenInfo.iScreenSize.iHeight);\r
-       \r
-       // vidInit\r
-       DEBUGPRINT(_L("vidInit()"));\r
-       ret = vidInit((void *)screenInfo.iScreenAddress, 0);\r
-       DEBUGPRINT(_L("vidInit() done (%i)"), ret);\r
-\r
-       User::LeaveIfError(ret);\r
-\r
-       memset(keyFlags, 0, 256);\r
-       keyFlags[EStdKeyM600JogUp] = keyFlags[EStdKeyM600JogDown] = 2; // add "pulse only" for jog up/down\r
-       keyFlags[EStdKeyOff] = 0x40; // not configurable\r
-\r
-       // try to start the audio engine\r
-       static int PsndRate_old = 0, PicoOpt_old = 0, pal_old = 0;\r
-\r
-       if (gamestate == PGS_Running && (currentConfig.EmuOpt & EOPT_EN_SOUND))\r
-       {\r
-               TInt err = 0;\r
-               if(PsndRate != PsndRate_old || (PicoOpt&11) != (PicoOpt_old&11) || Pico.m.pal != pal_old) {\r
-                       // if rate changed, reset all enabled chips, else reset only those chips, which were recently enabled\r
-                       //sound_reset(PsndRate != PsndRate_old ? PicoOpt : (PicoOpt&(PicoOpt^PicoOpt_old)));\r
-                       PsndRerate(1);\r
-               }\r
-               if(!gameAudio || PsndRate != PsndRate_old || ((PicoOpt&8) ^ (PicoOpt_old&8)) || Pico.m.pal != pal_old) { // rate or stereo or pal/ntsc changed\r
-                       if(gameAudio) delete gameAudio; gameAudio = 0;\r
-                       DEBUGPRINT(_L("starting audio: %i len: %i stereo: %i, pal: %i"), PsndRate, PsndLen, PicoOpt&8, Pico.m.pal);\r
-                       TRAP(err, gameAudio = CGameAudioMS::NewL(PsndRate, (PicoOpt&8) ? 1 : 0,\r
-                                               Pico.m.pal ? 50 : 60, currentConfig.volume));\r
-               }\r
-               if( gameAudio) {\r
-                       TRAP(err, PsndOut = gameAudio->ResumeL());\r
-               }\r
-               if(err) {\r
-                       if(gameAudio) delete gameAudio;\r
-                       gameAudio = 0;\r
-                       PsndOut = 0;\r
-                       strcpy(noticeMsg, "SOUND@STARTUP@FAILED");\r
-                       gettimeofday(&noticeMsgTime, 0);\r
-               }\r
-               PsndRate_old = PsndRate;\r
-               PicoOpt_old  = PicoOpt;\r
-               pal_old = Pico.m.pal;\r
-       } else {\r
-               if(gameAudio) delete gameAudio;\r
-               gameAudio = 0;\r
-               PsndOut = 0;\r
-       }\r
-\r
-       CPolledActiveScheduler::Instance()->Schedule();\r
-\r
-       // start key WS event polling\r
-       iWsSession->EventReady(&iWsEventStatus);\r
-\r
-       iWsSession->Flush(); // check: short hang in UIQ2\r
-       User::After(1);\r
-\r
-       // I don't know why but the Window server sometimes hangs completely (hanging the phone too) after calling StartL()\r
-       // Is this a sync broblem? weird bug?\r
-       TRAP(ret, iDSA->StartL());\r
-       if (ret) DEBUGPRINT(_L("iDSA->StartL() error: %i"), ret);\r
-\r
-//     User::After(1);\r
-//     CPolledActiveScheduler::Instance()->Schedule();\r
-\r
-       DEBUGPRINT(_L("CGameWindow::ConstructResourcesL() finished."));\r
-}\r
-\r
-// this may be run even if there is nothing to free\r
-void CGameWindow::FreeResources()\r
-{\r
-       if(gameAudio) gameAudio->Pause();\r
-\r
-       //DEBUGPRINT(_L("CPolledActiveScheduler::Instance(): %08x"), CPolledActiveScheduler::Instance());\r
-       if(CPolledActiveScheduler::Instance())\r
-               CPolledActiveScheduler::Instance()->Schedule();\r
-\r
-#if 0\r
-       // free RDirectScreenAccess stuff (seems to be deleted automatically after crash?)\r
-       if(iDSA) {\r
-               iDSA->Cancel();\r
-               iDSA->Close();\r
-               delete iDSA;\r
-       }\r
-       iDSA = NULL;\r
-#endif\r
-       if(iDSA) delete iDSA;\r
-       iDSA = 0;\r
-\r
-       if(iWsSession->WsHandle() > 0 && iWsEventStatus != KRequestPending) // TODO: 2 UIQ2 (?)\r
-               iWsSession->EventReadyCancel();\r
-\r
-       if(iWsWindow.WsHandle() > 0)\r
-               iWsWindow.Close();\r
-\r
-       if(iWsWindowGroup.WsHandle() > 0)\r
-               iWsWindowGroup.Close();\r
-\r
-       // these must be deleted before calling iWsSession->Close()\r
-       if(iWsScreen) {\r
-               delete iWsScreen;\r
-               iWsScreen = NULL;\r
-       }\r
-\r
-       if(iWsSession->WsHandle() > 0) {\r
-               iWsSession->Close();\r
-               delete iWsSession;\r
-       }\r
-       \r
-       vidFree();\r
-}\r
-\r
-\r
-void CGameWindow::DoKeys(void)\r
-{\r
-       TWsEvent iWsEvent;\r
-       TInt iWsEventType;\r
-       unsigned long allActions = 0;\r
-       static unsigned long areaActions = 0, forceUpdate = 0;\r
-       int i, nEvents;\r
-\r
-       for(nEvents = 0; iWsEventStatus != KRequestPending; nEvents++)\r
-       {\r
-               iWsSession->GetEvent(iWsEvent);\r
-               iWsEventType = iWsEvent.Type();\r
-\r
-               // pointer events?\r
-               if(iWsEventType == EEventPointer) {\r
-                       if(iWsEvent.Pointer()->iType == TPointerEvent::EButton1Up) {\r
-                               areaActions = 0; // remove all directionals\r
-                       } else { // if(iWsEvent.Pointer()->iType == TPointerEvent::EButton1Down) {\r
-                               TPoint p = iWsEvent.Pointer()->iPosition;\r
-                               const TPicoAreaConfigEntry *e = areaConfig + 1;\r
-                               for(i = 0; !e->rect.IsEmpty(); e++, i++)\r
-                                       if(e->rect.Contains(p)) {\r
-                                               areaActions = currentConfig.KeyBinds[i+256];\r
-                                               break;\r
-                                       }\r
-                               //DEBUGPRINT(_L("pointer event: %i %i"), p.iX, p.iY);\r
-                       }\r
-               }\r
-               else if(iWsEventType == EEventKeyDown || iWsEventType == EEventKeyUp) {\r
-                       TInt iScanCode = iWsEvent.Key()->iScanCode;\r
-                       //DEBUGPRINT(_L("key event: 0x%02x"), iScanCode);\r
-\r
-                       if(iScanCode < 256)\r
-                       {\r
-                               if(iWsEventType == EEventKeyDown) {\r
-                                       keyFlags[iScanCode] |=  1;\r
-                                       for(i=0; i < 10; i++) {\r
-                                               if( pressedKeys[i] == (TUint8) iScanCode) break;\r
-                                               if(!pressedKeys[i]) { pressedKeys[i] = (TUint8) iScanCode; break; }\r
-                                       }\r
-                               } else if(!(keyFlags[iScanCode]&2)) {\r
-                                       keyFlags[iScanCode] &= ~1;\r
-                                       for(i=0; i < 10; i++) {\r
-                                               if(pressedKeys[i] == (TUint8) iScanCode) { pressedKeys[i] = 0; break; }\r
-                                       }\r
-                               }\r
-\r
-                               // power?\r
-                               if(iScanCode == EStdKeyOff) gamestate = PGS_Paused;\r
-                       } else {\r
-                               DEBUGPRINT(_L("weird scancode: 0x%02x"), iScanCode);\r
-                       }\r
-               }\r
-               else if(iWsEventType == EEventScreenDeviceChanged) {\r
-                       // ???\r
-                       //User::After(500000);\r
-                       //reset_timing = 1;\r
-                       DEBUGPRINT(_L("EEventScreenDeviceChanged, focus: %i, our: %i"),\r
-                                               iWsSession->GetFocusWindowGroup(), iWsWindowGroup.Identifier());\r
-               }\r
-               else if(iWsEventType == EEventFocusGroupChanged) {\r
-                       TInt focusGrpId = iWsSession->GetFocusWindowGroup();\r
-                       DEBUGPRINT(_L("EEventFocusGroupChanged: %i, our: %i"),\r
-                                               focusGrpId, iWsWindowGroup.Identifier());\r
-                       // if it is not us and not launcher that got focus, pause emu\r
-                       if(focusGrpId != iWsWindowGroup.Identifier())\r
-                               gamestate = PGS_Paused;\r
-               }\r
-\r
-               iWsEventStatus = KRequestPending;\r
-               iWsSession->EventReady(&iWsEventStatus);\r
-       }\r
-\r
-       if(nEvents || forceUpdate) {\r
-               allActions = areaActions;\r
-               forceUpdate = 0;\r
-\r
-               // add all pushed button actions\r
-               for(i = 9; i >= 0; i--) {\r
-                       int scan = pressedKeys[i];\r
-                       if(scan) {\r
-                               if(keyFlags[scan] & 1) allActions |= currentConfig.KeyBinds[scan];\r
-                               if((keyFlags[scan]& 3)==3) forceUpdate = 1;\r
-                               if(keyFlags[scan] & 2) keyFlags[scan] &= ~1;\r
-                       }\r
-               }\r
-\r
-               PicoPad[0] = (unsigned short) allActions;\r
-               if(allActions & 0xFFFF0000) {\r
-                       RunEvents(allActions >> 16);\r
-                       areaActions = 0;\r
-               }\r
-       }\r
-\r
-       if (movie_data) emu_updateMovie();\r
-}\r
-\r
-\r
-void CGameWindow::DoKeysConfig(TUint &which)\r
-{\r
-       TWsEvent iWsEvent;\r
-       int i;\r
-\r
-       while(iWsEventStatus != KRequestPending)\r
-       {\r
-               TUint currentActCode = 1 << which;\r
-\r
-               iWsSession->GetEvent(iWsEvent);\r
-\r
-               // pointer events?\r
-               if(iWsEvent.Type() == EEventPointer) {\r
-                       TPoint p = iWsEvent.Pointer()->iPosition;\r
-                       TRect prev(56,  0, 120, 26);\r
-                       TRect next(120, 0, 180, 26);\r
-\r
-                       if(iWsEvent.Pointer()->iType == TPointerEvent::EButton1Down) {\r
-                                    if(prev.Contains(p)) do { which = (which-1) & 0x1F; } while(!actionNames[which]);\r
-                               else if(next.Contains(p)) do { which = (which+1) & 0x1F; } while(!actionNames[which]);\r
-                               else if(which == 31) gamestate = PGS_Paused; // done\r
-                               else {\r
-                                       const TPicoAreaConfigEntry *e = areaConfig + 1;\r
-                                       for(i = 0; e->rect != TRect(0,0,0,0); e++, i++)\r
-                                               if(e->rect.Contains(p)) {\r
-                                                       currentConfig.KeyBinds[i+256] ^= currentActCode;\r
-                                                       break;\r
-                                               }\r
-                               }\r
-                       }\r
-               }\r
-               else if(iWsEvent.Type() == EEventKeyDown || iWsEvent.Type() == EEventKeyUp)\r
-               {\r
-                       TUint scan = (TUint) iWsEvent.Key()->iScanCode;\r
-\r
-                       // key events?\r
-                       if(iWsEvent.Type() == EEventKeyDown) {\r
-                               if(which == 31) {\r
-                                       gamestate = PGS_Paused;\r
-                               } else if (scan < 256) {\r
-                                       if(!(keyFlags[scan]&0x40)) currentConfig.KeyBinds[scan] ^= currentActCode;\r
-                               }\r
-                       }\r
-\r
-                       // power?\r
-                       if(iWsEvent.Key()->iScanCode == EStdKeyOff) gamestate = PGS_Paused;\r
-               }\r
-               else if(iWsEvent.Type() == EEventFocusGroupChanged) {\r
-                       TInt focusGrpId = iWsSession->GetFocusWindowGroup();\r
-                       // if we lost focus, exit config mode\r
-                       if(focusGrpId != iWsWindowGroup.Identifier())\r
-                               gamestate = PGS_Paused;\r
-               }\r
-\r
-//             iWsEventStatus = KRequestPending;\r
-               iWsSession->EventReady(&iWsEventStatus);\r
-       }\r
-}\r
-\r
-\r
-void CGameWindow::RunEvents(TUint32 which)\r
-{\r
-       if (which & 0x4000) currentConfig.Frameskip = -1;\r
-       if (which & 0x2000) currentConfig.Frameskip =  8;\r
-       if (which & 0x1800) { // save or load (but not both)\r
-               if(PsndOut) gameAudio->Pause(); // this may take a while, so we pause sound output\r
-\r
-               vidDrawNotice((which & 0x1000) ? "LOADING@GAME" : "SAVING@GAME");\r
-               emu_save_load_game(which & 0x1000, 0);\r
-\r
-               if(PsndOut) PsndOut = gameAudio->ResumeL();\r
-               reset_timing = 1;\r
-       }\r
-       if (which & 0x0400) gamestate = PGS_Paused;\r
-       if (which & 0x0200) { // switch renderer\r
-               if (!(currentConfig.scaling == TPicoConfig::PMFit &&\r
-                       (currentConfig.rotation == TPicoConfig::PRot0 || currentConfig.rotation == TPicoConfig::PRot180)))\r
-               {\r
-                       PicoOpt^=0x10;\r
-                       vidInit(0, 1);\r
-\r
-                       strcpy(noticeMsg, (PicoOpt&0x10) ? "ALT@RENDERER" : "DEFAULT@RENDERER");\r
-                       gettimeofday(&noticeMsgTime, 0);\r
-               }\r
-       }\r
-       if(which & 0x00c0) {\r
-               if(which&0x0080) {\r
-                       state_slot -= 1;\r
-                       if(state_slot < 0) state_slot = 9;\r
-               } else {\r
-                       state_slot += 1;\r
-                       if(state_slot > 9) state_slot = 0;\r
-               }\r
-               sprintf(noticeMsg, "SAVE@SLOT@%i@SELECTED", state_slot);\r
-               gettimeofday(&noticeMsgTime, 0);\r
-       }\r
-       if ((which & 0x0030) && gameAudio != NULL) {\r
-               currentConfig.volume = gameAudio->ChangeVolume((which & 0x0010) ? 1 : 0);\r
-               sprintf(noticeMsg, "VOL@%02i@", currentConfig.volume);\r
-               gettimeofday(&noticeMsgTime, 0);\r
-       }\r
-}\r
-\r
-\r
-extern "C" void plat_status_msg(const char *format, ...)\r
-{\r
-       va_list vl;\r
-       char *p;\r
-\r
-       va_start(vl, format);\r
-       vsnprintf(noticeMsg, sizeof(noticeMsg), fmt, vl);\r
-       va_end(vl);\r
-\r
-       p = noticeMsg;\r
-       while (*p) {\r
-               if (*p == ' ') *p = '@';\r
-               if (*p < '0' || *p > 'Z') { *p = 0; break; }\r
-               p++;\r
-       }\r
-       gettimeofday(&noticeMsgTime, 0);\r
-}\r
-\r
-// static class members\r
-RWsSession*                            CGameWindow::iWsSession;\r
-RWindowGroup                   CGameWindow::iWsWindowGroup;\r
-RWindow                                        CGameWindow::iWsWindow;\r
-CWsScreenDevice*               CGameWindow::iWsScreen = NULL;\r
-CWindowGc*                             CGameWindow::iWindowGc = NULL;\r
-TRequestStatus                 CGameWindow::iWsEventStatus = KRequestPending;\r
-//RDirectScreenAccess* CGameWindow::iDSA;\r
-//TRequestStatus                       CGameWindow::iDSAstatus = KRequestPending;\r
-TPicoDirectScreenAccess        CGameWindow::iPDSA;\r
-CDirectScreenAccess*   CGameWindow::iDSA = NULL;\r
-\r
diff --git a/platform/uiq3/engine/polledas.cpp b/platform/uiq3/engine/polledas.cpp
deleted file mode 100644 (file)
index 898f76e..0000000
+++ /dev/null
@@ -1,269 +0,0 @@
-/*******************************************************************\r
- *\r
- *     File:           PolledAS.cpp\r
- *\r
- *     Author:         Peter van Sebille (peter@yipton.net)\r
- *\r
- *     (c) Copyright 2002, Peter van Sebille\r
- *     All Rights Reserved\r
- *\r
- *******************************************************************/\r
-\r
-/*\r
- * Oh Lord, forgive me for I have sinned.\r
- * In their infinite wisdom, Symbian Engineers have decided that\r
- * the Active Scheduler's queue of Active Objects is private\r
- * and no getters are provided... sigh.\r
- * This mere mortal will have to excercise the power of C pre-processor \r
- * once more to circumvent the will of the gods.\r
- */\r
-\r
-\r
-#include <e32std.h>\r
-\r
-// from e32base.h\r
-class CBase\r
-       {\r
-public:\r
-       /**\r
-       Default constructor\r
-       */\r
-       inline CBase()  {}\r
-       IMPORT_C virtual ~CBase();\r
-       inline TAny* operator new(TUint aSize, TAny* aBase) __NO_THROW { Mem::FillZ(aBase, aSize); return aBase; }\r
-       inline TAny* operator new(TUint aSize) __NO_THROW { return User::AllocZ(aSize); }\r
-       inline TAny* operator new(TUint aSize, TLeave) { return User::AllocZL(aSize); }\r
-       inline TAny* operator new(TUint aSize, TUint aExtraSize) { return User::AllocZ(aSize + aExtraSize); }\r
-       inline TAny* operator new(TUint aSize, TLeave, TUint aExtraSize) { return User::AllocZL(aSize + aExtraSize); }\r
-       IMPORT_C static void Delete(CBase* aPtr);\r
-protected:\r
-       IMPORT_C virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1);\r
-private:\r
-       CBase(const CBase&);\r
-       CBase& operator=(const CBase&);\r
-private:\r
-       };\r
-\r
-\r
-class TRequestStatusFaked\r
-       {\r
-public:\r
-       inline TRequestStatusFaked() : iFlags(0) {};\r
-       inline TRequestStatusFaked(TInt aVal) : iStatus(aVal), iFlags(aVal==KRequestPending ? TRequestStatusFaked::ERequestPending : 0) {}\r
-/*     inline TInt operator=(TInt aVal);\r
-       inline TBool operator==(TInt aVal) const;\r
-*/\r
-       inline TBool operator!=(TInt aVal) const {return(iStatus!=aVal);}\r
-/*\r
-       inline TBool operator>=(TInt aVal) const;\r
-       inline TBool operator<=(TInt aVal) const;\r
-       inline TBool operator>(TInt aVal) const;\r
-       inline TBool operator<(TInt aVal) const;\r
-       inline TInt Int() const;\r
-private:\r
-*/\r
-       enum\r
-               {\r
-               EActive                         = 1,  //bit0\r
-               ERequestPending         = 2,  //bit1\r
-               };\r
-       TInt iStatus;\r
-       TUint iFlags;\r
-       friend class CActive;\r
-       friend class CActiveScheduler;\r
-       friend class CServer2;\r
-       };\r
-\r
-\r
-class CActive : public CBase\r
-       {\r
-public:\r
-enum TPriority\r
-       {\r
-       EPriorityIdle=-100,\r
-       EPriorityLow=-20,\r
-       EPriorityStandard=0,\r
-       EPriorityUserInput=10,\r
-       EPriorityHigh=20,\r
-       };\r
-public:\r
-       IMPORT_C ~CActive();\r
-       IMPORT_C void Cancel();\r
-       IMPORT_C void Deque();\r
-       IMPORT_C void SetPriority(TInt aPriority);\r
-       inline TBool IsActive() const {return(iStatus.iFlags&TRequestStatus::EActive);}\r
-       inline TBool IsAdded() const {return(iLink.iNext!=NULL);}\r
-       inline TInt Priority() const {return iLink.iPriority;}\r
-protected:\r
-       IMPORT_C CActive(TInt aPriority);\r
-       IMPORT_C void SetActive();\r
-       virtual void DoCancel() =0;\r
-       virtual void RunL() =0;\r
-       IMPORT_C virtual TInt RunError(TInt aError);\r
-protected:\r
-       IMPORT_C virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1);\r
-public:\r
-       TRequestStatusFaked iStatus; // hope this will work\r
-private:\r
-//     TBool iActive;\r
-       TPriQueLink iLink;\r
-       TAny* iSpare;\r
-       friend class CActiveScheduler;\r
-       friend class CServer;\r
-       friend class CServer2;\r
-       friend class CPrivatePolledActiveScheduler; // added\r
-       };\r
-\r
-\r
-\r
-class CActiveScheduler : public CBase\r
-       {\r
-       friend class CActiveSchedulerWait;\r
-public:\r
-       struct TLoop;\r
-       typedef TLoop* TLoopOwner;\r
-public:\r
-       IMPORT_C CActiveScheduler();\r
-       IMPORT_C ~CActiveScheduler();\r
-       IMPORT_C static void Install(CActiveScheduler* aScheduler);\r
-       IMPORT_C static CActiveScheduler* Current();\r
-       IMPORT_C static void Add(CActive* aActive);\r
-       IMPORT_C static void Start();\r
-       IMPORT_C static void Stop();\r
-       IMPORT_C static TBool RunIfReady(TInt& aError, TInt aMinimumPriority);\r
-       IMPORT_C static CActiveScheduler* Replace(CActiveScheduler* aNewActiveScheduler);\r
-       IMPORT_C virtual void WaitForAnyRequest();\r
-       IMPORT_C virtual void Error(TInt aError) const;\r
-       IMPORT_C void Halt(TInt aExitCode) const;\r
-       IMPORT_C TInt StackDepth() const;\r
-private:\r
-       static void Start(TLoopOwner* aOwner);\r
-       IMPORT_C virtual void OnStarting();\r
-       IMPORT_C virtual void OnStopping();\r
-       IMPORT_C virtual void Reserved_1();\r
-       IMPORT_C virtual void Reserved_2();\r
-       void Run(TLoopOwner* const volatile& aLoop);\r
-       void DoRunL(TLoopOwner* const volatile& aLoop, CActive* volatile & aCurrentObj);\r
-       friend class CPrivatePolledActiveScheduler; // added\r
-protected:\r
-       IMPORT_C virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1);\r
-protected:\r
-       inline TInt Level() const {return StackDepth();}        // deprecated\r
-private:\r
-       TLoop* iStack;\r
-       TPriQue<CActive> iActiveQ;\r
-       TAny* iSpare;\r
-       };\r
-\r
-\r
-\r
-class TCleanupItem;\r
-class CleanupStack\r
-       {\r
-public:\r
-       IMPORT_C static void PushL(TAny* aPtr);\r
-       IMPORT_C static void PushL(CBase* aPtr);\r
-       IMPORT_C static void PushL(TCleanupItem anItem);\r
-       IMPORT_C static void Pop();\r
-       IMPORT_C static void Pop(TInt aCount);\r
-       IMPORT_C static void PopAndDestroy();\r
-       IMPORT_C static void PopAndDestroy(TInt aCount);\r
-       IMPORT_C static void Check(TAny* aExpectedItem);\r
-       inline static void Pop(TAny* aExpectedItem);\r
-       inline static void Pop(TInt aCount, TAny* aLastExpectedItem);\r
-       inline static void PopAndDestroy(TAny* aExpectedItem);\r
-       inline static void PopAndDestroy(TInt aCount, TAny* aLastExpectedItem);\r
-       };\r
-\r
-\r
-/*\r
- * This will declare CPrivatePolledActiveScheduler as a friend\r
- * of all classes that define a friend. CPrivatePolledActiveScheduler needs to\r
- * be a friend of CActive\r
- */\r
-//#define friend friend class CPrivatePolledActiveScheduler; friend\r
-\r
-\r
-/*\r
- * This will change the:\r
- *              void DoStart();\r
- * method in CActiveScheduler to:\r
- *              void DoStart(); friend class CPrivatePolledActiveScheduler;\r
- * We need this to access the private datamembers in CActiveScheduler.\r
- */\r
-//#define DoStart() DoStart(); friend class CPrivatePolledActiveScheduler;\r
-//#include <e32base.h>\r
-#include "PolledAS.h"\r
-\r
-\r
-class CPrivatePolledActiveScheduler : public CActiveScheduler\r
-{\r
-public:\r
-       void Schedule();\r
-};\r
-\r
-\r
-void CPrivatePolledActiveScheduler::Schedule()\r
-{\r
-       TDblQueIter<CActive> q(iActiveQ);\r
-       q.SetToFirst();\r
-       FOREVER\r
-       {\r
-               CActive *pR=q++;\r
-               if (pR)\r
-               {\r
-                       //TRequestStatus::EActive                               = 1,  //bit0\r
-                       //TRequestStatus::ERequestPending               = 2,  //bit1\r
-                       if (pR->IsActive() && pR->iStatus!=KRequestPending)\r
-                       {\r
-//                             pR->iActive=EFalse; // won't this cause trouble?\r
-                               pR->iStatus.iFlags&=~TRequestStatusFaked::EActive;\r
-                               //debugPrintFile(_L("as: %08x"), pR);\r
-                               TRAPD(r,pR->RunL());\r
-                               //pR->iStatus=TRequestStatus::ERequestPending;\r
-                               break;\r
-                       }\r
-               }\r
-               else\r
-                       break;\r
-       }\r
-}\r
-\r
-\r
-static CPolledActiveScheduler* sPolledActiveScheduler = NULL;\r
-\r
-CPolledActiveScheduler::~CPolledActiveScheduler()\r
-{\r
-       sPolledActiveScheduler = NULL;\r
-       delete iPrivatePolledActiveScheduler;\r
-}\r
-\r
-CPolledActiveScheduler* CPolledActiveScheduler::NewL()\r
-{\r
-       // if (sPolledActiveScheduler == NULL)\r
-       {\r
-               sPolledActiveScheduler = new(ELeave)CPolledActiveScheduler;\r
-               CleanupStack::PushL(sPolledActiveScheduler);\r
-               sPolledActiveScheduler->ConstructL();\r
-               CleanupStack::Pop();\r
-       }\r
-       return sPolledActiveScheduler;\r
-}\r
-\r
-void CPolledActiveScheduler::ConstructL()\r
-{\r
-       iPrivatePolledActiveScheduler = new(ELeave) CPrivatePolledActiveScheduler;\r
-       iPrivatePolledActiveScheduler->Install(iPrivatePolledActiveScheduler);\r
-}\r
-\r
-\r
-void CPolledActiveScheduler::Schedule()\r
-{\r
-       iPrivatePolledActiveScheduler->Schedule();\r
-}\r
-\r
-CPolledActiveScheduler* CPolledActiveScheduler::Instance()\r
-{\r
-//     return (CPolledActiveScheduler*) CActiveScheduler::Current();\r
-       return sPolledActiveScheduler;\r
-}\r
diff --git a/platform/uiq3/engine/vid.cpp b/platform/uiq3/engine/vid.cpp
deleted file mode 100644 (file)
index d004bdf..0000000
+++ /dev/null
@@ -1,628 +0,0 @@
-// EmuScan routines for Pico, also simple text and shape drawing routines.\r
-\r
-// (c) Copyright 2006, notaz\r
-// All Rights Reserved\r
-\r
-#include "vid.h"\r
-#include "../Engine.h"\r
-#include <pico/pico_int.h>\r
-#include "../../common/emu.h"\r
-#include "blit.h"\r
-#include "debug.h"\r
-\r
-\r
-// global stuff\r
-extern TPicoAreaConfigEntry areaConfig[];\r
-extern const char *actionNames[];\r
-\r
-// main framebuffer\r
-static void *screenbuff = 0; // pointer to real device video memory\r
-//static\r
-extern "C" { unsigned char *PicoDraw2FB = 0; }  // temporary buffer\r
-const int framebuffsize  = (8+320)*(8+240+8)*2+8*2; // PicoDraw2FB size (in bytes+to support new rendering mode)\r
-\r
-// drawer function pointers\r
-static void (*drawTextFps)(const char *text) = 0;\r
-static void (*drawTextNotice)(const char *text) = 0;\r
-\r
-// blitter\r
-static void (*vidBlit)(int full) = 0;\r
-\r
-// colors\r
-const unsigned short color_red     = 0x022F;\r
-const unsigned short color_red_dim = 0x0004;\r
-const unsigned short color_green   = 0x01F1;\r
-const unsigned short color_blue    = 0x0F11;\r
-const unsigned short color_grey    = 0x0222;\r
-\r
-// other\r
-int txtheight_fit = 138;\r
-\r
-// bitmasks\r
-static const unsigned long mask_numbers[] = {\r
-       0x12244800, // 47 2F /\r
-       0x69999600, // 48 30 0\r
-       0x26222200, // 49 31 1\r
-       0x69168F00, // 50 32 2\r
-       0x69219600, // 51 33 3\r
-       0x266AF200, // 52 34 4\r
-       0xF8E11E00, // 53 35 5\r
-       0x68E99600, // 54 36 6\r
-       0x71222200, // 55 37 7\r
-       0x69699600, // 56 38 8\r
-       0x69719600, // 57 39 9\r
-       0x04004000, // 58 3A :\r
-       0x04004400, // 59 3B ;\r
-       0x01242100, // 60 3C <\r
-       0x00707000, // 61 3D =\r
-       0x04212400, // 62 3E >\r
-       0x69240400, // 63 3F ?\r
-       0x00000000, // 64 40 @ [used instead of space for now]\r
-       0x22579900, // 65 41 A\r
-       0xE9E99E00, // 66 42 B\r
-       0x69889600, // 67 43 C\r
-       0xE9999E00, // 68 44 D\r
-       0xF8E88F00, // 69 45 E\r
-       0xF8E88800, // 70 46 F\r
-       0x698B9700, // 71 47 G\r
-       0x99F99900, // 72 48 H\r
-       0x44444400, // 73 49 I\r
-       0x11119600, // 74 4A J\r
-       0x9ACCA900, // 75 4B K\r
-       0x88888F00, // 76 4C L\r
-       0x9F999900, // 77 4D M\r
-       0x9DDBB900, // 78 4E N\r
-       0x69999600, // 79 4F O\r
-       0xE99E8800, // 80 50 P\r
-       0x6999A500, // 81 51 Q\r
-       0xE99E9900, // 82 52 R\r
-       0x69429600, // 83 53 S\r
-       0x72222200, // 84 54 T\r
-       0x99999600, // 85 55 U\r
-       0x55552200, // 86 56 V\r
-       0x9999F900, // 87 57 W\r
-       0x55225500, // 88 58 X\r
-       0x55222200, // 89 59 Y\r
-       0xF1248F00, // 90 5A Z\r
-};\r
-\r
-\r
-////////////////////////////////\r
-// PicoScan functions\r
-\r
-static int EmuScanBegin8(unsigned int num)\r
-{\r
-       DrawLineDest = PicoDraw2FB + 328*num + 8;\r
-\r
-       return 0;\r
-}\r
-\r
-\r
-static int EmuScanEndFit0(unsigned int num)\r
-{\r
-       // 0.75, 168 lines\r
-\r
-       static int u = 0, num2 = 0;\r
-       if(!num) u = num2 = 0;\r
-\r
-       DrawLineDest = PicoDraw2FB + 328*(++num2) + 8;\r
-\r
-       u += 6666;\r
-\r
-       if(u < 10000) {\r
-//             u += 7500;\r
-               return 1;\r
-       }\r
-\r
-       u -= 10000;\r
-\r
-       return 0;\r
-}\r
-\r
-\r
-////////////////////////////////\r
-// text drawers\r
-// warning: text must be at least 1px away from screen borders\r
-\r
-static void drawTextM2(int x, int y, const char *text)\r
-{\r
-       unsigned char *vidmem = PicoDraw2FB + 328*8 + 8;\r
-       int charmask, i, cx = x, cy;\r
-       unsigned char *l, *le;\r
-\r
-       // darken the background (left border)\r
-       for(l=vidmem+(cx-1)+(y-1)*328, le=l+8*328; l < le; l+=328) *l = 0xE0;\r
-\r
-       for(const char *p=text; *p; p++) {\r
-               cy = y;\r
-               charmask = *(mask_numbers + (*p - 0x2F));\r
-\r
-               for(l = vidmem+cx+(y-1)*328, le = l+8*328; l < le; l+=328-4) {\r
-                       *l = 0xE0; l++; *l = 0xE0; l++;\r
-                       *l = 0xE0; l++; *l = 0xE0; l++;\r
-                       *l = 0xE0;\r
-               }\r
-\r
-               for(i=0; i < 24; i++) {\r
-                       if(charmask&0x80000000) *( vidmem + (cx+(i&3)) + (cy+(i>>2))*328 ) = 0xf0;\r
-                       charmask <<= 1;\r
-               }\r
-               cx += 5;\r
-       }\r
-}\r
-\r
-\r
-static void drawTextM2Fat(int x, int y, const char *text)\r
-{\r
-       unsigned char *vidmem = PicoDraw2FB + 328*8 + 8;\r
-       int charmask, i, cx = x&~1, cy;\r
-       unsigned short *l, *le;\r
-\r
-       // darken the background (left border)\r
-       for(l=(unsigned short *)(vidmem+(cx-2)+(y-1)*328), le=l+8*328/2; l < le; l+=328/2) *l = 0xE0;\r
-\r
-       for(const char *p=text; *p; p++) {\r
-               cy = y;\r
-               for(l = (unsigned short *)(vidmem+cx+(y-1)*328), le = l+8*328/2; l < le; l+=328/2) {\r
-                       l += 4;\r
-                       *l-- = 0xe0e0; *l-- = 0xe0e0; *l-- = 0xe0e0; *l-- = 0xe0e0; *l = 0xe0e0; \r
-               }\r
-\r
-               charmask = *(mask_numbers + (*p - 0x2F));\r
-\r
-               for(i=0; i < 24; i++) {\r
-                       if(charmask&0x80000000) *(unsigned short *)( vidmem + cx+(i&3)*2 + (cy+(i>>2))*328 ) = 0xf0f0;\r
-                       charmask <<= 1;\r
-               }\r
-               cx += 5*2;\r
-       }\r
-}\r
-\r
-\r
-static void drawTextFpsCenter0(const char *text)\r
-{\r
-       if(!text) return;\r
-       drawTextM2((Pico.video.reg[12]&1) ? 234 : 214, 216, text);\r
-}\r
-\r
-static void drawTextFpsFit0(const char *text)\r
-{\r
-       if(!text) return;\r
-       drawTextM2Fat((Pico.video.reg[12]&1) ? 256-32 : 224-32, 160, text);\r
-}\r
-\r
-static void drawTextFpsFit2_0(const char *text)\r
-{\r
-       if(!text) return;\r
-       drawTextM2Fat((Pico.video.reg[12]&1) ? 256-32 : 224-32, 216, text);\r
-}\r
-\r
-static void drawTextFps0(const char *text)\r
-{\r
-       if(!text) return;\r
-       drawTextM2((Pico.video.reg[12]&1) ? 256 : 224, 216, text);\r
-}\r
-\r
-static void drawTextNoticeCenter0(const char *text)\r
-{\r
-       if(!text) return;\r
-       drawTextM2(42, 216, text);\r
-}\r
-\r
-static void drawTextNoticeFit0(const char *text)\r
-{\r
-       if(!text) return;\r
-       drawTextM2Fat(2, 160, text);\r
-}\r
-\r
-static void drawTextNoticeFit2_0(const char *text)\r
-{\r
-       if(!text) return;\r
-       drawTextM2Fat(2, 216, text);\r
-}\r
-\r
-static void drawTextNotice0(const char *text)\r
-{\r
-       if(!text) return;\r
-       drawTextM2(2, 216, text);\r
-}\r
-\r
-\r
-// -----------------------------------------------------------------\r
-\r
-static int localPal[0x100];\r
-\r
-static void fillLocalPal(void)\r
-{\r
-       Pico.m.dirtyPal = 0;\r
-\r
-       if (PicoOpt&0x10) {\r
-               // 8bit fast renderer\r
-               vidConvCpyRGB32(localPal, Pico.cram, 0x40);\r
-               return;\r
-       }\r
-\r
-       // 8bit accurate renderer\r
-       if(Pico.video.reg[0xC]&8) { // shadow/hilight mode\r
-               vidConvCpyRGB32(localPal, Pico.cram, 0x40);\r
-               vidConvCpyRGB32sh(localPal+0x40, Pico.cram, 0x40);\r
-               vidConvCpyRGB32hi(localPal+0x80, Pico.cram, 0x40);\r
-               memcpy32(localPal+0xc0, localPal+0x40, 0x40);\r
-               localPal[0xe0] = 0x00000000; // reserved pixels for OSD\r
-               localPal[0xf0] = 0x00ee0000;\r
-       }\r
-       else if (rendstatus & PDRAW_SONIC_MODE) { // mid-frame palette changes\r
-               vidConvCpyRGB32(localPal, Pico.cram, 0x40);\r
-               vidConvCpyRGB32(localPal+0x40, HighPal, 0x40);\r
-               vidConvCpyRGB32(localPal+0x80, HighPal+0x40, 0x40);\r
-       } else {\r
-               vidConvCpyRGB32(localPal, Pico.cram, 0x40);\r
-               memcpy32(localPal+0x80, localPal, 0x40); // for sprite prio mess\r
-       }\r
-}\r
-\r
-\r
-// note: the internal 8 pixel border is taken care by asm code\r
-static void vidBlit_90(int full)\r
-{\r
-       unsigned char *ps = PicoDraw2FB+328*8;\r
-       unsigned long *pd = (unsigned long *) screenbuff;\r
-\r
-       if(Pico.video.reg[12]&1)\r
-               vidConvCpy_90(pd, ps, localPal, 320/8);\r
-       else {\r
-               if(full) vidClear(pd, 32);\r
-               pd += (240+VID_BORDER_R)*32;\r
-               vidConvCpy_90(pd, ps, localPal, 256/8);\r
-               if(full) vidClear(pd + (240+VID_BORDER_R)*256, 32);\r
-       }\r
-}\r
-\r
-\r
-static void vidBlit_270(int full)\r
-{\r
-       unsigned char *ps = PicoDraw2FB+328*8;\r
-       unsigned long *pd = (unsigned long *) screenbuff;\r
-\r
-       if(Pico.video.reg[12]&1)\r
-               vidConvCpy_270(pd, ps, localPal, 320/8);\r
-       else {\r
-               if(full) vidClear(pd, 32);\r
-               pd += (240+VID_BORDER_R)*32;\r
-               ps -= 64;     // the blitter starts copying from the right border, so we need to adjust\r
-               vidConvCpy_270(pd, ps, localPal, 256/8);\r
-               if(full) vidClear(pd + (240+VID_BORDER_R)*256, 32);\r
-       }\r
-}\r
-\r
-\r
-static void vidBlitCenter_0(int full)\r
-{\r
-       unsigned char *ps = PicoDraw2FB+328*8+8;\r
-       unsigned long *pd = (unsigned long *) screenbuff;\r
-\r
-       if(Pico.video.reg[12]&1) ps += 32;\r
-       vidConvCpy_center_0(pd, ps, localPal);\r
-       if(full) vidClear(pd + (240+VID_BORDER_R)*224, 96);\r
-}\r
-\r
-\r
-static void vidBlitCenter_180(int full)\r
-{\r
-       unsigned char *ps = PicoDraw2FB+328*8+8;\r
-       unsigned long *pd = (unsigned long *) screenbuff;\r
-\r
-       if(Pico.video.reg[12]&1) ps += 32;\r
-       vidConvCpy_center_180(pd, ps, localPal);\r
-       if(full) vidClear(pd + (240+VID_BORDER_R)*224, 96);\r
-}\r
-\r
-\r
-static void vidBlitFit_0(int full)\r
-{\r
-       if(Pico.video.reg[12]&1)\r
-            vidConvCpy_center2_40c_0(screenbuff, PicoDraw2FB+328*8, localPal, 168);\r
-       else vidConvCpy_center2_32c_0(screenbuff, PicoDraw2FB+328*8, localPal, 168);\r
-       if(full) vidClear((unsigned long *)screenbuff + (240+VID_BORDER_R)*168, 320-168);\r
-}\r
-\r
-\r
-static void vidBlitFit_180(int full)\r
-{\r
-       if(Pico.video.reg[12]&1)\r
-            vidConvCpy_center2_40c_180(screenbuff, PicoDraw2FB+328*8, localPal, 168);\r
-       else vidConvCpy_center2_32c_180(screenbuff, PicoDraw2FB+328*8-64, localPal, 168);\r
-       if(full) vidClear((unsigned long *)screenbuff + (240+VID_BORDER_R)*168, 320-168);\r
-}\r
-\r
-\r
-static void vidBlitFit2_0(int full)\r
-{\r
-       if(Pico.video.reg[12]&1)\r
-            vidConvCpy_center2_40c_0(screenbuff, PicoDraw2FB+328*8, localPal, 224);\r
-       else vidConvCpy_center2_32c_0(screenbuff, PicoDraw2FB+328*8, localPal, 224);\r
-       if(full) vidClear((unsigned long *)screenbuff + (240+VID_BORDER_R)*224, 96);\r
-}\r
-\r
-\r
-static void vidBlitFit2_180(int full)\r
-{\r
-       if(Pico.video.reg[12]&1)\r
-            vidConvCpy_center2_40c_180(screenbuff, PicoDraw2FB+328*8, localPal, 224);\r
-       else vidConvCpy_center2_32c_180(screenbuff, PicoDraw2FB+328*8-64, localPal, 224);\r
-       if(full) vidClear((unsigned long *)screenbuff + (240+VID_BORDER_R)*224, 96);\r
-}\r
-\r
-static void vidBlitCfg(void)\r
-{\r
-       unsigned short *ps = (unsigned short *) PicoDraw2FB;\r
-       unsigned long *pd = (unsigned long *) screenbuff;\r
-       int i;\r
-\r
-       // hangs randomly (due to repeated ldms/stms?)\r
-       //for (int i = 1; i < 320; i++, ps += 240, pd += 256)\r
-       //      vidConvCpyRGB32(pd, ps, 240);\r
-\r
-       for (i = 0; i < 320; i++, pd += VID_BORDER_R)\r
-               for (int u = 0; u < 240; u++, ps++, pd++)\r
-                       *pd = ((*ps & 0xf) << 20) | ((*ps & 0xf0) << 8) | ((*ps & 0xf00) >> 4);\r
-}\r
-\r
-\r
-////////////////////////////////\r
-// main functions\r
-\r
-int vidInit(void *vidmem, int reinit)\r
-{\r
-       if(!reinit) {\r
-               // prepare framebuffer\r
-               screenbuff = vidmem;\r
-               PicoDraw2FB = (unsigned char *) malloc(framebuffsize);\r
-\r
-               if(!screenbuff) return KErrNotSupported;\r
-               if(!PicoDraw2FB)  return KErrNoMemory;\r
-\r
-               memset(PicoDraw2FB, 0, framebuffsize);\r
-       }\r
-\r
-       // select suitable blitters\r
-       vidBlit = vidBlit_270;\r
-       PicoScanBegin = EmuScanBegin8;\r
-       PicoScanEnd = NULL;\r
-       drawTextFps = drawTextFps0;\r
-       drawTextNotice = drawTextNotice0;\r
-\r
-       memset(localPal, 0, 0x100*4);\r
-       localPal[0xe0] = 0x00000000; // reserved pixels for OSD\r
-       localPal[0xf0] = 0x00ee0000;\r
-\r
-       // setup all orientation related stuff\r
-       if (currentConfig.rotation == TPicoConfig::PRot0)\r
-       {\r
-               if (currentConfig.scaling == TPicoConfig::PMCenter) {\r
-                       vidBlit = vidBlitCenter_0;\r
-                       drawTextFps = drawTextFpsCenter0;\r
-                       drawTextNotice = drawTextNoticeCenter0;\r
-               } else if (currentConfig.scaling == TPicoConfig::PMFit2) {\r
-                       vidBlit = vidBlitFit2_0;\r
-                       drawTextFps = drawTextFpsFit2_0;\r
-                       drawTextNotice = drawTextNoticeFit2_0;\r
-               } else {\r
-                       vidBlit = vidBlitFit_0;\r
-                       drawTextFps = drawTextFpsFit0;\r
-                       drawTextNotice = drawTextNoticeFit0;\r
-                       PicoScanBegin = NULL;\r
-                       PicoScanEnd = EmuScanEndFit0;\r
-               }\r
-       } else if (currentConfig.rotation == TPicoConfig::PRot90) {\r
-               vidBlit = vidBlit_90;\r
-       }\r
-       else if (currentConfig.rotation == TPicoConfig::PRot180)\r
-       {\r
-               if (currentConfig.scaling == TPicoConfig::PMCenter)\r
-               {\r
-                       vidBlit = vidBlitCenter_180;\r
-                       drawTextFps = drawTextFpsCenter0;\r
-                       drawTextNotice = drawTextNoticeCenter0;\r
-               }\r
-               else if (currentConfig.scaling == TPicoConfig::PMFit2) {\r
-                       vidBlit = vidBlitFit2_180;\r
-                       drawTextFps = drawTextFpsFit2_0;\r
-                       drawTextNotice = drawTextNoticeFit2_0;\r
-               } else {\r
-                       vidBlit = vidBlitFit_180;\r
-                       drawTextFps = drawTextFpsFit0;\r
-                       drawTextNotice = drawTextNoticeFit0;\r
-                       PicoScanBegin = NULL;\r
-                       PicoScanEnd = EmuScanEndFit0;\r
-               }\r
-       }\r
-       else if (currentConfig.rotation == TPicoConfig::PRot270) {\r
-               vidBlit = vidBlit_270;\r
-       }\r
-\r
-       fillLocalPal();\r
-       vidBlit(1);\r
-       PicoOpt |= 0x100;\r
-       Pico.m.dirtyPal = 1;\r
-\r
-       return 0;\r
-}\r
-\r
-void vidFree()\r
-{\r
-       free(PicoDraw2FB);\r
-       PicoDraw2FB = 0;\r
-}\r
-\r
-void vidDrawFrame(char *noticeStr, char *fpsStr, int num)\r
-{\r
-       DrawLineDest = PicoDraw2FB + 328*8 + 8;\r
-\r
-//     PicoFrame(); // moved to main loop\r
-       if (currentConfig.EmuOpt & EOPT_SHOW_FPS)\r
-               drawTextFps(fpsStr);\r
-       drawTextNotice(noticeStr);\r
-\r
-       if (Pico.m.dirtyPal) fillLocalPal();\r
-       vidBlit(!num); // copy full frame once a second\r
-}\r
-\r
-// -----------------------------------------------------------------\r
-\r
-static void drawText0(int x, int y, const char *text, long color)\r
-{\r
-       unsigned short *vidmem=(unsigned short *)PicoDraw2FB;\r
-       int charmask, i, cx = x, cy;\r
-       unsigned short *l, *le, dmask=0x0333;\r
-\r
-       // darken the background (left border)\r
-       for(l=vidmem+(cx-1)+(y-1)*240, le=vidmem+(cx-1)+(y+7)*240; l < le; l+=240)\r
-               *l = (*l >> 2) & dmask;\r
-\r
-       for(const char *p=text; *p; p++) {\r
-               cy = y;\r
-               charmask = *(mask_numbers + (*p - 0x2F));\r
-\r
-               for(l = vidmem+cx+(y-1)*240, le = vidmem+cx+(y+7)*240; l < le; l+=240-4) {\r
-                       *l = (*l >> 2) & dmask; l++; *l = (*l >> 2) & dmask; l++;\r
-                       *l = (*l >> 2) & dmask; l++; *l = (*l >> 2) & dmask; l++;\r
-                       *l = (*l >> 2) & dmask;\r
-               }\r
-\r
-               for(i=0; i < 24; i++) {\r
-                       // draw dot. Is this fast?\r
-                       if(charmask&0x80000000) *( vidmem + (cx+(i&3)) + (cy+(i>>2))*240 ) = color;\r
-                       charmask <<= 1;\r
-               }\r
-               cx += 5;\r
-       }\r
-}\r
-\r
-// draws rect with width - 1 and height - 1\r
-static void drawRect(const TRect &rc, unsigned short color)\r
-{\r
-       unsigned short *vidmem=(unsigned short *)PicoDraw2FB;\r
-\r
-       if(rc.iTl.iX - rc.iBr.iX && rc.iTl.iY - rc.iBr.iY) {\r
-               int stepX = rc.iTl.iX < rc.iBr.iX ? 1 : -1;\r
-               int stepY = rc.iTl.iY < rc.iBr.iY ? 1 : -1;\r
-               \r
-               for(int x = rc.iTl.iX;; x += stepX) {\r
-                       *(vidmem + rc.iTl.iY*240 + x) = *(vidmem + (rc.iBr.iY - stepY)*240 + x) = color;\r
-                       if(x == rc.iBr.iX - stepX) break;\r
-               }\r
-               \r
-               for(int y = rc.iTl.iY;; y += stepY) {\r
-                       *(vidmem + y*240 + rc.iTl.iX) = *(vidmem + y*240 + rc.iBr.iX - stepX) = color;\r
-                       if(y == rc.iBr.iY - stepY) break;\r
-               }\r
-       }\r
-}\r
-\r
-// draws fullsize filled rect\r
-static void drawRectFilled(const TRect rc, unsigned short color)\r
-{\r
-       unsigned short *vidmem=(unsigned short *)PicoDraw2FB;\r
-\r
-       if(rc.iTl.iX - rc.iBr.iX && rc.iTl.iY - rc.iBr.iY) {\r
-               int stepX = rc.iTl.iX < rc.iBr.iX ? 1 : -1;\r
-               int stepY = rc.iTl.iY < rc.iBr.iY ? 1 : -1;\r
-               \r
-               for(int y = rc.iTl.iY;; y += stepY) {\r
-                       for(int x = rc.iTl.iX;; x += stepX) {\r
-                               *(vidmem + y*240 + x) = *(vidmem + y*240 + x) = color;\r
-                               if(x == rc.iBr.iX) break;\r
-                       }\r
-                       if(y == rc.iBr.iY) break;\r
-               }\r
-       }\r
-}\r
-\r
-// direction: -1 left, 1 right\r
-static void drawArrow0(TPoint p, int direction, unsigned short color)\r
-{\r
-       unsigned short *vidmem=(unsigned short *)PicoDraw2FB;\r
-       int width = 15;\r
-       int x = p.iX;\r
-       int y = p.iY;\r
-\r
-       for(; width > 0; x+=direction, y++, width -=2)\r
-               for(int i=0; i < width; i++)\r
-                       *(vidmem + x + y*240 + i*240) = color;\r
-}\r
-\r
-static char *vidGetScanName(int scan)\r
-{\r
-       static char buff[32];\r
-\r
-       if((scan >= '0' && scan <= '9') || (scan >= 'A' && scan <= 'Z')) {\r
-               buff[0] = (char) scan; buff[1] = 0;\r
-       } else {\r
-               switch(scan) {\r
-                       case 0x01: strcpy(buff, "BSPACE");   break;\r
-                       case 0x03: strcpy(buff, "OK");       break;\r
-                       case 0x05: strcpy(buff, "SPACE");    break;\r
-                       case 0x0e: strcpy(buff, "AST");      break;\r
-                       case 0x0f: strcpy(buff, "HASH");     break;\r
-                       case 0x12: strcpy(buff, "SHIFT");    break;\r
-                       case 0x19: strcpy(buff, "ALT");      break;\r
-                       case 0x79: strcpy(buff, "PLUS");     break;\r
-                       case 0x7a: strcpy(buff, "DOT");      break;\r
-                       case 0xa5: strcpy(buff, "JOG@UP");   break;\r
-                       case 0xa6: strcpy(buff, "JOG@DOWN"); break;\r
-                       case 0xb5: strcpy(buff, "INET");     break;\r
-                       case 0xd4: strcpy(buff, "JOG@PUSH"); break;\r
-                       case 0xd5: strcpy(buff, "BACK");     break;\r
-                       default:  sprintf(buff, "KEY@%02X", scan); break;\r
-               }\r
-       }\r
-\r
-       return buff;\r
-}\r
-\r
-void vidKeyConfigFrame(const TUint whichAction)\r
-{\r
-       int i;\r
-       char buttonNames[128];\r
-       buttonNames[0] = 0;\r
-       memset(PicoDraw2FB, 0, framebuffsize);\r
-\r
-       unsigned long currentActCode = 1 << whichAction;\r
-\r
-       // draw all "buttons" in reverse order\r
-       const TPicoAreaConfigEntry *e = areaConfig + 1; i = 0;\r
-       while(e->rect != TRect(0,0,0,0)) { e++; i++; }\r
-       for(e--, i--; e->rect != TRect(0,0,0,0); e--, i--)\r
-               drawRect(e->rect, (currentConfig.KeyBinds[i+256] & currentActCode) ? color_red : color_red_dim);\r
-\r
-       // action name control\r
-       drawRectFilled(TRect(72, 2, 168, 20), color_grey); // 96x14\r
-       drawArrow0(TPoint(80, 3), -1, color_green);\r
-       drawArrow0(TPoint(160, 3), 1, color_green);\r
-\r
-       drawText0(86, 9, actionNames[whichAction], color_red);\r
-\r
-       // draw active button names if there are any\r
-       for (i = 0; i < 256; i++) {\r
-               if (currentConfig.KeyBinds[i] & currentActCode) {\r
-                       if(buttonNames[0]) strcat(buttonNames, ";@");\r
-                       strcat(buttonNames, vidGetScanName(i));\r
-               }\r
-       }\r
-\r
-       if (buttonNames[0]) {\r
-               buttonNames[61] = 0; // only 60 chars fit\r
-               drawText0(6, 48, buttonNames, color_blue);\r
-       }\r
-\r
-       vidBlitCfg();\r
-}\r
-\r
-void vidDrawNotice(const char *txt)\r
-{\r
-       if(PicoDraw2FB) {\r
-               drawTextNotice(txt);\r
-               vidBlit(1);\r
-       }\r
-}\r
diff --git a/platform/uiq3/engine/vid.h b/platform/uiq3/engine/vid.h
deleted file mode 100644 (file)
index d6b8995..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <e32base.h>\r
-\r
-// let's do it in more c-like way\r
-int  vidInit(void *vidmem, int reinit);\r
-void vidFree();\r
-void vidDrawFrame(char *noticeStr, char *fpsStr, int num);\r
-void vidKeyConfigFrame(const TUint whichAction);\r
-void vidDrawFCconfigDone();\r
-void vidDrawNotice(const char *txt); // safe to call anytime, draws text for 1 frame\r
diff --git a/platform/uiq3/picodrive.hrh b/platform/uiq3/picodrive.hrh
deleted file mode 100644 (file)
index 445c7fb..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-\r
-enum TAppMenuCommands\r
-{\r
-       // Emu menu\r
-       EEikCmdPicoMain = 10000,\r
-       EEikCmdPicoResume,\r
-       EEikCmdPicoLoadState,\r
-       EEikCmdPicoSaveState,\r
-       EEikCmdPicoLoadROM,\r
-       EEikCmdPicoReset,\r
-       EEikCmdPicoConfig,\r
-       EEikCmdPicoKeys,\r
-       EEikCmdPicoSettings,\r
-\r
-       // Frameskip submenu\r
-       EEikCmdPicoFrameskip,\r
-       EEikCmdPicoFrameskipAuto,\r
-       EEikCmdPicoFrameskip0,\r
-       EEikCmdPicoFrameskip1,\r
-       EEikCmdPicoFrameskip2,\r
-       EEikCmdPicoFrameskip4,\r
-       EEikCmdPicoFrameskip8,\r
-\r
-       // Debug menu\r
-       EEikCmdPicoDebug,\r
-//     EEikCmdPicoDebugKillEmu,\r
-       EEikCmdPicoDebugInfo,\r
-\r
-       // config Dialog\r
-       ECtlOptDone,\r
-       // pages\r
-       ECtlOptPageMain,\r
-       ECtlOptPageSound,\r
-       ECtlOptPageMCD,\r
-       ECtlOptPageMisc,\r
-       // main page\r
-       ECtlOptRotationLabel,\r
-       ECtlOptRotation,\r
-       ECtlOptRotation0,\r
-       ECtlOptRotation90,\r
-       ECtlOptRotation180,\r
-       ECtlOptRotation270,\r
-       ECtlOptScreenModeLabel,\r
-       ECtlOptScreenMode,\r
-       ECtlOptScreenModeCenter,\r
-       ECtlOptScreenModeFit,\r
-       ECtlOptScreenModeFit2,\r
-       ECtlOptUseAltRend,\r
-//     ECtlOptUseAccTiming,\r
-//     ECtlOptUseAccSprites,\r
-       ECtlOptShowFPS,\r
-       // sound page\r
-       ECtlOptEnableSound,\r
-       ECtlOptChipSelLabel,\r
-       ECtlOptEmulateZ80,\r
-       ECtlOptEmulateYM2612,\r
-       ECtlOptEmulateSN76496,\r
-       ECtlOptSndQLabel,\r
-       ECtlOptSndQuality,\r
-       // MCD page\r
-       ECtlOptCDleds,\r
-       ECtlOptCDcdda,\r
-       ECtlOptCDpcm,\r
-       ECtlOptCDramcart,\r
-       ECtlOptCDscalerot,\r
-       ECtlOptCDbettersync,\r
-       // misc page\r
-       ECtlOpt6ButtonPad,\r
-       ECtlOptGzipStates,\r
-       ECtlOptUseSRAM,\r
-       ECtlOptMotDontUseVol,\r
-       ECtlOptRegion,\r
-       // about dialog\r
-       EEikCmdPicoAboutDoneCmd,\r
-       EEikCmdPicoAboutCreditsCmd,\r
-       ECtlPicoAboutText,\r
-       // credits\r
-       ECtlPicoCreditsText,\r
-       // debug\r
-       ECtlDebugEdit\r
-};\r
-\r
-\r
-#define ECtlAboutVersion       1\r
-#define ECtlAboutLinks         2\r
-\r
diff --git a/platform/uiq3/picodrive.pkg b/platform/uiq3/picodrive.pkg
deleted file mode 100644 (file)
index ca13ec7..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-%{"notaz"}
-:"notaz"
-#{"PicoDrive"}, (0xA00010F3), 1, 51, 1, TYPE=SA
-(0x101F6300), 3, 0, 0, {"UIQ30ProductID"}
-"picodrive.exe"-"!:\sys\bin\PicoDrive.exe"
-"rsc/picodrive.rsc"-"!:\resource\apps\PicoDrive.rsc"
-"picodrive.mbm"-"!:\resource\apps\PicoDrive.mbm"
-"rsc/picodrive_loc.rsc"-"!:\resource\apps\PicoDrive_loc.rsc"
-"rsc/picodrive_reg.rsc"-"!:\private\10003a3f\import\apps\PicoDrive_reg.rsc"
diff --git a/platform/uiq3/port_config.h b/platform/uiq3/port_config.h
deleted file mode 100644 (file)
index 2eea033..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-// port specific settings\r
-\r
-#ifndef PORT_CONFIG_H\r
-#define PORT_CONFIG_H\r
-\r
-#define CASE_SENSITIVE_FS 0\r
-#define DONT_OPEN_MANY_FILES 0\r
-#define REDUCE_IO_CALLS 0\r
-#define SIMPLE_WRITE_SOUND 0\r
-\r
-// draw2.c\r
-#define START_ROW  0 // which row of tiles to start rendering at?\r
-#define END_ROW   28 // ..end\r
-\r
-// pico.c\r
-#define CAN_HANDLE_240_LINES   0 // for now\r
-\r
-// logging emu events\r
-#define EL_LOGMASK (EL_STATUS) // |EL_SVP|EL_ANOMALY)\r
-\r
-//extern void dprintf(char *format, ...);\r
-//#define dprintf(f,...) printf("%05i:%03i: " f "\n",Pico.m.frame_count,Pico.m.scanline,##__VA_ARGS__)\r
-#define dprintf(x...)\r
-\r
-// platform\r
-#define PATH_SEP      "\\"\r
-#define PATH_SEP_C    '\\'\r
-#define MENU_X2       0\r
-\r
-// engine/vid.cpp, also update BORDER_R in port_config.s\r
-#define VID_BORDER_R  16\r
-\r
-#endif // PORT_CONFIG_H\r
diff --git a/platform/uiq3/port_config.s b/platform/uiq3/port_config.s
deleted file mode 100644 (file)
index e0b359a..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-@ vim:filetype=armasm\r
-\r
-@ .equiv START_ROW,         1\r
-@ .equiv END_ROW,          27\r
-@ one row means 8 pixels. If above example was used, (27-1)*8=208 lines would be rendered.\r
-.equiv START_ROW,               0\r
-.equiv END_ROW,                28\r
-\r
-.equiv UNALIGNED_DRAWLINEDEST,  0\r
-\r
-@ this should be set to one only for GP2X port\r
-.equiv EXTERNAL_YM2612,         0\r
-\r
-@ also update VID_BORDER_R in port_config.h\r
-.equiv BORDER_R,               16\r
diff --git a/platform/uiq3/rsc/Pico18x18.bmp b/platform/uiq3/rsc/Pico18x18.bmp
deleted file mode 100644 (file)
index 840c55a..0000000
Binary files a/platform/uiq3/rsc/Pico18x18.bmp and /dev/null differ
diff --git a/platform/uiq3/rsc/Pico18x18m.bmp b/platform/uiq3/rsc/Pico18x18m.bmp
deleted file mode 100644 (file)
index 734d640..0000000
Binary files a/platform/uiq3/rsc/Pico18x18m.bmp and /dev/null differ
diff --git a/platform/uiq3/rsc/Pico40x40.bmp b/platform/uiq3/rsc/Pico40x40.bmp
deleted file mode 100644 (file)
index 81ad7e7..0000000
Binary files a/platform/uiq3/rsc/Pico40x40.bmp and /dev/null differ
diff --git a/platform/uiq3/rsc/Pico40x40m.bmp b/platform/uiq3/rsc/Pico40x40m.bmp
deleted file mode 100644 (file)
index 32a75ef..0000000
Binary files a/platform/uiq3/rsc/Pico40x40m.bmp and /dev/null differ
diff --git a/platform/uiq3/rsc/Pico64x64.bmp b/platform/uiq3/rsc/Pico64x64.bmp
deleted file mode 100644 (file)
index 3e35716..0000000
Binary files a/platform/uiq3/rsc/Pico64x64.bmp and /dev/null differ
diff --git a/platform/uiq3/rsc/Pico64x64m.bmp b/platform/uiq3/rsc/Pico64x64m.bmp
deleted file mode 100644 (file)
index 83a1857..0000000
Binary files a/platform/uiq3/rsc/Pico64x64m.bmp and /dev/null differ
diff --git a/platform/uiq3/rsc/picodrive.rss b/platform/uiq3/rsc/picodrive.rss
deleted file mode 100644 (file)
index eb5f5a6..0000000
+++ /dev/null
@@ -1,637 +0,0 @@
-NAME PCDR\r
-\r
-#include <eikon.rh>\r
-#include <eikon.rsg>\r
-#include <qikon.rh>\r
-#include <qikcommand.rh>\r
-#include "picodrive.hrh"\r
-\r
-\r
-RESOURCE RSS_SIGNATURE { }\r
-\r
-// Defines the name of the default file the application framework creates.\r
-// This resource must always be the second resource in the resource file.\r
-RESOURCE TBUF { buf = "PicoDrive"; }\r
-\r
-RESOURCE EIK_APP_INFO { }\r
-\r
-\r
-// A view shall use the QIK_VIEW_CONFIGURATIONS resource struct to define which \r
-// UI configurations it supports. Can also use QIK_VIEW_CONFIGURATIONS to setup \r
-// the view to switch layout and command list automatically when changes of UI \r
-// configuration occur. This is done with the view and command_list members of \r
-// the QIK_VIEW_CONFIGURATIONS.\r
-// The application supports the reference UI Configurations that are supported\r
-// in the UIQ 3 SDK. Use the UiqEnv tool, to change the UI Configuration in the\r
-// emulator in order to develop and test the application with varying phone styles.\r
-RESOURCE QIK_VIEW_CONFIGURATIONS r_app_ui_configurations\r
-{\r
-       configurations = \r
-       {\r
-               QIK_VIEW_CONFIGURATION\r
-               {\r
-                       ui_config_mode = KQikPenStyleTouchPortrait;\r
-                       command_list = r_app_commands;\r
-                       view = r_app_layout;\r
-               },\r
-               QIK_VIEW_CONFIGURATION\r
-               {\r
-                       ui_config_mode = KQikPenStyleTouchLandscape;\r
-                       command_list = r_app_commands;\r
-                       view = r_app_layout;\r
-               },\r
-               QIK_VIEW_CONFIGURATION\r
-               {\r
-                       ui_config_mode = KQikSoftkeyStyleTouchPortrait;\r
-                       command_list = r_app_commands;\r
-                       view = r_app_layout;\r
-               },\r
-               QIK_VIEW_CONFIGURATION\r
-               {\r
-                       ui_config_mode = KQikSoftkeyStylePortrait;\r
-                       command_list = r_app_commands;\r
-                       view = r_app_layout;\r
-               },\r
-               QIK_VIEW_CONFIGURATION\r
-               {\r
-                       ui_config_mode = KQikSoftkeyStyleSmallPortrait;\r
-                       command_list = r_app_commands;\r
-                       view = r_app_layout;\r
-               }\r
-       };\r
-}\r
-\r
-// Commands are defined with the QIK_COMMAND_LIST struct, \r
-// commands can also be created in code by instantiating CQikCommand.\r
-// The control command id for debug command is a reserved id from uikon.hrh.\r
-// The id for each command is defined in the .hrh file.\r
-RESOURCE QIK_COMMAND_LIST r_app_commands\r
-{\r
-       items = \r
-       {\r
-//             QIK_COMMAND { id=EEikCmdPicoMain;          text="Main";           type=EQikCommandTypeDone; namedGroupLinkId=EEikCmdPicoMain; },\r
-//             QIK_COMMAND { id=EEikCmdPicoDebugInfo;     text="Debug info";     type=EQikCommandTypeScreen; stateFlags=EQikCmdFlagDebugOnly; },\r
-               QIK_COMMAND { id=EEikCmdPicoFrameskip;     text="Frameskip";      type=EQikCommandTypeScreen; namedGroupLinkId=EEikCmdPicoFrameskip; },\r
-               QIK_COMMAND { id=EEikCmdPicoFrameskipAuto; text="Auto";           type=EQikCommandTypeScreen; namedGroupId=EEikCmdPicoFrameskip;\r
-                       groupId=EEikCmdPicoFrameskip;  stateFlags=EQikCmdFlagRadioStart; },\r
-               QIK_COMMAND { id=EEikCmdPicoFrameskip0;    text="0";              type=EQikCommandTypeScreen; namedGroupId=EEikCmdPicoFrameskip;\r
-                       groupId=EEikCmdPicoFrameskip0; stateFlags=EQikCmdFlagRadioMiddle; },\r
-               QIK_COMMAND { id=EEikCmdPicoFrameskip1;    text="1";              type=EQikCommandTypeScreen; namedGroupId=EEikCmdPicoFrameskip;\r
-                       groupId=EEikCmdPicoFrameskip0; stateFlags=EQikCmdFlagRadioMiddle; },\r
-               QIK_COMMAND { id=EEikCmdPicoFrameskip2;    text="2";              type=EQikCommandTypeScreen; namedGroupId=EEikCmdPicoFrameskip;\r
-                       groupId=EEikCmdPicoFrameskip0; stateFlags=EQikCmdFlagRadioMiddle; },\r
-               QIK_COMMAND { id=EEikCmdPicoFrameskip4;    text="4";              type=EQikCommandTypeScreen; namedGroupId=EEikCmdPicoFrameskip;\r
-                       groupId=EEikCmdPicoFrameskip0; stateFlags=EQikCmdFlagRadioMiddle; },\r
-               QIK_COMMAND { id=EEikCmdPicoFrameskip8;    text="8";              type=EQikCommandTypeScreen; namedGroupId=EEikCmdPicoFrameskip;\r
-                       groupId=EEikCmdPicoFrameskip0; stateFlags=EQikCmdFlagRadioEnd; },\r
-               QIK_COMMAND { id=EEikCmdPicoConfig;        text="Configure";      type=EQikCommandTypeScreen; namedGroupLinkId=EEikCmdPicoConfig; },\r
-               QIK_COMMAND { id=EEikCmdPicoKeys;          text="Keys";           type=EQikCommandTypeScreen; namedGroupId=EEikCmdPicoConfig; },\r
-               QIK_COMMAND { id=EEikCmdPicoSettings;      text="Settings";       type=EQikCommandTypeScreen; namedGroupId=EEikCmdPicoConfig; },\r
-               QIK_COMMAND { id=EEikCmdHelpAbout;         text="About";          type=EQikCommandTypeScreen; namedGroupId=EEikCmdPicoConfig; },\r
-\r
-               QIK_COMMAND { id=EEikCmdPicoLoadROM;       text="Load new ROM/ISO";type=EQikCommandTypeScreen; groupId=EEikCmdPicoResume; },\r
-               QIK_COMMAND { id=EEikCmdPicoReset;         text="Reset game";     type=EQikCommandTypeScreen; groupId=EEikCmdPicoResume; },\r
-               QIK_COMMAND { id=EEikCmdPicoLoadState;     text="Load state";     type=EQikCommandTypeScreen; groupId=EEikCmdPicoResume; },\r
-               QIK_COMMAND { id=EEikCmdPicoSaveState;     text="Save state";     type=EQikCommandTypeScreen; groupId=EEikCmdPicoResume; },\r
-               QIK_COMMAND { id=EEikCmdPicoResume;        text="Resume game";    type=EQikCommandTypeScreen; groupId=EEikCmdPicoResume; cpfFlags=EQikCpfFlagIsDefault; },\r
-\r
-               QIK_COMMAND { id=EEikCmdExit;              text="Exit";           type=EQikCommandTypeScreen; groupId=EEikCmdExit; }\r
-       };\r
-}\r
-\r
-\r
-// Defines the view by linking to the pages.\r
-RESOURCE QIK_VIEW r_app_layout\r
-{\r
-       pages = {};\r
-}\r
-\r
-\r
-/**************************************\r
- *\r
- * config dialog\r
- *\r
- **************************************/\r
-\r
-RESOURCE DIALOG r_pico_config\r
-{\r
-   title   = "Settings";\r
-   buttons = R_EIK_BUTTONS_CANCEL_OK;\r
-   flags   = EEikDialogFlagWait;\r
-   pages   = r_pico_config_pages;\r
-}\r
-\r
-RESOURCE ARRAY r_pico_config_pages\r
-{\r
-   items = {\r
-      PAGE\r
-      {\r
-         id    = ECtlOptPageMain;\r
-         text  = "Main";\r
-         lines = r_pico_config_page_main;\r
-      },\r
-      PAGE\r
-      {\r
-         id    = ECtlOptPageSound;\r
-         text  = "Sound";\r
-         lines = r_pico_config_page_sound;\r
-      },\r
-      PAGE\r
-      {\r
-         id    = ECtlOptPageMCD;\r
-         text  = "MegaCD";\r
-         lines = r_pico_config_page_mcd;\r
-      },\r
-      PAGE\r
-      {\r
-         id    = ECtlOptPageMisc;\r
-         text  = "Misc";\r
-         lines = r_pico_config_page_misc;\r
-      }\r
-   };\r
-}\r
-\r
-\r
-RESOURCE ARRAY r_pico_config_page_main\r
-{\r
-   items = {\r
-      DLG_LINE\r
-      {\r
-          id      = ECtlOptRotationLabel;\r
-          type    = EEikCtLabel;\r
-          prompt  = "Screen Rotation";\r
-          control = LABEL { horiz_align = EEikLabelAlignHLeft; };\r
-      },\r
-      DLG_LINE\r
-      {\r
-         id      = ECtlOptRotation;\r
-         type    = EEikCtHorOptionButList;\r
-         control = HOROPBUT\r
-         {\r
-            array_id = r_pico_config_rotation_buttons;\r
-         };\r
-      },\r
-      DLG_LINE\r
-      {\r
-          id      = ECtlOptScreenModeLabel;\r
-          type    = EEikCtLabel;\r
-          prompt  = "Screen Mode";\r
-          control = LABEL { horiz_align = EEikLabelAlignHLeft; };\r
-      },\r
-      DLG_LINE\r
-      {\r
-         id      = ECtlOptScreenMode;\r
-         type    = EEikCtHorOptionButList;\r
-         control = HOROPBUT\r
-         {\r
-            array_id = r_pico_config_screenmode_buttons;\r
-         };\r
-      },\r
-      DLG_LINE\r
-      {\r
-         id     = ECtlOptUseAltRend;\r
-         type   = EEikCtCheckBox;\r
-         prompt = "Fast renderer (inaccurate)";\r
-      },\r
-      DLG_LINE\r
-      {\r
-         id     = ECtlOptShowFPS;\r
-         type   = EEikCtCheckBox;\r
-         prompt = "Show FPS";\r
-      }\r
-   };\r
-}\r
-\r
-\r
-RESOURCE ARRAY r_pico_config_page_sound\r
-{\r
-   items = {\r
-      DLG_LINE\r
-      {\r
-         id     = ECtlOptEnableSound;\r
-         type   = EEikCtCheckBox;\r
-         prompt = "Enable sound";\r
-      },\r
-      DLG_LINE\r
-      {\r
-         id      = ECtlOptChipSelLabel;\r
-         type    = EEikCtLabel;\r
-         prompt  = "Emulate these sound chips:";\r
-         control = LABEL { horiz_align = EEikLabelAlignHLeft; };\r
-      },\r
-      DLG_LINE\r
-      {\r
-         id     = ECtlOptEmulateZ80;\r
-         type   = EEikCtCheckBox;\r
-         prompt = "Z80";\r
-      },\r
-      DLG_LINE\r
-      {\r
-         id     = ECtlOptEmulateYM2612;\r
-         type   = EEikCtCheckBox;\r
-         prompt = "YM2612";\r
-      },\r
-      DLG_LINE\r
-      {\r
-         id     = ECtlOptEmulateSN76496;\r
-         type   = EEikCtCheckBox;\r
-         prompt = "SN76496 (PSG)";\r
-      },\r
-      DLG_LINE\r
-      {\r
-         id      = ECtlOptSndQLabel;\r
-         type    = EEikCtLabel;\r
-         prompt  = "Quality (lowest is fastest)";\r
-         control = LABEL { horiz_align = EEikLabelAlignHLeft; };\r
-      },\r
-      DLG_LINE\r
-      {\r
-         id      = ECtlOptSndQuality;\r
-         type    = EEikCtChoiceList;\r
-         prompt  = "";\r
-         control = CHOICELIST { array_id = r_pico_config_snd_quality; };\r
-         itemflags = EEikDlgItemNonFocusing;\r
-      }\r
-   };\r
-}\r
-\r
-\r
-RESOURCE ARRAY r_pico_config_page_mcd\r
-{\r
-   items = {\r
-      DLG_LINE\r
-      {\r
-         id     = ECtlOptCDcdda;\r
-         type   = EEikCtCheckBox;\r
-         prompt = "CDDA audio";\r
-      },\r
-      DLG_LINE\r
-      {\r
-         id     = ECtlOptCDpcm;\r
-         type   = EEikCtCheckBox;\r
-         prompt = "PCM audio";\r
-      },\r
-      DLG_LINE\r
-      {\r
-         id     = ECtlOptCDramcart;\r
-         type   = EEikCtCheckBox;\r
-         prompt = "SaveRAM cart";\r
-      },\r
-      DLG_LINE\r
-      {\r
-         id     = ECtlOptCDscalerot;\r
-         type   = EEikCtCheckBox;\r
-         prompt = "Scale/Rot. fx (slow)";\r
-      },\r
-      DLG_LINE\r
-      {\r
-         id     = ECtlOptCDbettersync;\r
-         type   = EEikCtCheckBox;\r
-         prompt = "Better sync (slow)";\r
-      }\r
-   };\r
-}\r
-\r
-\r
-RESOURCE ARRAY r_pico_config_page_misc\r
-{\r
-   items = {\r
-      DLG_LINE\r
-      {\r
-         id     = ECtlOpt6ButtonPad;\r
-         type   = EEikCtCheckBox;\r
-         prompt = "6 button pad";\r
-      },\r
-      DLG_LINE\r
-      {\r
-         id     = ECtlOptGzipStates;\r
-         type   = EEikCtCheckBox;\r
-         prompt = "gzip save states";\r
-      },\r
-      DLG_LINE\r
-      {\r
-         id     = ECtlOptUseSRAM;\r
-         type   = EEikCtCheckBox;\r
-         prompt = "Use SRAM saves (.srm)";\r
-      },\r
-      DLG_LINE\r
-      {\r
-         id      = ECtlOptRegion;\r
-         type    = EEikCtChoiceList;\r
-         prompt  = "Region:";\r
-         control = CHOICELIST { array_id = r_pico_config_region; };\r
-         itemflags = EEikDlgItemNonFocusing;\r
-      }\r
-   };\r
-}\r
-\r
-\r
-RESOURCE ARRAY r_pico_config_rotation_buttons\r
-{\r
-   items = {\r
-     OPBUT { id = ECtlOptRotation0;    text = "0º";   },\r
-     OPBUT { id = ECtlOptRotation90;   text = "90º";  },\r
-     OPBUT { id = ECtlOptRotation180;  text = "180º";  },\r
-     OPBUT { id = ECtlOptRotation270;  text = "270º";  }\r
-   };\r
-}\r
-\r
-\r
-RESOURCE ARRAY r_pico_config_screenmode_buttons\r
-{\r
-   items = {\r
-     OPBUT { id = ECtlOptScreenModeCenter;  text = "Center"; },\r
-     OPBUT { id = ECtlOptScreenModeFit;     text = "Fit";    },\r
-     OPBUT { id = ECtlOptScreenModeFit2;    text = "Fit2";   }\r
-   };\r
-}\r
-\r
-\r
-RESOURCE ARRAY r_pico_config_snd_quality\r
-{\r
-   items = {\r
-     LBUF { txt = "8000Hz mono";          },\r
-     LBUF { txt = "11025Hz mono";         },\r
-     LBUF { txt = "16000Hz mono";         },\r
-     LBUF { txt = "22050Hz mono";         },\r
-     LBUF { txt = "44100Hz mono";         },\r
-     LBUF { txt = "8000Hz stereo";        },\r
-     LBUF { txt = "11025Hz stereo";       },\r
-     LBUF { txt = "16000Hz stereo";       },\r
-     LBUF { txt = "22050Hz stereo";       },\r
-     LBUF { txt = "44100Hz stereo";       }\r
-   };\r
-}\r
-\r
-\r
-RESOURCE ARRAY r_pico_config_region\r
-{\r
-   items = {\r
-     LBUF { txt = "Auto";        },\r
-     LBUF { txt = "Europe";      },\r
-     LBUF { txt = "USA";         },\r
-     LBUF { txt = "Japan PAL";   },\r
-     LBUF { txt = "Japan NTSC";  }\r
-   };\r
-}\r
-\r
-\r
-/**************************************\r
- *\r
- * about dialog\r
- *\r
- **************************************/\r
-\r
-// A simple dialog shall use the QIK_DIALOG resource struct to \r
-// define which UI configurations it supports.\r
-RESOURCE QIK_DIALOG r_pico_about\r
-{\r
-       title = "About";\r
-       configurations = \r
-       {\r
-               QIK_DIALOG_CONFIGURATION\r
-               {\r
-                       ui_config_mode = 0;\r
-                       container = r_pico_about_container;\r
-                       command_list = r_pico_about_commands;\r
-               }\r
-       };\r
-       controls = r_pico_about_controls;\r
-}\r
-\r
-RESOURCE QIK_COMMAND_LIST r_pico_about_commands\r
-{\r
-       items=\r
-       {\r
-               QIK_COMMAND\r
-               {\r
-                       id = EEikCmdPicoAboutDoneCmd;\r
-                       type = EQikCommandTypeDone;\r
-                       text = "Done";\r
-               },\r
-               QIK_COMMAND\r
-               {\r
-                       id = EEikCmdPicoAboutCreditsCmd;\r
-                       type = EQikCommandTypeItem;\r
-                       text = "Credits";\r
-               }\r
-       };\r
-}\r
\r
-// A collection of controls that can be used throughout the various \r
-// view/container/building block structs by using the unique handle in \r
-// QIK_CONTROL. So you can specify how the control should be created here and \r
-// just reference to it from other places.\r
-RESOURCE QIK_CONTROL_COLLECTION r_pico_about_controls\r
-{\r
-       items = \r
-       {\r
-               QIK_CONTROL\r
-               {\r
-                       unique_handle = ECtlPicoAboutText;\r
-                       type = EEikCtRichTextEditor;\r
-                       control = r_pico_about_rtxted;\r
-                       itemflags = EQikCtrlFlagIsEditInPlace;\r
-               }\r
-       };\r
-}\r
-\r
-// the controls themselves\r
-RESOURCE RTXTED r_pico_about_rtxted\r
-{\r
-    flags = EEikEdwinDisplayOnly|EEikEdwinReadOnly|EEikEdwinNoHorizScrolling;\r
-    numlines = 13;\r
-       displayMode = 1; // EDisplayModeView;\r
-}\r
-\r
-// Defines the content of the simple dialog and how they are laid out. \r
-// Default layout manager is used for laying out the controls, which is a row \r
-// layout.\r
-RESOURCE QIK_CONTAINER_SETTINGS r_pico_about_container\r
-{\r
-       controls = \r
-       {\r
-               QIK_CONTAINER_ITEM_CI_LI\r
-               {\r
-                       type = EQikCtOnelineBuildingBlock;\r
-                       control = r_pico_about_bb1;\r
-               }\r
-       };\r
-}\r
-    \r
-// Building block that contains the label.\r
-RESOURCE QIK_SYSTEM_BUILDING_BLOCK r_pico_about_bb1\r
-{\r
-       content =\r
-       {\r
-               QIK_SLOT_CONTENT\r
-               {\r
-                       slot_id = EQikItemSlot1;\r
-                       unique_handle = ECtlPicoAboutText;\r
-               }\r
-       };\r
-}\r
-\r
-RESOURCE TBUF r_pico_text_about\r
-{\r
-       buf= \r
-               "<f=Polo><s=26><a=center><fg=RgbDarkBlue>PicoDrive"\\r
-               "<p><f=Polo><s=10><a=center>for UIQ3"\\r
-               "<p><s=6> <p><f=Corinna><s=12>Version %S, by notaz."\\r
-               "<p><s=5> <p><s=10>Port based on UIQ2 version, which is based on PicoDrive 0.030 for Pocket PC by Dave"\\r
-               "<p><s=5> <p><f=Corinna><s=11><u>Email</u>: notasas@gmail.com"\\r
-               "<p><f=Corinna><s=10><u>Web</u>: http://notaz.gp2x.de"\\r
-               "<p><f=Corinna><s=10><u>Dave's Web</u>: http://www.finalburn.com";\r
-}\r
-\r
-/**************************************\r
- *\r
- * credits dialog\r
- *\r
- **************************************/\r
-\r
-// A simple dialog shall use the QIK_DIALOG resource struct to \r
-// define which UI configurations it supports.\r
-RESOURCE QIK_DIALOG r_pico_credits\r
-{\r
-       title = "Credits and thanks";\r
-       configurations = \r
-       {\r
-               QIK_DIALOG_CONFIGURATION\r
-               {\r
-                       ui_config_mode = 0;\r
-                       container = r_pico_credits_container;\r
-                       command_list = r_pico_credits_commands;\r
-               }\r
-       };\r
-       controls = r_pico_credits_controls;\r
-}\r
-\r
-RESOURCE QIK_COMMAND_LIST r_pico_credits_commands\r
-{\r
-       items=\r
-       {\r
-               QIK_COMMAND\r
-               {\r
-                       id = EEikCmdPicoAboutDoneCmd;\r
-                       type = EQikCommandTypeDone;\r
-                       text = "Done";\r
-               }\r
-       };\r
-}\r
-\r
-// A collection of controls that can be used throughout the various \r
-// view/container/building block structs by using the unique handle in \r
-// QIK_CONTROL. So you can specify how the control should be created here and \r
-// just reference to it from other places.\r
-RESOURCE QIK_CONTROL_COLLECTION r_pico_credits_controls\r
-{\r
-       items = \r
-       {\r
-               QIK_CONTROL\r
-               {\r
-                       unique_handle = ECtlPicoCreditsText;\r
-                       type = EEikCtEdwin;\r
-                       control = r_pico_credits_edwin;\r
-                       itemflags = EQikCtrlFlagIsEditInPlace;\r
-               }\r
-       };\r
-}\r
-\r
-// the controls themselves\r
-RESOURCE EDWIN r_pico_credits_edwin\r
-{\r
-       flags = EEikEdwinDisplayOnly|EEikEdwinReadOnly|EEikEdwinNoHorizScrolling|EEikEdwinDisableAutoCurEnd;\r
-       lines = 11;\r
-}\r
-\r
-// Defines the content of the simple dialog and how they are laid out. \r
-// Default layout manager is used for laying out the controls, which is a row \r
-// layout.\r
-RESOURCE QIK_CONTAINER_SETTINGS r_pico_credits_container\r
-{\r
-       controls = \r
-       {\r
-               QIK_CONTAINER_ITEM_CI_LI\r
-               {\r
-                       type = EQikCtOnelineBuildingBlock;\r
-                       control = r_pico_credits_bb1;\r
-               }\r
-       };\r
-}\r
-    \r
-// Building block that contains the label.\r
-RESOURCE QIK_SYSTEM_BUILDING_BLOCK r_pico_credits_bb1\r
-{\r
-       content =\r
-       {\r
-               QIK_SLOT_CONTENT\r
-               {\r
-                       slot_id = EQikItemSlot1;\r
-                       unique_handle = ECtlPicoCreditsText;\r
-               }\r
-       };\r
-}\r
-\r
-\r
-RESOURCE ARRAY r_pico_tbuf_credits\r
-{\r
-  items=\r
-  {\r
-       LBUF{txt="This emulator uses code from these people / projects:";},\r
-       LBUF{txt="";},\r
-       LBUF{txt="Dave";},\r
-       LBUF{txt="- Cyclone 68000 core, Pico emulation library";},\r
-       LBUF{txt="Homepage: http://www.finalburn.com/";},\r
-       LBUF{txt="";},\r
-       LBUF{txt="Reesy & FluBBa";},\r
-       LBUF{txt="- DrZ80, the Z80 emulator written in ARM assembly.";},\r
-       LBUF{txt="Homepage: http://reesy.gp32x.de/";},\r
-       LBUF{txt="";},\r
-       LBUF{txt="MultiArcadeMachineEmulator (MAME) development";},\r
-       LBUF{txt="- software implementation of Yamaha FM sound generator and";},\r
-       LBUF{txt="Texas Instruments SN76489 / SN76496 programmable tone / noise generator";},\r
-       LBUF{txt="Homepage: http://www.mame.net/";},\r
-       LBUF{txt="";},\r
-       LBUF{txt="Helix community";},\r
-       LBUF{txt="Helix mp3 decoder";},\r
-       LBUF{txt="";},\r
-       LBUF{txt="Additional thanks:";},\r
-       LBUF{txt="- Charles MacDonald (http://cgfm2.emuviews.com/) for old but still very useful info about genesis hardware.";},\r
-       LBUF{txt="- Stéphane Dallongeville for creating Gens and making it open-source.";},\r
-       LBUF{txt="- Steve Snake for all that he has done for Genesis emulation scene.";},\r
-       LBUF{txt="- Tasco Deluxe for his reverse engineering work on SVP and some mappers.";},\r
-       LBUF{txt="- Bart Trzynadlowski for his SSFII and 68000 docs.";},\r
-       LBUF{txt="- Haze for his research (http://haze.mameworld.info).";},\r
-       LBUF{txt="- Lordus, Exophase and Rokas for various ideas.";},\r
-       LBUF{txt="- Mark and Jean-loup for zlib library.";},\r
-       LBUF{txt="- Peter van Sebille for his various open-source Symbian projects to learn from.";},\r
-       LBUF{txt="- Steve Fischer for his open-source Motorola projects.";},\r
-       LBUF{txt="- AnotherGuest for all his Symbian stuff and support.";},\r
-       LBUF{txt="- Inder for the icons.";},\r
-       LBUF{txt="- Anyone else I forgot. You know who you are.";}\r
-  };\r
-}\r
-\r
-\r
-/**************************************\r
- *\r
- * debug dialog\r
- *\r
- **************************************/\r
-\r
-RESOURCE QIK_DIALOG r_pico_debug\r
-{\r
-       title = "debug";\r
-       configurations = \r
-       {\r
-               QIK_DIALOG_CONFIGURATION\r
-               {\r
-                       ui_config_mode = 0;\r
-                       container = r_pico_credits_container; // stuff from credits should fit\r
-                       command_list = r_pico_credits_commands;\r
-               }\r
-       };\r
-       controls = r_pico_credits_controls;\r
-}\r
-\r
diff --git a/platform/uiq3/rsc/picodrive_loc.rss b/platform/uiq3/rsc/picodrive_loc.rss
deleted file mode 100644 (file)
index 32b6475..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-#include <appinfo.rh>\r
-#include <qikon.hrh>\r
-\r
-#define EViewIdPrimaryView 1\r
-\r
-// This file localise the applications icons and caption\r
-RESOURCE LOCALISABLE_APP_INFO\r
-{\r
-       caption_and_icon =\r
-       {\r
-               CAPTION_AND_ICON_INFO\r
-               {\r
-                       caption = "PicoDrive";\r
-                       // Icons are used to represent applications in the \r
-                       // application launcher and application title bar.\r
-                       // The number_of_icons value identifies how many icons \r
-                       // that exist in the icon_file.\r
-                       number_of_icons = 3;\r
-                       // Using the application icons.\r
-                       icon_file = "\\Resource\\Apps\\PicoDrive.mbm";\r
-               }\r
-       };\r
-\r
-       view_list =\r
-       {\r
-               VIEW_DATA\r
-               {\r
-                       uid=EViewIdPrimaryView;\r
-                       screen_mode=0;\r
-                       caption_and_icon =\r
-                       {\r
-                               CAPTION_AND_ICON_INFO\r
-                               {\r
-                                       caption = "PicoDrive";\r
-                                       number_of_icons = 3;\r
-                                       icon_file = "\\Resource\\Apps\\PicoDrive.mbm";\r
-                               }\r
-                       };   \r
-               },\r
-\r
-               VIEW_DATA\r
-               {\r
-                       uid=EViewIdPrimaryView;\r
-                       screen_mode=EQikScreenModeSmallPortrait;\r
-                       caption_and_icon =\r
-                       {\r
-                               CAPTION_AND_ICON_INFO\r
-                               {\r
-                                       caption = "PicoDrive";\r
-                                       number_of_icons = 3;\r
-                                       icon_file = "\\Resource\\Apps\\PicoDrive.mbm";\r
-                               }\r
-                       };   \r
-               }\r
-       };\r
-}\r
diff --git a/platform/uiq3/rsc/picodrive_reg.rss b/platform/uiq3/rsc/picodrive_reg.rss
deleted file mode 100644 (file)
index d95f515..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// All registration files need to #include appinfo.rh. \r
-#include <appinfo.rh>\r
-\r
-// All registration files must define UID2, which is always \r
-// KUidAppRegistrationResourceFile, and UID3, which is the application's UID.\r
-// ? UID2 KUidAppRegistrationResourceFile\r
-// ? UID3 0xA00010F3 // application UID\r
-\r
-// Registration file need to containo an APP_REGISTRATION_INFO resource that\r
-// minimally needs to provide the name of the application binary (using the \r
-// app_file statement). \r
-RESOURCE APP_REGISTRATION_INFO\r
-       {\r
-       app_file = "PicoDrive"; // filename of application binary (minus extension)\r
-       // Specify the location of the localisable icon/caption definition file\r
-       localisable_resource_file = "\\Resource\\Apps\\PicoDrive_loc";\r
-       }\r
diff --git a/platform/uiq3/uiq3.mak b/platform/uiq3/uiq3.mak
deleted file mode 100644 (file)
index ddf2e84..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-#######################################################################
-### App specific part - this must be defined
-#NAME="AnimatedStereogram"
-#VENDOR="Pal Szasz"
-#UID2=100039CE
-#UID3=E0004201
-#EPOCLIBS="euser.lib apparc.lib cone.lib eikcore.lib eikcoctl.lib qikcore.lib fbscli.lib estlib.lib"
-#EPOCROOT=/opt/space/uiq3/
-#######################################################################
-
-APPNAME ?= "UIQ3 Program"
-VENDOR ?= "Somebody"
-UID2 ?= 100039CE
-UID3 ?= E0001001
-VER_MAJ ?= 1
-VER_MIN ?= 0
-STACK ?= 0x1000
-HEAP ?= 0x1000,0x100000
-EPOCROOT ?= /opt/space/uiq3/
-GCCPREF ?= arm-none-symbianelf
-GCCPATH ?= $(EPOCROOT)/gcc
-GCCVER ?= 3.4.3
-
-export EPOCROOT
-
-NAME_ := $(shell echo $(APPNAME) | sed 's: ::g')
-NAME := $(shell perl -e "print lc(\"$(NAME_)\")")
-EPOCLIBS += euser.lib apparc.lib cone.lib eikcore.lib eikcoctl.lib qikcore.lib fbscli.lib estlib.lib qikallocdll.lib
-EPOCREL = $(EPOCROOT)/epoc32/release/armv5
-CC = $(GCCPREF)-gcc
-CXX = $(GCCPREF)-g++
-AS = $(GCCPREF)-as
-LD = $(GCCPREF)-ld
-ELF2E32 = elf2e32
-BMCONV = bmconv
-EPOCRC = EPOCROOT=$(EPOCROOT) epocrc
-
-PATH := $(EPOCROOT)/bin:$(GCCPATH)/bin:$(PATH)
-
-# -march=armv5t ?
-CFLAGS += -Wall -pipe -nostdinc -msoft-float
-CFLAGS += -DNDEBUG -D_UNICODE -D__GCCE__  -D__SYMBIAN32__ -D__EPOC32__ -D__MARM__
-CFLAGS += -D__EABI__ -D__MARM_ARMV5__ -D__EXE__ -D__SUPPORT_CPP_EXCEPTIONS__ -D__MARM_ARMV5__
-CFLAGS += -D__PRODUCT_INCLUDE__="$(EPOCROOT)/epoc32/include/variant/uiq_3.0.hrh"
-CFLAGS += -include $(EPOCROOT)/epoc32/include/gcce/gcce.h
-CFLAGS += -I$(EPOCROOT)/epoc32/include -I$(EPOCROOT)/epoc32/include/libc \
-               -I$(EPOCROOT)/epoc32/include/variant -I$(GCCPATH)/lib/gcc/arm-none-symbianelf/$(GCCVER)/include/
-# can't optimize .cpp without -fno-unit-at-a-time
-CXXFLAGS += $(CFLAGS) -c -x c++ -mapcs -Wno-ctor-dtor-privacy -Wno-unknown-pragmas -fexceptions -fno-unit-at-a-time
-
-LDFLAGS +=  -L$(GCCPATH)/lib -L$(GCCPATH)/lib/gcc/$(GCCPREF)/$(GCCVER) -L $(GCCPATH)/$(GCCPREF)/lib
-LDFLAGS +=  --target1-abs --no-undefined -nostdlib  -shared
-LDFLAGS +=  -Ttext 0x8000   -Tdata 0x400000 --default-symver
-LDFLAGS +=  -soname $(NAME){000a0000}\[$(UID3)\].exe --entry _E32Startup -u _E32Startup
-LDFLAGS +=  $(EPOCROOT)/epoc32/release/armv5/urel/eexe.lib
-LDFLAGS +=  -o $(NAME).elf.exe -Map $(NAME).exe.map
-LDFLAGS2 =  $(EPOCREL)/urel/qikalloc.lib $(EPOCREL)/lib/euser.dso
-LDFLAGS2 += $(shell for i in $(EPOCLIBS); do echo -n " $(EPOCREL)/lib/$${i%%.lib}.dso "; done)
-LDFLAGS2 += $(EPOCREL)/urel/usrt2_2.lib
-LDFLAGS2 += $(shell for i in dfpaeabi dfprvct2_2 drtaeabi scppnwdl drtrvct2_2; do echo -n "  $(EPOCREL)/lib/$$i.dso "; done)
-LDFLAGS2 += -lsupc++ -lgcc
-
-E32FLAGS += --sid=0x$(UID3) --uid1=0x1000007a --uid2=0x$(UID2) --uid3=0x$(UID3)
-E32FLAGS += --capability=none --fpu=softvfp --targettype=EXE
-E32FLAGS += --output=$(NAME).exe --elfinput=$(NAME).elf.exe
-E32FLAGS += --stack=$(STACK)
-E32FLAGS += --heap=$(HEAP)
-E32FLAGS += --linkas=$(NAME){000a0000}[$(UID3)].exe --libpath=$(EPOCREL)/lib
-
-EPOCRCFLAGS += -I../inc -I- -I$(EPOCROOT)/epoc32/include -I$(EPOCROOT)/epoc32/include/variant -DLANGUAGE_SC
-
-ICONS ?= $(shell echo ../data/appicon/*.bmp)
-APPICON ?= $(NAME)appicon.mbm
-RSCDIR ?= ../rsc
-REGDIR ?= ../reg
-
-SRCH += $(shell echo ../inc/*.h)
-SRC += $(shell echo ../src/*.cpp)
-SRCRES ?= $(shell echo $(RSCDIR)/*.rss $(RSCDIR)/*.rls $(REGDIR)/*.rss $(REGDIR)/*.rls)
-OBJS ?= $(SRC:.cpp=.o)
-
-.PHONY : all mbm icon_mbm rsc reg loc bin sis run
-
-#all : sis
-
-sis : $(NAME).sis
-
-icon_mbm : $(APPICON)
-
-mbm :
-
-$(NAME)appicon.mbg $(NAME)appicon.mbm : $(ICONS)
-       @echo "Creating multibitmap file..."
-       $(BMCONV) /h$(NAME)appicon.mbg $(NAME)appicon.mbm \
-               /c24../data/appicon/icon_small.bmp\
-               /8../data/appicon/icon_small_mask.bmp\
-               /c24../data/appicon/icon_large.bmp\
-               /8../data/appicon/icon_large_mask.bmp\
-               /c24../data/appicon/icon_xlarge.bmp\
-               /8../data/appicon/icon_xlarge_mask.bmp
-
-rsc : $(RSCDIR)/$(NAME).rsc
-
-$(RSCDIR)/$(NAME).rsc : $(RSCDIR)/$(NAME).rss # $(RSCDIR)/$(NAME).rls
-       @echo "Creating $@ ..."
-       $(EPOCRC) $(EPOCRCFLAGS) -I$(RSCDIR) -u $(RSCDIR)/$(NAME).rss \
-               -o$(RSCDIR)/$(NAME).rsc -h$(RSCDIR)/$(NAME).rsg -t/tmp -l$(RSCDIR)
-
-reg : $(REGDIR)/$(NAME)_reg.rsc
-
-$(REGDIR)/$(NAME)_reg.rsc : $(REGDIR)/$(NAME)_reg.rss
-       @echo "Creating $@ ..."
-       RC_UID2=0x101f8021 RC_UID3=0x$(UID3) $(EPOCRC) $(EPOCRCFLAGS) -I$(REGDIR) \
-               -u $(REGDIR)/$(NAME)_reg.rss -o$(REGDIR)/$(NAME)_reg.rsc -h$(REGDIR)/$(NAME)_reg.rsg -t/tmp  -l$(REGDIR)
-
-loc : $(REGDIR)/$(NAME)_loc.rsc
-
-$(REGDIR)/$(NAME)_loc.rsc : $(REGDIR)/$(NAME)_loc.rss
-       @echo "Creating $@ ..."
-       $(EPOCRC) $(EPOCRCFLAGS) -I$(REGDIR) \
-               -u $(REGDIR)/$(NAME)_loc.rss -o$(REGDIR)/$(NAME)_loc.rsc -h$(REGDIR)/$(NAME)_loc.rsg -t/tmp  -l$(REGDIR)
-
-bin : bin_elf
-       @echo "Elf -> E32"
-       $(ELF2E32) $(E32FLAGS)
-
-bin_elf : $(NAME).elf.exe
-
-$(NAME).elf.exe : $(OBJS) $(EXTRALIB)
-       @echo "Linking..."
-       $(LD) $(LDFLAGS) $(OBJS) $(EXTRALIB) $(LDFLAGS2)
-
-.cpp.o :
-       @echo "Compiling $< ..."
-       $(CXX) $(CXXFLAGS) -o $@ $<
-
-$(NAME).sis : icon_mbm mbm rsc reg loc bin
-       rm -f $(NAME).sis
-       makesis $(NAME).pkg
-       mv $(NAME).SIS $(NAME).sis
-
-#cat $(EPOCROOT)/extra/in.pkg extra.pkg | \
-#              sed "s:APPNAME:$(APPNAME):g" | \
-#              sed "s:NAME:$(NAME):g" | \
-#              sed "s:VER_MAJ:$(VER_MAJ):g" | \
-#              sed "s:VER_MIN:$(VER_MIN):g" | \
-#              sed "s:UID3:$(UID3):g" | \
-#              sed "s:VENDOR:$(VENDOR):g" > $(NAME).pkg
-
-run : sis
-       xterm -e "to-phone m600 $(NAME).sis"
-
--include .deps
-
-.deps : $(SRC) $(SRCH)
-       echo > $@
-       $(CXX) -M -DDEPS $(SRC) $(CXXFLAGS) >> $@
-
-clean :
-       rm -f $(NAME).exe $(NAME).elf.exe $(OBJS) tags .deps $(NAME).exe.map
-       rm -f *.bkp ../src/*.bkp ../inc/*.bkp $(RSCDIR)/*.bkp $(REGDIR)/*.bkp
-       rm -f $(RSCDIR)/*.rsc $(RSCDIR)/*.rsg
-       rm -f $(REGDIR)/*.rsc $(REGDIR)/*.rsg
-       rm -f $(APPICON) $(NAME)appicon.mbg $(NAME).mbg
-
-
diff --git a/platform/uiq3/version.h b/platform/uiq3/version.h
deleted file mode 100644 (file)
index 4388a01..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-// version number\r
-\r
-#ifndef __VERSION_H\r
-#define __VERSION_H\r
-\r
-#define KPicoMajorVersionNumber 1\r
-#define KPicoMinorVersionNumber 51\r
-#define KPicoBuildNumber 0\r
-\r
-#endif                 /* __VERSION_H */\r