From fb7a7fea8735400818773dd47f1e6913bd1ceecf Mon Sep 17 00:00:00 2001 From: notaz Date: Sat, 22 Jun 2013 19:16:16 +0300 Subject: [PATCH] remove unused/unmaintained code RIP Symbian.. mz80 is unused --- cpu/mz80/Makefile | 13 - cpu/mz80/Makefile.win | 18 - cpu/mz80/driver.h | 13 - cpu/mz80/makez80.c | 9512 --------- cpu/mz80/mz80.c | 17053 ---------------- cpu/mz80/mz80.h | 394 - cpu/mz80/mz80.txt | 809 - pico/pico.h | 7 - pico/utils.c | 108 - platform/uiq2/ClientServer.h | 69 - platform/uiq2/Makefile | 321 - platform/uiq2/SimpleServer.cpp | 430 - platform/uiq2/SimpleServer.h | 121 - platform/uiq2/_out/PicodriveN.pkg | 24 - platform/uiq2/_out/install.txt | 16 - platform/uiq2/_out/readme.txt | 347 - platform/uiq2/audio.h | 24 - platform/uiq2/audio/AUDIO_MEDIASERVER.DLL | Bin 3904 -> 0 bytes platform/uiq2/audio/AUDIO_MOTOROLA.DLL | Bin 3980 -> 0 bytes .../audio/mediaserver/AUDIO_MEDIASERVER.ARMI | 402 - platform/uiq2/audio/mediaserver/PolledAS.h | 32 - .../audio/mediaserver/audio_mediaserver.cpp | 321 - .../audio/mediaserver/audio_mediaserver.def | 3 - .../audio/mediaserver/audio_mediaserver.h | 87 - .../audio/mediaserver/audio_mediaserver.mmp | 18 - platform/uiq2/audio/mediaserver/polledas.cpp | 213 - platform/uiq2/audio/mediaserver/retr.cmd | 2 - platform/uiq2/audio/mediaserver/retr2.cmd | 1 - .../uiq2/audio/motorola/AUDIO_MOTOROLA.ARMI | 418 - platform/uiq2/audio/motorola/PolledAS.h | 32 - .../uiq2/audio/motorola/audio_motorola.cpp | 363 - .../uiq2/audio/motorola/audio_motorola.def | 3 - platform/uiq2/audio/motorola/audio_motorola.h | 91 - .../uiq2/audio/motorola/audio_motorola.mmp | 20 - platform/uiq2/audio/motorola/polledas.cpp | 209 - platform/uiq2/audio/motorola/retr.cmd | 2 - platform/uiq2/audio/motorola/retr2.cmd | 1 - platform/uiq2/blit.h | 11 - platform/uiq2/blit.s | 432 - platform/uiq2/debug.cpp | 241 - platform/uiq2/debug.h | 27 - platform/uiq2/launcher/App.cpp | 644 - platform/uiq2/launcher/App.h | 178 - platform/uiq2/launcher/CSimpleTextParser.cpp | 477 - platform/uiq2/launcher/CSimpleTextParser.h | 62 - platform/uiq2/launcher/Dialogs.cpp | 473 - platform/uiq2/launcher/Dialogs.h | 145 - platform/uiq2/launcher/Engine.cpp | 256 - platform/uiq2/launcher/Engine.h | 112 - platform/uiq2/launcher/PICODRIVEN.ARMI | 1070 - platform/uiq2/launcher/PicoN20x16.bmp | Bin 1016 -> 0 bytes platform/uiq2/launcher/PicoN20x16m.bmp | Bin 1014 -> 0 bytes platform/uiq2/launcher/PicoN32x32.bmp | Bin 3128 -> 0 bytes platform/uiq2/launcher/PicoN32x32m.bmp | Bin 3126 -> 0 bytes platform/uiq2/launcher/PicodriveN.hrh | 70 - platform/uiq2/launcher/PicodriveN.mmp | 34 - platform/uiq2/launcher/PicodriveN.rss | 474 - platform/uiq2/launcher/PicodriveNAif.rss | 14 - platform/uiq2/launcher/SimpleClient.cpp | 33 - platform/uiq2/launcher/SimpleClient.h | 23 - platform/uiq2/launcher/nicemake.c | 101 - platform/uiq2/launcher/nicemake.exe | Bin 45056 -> 0 bytes platform/uiq2/launcher/quploadpicol.cmd | 1 - platform/uiq2/main.cpp | 1183 -- platform/uiq2/port_config.h | 21 - platform/uiq2/port_config.s | 2 - platform/uiq2/qconn.cmd | 1 - platform/uiq2/quploadpico.cmd | 1 - platform/uiq2/quploadpicol.cmd | 1 - platform/uiq2/version.h | 10 - platform/uiq2/vid.cpp | 1017 - platform/uiq2/vid.h | 9 - platform/uiq3/App.cpp | 491 - platform/uiq3/App.h | 113 - platform/uiq3/CSimpleTextParser.cpp | 477 - platform/uiq3/CSimpleTextParser.h | 59 - platform/uiq3/Dialogs.cpp | 361 - platform/uiq3/Dialogs.h | 94 - platform/uiq3/Engine.cpp | 352 - platform/uiq3/Engine.h | 143 - platform/uiq3/Makefile | 133 - platform/uiq3/Makefile.old | 307 - platform/uiq3/PicoDrive.mmp | 140 - platform/uiq3/config.txt | 110 - platform/uiq3/emu.c | 157 - platform/uiq3/engine/PolledAS.h | 32 - platform/uiq3/engine/audio_mediaserver.cpp | 317 - platform/uiq3/engine/audio_mediaserver.h | 85 - platform/uiq3/engine/blit.c | 34 - platform/uiq3/engine/blit.h | 22 - platform/uiq3/engine/blit.s | 724 - platform/uiq3/engine/debug.cpp | 270 - platform/uiq3/engine/debug.h | 27 - platform/uiq3/engine/main.cpp | 921 - platform/uiq3/engine/polledas.cpp | 269 - platform/uiq3/engine/vid.cpp | 628 - platform/uiq3/engine/vid.h | 9 - platform/uiq3/picodrive.hrh | 86 - platform/uiq3/picodrive.pkg | 9 - platform/uiq3/port_config.h | 33 - platform/uiq3/port_config.s | 15 - platform/uiq3/rsc/Pico18x18.bmp | Bin 1062 -> 0 bytes platform/uiq3/rsc/Pico18x18m.bmp | Bin 334 -> 0 bytes platform/uiq3/rsc/Pico40x40.bmp | Bin 4854 -> 0 bytes platform/uiq3/rsc/Pico40x40m.bmp | Bin 4854 -> 0 bytes platform/uiq3/rsc/Pico64x64.bmp | Bin 12342 -> 0 bytes platform/uiq3/rsc/Pico64x64m.bmp | Bin 2166 -> 0 bytes platform/uiq3/rsc/picodrive.rss | 637 - platform/uiq3/rsc/picodrive_loc.rss | 56 - platform/uiq3/rsc/picodrive_reg.rss | 17 - platform/uiq3/uiq3.mak | 166 - platform/uiq3/version.h | 10 - 112 files changed, 45924 deletions(-) delete mode 100644 cpu/mz80/Makefile delete mode 100644 cpu/mz80/Makefile.win delete mode 100644 cpu/mz80/driver.h delete mode 100644 cpu/mz80/makez80.c delete mode 100644 cpu/mz80/mz80.c delete mode 100644 cpu/mz80/mz80.h delete mode 100644 cpu/mz80/mz80.txt delete mode 100644 pico/utils.c delete mode 100644 platform/uiq2/ClientServer.h delete mode 100644 platform/uiq2/Makefile delete mode 100644 platform/uiq2/SimpleServer.cpp delete mode 100644 platform/uiq2/SimpleServer.h delete mode 100644 platform/uiq2/_out/PicodriveN.pkg delete mode 100644 platform/uiq2/_out/install.txt delete mode 100644 platform/uiq2/_out/readme.txt delete mode 100644 platform/uiq2/audio.h delete mode 100644 platform/uiq2/audio/AUDIO_MEDIASERVER.DLL delete mode 100644 platform/uiq2/audio/AUDIO_MOTOROLA.DLL delete mode 100644 platform/uiq2/audio/mediaserver/AUDIO_MEDIASERVER.ARMI delete mode 100644 platform/uiq2/audio/mediaserver/PolledAS.h delete mode 100644 platform/uiq2/audio/mediaserver/audio_mediaserver.cpp delete mode 100644 platform/uiq2/audio/mediaserver/audio_mediaserver.def delete mode 100644 platform/uiq2/audio/mediaserver/audio_mediaserver.h delete mode 100644 platform/uiq2/audio/mediaserver/audio_mediaserver.mmp delete mode 100644 platform/uiq2/audio/mediaserver/polledas.cpp delete mode 100644 platform/uiq2/audio/mediaserver/retr.cmd delete mode 100644 platform/uiq2/audio/mediaserver/retr2.cmd delete mode 100644 platform/uiq2/audio/motorola/AUDIO_MOTOROLA.ARMI delete mode 100644 platform/uiq2/audio/motorola/PolledAS.h delete mode 100644 platform/uiq2/audio/motorola/audio_motorola.cpp delete mode 100644 platform/uiq2/audio/motorola/audio_motorola.def delete mode 100644 platform/uiq2/audio/motorola/audio_motorola.h delete mode 100644 platform/uiq2/audio/motorola/audio_motorola.mmp delete mode 100644 platform/uiq2/audio/motorola/polledas.cpp delete mode 100644 platform/uiq2/audio/motorola/retr.cmd delete mode 100644 platform/uiq2/audio/motorola/retr2.cmd delete mode 100644 platform/uiq2/blit.h delete mode 100644 platform/uiq2/blit.s delete mode 100644 platform/uiq2/debug.cpp delete mode 100644 platform/uiq2/debug.h delete mode 100644 platform/uiq2/launcher/App.cpp delete mode 100644 platform/uiq2/launcher/App.h delete mode 100644 platform/uiq2/launcher/CSimpleTextParser.cpp delete mode 100644 platform/uiq2/launcher/CSimpleTextParser.h delete mode 100644 platform/uiq2/launcher/Dialogs.cpp delete mode 100644 platform/uiq2/launcher/Dialogs.h delete mode 100644 platform/uiq2/launcher/Engine.cpp delete mode 100644 platform/uiq2/launcher/Engine.h delete mode 100644 platform/uiq2/launcher/PICODRIVEN.ARMI delete mode 100644 platform/uiq2/launcher/PicoN20x16.bmp delete mode 100644 platform/uiq2/launcher/PicoN20x16m.bmp delete mode 100644 platform/uiq2/launcher/PicoN32x32.bmp delete mode 100644 platform/uiq2/launcher/PicoN32x32m.bmp delete mode 100644 platform/uiq2/launcher/PicodriveN.hrh delete mode 100644 platform/uiq2/launcher/PicodriveN.mmp delete mode 100644 platform/uiq2/launcher/PicodriveN.rss delete mode 100644 platform/uiq2/launcher/PicodriveNAif.rss delete mode 100644 platform/uiq2/launcher/SimpleClient.cpp delete mode 100644 platform/uiq2/launcher/SimpleClient.h delete mode 100644 platform/uiq2/launcher/nicemake.c delete mode 100644 platform/uiq2/launcher/nicemake.exe delete mode 100644 platform/uiq2/launcher/quploadpicol.cmd delete mode 100644 platform/uiq2/main.cpp delete mode 100644 platform/uiq2/port_config.h delete mode 100644 platform/uiq2/port_config.s delete mode 100644 platform/uiq2/qconn.cmd delete mode 100644 platform/uiq2/quploadpico.cmd delete mode 100644 platform/uiq2/quploadpicol.cmd delete mode 100644 platform/uiq2/version.h delete mode 100644 platform/uiq2/vid.cpp delete mode 100644 platform/uiq2/vid.h delete mode 100644 platform/uiq3/App.cpp delete mode 100644 platform/uiq3/App.h delete mode 100644 platform/uiq3/CSimpleTextParser.cpp delete mode 100644 platform/uiq3/CSimpleTextParser.h delete mode 100644 platform/uiq3/Dialogs.cpp delete mode 100644 platform/uiq3/Dialogs.h delete mode 100644 platform/uiq3/Engine.cpp delete mode 100644 platform/uiq3/Engine.h delete mode 100644 platform/uiq3/Makefile delete mode 100644 platform/uiq3/Makefile.old delete mode 100644 platform/uiq3/PicoDrive.mmp delete mode 100644 platform/uiq3/config.txt delete mode 100644 platform/uiq3/emu.c delete mode 100644 platform/uiq3/engine/PolledAS.h delete mode 100644 platform/uiq3/engine/audio_mediaserver.cpp delete mode 100644 platform/uiq3/engine/audio_mediaserver.h delete mode 100644 platform/uiq3/engine/blit.c delete mode 100644 platform/uiq3/engine/blit.h delete mode 100644 platform/uiq3/engine/blit.s delete mode 100644 platform/uiq3/engine/debug.cpp delete mode 100644 platform/uiq3/engine/debug.h delete mode 100644 platform/uiq3/engine/main.cpp delete mode 100644 platform/uiq3/engine/polledas.cpp delete mode 100644 platform/uiq3/engine/vid.cpp delete mode 100644 platform/uiq3/engine/vid.h delete mode 100644 platform/uiq3/picodrive.hrh delete mode 100644 platform/uiq3/picodrive.pkg delete mode 100644 platform/uiq3/port_config.h delete mode 100644 platform/uiq3/port_config.s delete mode 100644 platform/uiq3/rsc/Pico18x18.bmp delete mode 100644 platform/uiq3/rsc/Pico18x18m.bmp delete mode 100644 platform/uiq3/rsc/Pico40x40.bmp delete mode 100644 platform/uiq3/rsc/Pico40x40m.bmp delete mode 100644 platform/uiq3/rsc/Pico64x64.bmp delete mode 100644 platform/uiq3/rsc/Pico64x64m.bmp delete mode 100644 platform/uiq3/rsc/picodrive.rss delete mode 100644 platform/uiq3/rsc/picodrive_loc.rss delete mode 100644 platform/uiq3/rsc/picodrive_reg.rss delete mode 100644 platform/uiq3/uiq3.mak delete mode 100644 platform/uiq3/version.h diff --git a/cpu/mz80/Makefile b/cpu/mz80/Makefile deleted file mode 100644 index 2080dda3..00000000 --- a/cpu/mz80/Makefile +++ /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 index 0fe2ddad..00000000 --- a/cpu/mz80/Makefile.win +++ /dev/null @@ -1,18 +0,0 @@ -all : mz80.obj - -mz80.obj : mz80.asm - nasm -f win32 mz80.asm -o $@ - -mz80.asm : makez80.exe - makez80.exe -s -x86 $@ - -makez80.exe : makez80.c - cl /DWIN32 /W3 makez80.c - - -clean : tidy - del mz80.obj - -tidy : - del mz80.asm makez80.exe makez80.obj - diff --git a/cpu/mz80/driver.h b/cpu/mz80/driver.h deleted file mode 100644 index 0705ea99..00000000 --- a/cpu/mz80/driver.h +++ /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 index 653d82e8..00000000 --- a/cpu/mz80/makez80.c +++ /dev/null @@ -1,9512 +0,0 @@ -/* Multi-Z80 32 Bit emulator */ - -/* Copyright 1996, 1997, 1998, 1999, 2000 Neil Bradley, All rights reserved - * - * License agreement: - * - * (MZ80 Refers to both the assembly and C 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 -#include -#include -#include - -#define VERSION "3.4" - -#define TRUE 0xff -#define FALSE 0x0 -#define INVALID 0xff - -#define UINT32 unsigned long int -#define UINT8 unsigned char - -#define TIMING_REGULAR 0x00 -#define TIMING_XXCB 0x01 -#define TIMING_CB 0xcb -#define TIMING_DDFD 0xdd -#define TIMING_ED 0xed -#define TIMING_EXCEPT 0x02 - -FILE *fp = NULL; -char string[150]; -char cpubasename[150]; -static char mz80Index[50]; -static char mz80IndexHalfHigh[50]; -static char mz80IndexHalfLow[50]; -char majorOp[50]; -char procname[150]; -UINT32 dwGlobalLabel = 0; - -enum -{ - MZ80_ASSEMBLY_X86, - MZ80_C, - MZ80_UNKNOWN -}; - -UINT8 bPlain = FALSE; -UINT8 bNoTiming = FALSE; -UINT8 bUseStack = 0; -UINT8 bCurrentMode = TIMING_REGULAR; // Current timing mode -UINT8 b16BitIo = FALSE; -UINT8 bThroughCallHandler = FALSE; -UINT8 bOS2 = FALSE; -UINT8 bWhat = MZ80_UNKNOWN; - -void ProcBegin(UINT32 dwOpcode); - -UINT8 *pbLocalReg[8] = -{ - "ch", - "cl", - "dh", - "dl", - "bh", - "bl", - "dl", - "al" -}; - -UINT8 *pbLocalRegC[8] = -{ - "cpu.z80B", - "cpu.z80C", - "cpu.z80D", - "cpu.z80E", - "cpu.z80H", - "cpu.z80L", - "barf", - "cpu.z80A" -}; - -UINT8 *pbPushReg[8] = -{ - "cl", - "ch", - "byte [_z80de]", - "byte [_z80de + 1]", - "bl", - "bh", - "ah", - "al" -}; - -UINT8 *pbFlags[8] = -{ - "nz", - "z", - "nc", - "c", - "po", - "pe", - "ns", - "s" -}; - -UINT8 *pbRegPairC[] = -{ - "cpu.z80BC", - "cpu.z80DE", - "cpu.z80HL", - "cpu.z80sp" -}; - -UINT8 *pbFlagsC[8] = -{ - "(!(cpu.z80F & Z80_FLAG_ZERO))", - "(cpu.z80F & Z80_FLAG_ZERO)", - "(!(cpu.z80F & Z80_FLAG_CARRY))", - "(cpu.z80F & Z80_FLAG_CARRY)", - "(!(cpu.z80F & Z80_FLAG_OVERFLOW_PARITY))", - "(cpu.z80F & Z80_FLAG_OVERFLOW_PARITY)", - "(!(cpu.z80F & Z80_FLAG_SIGN))", - "(cpu.z80F & Z80_FLAG_SIGN)" -}; - -UINT8 *pbMathReg[8] = -{ - "ch", - "cl", - "byte [_z80de + 1]", - "byte [_z80de]", - "bh", - "bl", - "INVALID", - "al" -}; - -UINT8 *pbMathRegC[8] = -{ - "cpu.z80B", - "cpu.z80C", - "cpu.z80D", - "cpu.z80E", - "cpu.z80H", - "cpu.z80L", - "bTemp", - "cpu.z80A" -}; - -UINT8 *pbRegPairs[4] = -{ - "cx", // BC - "word [_z80de]", // DE - "bx", // HL - "word [_z80sp]" // SP -}; - -UINT8 *pbRegPairsC[4] = -{ - "cpu.z80BC", // BC - "cpu.z80DE", // DE - "cpu.z80HL", // HL - "cpu.z80sp" // SP -}; - -UINT8 *pbPopRegPairs[4] = -{ - "cx", // BC - "word [_z80de]", // DE - "bx", // HL - "ax" // SP -}; - -UINT8 *pbPopRegPairC[4] = -{ - "cpu.z80BC", - "cpu.z80DE", - "cpu.z80HL", - "cpu.z80AF" -}; - -UINT8 *pbIndexedRegPairs[4] = -{ - "cx", // BC - "word [_z80de]", // DE - "di", // IX/IY - "word [_z80sp]" // SP -}; - -// Timing tables - -UINT8 bTimingRegular[0x100] = -{ - 0x04, 0x0a, 0x07, 0x06, 0x04, 0x04, 0x07, 0x04, 0x04, 0x0b, 0x07, 0x06, 0x04, 0x04, 0x07, 0x04, - 0x08, 0x0a, 0x07, 0x06, 0x04, 0x04, 0x07, 0x04, 0x0c, 0x0b, 0x07, 0x06, 0x04, 0x04, 0x07, 0x04, - 0x07, 0x0a, 0x10, 0x06, 0x04, 0x04, 0x07, 0x04, 0x07, 0x0b, 0x10, 0x06, 0x04, 0x04, 0x07, 0x04, - 0x07, 0x0a, 0x0d, 0x06, 0x0b, 0x0b, 0x0a, 0x04, 0x07, 0x0b, 0x0d, 0x06, 0x04, 0x04, 0x07, 0x04, - - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07, 0x04, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x04, 0x07, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07, 0x04, - - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x07, 0x04, - - 0x05, 0x0a, 0x0a, 0x0a, 0x0a, 0x0b, 0x07, 0x0b, 0x05, 0x0a, 0x0a, 0x00, 0x0a, 0x11, 0x07, 0x0b, - 0x05, 0x0a, 0x0a, 0x0b, 0x0a, 0x0b, 0x07, 0x0b, 0x05, 0x04, 0x0a, 0x0b, 0x0a, 0x00, 0x07, 0x0b, - 0x05, 0x0a, 0x0a, 0x13, 0x0a, 0x0b, 0x07, 0x0b, 0x05, 0x04, 0x0a, 0x04, 0x0a, 0x00, 0x07, 0x0b, - 0x05, 0x0a, 0x0a, 0x04, 0x0a, 0x0b, 0x07, 0x0b, 0x05, 0x06, 0x0a, 0x04, 0x0a, 0x00, 0x07, 0x0b -}; - -UINT8 bTimingCB[0x100] = -{ - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, - - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0c, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0c, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0c, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0c, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0c, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0c, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0c, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0c, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08 -}; - -UINT8 bTimingXXCB[0x100] = -{ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, - 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, - 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, - 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, - 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00 -}; - -UINT8 bTimingDDFD[0x100] = -{ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x0e, 0x14, 0x0a, 0x09, 0x09, 0x09, 0x00, 0x00, 0x0f, 0x14, 0x0a, 0x09, 0x09, 0x09, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x17, 0x17, 0x13, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x13, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x13, 0x00, - - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x13, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x13, 0x09, - 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x13, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x13, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x13, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x13, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x13, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x0e, 0x00, 0x17, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - -UINT8 bTimingED[0x100] = -{ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - 0x0c, 0x0c, 0x0f, 0x14, 0x08, 0x0e, 0x08, 0x09, 0x0c, 0x0c, 0x0f, 0x14, 0x08, 0x0e, 0x08, 0x09, - 0x0c, 0x0c, 0x0f, 0x14, 0x08, 0x08, 0x08, 0x09, 0x0c, 0x0c, 0x0f, 0x14, 0x08, 0x08, 0x08, 0x09, - 0x0c, 0x0c, 0x0f, 0x14, 0x08, 0x08, 0x08, 0x12, 0x0c, 0x0c, 0x0f, 0x14, 0x08, 0x08, 0x08, 0x12, - 0x0c, 0x0c, 0x0f, 0x14, 0x08, 0x08, 0x08, 0x00, 0x0c, 0x0c, 0x0f, 0x14, 0x08, 0x08, 0x08, 0x00, - - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, - - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - -void EDHandler(UINT32 dwOpcode); -void DDHandler(UINT32 dwOpcode); -void FDHandler(UINT32 dwOpcode); -void CBHandler(UINT32 dwOpcode); - -void PushPopOperations(UINT32 dwOpcode); -void AddRegpairOperations(UINT32 dwOpcode); -void CallHandler(UINT32 dwOpcode); -void MiscHandler(UINT32 dwOpcode); -void IMHandler(UINT32 dwOpcode); -void IRHandler(UINT32 dwOpcode); -void LdRegPairImmediate(UINT32 dwOpcode); -void LoadImmediate(UINT32 dwOpcode); -void LdRegpairPtrByte(UINT32 dwOpcode); -void MathOperation(UINT32 dwOpcode); -void RegIntoMemory(UINT32 dwOpcode); -void JpHandler(UINT32 dwOpcode); -void LdRegImmediate(UINT32 dwOpcode); -void IncRegister(UINT32 dwOpcode); -void DecRegister(UINT32 dwOpcode); -void IncDecRegpair(UINT32 dwOpcode); -void LdRegReg(UINT32 dwOpcode); -void MathOperationDirect(UINT32 dwOpcode); -void JrHandler(UINT32 dwOpcode); -void RetHandler(UINT32 dwOpcode); -void RestartHandler(UINT32 dwOpcode); -void ToRegFromHl(UINT32); -void RraRlaHandler(UINT32); -void LdByteRegpair(UINT32); -void IncDecHLPtr(UINT32 dwOpcode); -void InOutHandler(UINT32 dwOpcode); -void RLCRRCRLRRSLASRASRLHandler(UINT32 dwOpcode); -void BITHandler(UINT32 dwOpcode); -void RESSETHandler(UINT32 dwOpcode); -void PushPopOperationsIndexed(UINT32 dwOpcode); -void LDILDRLDIRLDDRHandler(UINT32); -void LdRegpair(UINT32 dwOpcode); -void ExtendedRegIntoMemory(UINT32 dwOpcode); -void NegHandler(UINT32 dwOpcode); -void ExtendedInHandler(UINT32 dwOpcode); -void ExtendedOutHandler(UINT32 dwOpcode); -void RetIRetNHandler(UINT32 dwOcode); -void AdcSbcRegpair(UINT32 dwOpcode); -void CPICPDCPIRCPDRHandler(UINT32 dwOpcode); -void RRDRLDHandler(UINT32 dwOpcode); -void UndocRegToIndex(UINT32 dwOpcode); -void UndocIndexToReg(UINT32 dwOpcode); -void MathOperationIndexed(UINT32 dwOpcode); -void IncDecIndexed(UINT32 dwOpcode); -void DDFDCBHandler(UINT32 dwOpcode); -void JPIXIYHandler(UINT32 dwOpcode); -void AddIndexHandler(UINT32 dwOpcode); -void SPToIndex(UINT32 dwOpcode); -void LdByteToIndex(UINT32 dwOpcode); -void LdRegIndexOffset(UINT32 dwOpcode); -void IncDecIndexReg(UINT32 dwOpcode); -void ExIndexed(UINT32 dwOpcode); -void UndocIncDecIndexReg(UINT32 dwOpcode); -void UndocLoadHalfIndexReg(UINT32 dwOpcode); -void UndocMathIndex(UINT32 dwOpcode); -void ddcbBitWise(UINT32 dwOpcode); -void LdIndexPtrReg(UINT32 dwOpcode); -void StoreIndexReg(UINT32 dwOpcode); -void LoadIndexReg(UINT32 dwOpcode); -void OTIROTDROUTIOUTDHandler(UINT32 dwOpcode); -void INIRINDRINIINDHandler(UINT32 dwOpcode); - -struct sOp -{ - UINT32 bOpCode; - void (*Emitter)(UINT32); -}; - -struct sOp StandardOps[] = -{ - {0xd3, InOutHandler}, // V - {0xdb, InOutHandler}, // V - - {0x0a, LdByteRegpair}, // V - {0x1a, LdByteRegpair}, // V - - {0x17, RraRlaHandler}, // V - {0x1f, RraRlaHandler}, // V - - {0x05, DecRegister}, // V - {0x0d, DecRegister}, // V - {0x15, DecRegister}, // V - {0x1d, DecRegister}, // V - {0x25, DecRegister}, // V - {0x2d, DecRegister}, // V - {0x3d, DecRegister}, // V - - {0x04, IncRegister}, // V - {0x0c, IncRegister}, // V - {0x14, IncRegister}, // V - {0x1c, IncRegister}, // V - {0x24, IncRegister}, // V - {0x2c, IncRegister}, // V - {0x3c, IncRegister}, // V - - {0x32, RegIntoMemory}, // V - {0x22, RegIntoMemory}, // V - - {0xc3, JpHandler}, // V - {0xc2, JpHandler}, // V - {0xca, JpHandler}, // V - {0xd2, JpHandler}, // V - {0xda, JpHandler}, // V - {0xe2, JpHandler}, // V - {0xea, JpHandler}, // V - {0xf2, JpHandler}, // V - {0xfa, JpHandler}, // V - - - {0x06, LdRegImmediate}, // V - {0x0e, LdRegImmediate}, // V - {0x16, LdRegImmediate}, // V - {0x1e, LdRegImmediate}, // V - {0x26, LdRegImmediate}, // V - {0x2e, LdRegImmediate}, // V - {0x3e, LdRegImmediate}, // V - - {0x0b, IncDecRegpair}, // V - {0x1b, IncDecRegpair}, // V - {0x2b, IncDecRegpair}, // V - {0x3b, IncDecRegpair}, // V - - {0x03, IncDecRegpair}, // V - {0x13, IncDecRegpair}, // V - {0x23, IncDecRegpair}, // V - {0x33, IncDecRegpair}, // V - - {0x34, IncDecHLPtr}, // V - {0x35, IncDecHLPtr}, // V - - {0xcb, CBHandler}, - {0xdd, DDHandler}, - {0xed, EDHandler}, - {0xfd, FDHandler}, - - {0x01, LdRegPairImmediate}, // V - {0x11, LdRegPairImmediate}, // V - {0x21, LdRegPairImmediate}, // V - {0x31, LdRegPairImmediate}, // V - - {0xe3, MiscHandler}, // V - {0x2a, MiscHandler}, // V - {0xfb, MiscHandler}, // V - {0xf9, MiscHandler}, // V - {0xd9, MiscHandler}, // V - {0x76, MiscHandler}, // V - {0x3f, MiscHandler}, // V - {0x37, MiscHandler}, // V - {0x27, MiscHandler}, // V - {0x07, MiscHandler}, // V - {0x08, MiscHandler}, // V - {0x00, MiscHandler}, // V - {0xe9, MiscHandler}, // V - {0xeb, MiscHandler}, // V - {0xf3, MiscHandler}, // V - {0x3a, MiscHandler}, // V - {0x10, MiscHandler}, // V - {0x2f, MiscHandler}, // V - {0x0f, MiscHandler}, // V - - {0x02, LdRegpairPtrByte}, // V - {0x12, LdRegpairPtrByte}, // V - - {0x70, LdRegpairPtrByte}, // V - {0x71, LdRegpairPtrByte}, // V - {0x72, LdRegpairPtrByte}, // V - {0x73, LdRegpairPtrByte}, // V - {0x74, LdRegpairPtrByte}, // V - {0x75, LdRegpairPtrByte}, // V - {0x77, LdRegpairPtrByte}, // V - - {0x36, LdRegpairPtrByte}, // V - - {0x80, MathOperation}, // V - {0x81, MathOperation}, // V - {0x82, MathOperation}, // V - {0x83, MathOperation}, // V - {0x84, MathOperation}, // V - {0x85, MathOperation}, // V - {0x86, MathOperation}, // V - {0x87, MathOperation}, // V - {0x88, MathOperation}, // V - {0x89, MathOperation}, // V - {0x8a, MathOperation}, // V - {0x8b, MathOperation}, // V - {0x8c, MathOperation}, // V - {0x8d, MathOperation}, // V - {0x8e, MathOperation}, // V - {0x8f, MathOperation}, // V - {0x90, MathOperation}, // V - {0x91, MathOperation}, // V - {0x92, MathOperation}, // V - {0x93, MathOperation}, // V - {0x94, MathOperation}, // V - {0x95, MathOperation}, // V - {0x96, MathOperation}, // V - {0x97, MathOperation}, // V - {0x98, MathOperation}, // V - {0x99, MathOperation}, // V - {0x9a, MathOperation}, // V - {0x9b, MathOperation}, // V - {0x9c, MathOperation}, // V - {0x9d, MathOperation}, // V - {0x9e, MathOperation}, // V - {0x9f, MathOperation}, // V - {0xa0, MathOperation}, // V - {0xa1, MathOperation}, // V - {0xa2, MathOperation}, // V - {0xa3, MathOperation}, // V - {0xa4, MathOperation}, // V - {0xa5, MathOperation}, // V - {0xa6, MathOperation}, // V - {0xa7, MathOperation}, // V - {0xa8, MathOperation}, // V - {0xa9, MathOperation}, // V - {0xaa, MathOperation}, // V - {0xab, MathOperation}, // V - {0xac, MathOperation}, // V - {0xad, MathOperation}, // V - {0xae, MathOperation}, // V - {0xaf, MathOperation}, // V - {0xb0, MathOperation}, // V - {0xb1, MathOperation}, // V - {0xb2, MathOperation}, // V - {0xb3, MathOperation}, // V - {0xb4, MathOperation}, // V - {0xb5, MathOperation}, // V - {0xb6, MathOperation}, // V - {0xb7, MathOperation}, // V - {0xb8, MathOperation}, // V - {0xb9, MathOperation}, // V - {0xba, MathOperation}, // V - {0xbb, MathOperation}, // V - {0xbc, MathOperation}, // V - {0xbd, MathOperation}, // V - {0xbe, MathOperation}, // V - {0xbf, MathOperation}, // V - - {0x40, LdRegReg}, // V - {0x41, LdRegReg}, // V - {0x42, LdRegReg}, // V - {0x43, LdRegReg}, // V - {0x44, LdRegReg}, // V - {0x45, LdRegReg}, // V - {0x47, LdRegReg}, // V - {0x48, LdRegReg}, // V - {0x49, LdRegReg}, // V - {0x4a, LdRegReg}, // V - {0x4b, LdRegReg}, // V - {0x4c, LdRegReg}, // V - {0x4d, LdRegReg}, // V - {0x4f, LdRegReg}, // V - {0x50, LdRegReg}, // V - {0x51, LdRegReg}, // V - {0x52, LdRegReg}, // V - {0x53, LdRegReg}, // V - {0x54, LdRegReg}, // V - {0x55, LdRegReg}, // V - {0x57, LdRegReg}, // V - {0x58, LdRegReg}, // V - {0x59, LdRegReg}, // V - {0x5a, LdRegReg}, // V - {0x5b, LdRegReg}, // V - {0x5c, LdRegReg}, // V - {0x5d, LdRegReg}, // V - {0x5f, LdRegReg}, // V - {0x60, LdRegReg}, // V - {0x61, LdRegReg}, // V - {0x62, LdRegReg}, // V - {0x63, LdRegReg}, // V - {0x64, LdRegReg}, // V - {0x65, LdRegReg}, // V - {0x67, LdRegReg}, // V - {0x68, LdRegReg}, // V - {0x69, LdRegReg}, // V - {0x6a, LdRegReg}, // V - {0x6b, LdRegReg}, // V - {0x6c, LdRegReg}, // V - {0x6d, LdRegReg}, // V - {0x6f, LdRegReg}, // V - {0x78, LdRegReg}, // V - {0x79, LdRegReg}, // V - {0x7a, LdRegReg}, // V - {0x7b, LdRegReg}, // V - {0x7c, LdRegReg}, // V - {0x7d, LdRegReg}, // V - {0x7f, LdRegReg}, // V - - {0xc6, MathOperationDirect}, // V - {0xce, MathOperationDirect}, // V - {0xd6, MathOperationDirect}, // V - {0xde, MathOperationDirect}, // V - {0xe6, MathOperationDirect}, // V - {0xee, MathOperationDirect}, // V - {0xf6, MathOperationDirect}, // V - {0xfe, MathOperationDirect}, // V - - {0x18, JrHandler}, // V - {0x20, JrHandler}, // V - {0x28, JrHandler}, // V - {0x30, JrHandler}, // V - {0x38, JrHandler}, - - {0xc4, CallHandler}, // V - {0xcc, CallHandler}, // V - {0xcd, CallHandler}, // V - {0xd4, CallHandler}, // V - {0xdc, CallHandler}, // V - {0xe4, CallHandler}, // V - {0xec, CallHandler}, // V - {0xf4, CallHandler}, // V - {0xfc, CallHandler}, // V - - {0xc9, RetHandler}, // V - {0xc0, RetHandler}, // V - {0xc8, RetHandler}, // V - {0xd0, RetHandler}, // V - {0xd8, RetHandler}, // V - {0xe0, RetHandler}, // V - {0xe8, RetHandler}, // V - {0xf0, RetHandler}, // V - {0xf8, RetHandler}, // V - - {0xc7, RestartHandler}, // V - {0xcf, RestartHandler}, // V - {0xd7, RestartHandler}, // V - {0xdf, RestartHandler}, // V - {0xe7, RestartHandler}, // V - {0xef, RestartHandler}, // V - {0xf7, RestartHandler}, // V - {0xff, RestartHandler}, // V - - {0x46, ToRegFromHl}, // V - {0x4e, ToRegFromHl}, // V - {0x56, ToRegFromHl}, // V - {0x5e, ToRegFromHl}, // V - {0x66, ToRegFromHl}, // V - {0x6e, ToRegFromHl}, // V - {0x7e, ToRegFromHl}, - - {0x09, AddRegpairOperations}, // V - {0x19, AddRegpairOperations}, // V - {0x29, AddRegpairOperations}, // V - {0x39, AddRegpairOperations}, // V - - {0xc5, PushPopOperations}, // V - {0xd5, PushPopOperations}, // V - {0xe5, PushPopOperations}, // V - {0xf5, PushPopOperations}, // V - {0xc1, PushPopOperations}, // V - {0xd1, PushPopOperations}, // V - {0xe1, PushPopOperations}, // V - {0xf1, PushPopOperations}, // V - - // Terminator - - {0xffffffff, NULL} -}; - -struct sOp CBOps[] = -{ - {0x00, RLCRRCRLRRSLASRASRLHandler}, - {0x01, RLCRRCRLRRSLASRASRLHandler}, - {0x02, RLCRRCRLRRSLASRASRLHandler}, - {0x03, RLCRRCRLRRSLASRASRLHandler}, - {0x04, RLCRRCRLRRSLASRASRLHandler}, - {0x05, RLCRRCRLRRSLASRASRLHandler}, - {0x06, RLCRRCRLRRSLASRASRLHandler}, - {0x07, RLCRRCRLRRSLASRASRLHandler}, - {0x08, RLCRRCRLRRSLASRASRLHandler}, - {0x09, RLCRRCRLRRSLASRASRLHandler}, - {0x0a, RLCRRCRLRRSLASRASRLHandler}, - {0x0b, RLCRRCRLRRSLASRASRLHandler}, - {0x0c, RLCRRCRLRRSLASRASRLHandler}, - {0x0d, RLCRRCRLRRSLASRASRLHandler}, - {0x0e, RLCRRCRLRRSLASRASRLHandler}, - {0x0f, RLCRRCRLRRSLASRASRLHandler}, - - {0x10, RLCRRCRLRRSLASRASRLHandler}, - {0x11, RLCRRCRLRRSLASRASRLHandler}, - {0x12, RLCRRCRLRRSLASRASRLHandler}, - {0x13, RLCRRCRLRRSLASRASRLHandler}, - {0x14, RLCRRCRLRRSLASRASRLHandler}, - {0x15, RLCRRCRLRRSLASRASRLHandler}, - {0x16, RLCRRCRLRRSLASRASRLHandler}, - {0x17, RLCRRCRLRRSLASRASRLHandler}, - {0x18, RLCRRCRLRRSLASRASRLHandler}, - {0x19, RLCRRCRLRRSLASRASRLHandler}, - {0x1a, RLCRRCRLRRSLASRASRLHandler}, - {0x1b, RLCRRCRLRRSLASRASRLHandler}, - {0x1c, RLCRRCRLRRSLASRASRLHandler}, - {0x1d, RLCRRCRLRRSLASRASRLHandler}, - {0x1e, RLCRRCRLRRSLASRASRLHandler}, - {0x1f, RLCRRCRLRRSLASRASRLHandler}, - - {0x20, RLCRRCRLRRSLASRASRLHandler}, - {0x21, RLCRRCRLRRSLASRASRLHandler}, - {0x22, RLCRRCRLRRSLASRASRLHandler}, - {0x23, RLCRRCRLRRSLASRASRLHandler}, - {0x24, RLCRRCRLRRSLASRASRLHandler}, - {0x25, RLCRRCRLRRSLASRASRLHandler}, - {0x26, RLCRRCRLRRSLASRASRLHandler}, - {0x27, RLCRRCRLRRSLASRASRLHandler}, - {0x28, RLCRRCRLRRSLASRASRLHandler}, - {0x29, RLCRRCRLRRSLASRASRLHandler}, - {0x2a, RLCRRCRLRRSLASRASRLHandler}, - {0x2b, RLCRRCRLRRSLASRASRLHandler}, - {0x2c, RLCRRCRLRRSLASRASRLHandler}, - {0x2d, RLCRRCRLRRSLASRASRLHandler}, - {0x2e, RLCRRCRLRRSLASRASRLHandler}, - {0x2f, RLCRRCRLRRSLASRASRLHandler}, - - {0x30, RLCRRCRLRRSLASRASRLHandler}, - {0x31, RLCRRCRLRRSLASRASRLHandler}, - {0x32, RLCRRCRLRRSLASRASRLHandler}, - {0x33, RLCRRCRLRRSLASRASRLHandler}, - {0x34, RLCRRCRLRRSLASRASRLHandler}, - {0x35, RLCRRCRLRRSLASRASRLHandler}, - {0x36, RLCRRCRLRRSLASRASRLHandler}, - {0x37, RLCRRCRLRRSLASRASRLHandler}, - - {0x38, RLCRRCRLRRSLASRASRLHandler}, - {0x39, RLCRRCRLRRSLASRASRLHandler}, - {0x3a, RLCRRCRLRRSLASRASRLHandler}, - {0x3b, RLCRRCRLRRSLASRASRLHandler}, - {0x3c, RLCRRCRLRRSLASRASRLHandler}, - {0x3d, RLCRRCRLRRSLASRASRLHandler}, - {0x3e, RLCRRCRLRRSLASRASRLHandler}, - {0x3f, RLCRRCRLRRSLASRASRLHandler}, - - {0x40, BITHandler}, - {0x41, BITHandler}, - {0x42, BITHandler}, - {0x43, BITHandler}, - {0x44, BITHandler}, - {0x45, BITHandler}, - {0x46, BITHandler}, - {0x47, BITHandler}, - {0x48, BITHandler}, - {0x49, BITHandler}, - {0x4a, BITHandler}, - {0x4b, BITHandler}, - {0x4c, BITHandler}, - {0x4d, BITHandler}, - {0x4e, BITHandler}, - {0x4f, BITHandler}, - - {0x50, BITHandler}, - {0x51, BITHandler}, - {0x52, BITHandler}, - {0x53, BITHandler}, - {0x54, BITHandler}, - {0x55, BITHandler}, - {0x56, BITHandler}, - {0x57, BITHandler}, - {0x58, BITHandler}, - {0x59, BITHandler}, - {0x5a, BITHandler}, - {0x5b, BITHandler}, - {0x5c, BITHandler}, - {0x5d, BITHandler}, - {0x5e, BITHandler}, - {0x5f, BITHandler}, - - {0x60, BITHandler}, - {0x61, BITHandler}, - {0x62, BITHandler}, - {0x63, BITHandler}, - {0x64, BITHandler}, - {0x65, BITHandler}, - {0x66, BITHandler}, - {0x67, BITHandler}, - {0x68, BITHandler}, - {0x69, BITHandler}, - {0x6a, BITHandler}, - {0x6b, BITHandler}, - {0x6c, BITHandler}, - {0x6d, BITHandler}, - {0x6e, BITHandler}, - {0x6f, BITHandler}, - - {0x70, BITHandler}, - {0x71, BITHandler}, - {0x72, BITHandler}, - {0x73, BITHandler}, - {0x74, BITHandler}, - {0x75, BITHandler}, - {0x76, BITHandler}, - {0x77, BITHandler}, - {0x78, BITHandler}, - {0x79, BITHandler}, - {0x7a, BITHandler}, - {0x7b, BITHandler}, - {0x7c, BITHandler}, - {0x7d, BITHandler}, - {0x7e, BITHandler}, - {0x7f, BITHandler}, - - // RES - - {0x80, RESSETHandler}, - {0x81, RESSETHandler}, - {0x82, RESSETHandler}, - {0x83, RESSETHandler}, - {0x84, RESSETHandler}, - {0x85, RESSETHandler}, - {0x86, RESSETHandler}, - {0x87, RESSETHandler}, - {0x88, RESSETHandler}, - {0x89, RESSETHandler}, - {0x8a, RESSETHandler}, - {0x8b, RESSETHandler}, - {0x8c, RESSETHandler}, - {0x8d, RESSETHandler}, - {0x8e, RESSETHandler}, - {0x8f, RESSETHandler}, - - {0x90, RESSETHandler}, - {0x91, RESSETHandler}, - {0x92, RESSETHandler}, - {0x93, RESSETHandler}, - {0x94, RESSETHandler}, - {0x95, RESSETHandler}, - {0x96, RESSETHandler}, - {0x97, RESSETHandler}, - {0x98, RESSETHandler}, - {0x99, RESSETHandler}, - {0x9a, RESSETHandler}, - {0x9b, RESSETHandler}, - {0x9c, RESSETHandler}, - {0x9d, RESSETHandler}, - {0x9e, RESSETHandler}, - {0x9f, RESSETHandler}, - - {0xa0, RESSETHandler}, - {0xa1, RESSETHandler}, - {0xa2, RESSETHandler}, - {0xa3, RESSETHandler}, - {0xa4, RESSETHandler}, - {0xa5, RESSETHandler}, - {0xa6, RESSETHandler}, - {0xa7, RESSETHandler}, - {0xa8, RESSETHandler}, - {0xa9, RESSETHandler}, - {0xaa, RESSETHandler}, - {0xab, RESSETHandler}, - {0xac, RESSETHandler}, - {0xad, RESSETHandler}, - {0xae, RESSETHandler}, - {0xaf, RESSETHandler}, - - {0xb0, RESSETHandler}, - {0xb1, RESSETHandler}, - {0xb2, RESSETHandler}, - {0xb3, RESSETHandler}, - {0xb4, RESSETHandler}, - {0xb5, RESSETHandler}, - {0xb6, RESSETHandler}, - {0xb7, RESSETHandler}, - {0xb8, RESSETHandler}, - {0xb9, RESSETHandler}, - {0xba, RESSETHandler}, - {0xbb, RESSETHandler}, - {0xbc, RESSETHandler}, - {0xbd, RESSETHandler}, - {0xbe, RESSETHandler}, - {0xbf, RESSETHandler}, - - // SET - - {0xc0, RESSETHandler}, - {0xc1, RESSETHandler}, - {0xc2, RESSETHandler}, - {0xc3, RESSETHandler}, - {0xc4, RESSETHandler}, - {0xc5, RESSETHandler}, - {0xc6, RESSETHandler}, - {0xc7, RESSETHandler}, - {0xc8, RESSETHandler}, - {0xc9, RESSETHandler}, - {0xca, RESSETHandler}, - {0xcb, RESSETHandler}, - {0xcc, RESSETHandler}, - {0xcd, RESSETHandler}, - {0xce, RESSETHandler}, - {0xcf, RESSETHandler}, - - {0xd0, RESSETHandler}, - {0xd1, RESSETHandler}, - {0xd2, RESSETHandler}, - {0xd3, RESSETHandler}, - {0xd4, RESSETHandler}, - {0xd5, RESSETHandler}, - {0xd6, RESSETHandler}, - {0xd7, RESSETHandler}, - {0xd8, RESSETHandler}, - {0xd9, RESSETHandler}, - {0xda, RESSETHandler}, - {0xdb, RESSETHandler}, - {0xdc, RESSETHandler}, - {0xdd, RESSETHandler}, - {0xde, RESSETHandler}, - {0xdf, RESSETHandler}, - - {0xe0, RESSETHandler}, - {0xe1, RESSETHandler}, - {0xe2, RESSETHandler}, - {0xe3, RESSETHandler}, - {0xe4, RESSETHandler}, - {0xe5, RESSETHandler}, - {0xe6, RESSETHandler}, - {0xe7, RESSETHandler}, - {0xe8, RESSETHandler}, - {0xe9, RESSETHandler}, - {0xea, RESSETHandler}, - {0xeb, RESSETHandler}, - {0xec, RESSETHandler}, - {0xed, RESSETHandler}, - {0xee, RESSETHandler}, - {0xef, RESSETHandler}, - - {0xf0, RESSETHandler}, - {0xf1, RESSETHandler}, - {0xf2, RESSETHandler}, - {0xf3, RESSETHandler}, - {0xf4, RESSETHandler}, - {0xf5, RESSETHandler}, - {0xf6, RESSETHandler}, - {0xf7, RESSETHandler}, - {0xf8, RESSETHandler}, - {0xf9, RESSETHandler}, - {0xfa, RESSETHandler}, - {0xfb, RESSETHandler}, - {0xfc, RESSETHandler}, - {0xfd, RESSETHandler}, - {0xfe, RESSETHandler}, - {0xff, RESSETHandler}, - - // Terminator - - {0xffffffff, NULL} -}; - -struct sOp EDOps[] = -{ - {0x67, RRDRLDHandler}, - {0x6f, RRDRLDHandler}, - {0x42, AdcSbcRegpair}, - {0x4a, AdcSbcRegpair}, - {0x52, AdcSbcRegpair}, - {0x5a, AdcSbcRegpair}, - {0x62, AdcSbcRegpair}, - {0x6a, AdcSbcRegpair}, - {0x72, AdcSbcRegpair}, - {0x7a, AdcSbcRegpair}, - {0x45, RetIRetNHandler}, - {0x4d, RetIRetNHandler}, - {0x44, NegHandler}, - {0xa0, LDILDRLDIRLDDRHandler}, - {0xa8, LDILDRLDIRLDDRHandler}, - {0xb0, LDILDRLDIRLDDRHandler}, - {0xb8, LDILDRLDIRLDDRHandler}, - {0x57, IRHandler}, - {0x5F, IRHandler}, - {0x47, IRHandler}, - {0x4F, IRHandler}, - {0x46, IMHandler}, - {0x56, IMHandler}, - {0x5e, IMHandler}, - {0x4b, LdRegpair}, - {0x5b, LdRegpair}, - {0x7b, LdRegpair}, - {0x43, ExtendedRegIntoMemory}, - {0x53, ExtendedRegIntoMemory}, - {0x63, ExtendedRegIntoMemory}, - {0x73, ExtendedRegIntoMemory}, - {0x40, ExtendedInHandler}, - {0x48, ExtendedInHandler}, - {0x50, ExtendedInHandler}, - {0x58, ExtendedInHandler}, - {0x60, ExtendedInHandler}, - {0x68, ExtendedInHandler}, - {0x78, ExtendedInHandler}, - {0x41, ExtendedOutHandler}, - {0x49, ExtendedOutHandler}, - {0x51, ExtendedOutHandler}, - {0x59, ExtendedOutHandler}, - {0x61, ExtendedOutHandler}, - {0x69, ExtendedOutHandler}, - {0x79, ExtendedOutHandler}, - {0xa1, CPICPDCPIRCPDRHandler}, - {0xa9, CPICPDCPIRCPDRHandler}, - {0xb1, CPICPDCPIRCPDRHandler}, - {0xb9, CPICPDCPIRCPDRHandler}, - - {0xbb, OTIROTDROUTIOUTDHandler}, // OTDR - {0xb3, OTIROTDROUTIOUTDHandler}, // OTIR - {0xab, OTIROTDROUTIOUTDHandler}, // OUTD - {0xa3, OTIROTDROUTIOUTDHandler}, // OUTI - - {0xb2, INIRINDRINIINDHandler}, // INIR - {0xba, INIRINDRINIINDHandler}, // INDR - {0xa2, INIRINDRINIINDHandler}, // INI - {0xaa, INIRINDRINIINDHandler}, // IND - - // Terminator - - {0xffffffff, NULL} -}; - -struct sOp DDFDOps[] = -{ - {0x35, IncDecIndexed}, - {0x34, IncDecIndexed}, - {0xcb, DDFDCBHandler}, - {0x86, MathOperationIndexed}, - {0x8e, MathOperationIndexed}, - {0x96, MathOperationIndexed}, - {0x9e, MathOperationIndexed}, - {0xa6, MathOperationIndexed}, - {0xae, MathOperationIndexed}, - {0xb6, MathOperationIndexed}, - {0xbe, MathOperationIndexed}, - - {0xe1, PushPopOperationsIndexed}, - {0xe5, PushPopOperationsIndexed}, - {0x21, LoadImmediate}, - {0xe9, JPIXIYHandler}, - {0x09, AddIndexHandler}, - {0x19, AddIndexHandler}, - {0x29, AddIndexHandler}, - {0x39, AddIndexHandler}, - {0xf9, SPToIndex}, - {0x36, LdByteToIndex}, - {0x46, LdRegIndexOffset}, - {0x4e, LdRegIndexOffset}, - {0x56, LdRegIndexOffset}, - {0x5e, LdRegIndexOffset}, - {0x66, LdRegIndexOffset}, - {0x6e, LdRegIndexOffset}, - {0x7e, LdRegIndexOffset}, - - {0x70, LdIndexPtrReg}, - {0x71, LdIndexPtrReg}, - {0x72, LdIndexPtrReg}, - {0x73, LdIndexPtrReg}, - {0x74, LdIndexPtrReg}, - {0x75, LdIndexPtrReg}, - {0x77, LdIndexPtrReg}, - - {0x23, IncDecIndexReg}, - {0x2b, IncDecIndexReg}, - - {0x22, StoreIndexReg}, - {0x2a, LoadIndexReg}, - {0xe3, ExIndexed}, - - {0x44, UndocRegToIndex}, - {0x45, UndocRegToIndex}, - {0x4c, UndocRegToIndex}, - {0x4d, UndocRegToIndex}, - {0x54, UndocRegToIndex}, - {0x55, UndocRegToIndex}, - {0x5c, UndocRegToIndex}, - {0x5d, UndocRegToIndex}, - {0x7c, UndocRegToIndex}, - {0x7d, UndocRegToIndex}, - - {0x60, UndocIndexToReg}, - {0x61, UndocIndexToReg}, - {0x62, UndocIndexToReg}, - {0x63, UndocIndexToReg}, - {0x64, UndocIndexToReg}, - {0x65, UndocIndexToReg}, - {0x67, UndocIndexToReg}, - {0x68, UndocIndexToReg}, - {0x69, UndocIndexToReg}, - {0x6a, UndocIndexToReg}, - {0x6b, UndocIndexToReg}, - {0x6c, UndocIndexToReg}, - {0x6d, UndocIndexToReg}, - {0x6f, UndocIndexToReg}, - - {0x24, UndocIncDecIndexReg}, - {0x25, UndocIncDecIndexReg}, - {0x2c, UndocIncDecIndexReg}, - {0x2d, UndocIncDecIndexReg}, - - {0x26, UndocLoadHalfIndexReg}, - {0x2e, UndocLoadHalfIndexReg}, - - {0x84, UndocMathIndex}, - {0x85, UndocMathIndex}, - {0x8c, UndocMathIndex}, - {0x8d, UndocMathIndex}, - - {0x94, UndocMathIndex}, - {0x95, UndocMathIndex}, - {0x9c, UndocMathIndex}, - {0x9d, UndocMathIndex}, - - {0xa4, UndocMathIndex}, - {0xa5, UndocMathIndex}, - {0xac, UndocMathIndex}, - {0xad, UndocMathIndex}, - - {0xb4, UndocMathIndex}, - {0xb5, UndocMathIndex}, - {0xbc, UndocMathIndex}, - {0xbd, UndocMathIndex}, - - // Terminator - - {0xffffffff, NULL} -}; - -struct sOp DDFDCBOps[] = -{ - {0x06, ddcbBitWise}, - {0x0e, ddcbBitWise}, - {0x16, ddcbBitWise}, - {0x1e, ddcbBitWise}, - {0x26, ddcbBitWise}, - {0x2e, ddcbBitWise}, - {0x3e, ddcbBitWise}, - {0x46, ddcbBitWise}, - {0x4e, ddcbBitWise}, - {0x56, ddcbBitWise}, - {0x5e, ddcbBitWise}, - {0x66, ddcbBitWise}, - {0x6e, ddcbBitWise}, - {0x76, ddcbBitWise}, - {0x7e, ddcbBitWise}, - {0x86, ddcbBitWise}, - {0x8e, ddcbBitWise}, - {0x96, ddcbBitWise}, - {0x9e, ddcbBitWise}, - {0xa6, ddcbBitWise}, - {0xae, ddcbBitWise}, - {0xb6, ddcbBitWise}, - {0xbe, ddcbBitWise}, - {0xc6, ddcbBitWise}, - {0xce, ddcbBitWise}, - {0xd6, ddcbBitWise}, - {0xde, ddcbBitWise}, - {0xe6, ddcbBitWise}, - {0xee, ddcbBitWise}, - {0xf6, ddcbBitWise}, - {0xfe, ddcbBitWise}, - - // Terminator - - {0xffffffff, NULL} -}; - -void InvalidInstructionC(UINT32 dwCount) -{ - fprintf(fp, " InvalidInstruction(%ld);\n", dwCount); -} - -UINT32 Timing(UINT8 bWho, UINT32 dwOpcode) -{ - UINT32 dwTiming = 0; - - assert(dwOpcode < 0x100); - - if (TIMING_REGULAR == bWho) // Regular? - dwTiming = bTimingRegular[dwOpcode]; - else - if (TIMING_CB == bWho) - dwTiming = bTimingCB[dwOpcode]; - else - if (TIMING_DDFD == bWho) - dwTiming = bTimingDDFD[dwOpcode]; - else - if (TIMING_ED == bWho) - dwTiming = bTimingED[dwOpcode]; - else - if (TIMING_XXCB == bWho) - dwTiming = bTimingXXCB[dwOpcode]; - else - if (TIMING_EXCEPT == bWho) - dwTiming = dwOpcode; - else - assert(0); - - if (0 == dwTiming) - { - fprintf(stderr, "Opcode: %.2x:%.2x - Not zero!\n", bWho, dwOpcode); - fclose(fp); - exit(1); - } - - return(dwTiming); -} - -void IndexedOffset(UINT8 *Localmz80Index) -{ - fprintf(fp, " mov dl, [esi] ; Fetch our offset\n"); - fprintf(fp, " inc esi ; Move past the offset\n"); - fprintf(fp, " or dl, dl ; Is this bad boy signed?\n"); - fprintf(fp, " jns notSigned%ld ; Nope!\n", dwGlobalLabel); - fprintf(fp, " dec dh ; Make it FFable\n"); - fprintf(fp, "notSigned%ld:\n", dwGlobalLabel); - fprintf(fp, " add dx, [_z80%s] ; Our offset!\n", Localmz80Index); - ++dwGlobalLabel; -} - -void CBHandler(UINT32 dwOpcode) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - fprintf(fp, ";\n"); - fprintf(fp, "; Handler for all CBxx instructions\n"); - fprintf(fp, ";\n"); - sprintf(string, "RegInst%.2x", dwOpcode); - ProcBegin(0xffffffff); - fprintf(fp, " mov dl, [esi]\n"); - fprintf(fp, " inc esi\n"); - fprintf(fp, " jmp dword [z80PrefixCB+edx*4]\n\n"); - fprintf(fp, "\n\n"); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, " CBHandler();\n"); - } - else - { - assert(0); - } -} - -void EDHandler(UINT32 dwOpcode) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - fprintf(fp, ";\n"); - fprintf(fp, "; Handler for all EDxx instructions\n"); - fprintf(fp, ";\n"); - sprintf(string, "RegInst%.2x", dwOpcode); - ProcBegin(0xffffffff); - fprintf(fp, " mov dl, [esi]\n"); - fprintf(fp, " inc esi\n"); - fprintf(fp, " jmp dword [z80PrefixED+edx*4]\n\n"); - fprintf(fp, "\n\n"); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, " EDHandler();\n"); - } - else - { - assert(0); - } -} - -void DDHandler(UINT32 dwOpcode) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - fprintf(fp, ";\n"); - fprintf(fp, "; Handler for all DDxx instructions\n"); - fprintf(fp, ";\n"); - sprintf(string, "RegInst%.2x", dwOpcode); - ProcBegin(0xffffffff); - fprintf(fp, " mov dl, [esi]\n"); - fprintf(fp, " inc esi\n"); - fprintf(fp, " jmp dword [z80PrefixDD+edx*4]\n\n"); - fprintf(fp, "\n\n"); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, " DDHandler();\n"); - } - else - { - assert(0); - } -} - -void FDHandler(UINT32 dwOpcode) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - fprintf(fp, ";\n"); - fprintf(fp, "; Handler for all FDxx instructions\n"); - fprintf(fp, ";\n"); - sprintf(string, "RegInst%.2x", dwOpcode); - ProcBegin(0xffffffff); - fprintf(fp, " mov dl, [esi]\n"); - fprintf(fp, " inc esi\n"); - fprintf(fp, " jmp dword [z80PrefixFD+edx*4]\n\n"); - fprintf(fp, "\n\n"); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, " FDHandler();\n"); - } - else - { - assert(0); - } -} - -StandardHeader() -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - fprintf(fp,"; For assembly by NASM only\n"); - fprintf(fp,"bits 32\n\n"); - - fprintf(fp,"; Theory of operation\n\n"); - fprintf(fp,"; EDI=General purpose\n"); - fprintf(fp,"; ESI=Program counter + base address\n"); - fprintf(fp,"; EBP=z80Base\n"); - fprintf(fp,"; AX=AF\n"); - fprintf(fp,"; BX=HL\n"); - fprintf(fp,"; CX=BC\n"); - fprintf(fp,"; DX=General purpose\n\n"); - - if (bUseStack) - fprintf(fp, "; Using stack calling conventions\n"); - else - fprintf(fp, "; Using register calling conventions\n"); - - if (b16BitIo) - fprintf(fp, "; Extended input/output instructions treat (BC) as I/O address\n"); - else - fprintf(fp, "; Extended input/output instructions treat (C) as I/O address\n\n"); - - fprintf(fp, "IFF1 equ 01h\n"); - fprintf(fp, "IFF2 equ 02h\n"); - - fprintf(fp, "CPUREG_PC equ 00h\n"); - fprintf(fp, "CPUREG_SP equ 01h\n"); - fprintf(fp, "CPUREG_AF equ 02h\n"); - fprintf(fp, "CPUREG_BC equ 03h\n"); - fprintf(fp, "CPUREG_DE equ 04h\n"); - fprintf(fp, "CPUREG_HL equ 05h\n"); - fprintf(fp, "CPUREG_AFPRIME equ 06h\n"); - fprintf(fp, "CPUREG_BCPRIME equ 07h\n"); - fprintf(fp, "CPUREG_DEPRIME equ 08h\n"); - fprintf(fp, "CPUREG_HLPRIME equ 09h\n"); - fprintf(fp, "CPUREG_IX equ 0ah\n"); - fprintf(fp, "CPUREG_IY equ 0bh\n"); - fprintf(fp, "CPUREG_I equ 0ch\n"); - fprintf(fp, "CPUREG_A equ 0dh\n"); - fprintf(fp, "CPUREG_F equ 0eh\n"); - fprintf(fp, "CPUREG_B equ 0fh\n"); - fprintf(fp, "CPUREG_C equ 10h\n"); - fprintf(fp, "CPUREG_D equ 11h\n"); - fprintf(fp, "CPUREG_E equ 12h\n"); - fprintf(fp, "CPUREG_H equ 13h\n"); - fprintf(fp, "CPUREG_L equ 14h\n"); - fprintf(fp, "CPUREG_IFF1 equ 15h\n"); - fprintf(fp, "CPUREG_IFF2 equ 16h\n"); - fprintf(fp, "CPUREG_CARRY equ 17h\n"); - fprintf(fp, "CPUREG_NEGATIVE equ 18h\n"); - fprintf(fp, "CPUREG_PARITY equ 19h\n"); - fprintf(fp, "CPUREG_OVERFLOW equ 1ah\n"); - fprintf(fp, "CPUREG_HALFCARRY equ 1bh\n"); - fprintf(fp, "CPUREG_ZERO equ 1ch\n"); - fprintf(fp, "CPUREG_SIGN equ 1dh\n"); - fprintf(fp, "CPUREG_MAXINDEX equ 1eh\n\n"); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, "/* Multi-Z80 32 Bit emulator */\n"); - fprintf(fp, "\n"); - fprintf(fp, "/* Copyright 1996-2000 Neil Bradley, All rights reserved\n"); - fprintf(fp, " *\n"); - fprintf(fp, " * License agreement:\n"); - fprintf(fp, " *\n"); - fprintf(fp, " * (MZ80 Refers to both the assembly code emitted by makeZ80.c and makeZ80.c\n"); - fprintf(fp, " * itself)\n"); - fprintf(fp, " *\n"); - fprintf(fp, " * MZ80 May be distributed in unmodified form to any medium.\n"); - fprintf(fp, " *\n"); - fprintf(fp, " * MZ80 May not be sold, or sold as a part of a commercial package without\n"); - fprintf(fp, " * the express written permission of Neil Bradley (neil@synthcom.com). This\n"); - fprintf(fp, " * includes shareware.\n"); - fprintf(fp, " *\n"); - fprintf(fp, " * Modified versions of MZ80 may not be publicly redistributed without author\n"); - fprintf(fp, " * approval (neil@synthcom.com). This includes distributing via a publicly\n"); - fprintf(fp, " * accessible LAN. You may make your own source modifications and distribute\n"); - fprintf(fp, " * MZ80 in source or object form, but if you make modifications to MZ80\n"); - fprintf(fp, " * then it should be noted in the top as a comment in makeZ80.c.\n"); - fprintf(fp, " *\n"); - fprintf(fp, " * MZ80 Licensing for commercial applications is available. Please email\n"); - fprintf(fp, " * neil@synthcom.com for details.\n"); - fprintf(fp, " *\n"); - fprintf(fp, " * Synthcom Systems, Inc, and Neil Bradley will not be held responsible for\n"); - fprintf(fp, " * any damage done by the use of MZ80. It is purely \"as-is\".\n"); - fprintf(fp, " *\n"); - fprintf(fp, " * If you use MZ80 in a freeware application, credit in the following text:\n"); - fprintf(fp, " *\n"); - fprintf(fp, " * \"Multi-Z80 CPU emulator by Neil Bradley (neil@synthcom.com)\"\n"); - fprintf(fp, " *\n"); - fprintf(fp, " * must accompany the freeware application within the application itself or\n"); - fprintf(fp, " * in the documentation.\n"); - fprintf(fp, " *\n"); - fprintf(fp, " * Legal stuff aside:\n"); - fprintf(fp, " *\n"); - fprintf(fp, " * If you find problems with MZ80, please email the author so they can get\n"); - fprintf(fp, " * resolved. If you find a bug and fix it, please also email the author so\n"); - fprintf(fp, " * that those bug fixes can be propogated to the installed base of MZ80\n"); - fprintf(fp, " * users. If you find performance improvements or problems with MZ80, please\n"); - fprintf(fp, " * email the author with your changes/suggestions and they will be rolled in\n"); - fprintf(fp, " * with subsequent releases of MZ80.\n"); - fprintf(fp, " *\n"); - fprintf(fp, " * The whole idea of this emulator is to have the fastest available 32 bit\n"); - fprintf(fp, " * Multi-Z80 emulator for the PC, giving maximum performance. \n"); - fprintf(fp, " */\n\n"); - fprintf(fp, "#include \n"); - fprintf(fp, "#include \n"); - fprintf(fp, "#include \n"); - fprintf(fp, "#include \"mz80.h\"\n"); - - // HACK HACK - - fprintf(fp, "UINT32 z80intAddr;\n"); - fprintf(fp, "UINT32 z80pc;\n"); - } - else - { - // Whoops. Unknown emission type. - - assert(0); - } - - fprintf(fp, "\n\n"); -} - -Alignment() -{ - fprintf(fp, "\ntimes ($$-$) & 3 nop ; pad with NOPs to 4-byte boundary\n\n"); -} - -void ProcBegin(UINT32 dwOpcode) -{ - Alignment(); - fprintf(fp, "%s:\n", procname); -} - -void SetSubFlagsSZHVC(UINT8 *pszLeft, UINT8 *pszRight) -{ - fprintf(fp, " cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | \n"); - fprintf(fp, " Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |\n"); - fprintf(fp, " pbSubSbcTable[((UINT32) %s << 8) | %s];\n", pszLeft, pszRight); -} - -void SetSbcFlagsSZHVC(UINT8 *pszLeft, UINT8 *pszRight) -{ - fprintf(fp, " cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | \n"); - fprintf(fp, " Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |\n"); - fprintf(fp, " pbSubSbcTable[((UINT32) %s << 8) | %s | (((UINT32) cpu.z80F & Z80_FLAG_CARRY) << 16)];\n", pszLeft, pszRight); -} - -void SetAddFlagsSZHVC(UINT8 *pszLeft, UINT8 *pszRight) -{ - fprintf(fp, " cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | \n"); - fprintf(fp, " Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |\n"); - fprintf(fp, " pbAddAdcTable[((UINT32) %s << 8) | %s];\n", pszLeft, pszRight); -} - -void SetAdcFlagsSZHVC(UINT8 *pszLeft, UINT8 *pszRight) -{ - fprintf(fp, " cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY | \n"); - fprintf(fp, " Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN)) |\n"); - fprintf(fp, " pbAddAdcTable[((UINT32) %s << 8) | %s | (((UINT32) cpu.z80F & Z80_FLAG_CARRY) << 16)];\n", pszLeft, pszRight); -} - -UINT32 dwOverflowCount = 0; - -SetOverflow() -{ - fprintf(fp, " seto dl\n"); - fprintf(fp, " and ah, 0fbh ; Knock out parity/overflow\n"); - fprintf(fp, " shl dl, 2\n"); - fprintf(fp, " or ah, dl\n"); -} - -void FetchNextInstruction(UINT32 dwOpcode) -{ - if (0xffffffff != dwOpcode) - { - fprintf(fp, " sub edi, byte %ld\n", Timing(bCurrentMode, dwOpcode)); - - if (bCurrentMode == TIMING_REGULAR) - fprintf(fp, " js near noMoreExec\n"); - else - fprintf(fp, " js near noMoreExec\n"); - } - - fprintf(fp, " mov dl, byte [esi] ; Get our next instruction\n"); - fprintf(fp, " inc esi ; Increment PC\n"); - fprintf(fp, " jmp dword [z80regular+edx*4]\n\n"); -} - -void WriteValueToMemory(UINT8 *pszAddress, UINT8 *pszValue) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - fprintf(fp, " mov [cyclesRemaining], edi\n"); - fprintf(fp, " mov [_z80af], ax ; Store AF\n"); - - // First off, load our byte to write into al after we've saved AF - - if (strcmp(pszValue, "al") != 0) - fprintf(fp, " mov al, %s ; And our data to write\n", pszValue); - if (strcmp(pszValue, "[esi]") == 0) // Immediate value? - fprintf(fp, " inc esi ; Increment our program counter\n"); - - // Now get the address in DX - regardless of what it is - - if (strcmp(pszAddress, "[_z80de]") == 0 || - strcmp(pszAddress, "[_orgval]") == 0 || - strcmp(pszAddress, "[_z80ix]") == 0 || - strcmp(pszAddress, "[_z80iy]") == 0) - fprintf(fp, " mov dx, %s\n", pszAddress); - - fprintf(fp, " mov edi, [_z80MemWrite] ; Point to the write array\n\n", cpubasename); - fprintf(fp, "checkLoop%ld:\n", dwGlobalLabel); - fprintf(fp, " cmp [edi], word 0ffffh ; End of our list?\n"); - fprintf(fp, " je memoryWrite%ld ; Yes - go write it!\n", dwGlobalLabel); - - if (strcmp(pszAddress, "[_z80de]") == 0 || - strcmp(pszAddress, "[_orgval]") == 0 || - strcmp(pszAddress, "[_z80ix]") == 0 || - strcmp(pszAddress, "[_z80iy]") == 0) - fprintf(fp, " cmp dx, [edi] ; Are we smaller?\n", pszAddress); - else - fprintf(fp, " cmp %s, [edi] ; Are we smaller?\n", pszAddress); - - fprintf(fp, " jb nextAddr%ld ; Yes... go to the next addr\n", dwGlobalLabel); - - if (strcmp(pszAddress, "[_z80de]") == 0 || - strcmp(pszAddress, "[_orgval]") == 0 || - strcmp(pszAddress, "[_z80ix]") == 0 || - strcmp(pszAddress, "[_z80iy]") == 0) - fprintf(fp, " cmp dx, [edi+4] ; Are we smaller?\n", pszAddress); - else - fprintf(fp, " cmp %s, [edi+4] ; Are we smaller?\n", pszAddress); - - fprintf(fp, " jbe callRoutine%ld ; If not, go call it!\n\n", dwGlobalLabel); - fprintf(fp, "nextAddr%ld:\n", dwGlobalLabel); - fprintf(fp, " add edi, 10h ; Next structure, please\n"); - fprintf(fp, " jmp short checkLoop%ld\n\n", dwGlobalLabel); - fprintf(fp, "callRoutine%ld:\n", dwGlobalLabel); - - // Save off our registers! - - if ((strcmp(pszAddress, "dx") != 0) && (strcmp(pszAddress, "[_z80de]") != 0) && - (strcmp(pszAddress, "[_z80ix]") != 0) && - (strcmp(pszAddress, "[_orgval]") != 0) && - (strcmp(pszAddress, "[_z80iy]") != 0)) - fprintf(fp, " mov dx, %s ; Get our address to target\n", pszAddress); - - fprintf(fp, " call WriteMemoryByte ; Go write the data!\n"); - fprintf(fp, " jmp short WriteMacroExit%ld\n", dwGlobalLabel); - - fprintf(fp, "memoryWrite%ld:\n", dwGlobalLabel); - - if (strcmp(pszValue, "[esi]") == 0) - fprintf(fp, " mov [ebp + e%s], al ; Store our direct value\n", pszAddress); - else - { - if (pszValue[0] == 'b' && pszValue[1] == 'y' && pszValue[2] == 't') - { - fprintf(fp, " mov edi, edx\n"); - assert(strcmp(pszValue, "dl") != 0); - - fprintf(fp, " mov dl, %s\n", pszValue); - - if (strcmp(pszAddress, "dx") == 0) - fprintf(fp, " mov [ebp + edi], dl\n"); - else - fprintf(fp, " mov [ebp + e%s], dl\n", pszAddress); - - fprintf(fp, " mov edx, edi\n"); - } - else - { - if (strcmp(pszAddress, "[_z80de]") != 0 && - strcmp(pszAddress, "[_orgval]") != 0 && - strcmp(pszAddress, "[_z80ix]") != 0 && - strcmp(pszAddress, "[_z80iy]") != 0) - fprintf(fp, " mov [ebp + e%s], %s\n", pszAddress, pszValue); - else - fprintf(fp, " mov [ebp + edx], al\n"); - } - } - - fprintf(fp, " mov ax, [_z80af] ; Get our accumulator and flags\n"); - - fprintf(fp, "WriteMacroExit%ld:\n", dwGlobalLabel); - fprintf(fp, " mov edi, [cyclesRemaining]\n"); - - ++dwGlobalLabel; - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, " psMemWrite = cpu.z80MemWrite; /* Beginning of our handler */\n"); - fprintf(fp, " while (psMemWrite->lowAddr != 0xffffffff)\n"); - fprintf(fp, " {\n"); - fprintf(fp, " if ((%s >= psMemWrite->lowAddr) && (%s <= psMemWrite->highAddr))\n", pszAddress, pszAddress); - fprintf(fp, " {\n"); - fprintf(fp, " cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;\n"); - fprintf(fp, " if (psMemWrite->memoryCall)\n"); - fprintf(fp, " {\n"); - fprintf(fp, " psMemWrite->memoryCall(%s, %s, psMemWrite);\n", pszAddress, pszValue); - fprintf(fp, " }\n"); - fprintf(fp, " else\n"); - fprintf(fp, " {\n"); - fprintf(fp, " *((UINT8 *) psMemWrite->pUserArea + (%s - psMemWrite->lowAddr)) = %s;\n", pszAddress, pszValue); - fprintf(fp, " }\n"); - fprintf(fp, " psMemWrite = NULL;\n"); - fprintf(fp, " break;\n"); - fprintf(fp, " }\n"); - fprintf(fp, " ++psMemWrite;\n"); - fprintf(fp, " }\n\n"); - fprintf(fp, " if (psMemWrite)\n"); - fprintf(fp, " {\n"); - fprintf(fp, " cpu.z80Base[%s] = (UINT8) %s;\n", pszAddress, pszValue); - fprintf(fp, " }\n\n"); - } -} - -void WriteWordToMemory(UINT8 *pszAddress, UINT8 *pszTarget) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - fprintf(fp, " mov [cyclesRemaining], edi\n"); - fprintf(fp, " mov edi, [_z80MemWrite] ; Point to the write array\n\n", cpubasename); - fprintf(fp, "checkLoop%ld:\n", dwGlobalLabel); - fprintf(fp, " cmp [edi], word 0ffffh ; End of the list?\n"); - fprintf(fp, " je memoryWrite%ld\n", dwGlobalLabel); - fprintf(fp, " cmp %s, [edi] ; Are we smaller?\n", pszAddress); - fprintf(fp, " jb nextAddr%ld ; Yes, go to the next address\n", dwGlobalLabel); - fprintf(fp, " cmp %s, [edi+4] ; Are we bigger?\n", pszAddress); - fprintf(fp, " jbe callRoutine%ld\n\n", dwGlobalLabel); - fprintf(fp, "nextAddr%ld:\n", dwGlobalLabel); - fprintf(fp, " add edi, 10h ; Next structure!\n"); - fprintf(fp, " jmp short checkLoop%ld\n\n", dwGlobalLabel); - fprintf(fp, "callRoutine%ld:\n", dwGlobalLabel); - - fprintf(fp, " push ax ; Save this for later\n"); - - // Write the LSB - - fprintf(fp, " push dx\n"); - - if (strcmp(pszTarget, "ax") != 0) - { - fprintf(fp, " mov ax, %s\n", pszTarget); - } - else - { - fprintf(fp, " xchg ah, al\n"); - } - - fprintf(fp, " call WriteMemoryByte\n"); - fprintf(fp, " pop dx\n"); - fprintf(fp, " pop ax\n"); - fprintf(fp, " inc dx\n\n"); - - fprintf(fp, " push ax\n"); - fprintf(fp, " push dx\n"); - - if (strcmp(pszTarget, "ax") != 0) - { - fprintf(fp, " mov ax, %s\n", pszTarget); - fprintf(fp, " xchg ah, al\n"); - } - - fprintf(fp, " call WriteMemoryByte\n"); - fprintf(fp, " pop dx\n"); - fprintf(fp, " pop ax ; Restore us!\n"); - - fprintf(fp, " jmp writeExit%ld\n\n", dwGlobalLabel); - - fprintf(fp, "memoryWrite%ld:\n", dwGlobalLabel); - - if (strlen(pszTarget) != 2) - { - fprintf(fp, " mov di, %s\n", pszTarget); - fprintf(fp, " mov [ebp + e%s], di ; Store our word\n", pszAddress); - } - else - { - if (strcmp(pszTarget, "ax") != 0) - { - fprintf(fp, " mov [ebp + e%s], %s ; Store our word\n", pszAddress, pszTarget); - } - else - { - fprintf(fp, " xchg ah, al ; Swap for later\n"); - fprintf(fp, " mov [ebp + e%s], %s ; Store our word\n", pszAddress, pszTarget); - fprintf(fp, " xchg ah, al ; Restore\n"); - } - } - - fprintf(fp, "writeExit%ld:\n", dwGlobalLabel); - fprintf(fp, " mov edi, [cyclesRemaining]\n"); - - dwGlobalLabel++; - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, " psMemWrite = cpu.z80MemWrite; /* Beginning of our handler */\n"); - fprintf(fp, " while (psMemWrite->lowAddr != 0xffffffff)\n"); - fprintf(fp, " {\n"); - fprintf(fp, " if ((%s >= psMemWrite->lowAddr) && (%s <= psMemWrite->highAddr))\n", pszAddress, pszAddress); - fprintf(fp, " {\n"); - fprintf(fp, " cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;\n"); - - fprintf(fp, " if (psMemWrite->memoryCall)\n"); - fprintf(fp, " {\n"); - fprintf(fp, " psMemWrite->memoryCall(%s, (%s & 0xff), psMemWrite);\n", pszAddress, pszTarget); - fprintf(fp, " psMemWrite->memoryCall(%s + 1, (%s >> 8), psMemWrite);\n", pszAddress, pszTarget); - fprintf(fp, " }\n"); - fprintf(fp, " else\n"); - fprintf(fp, " {\n"); - fprintf(fp, " *((UINT8 *) psMemWrite->pUserArea + (%s - psMemWrite->lowAddr)) = %s;\n", pszAddress, pszTarget); - fprintf(fp, " *((UINT8 *) psMemWrite->pUserArea + (%s - psMemWrite->lowAddr) + 1) = %s >> 8;\n", pszAddress, pszTarget); - fprintf(fp, " }\n"); - - fprintf(fp, " psMemWrite = NULL;\n"); - fprintf(fp, " break;\n"); - fprintf(fp, " }\n"); - fprintf(fp, " ++psMemWrite;\n"); - fprintf(fp, " }\n\n"); - fprintf(fp, " if (psMemWrite)\n"); - fprintf(fp, " {\n"); - fprintf(fp, " cpu.z80Base[%s] = (UINT8) %s;\n", pszAddress, pszTarget); - fprintf(fp, " cpu.z80Base[%s + 1] = (UINT8) ((UINT32) %s >> 8);\n", pszAddress, pszTarget); - fprintf(fp, " }\n\n"); - } - else - { - assert(0); - } -} - -void WriteValueToIo(UINT8 *pszIoAddress, UINT8 *pszValue) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - fprintf(fp, " mov [cyclesRemaining], edi\n"); - fprintf(fp, " mov [_z80af], ax ; Store AF\n"); - - if (strcmp(pszValue, "al") != 0) - fprintf(fp, " mov al, %s ; And our data to write\n", pszValue); - if (strcmp(pszValue, "[esi]") == 0) // Immediate value? - fprintf(fp, " inc esi ; Increment our program counter\n"); - - fprintf(fp, " mov edi, [_z80IoWrite] ; Point to the I/O write array\n\n", cpubasename); - fprintf(fp, "checkLoop%ld:\n", dwGlobalLabel); - fprintf(fp, " cmp [edi], word 0ffffh ; End of our list?\n"); - fprintf(fp, " je WriteMacroExit%ld ; Yes - ignore it!\n", dwGlobalLabel); - fprintf(fp, " cmp %s, [edi] ; Are we smaller?\n", pszIoAddress); - fprintf(fp, " jb nextAddr%ld ; Yes... go to the next addr\n", dwGlobalLabel); - fprintf(fp, " cmp %s, [edi+2] ; Are we bigger?\n", pszIoAddress); - fprintf(fp, " jbe callRoutine%ld ; If not, go call it!\n\n", dwGlobalLabel); - fprintf(fp, "nextAddr%ld:\n", dwGlobalLabel); - fprintf(fp, " add edi, 0ch ; Next structure, please\n"); - fprintf(fp, " jmp short checkLoop%ld\n\n", dwGlobalLabel); - fprintf(fp, "callRoutine%ld:\n", dwGlobalLabel); - - // Save off our registers! - - if (strcmp(pszIoAddress, "dx") != 0) - fprintf(fp, " mov dx, %s ; Get our address to target\n", pszIoAddress); - - fprintf(fp, " call WriteIOByte ; Go write the data!\n"); - - fprintf(fp, "WriteMacroExit%ld:\n", dwGlobalLabel); - fprintf(fp, " mov edi, [cyclesRemaining]\n"); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, " psIoWrite = cpu.z80IoWrite; /* Beginning of our handler */\n"); - fprintf(fp, " while (psIoWrite->lowIoAddr != 0xffff)\n"); - fprintf(fp, " {\n"); - fprintf(fp, " if ((%s >= psIoWrite->lowIoAddr) && (%s <= psIoWrite->highIoAddr))\n", pszIoAddress, pszIoAddress); - fprintf(fp, " {\n"); - fprintf(fp, " cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;\n"); - fprintf(fp, " psIoWrite->IOCall(%s, %s, psIoWrite);\n", pszIoAddress, pszValue); - fprintf(fp, " psIoWrite = NULL;\n"); - fprintf(fp, " break;\n"); - fprintf(fp, " }\n"); - fprintf(fp, " ++psIoWrite;\n"); - fprintf(fp, " }\n\n"); - } - else - { - assert(0); - } - - ++dwGlobalLabel; -} - -void ReadValueFromMemory(UINT8 *pszAddress, UINT8 *pszTarget) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - fprintf(fp, " mov [cyclesRemaining], edi\n"); - fprintf(fp, " mov edi, [_z80MemRead] ; Point to the read array\n\n", cpubasename); - fprintf(fp, "checkLoop%ld:\n", dwGlobalLabel); - fprintf(fp, " cmp [edi], word 0ffffh ; End of the list?\n"); - fprintf(fp, " je memoryRead%ld\n", dwGlobalLabel); - fprintf(fp, " cmp e%s, [edi] ; Are we smaller?\n", pszAddress); - fprintf(fp, " jb nextAddr%ld ; Yes, go to the next address\n", dwGlobalLabel); - fprintf(fp, " cmp e%s, [edi+4] ; Are we bigger?\n", pszAddress); - fprintf(fp, " jbe callRoutine%ld\n\n", dwGlobalLabel); - fprintf(fp, "nextAddr%ld:\n", dwGlobalLabel); - fprintf(fp, " add edi, 10h ; Next structure!\n"); - fprintf(fp, " jmp short checkLoop%ld\n\n", dwGlobalLabel); - fprintf(fp, "callRoutine%ld:\n", dwGlobalLabel); - - if (strcmp(pszAddress, "dx") != 0) - fprintf(fp, " mov dx, %s ; Get our address\n", pszAddress); - - fprintf(fp, " call ReadMemoryByte ; Standard read routine\n"); - - // Yes, these are intentionally reversed! - - if (strcmp(pszTarget, "al") == 0) - fprintf(fp, " mov [_z80af], al ; Save our new accumulator\n"); - else - if (strcmp(pszTarget, "ah") == 0) - fprintf(fp, " mov [_z80af + 1], al ; Save our new flags\n"); - else - fprintf(fp, " mov %s, al ; Put our returned value here\n", pszTarget); - - // And are properly restored HERE: - - fprintf(fp, " mov ax, [_z80af] ; Get our AF back\n"); - - // Restore registers here... - - fprintf(fp, " jmp short readExit%ld\n\n", dwGlobalLabel); - fprintf(fp, "memoryRead%ld:\n", dwGlobalLabel); - - if (pszTarget[0] == 'b' && pszTarget[1] == 'y' && pszTarget[2] == 't') - { - fprintf(fp, " mov di, dx\n"); - fprintf(fp, " mov dl, [ebp + e%s]\n", pszAddress); - fprintf(fp, " mov %s, dl\n", pszTarget); - fprintf(fp, " mov dx, di\n"); - } - else - fprintf(fp, " mov %s, [ebp + e%s] ; Get our data\n\n", pszTarget, pszAddress); - - fprintf(fp, "readExit%ld:\n", dwGlobalLabel); - fprintf(fp, " mov edi, [cyclesRemaining]\n"); - - dwGlobalLabel++; - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, " psMemRead = cpu.z80MemRead; /* Beginning of our handler */\n"); - fprintf(fp, " while (psMemRead->lowAddr != 0xffffffff)\n"); - fprintf(fp, " {\n"); - fprintf(fp, " if ((%s >= psMemRead->lowAddr) && (%s <= psMemRead->highAddr))\n", pszAddress, pszAddress); - fprintf(fp, " {\n"); - fprintf(fp, " cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;\n"); - fprintf(fp, " if (psMemRead->memoryCall)\n"); - fprintf(fp, " {\n"); - fprintf(fp, " %s = psMemRead->memoryCall(%s, psMemRead);\n", pszTarget, pszAddress); - fprintf(fp, " }\n"); - fprintf(fp, " else\n"); - fprintf(fp, " {\n"); - fprintf(fp, " %s = *((UINT8 *) psMemRead->pUserArea + (%s - psMemRead->lowAddr));\n", pszTarget, pszAddress); - fprintf(fp, " }\n"); - fprintf(fp, " psMemRead = NULL;\n"); - fprintf(fp, " break;\n"); - fprintf(fp, " }\n"); - fprintf(fp, " ++psMemRead;\n"); - fprintf(fp, " }\n\n"); - fprintf(fp, " if (psMemRead)\n"); - fprintf(fp, " {\n"); - fprintf(fp, " %s = cpu.z80Base[%s];\n", pszTarget, pszAddress); - fprintf(fp, " }\n\n"); - } - else - { - assert(0); - } -} - - -void ReadWordFromMemory(UINT8 *pszAddress, UINT8 *pszTarget) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - fprintf(fp, " mov [cyclesRemaining], edi\n"); - fprintf(fp, " mov edi, [_z80MemRead] ; Point to the read array\n\n", cpubasename); - fprintf(fp, "checkLoop%ld:\n", dwGlobalLabel); - fprintf(fp, " cmp [edi], word 0ffffh ; End of the list?\n"); - fprintf(fp, " je memoryRead%ld\n", dwGlobalLabel); - fprintf(fp, " cmp %s, [edi] ; Are we smaller?\n", pszAddress); - fprintf(fp, " jb nextAddr%ld ; Yes, go to the next address\n", dwGlobalLabel); - fprintf(fp, " cmp %s, [edi+4] ; Are we bigger?\n", pszAddress); - fprintf(fp, " jbe callRoutine%ld\n\n", dwGlobalLabel); - fprintf(fp, "nextAddr%ld:\n", dwGlobalLabel); - fprintf(fp, " add edi, 10h ; Next structure!\n"); - fprintf(fp, " jmp short checkLoop%ld\n\n", dwGlobalLabel); - fprintf(fp, "callRoutine%ld:\n", dwGlobalLabel); - - if (strcmp(pszAddress, "dx") != 0) - fprintf(fp, " mov dx, %s ; Get our address\n", pszAddress); - - if (strcmp(pszTarget, "ax") != 0) - fprintf(fp, " push ax ; Save this for later\n"); - - fprintf(fp, " push dx ; Save address\n"); - fprintf(fp, " call ReadMemoryByte ; Standard read routine\n"); - fprintf(fp, " pop dx ; Restore our address\n"); - - fprintf(fp, " inc dx ; Next byte, please\n"); - - fprintf(fp, " push ax ; Save returned byte\n"); - fprintf(fp, " call ReadMemoryByte ; Standard read routine\n"); - fprintf(fp, " xchg ah, al ; Swap for endian's sake\n"); - fprintf(fp, " pop dx ; Restore LSB\n"); - - fprintf(fp, " mov dh, ah ; Our word is now in DX\n"); - - // DX Now has our data and our address is toast - - if (strcmp(pszTarget, "ax") != 0) - { - fprintf(fp, " pop ax ; Restore this\n"); - - if (strcmp(pszTarget, "dx") != 0) - { - fprintf(fp, " mov %s, dx ; Store our word\n", pszTarget); - } - } - else - fprintf(fp, " mov ax, dx\n"); - - if (strcmp(pszTarget, "ax") == 0) - { - fprintf(fp, " xchg ah, al\n"); - } - - fprintf(fp, " jmp readExit%ld\n\n", dwGlobalLabel); - - fprintf(fp, "memoryRead%ld:\n", dwGlobalLabel); - - if (strlen(pszTarget) == 2) - { - fprintf(fp, " mov %s, [ebp + e%s]\n", pszTarget, pszAddress); - if (strcmp(pszTarget, "ax") == 0) - { - fprintf(fp, " xchg ah, al\n"); - } - } - else - { - fprintf(fp, " mov dx, [ebp + e%s]\n", pszAddress); - fprintf(fp, " mov %s, dx\n", pszTarget); - } - - fprintf(fp, "readExit%ld:\n", dwGlobalLabel); - fprintf(fp, " mov edi, [cyclesRemaining]\n"); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, " psMemRead = cpu.z80MemRead; /* Beginning of our handler */\n"); - fprintf(fp, " while (psMemRead->lowAddr != 0xffffffff)\n"); - fprintf(fp, " {\n"); - fprintf(fp, " if ((%s >= psMemRead->lowAddr) && (%s <= psMemRead->highAddr))\n", pszAddress, pszAddress); - fprintf(fp, " {\n"); - fprintf(fp, " cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;\n"); - fprintf(fp, " if (psMemRead->memoryCall)\n"); - fprintf(fp, " {\n"); - fprintf(fp, " %s = psMemRead->memoryCall(%s, psMemRead);\n", pszTarget, pszAddress); - fprintf(fp, " %s |= (UINT32) ((UINT32) psMemRead->memoryCall(%s + 1, psMemRead) << 8);\n", pszTarget, pszAddress); - fprintf(fp, " }\n"); - fprintf(fp, " else\n"); - fprintf(fp, " {\n"); - fprintf(fp, " %s = *((UINT8 *) psMemRead->pUserArea + (%s - psMemRead->lowAddr));\n", pszTarget, pszAddress); - fprintf(fp, " %s |= (UINT32) ((UINT32) *((UINT8 *) psMemRead->pUserArea + (%s - psMemRead->lowAddr + 1)) << 8);\n", pszTarget, pszAddress); - fprintf(fp, " }\n"); - fprintf(fp, " psMemRead = NULL;\n"); - fprintf(fp, " break;\n"); - fprintf(fp, " }\n"); - fprintf(fp, " ++psMemRead;\n"); - fprintf(fp, " }\n\n"); - fprintf(fp, " if (psMemRead)\n"); - fprintf(fp, " {\n"); - fprintf(fp, " %s = cpu.z80Base[%s];\n", pszTarget, pszAddress); - fprintf(fp, " %s |= (UINT32) ((UINT32) cpu.z80Base[%s + 1] << 8);\n", pszTarget, pszAddress); - fprintf(fp, " }\n\n"); - } - else - { - assert(0); - } - - dwGlobalLabel++; -} - - -void ReadValueFromIo(UINT8 *pszIoAddress, UINT8 *pszTarget) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - fprintf(fp, " mov [cyclesRemaining], edi\n"); - fprintf(fp, " mov edi, [_z80IoRead] ; Point to the read array\n\n", cpubasename); - fprintf(fp, "checkLoop%ld:\n", dwGlobalLabel); - fprintf(fp, " cmp [edi], word 0ffffh ; End of the list?\n"); - fprintf(fp, " je ioRead%ld\n", dwGlobalLabel); - fprintf(fp, " cmp %s, [edi] ; Are we smaller?\n", pszIoAddress); - fprintf(fp, " jb nextAddr%ld ; Yes, go to the next address\n", dwGlobalLabel); - fprintf(fp, " cmp %s, [edi+2] ; Are we bigger?\n", pszIoAddress); - fprintf(fp, " jbe callRoutine%ld\n\n", dwGlobalLabel); - fprintf(fp, "nextAddr%ld:\n", dwGlobalLabel); - fprintf(fp, " add edi, 0ch ; Next structure!\n"); - fprintf(fp, " jmp short checkLoop%ld\n\n", dwGlobalLabel); - fprintf(fp, "callRoutine%ld:\n", dwGlobalLabel); - - if (strcmp(pszIoAddress, "dx") != 0) - fprintf(fp, " mov dx, %s ; Get our address\n", pszIoAddress); - - fprintf(fp, " call ReadIOByte ; Standard read routine\n"); - - // Yes, these are intentionally reversed! - - if (strcmp(pszTarget, "al") == 0) - fprintf(fp, " mov [_z80af], al ; Save our new accumulator\n"); - else - if (strcmp(pszTarget, "ah") == 0) - fprintf(fp, " mov [_z80af + 1], ah ; Save our new flags\n"); - else - if (strcmp(pszTarget, "dl") == 0) - fprintf(fp, " mov [_z80de], al ; Put it in E\n"); - else - if (strcmp(pszTarget, "dh") == 0) - fprintf(fp, " mov [_z80de + 1], al ; Put it in D\n"); - else - if (strcmp(pszTarget, "*dl") == 0) - fprintf(fp, " mov dl, al ; Put it in DL for later consumption\n"); - else - fprintf(fp, " mov %s, al ; Put our returned value here\n", pszTarget); - - // And are properly restored HERE: - - fprintf(fp, " mov ax, [_z80af] ; Get our AF back\n"); - - // Restore registers here... - - fprintf(fp, " jmp short readExit%ld\n\n", dwGlobalLabel); - fprintf(fp, "ioRead%ld:\n", dwGlobalLabel); - - if (strcmp(pszTarget, "*dl") == 0) - fprintf(fp, " mov dl, 0ffh ; An unreferenced read\n"); - else - fprintf(fp, " mov %s, 0ffh ; An unreferenced read\n", pszTarget); - fprintf(fp, "readExit%ld:\n", dwGlobalLabel); - fprintf(fp, " mov edi, [cyclesRemaining]\n"); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, " psIoRead = cpu.z80IoRead; /* Beginning of our handler */\n"); - fprintf(fp, " while (psIoRead->lowIoAddr != 0xffff)\n"); - fprintf(fp, " {\n"); - fprintf(fp, " if ((%s >= psIoRead->lowIoAddr) && (%s <= psIoRead->highIoAddr))\n", pszIoAddress, pszIoAddress); - fprintf(fp, " {\n"); - fprintf(fp, " cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;\n"); - fprintf(fp, " %s = psIoRead->IOCall(%s, psIoRead);\n", pszTarget, pszIoAddress); - fprintf(fp, " psIoRead = NULL;\n"); - fprintf(fp, " break;\n"); - fprintf(fp, " }\n"); - fprintf(fp, " ++psIoRead;\n"); - fprintf(fp, " }\n\n"); - fprintf(fp, " if (psIoRead)\n"); - fprintf(fp, " {\n"); - fprintf(fp, " %s = 0xff; /* Unclaimed I/O read */\n", pszTarget); - fprintf(fp, " }\n\n"); - } - else - { - assert(0); - } - - dwGlobalLabel++; -} - -// Basic instruction set area - -void MiscHandler(UINT32 dwOpcode) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - if (dwOpcode == 0xe3) - { - if (bThroughCallHandler) - { - fprintf(fp, " call PopWord\n"); - fprintf(fp, " xchg bx, [_wordval]\n"); - fprintf(fp, " call PushWord\n"); - } - else - { - fprintf(fp, " mov dx, word [_z80sp]\n"); - fprintf(fp, " xchg bx, [ebp+edx]\n"); - fprintf(fp, " xor edx, edx\n"); - } - } - - if (dwOpcode == 0x2a) - { - fprintf(fp, " mov dx, [esi] ; Get address to load\n"); - fprintf(fp, " add esi, 2 ; Skip over it so we don't execute it\n"); - - ReadWordFromMemory("dx", "bx"); - fprintf(fp, " xor edx, edx\n"); - } - - if (dwOpcode == 0xfb) - { - fprintf(fp, " or dword [_z80iff], IFF1 ; Indicate interrupts are enabled now\n"); - fprintf(fp, " sub edi, 4 ; Takes 4 cycles!\n"); - fprintf(fp, " mov [dwEITiming], edi ; Snapshot our current timing\n"); - fprintf(fp, " mov [bEIExit], byte 1 ; Indicate we're exiting because of an EI\n"); - fprintf(fp, " xor edi, edi ; Force next instruction to exit\n"); - fprintf(fp, " mov dl, byte [esi] ; Get our next instruction\n"); - fprintf(fp, " inc esi ; Next PC\n"); - fprintf(fp, " jmp dword [z80regular+edx*4]\n\n"); - } - - if (dwOpcode == 0xf9) - fprintf(fp, " mov word [_z80sp], bx\n"); - - if (dwOpcode == 0xd9) - { - fprintf(fp, " mov [cyclesRemaining], edi\n"); - fprintf(fp, " mov di, [_z80de]\n"); - fprintf(fp, " xchg cx, [_z80bcprime]\n"); - fprintf(fp, " xchg di, [_z80deprime]\n"); - fprintf(fp, " xchg bx, [_z80hlprime]\n"); - fprintf(fp, " mov [_z80de], di\n"); - fprintf(fp, " mov edi, [cyclesRemaining]\n"); - } - - if (dwOpcode == 0x76) - { - fprintf(fp, " mov dword [_z80halted], 1 ; We've halted the chip!\n"); - - if (FALSE == bNoTiming) - { - fprintf(fp, " xor edi, edi\n"); - fprintf(fp, " mov [cyclesRemaining], edi\n"); - } - - fprintf(fp, " jmp noMoreExec\n"); - return; - } - - if (dwOpcode == 0x3f) - { - fprintf(fp, " mov dl, ah\n"); - fprintf(fp, " and dl, 01h\n"); - fprintf(fp, " shl dl, 4\n"); - fprintf(fp, " xor ah, 01h\n"); - fprintf(fp, " and ah, 0edh\n"); - fprintf(fp, " or ah, dl\n"); - } - - if (dwOpcode == 0x37) - { - fprintf(fp, " or ah, 1\n"); - fprintf(fp, " and ah,0edh\n"); - } - - if (dwOpcode == 0x27) - { - fprintf(fp, " mov dh, ah\n"); - fprintf(fp, " and dh, 02ah\n"); - fprintf(fp, " test ah, 02h ; Were we doing a subtraction?\n"); - fprintf(fp, " jnz handleNeg ; Nope!\n"); - fprintf(fp, " sahf\n"); - fprintf(fp, " daa\n"); - fprintf(fp, " lahf\n"); - fprintf(fp, " jmp short endDaa\n"); - fprintf(fp, "handleNeg:\n"); - fprintf(fp, " sahf\n"); - fprintf(fp, " das\n"); - fprintf(fp, " lahf\n"); - fprintf(fp, "endDaa:\n"); - fprintf(fp, " and ah, 0d5h\n"); - fprintf(fp, " or ah, dh\n"); - fprintf(fp, " xor edx, edx\n"); - } - - if (dwOpcode == 0x08) - { - fprintf(fp, " xchg ah, al\n"); - fprintf(fp, " xchg ax, [_z80afprime]\n"); - fprintf(fp, " xchg ah, al\n"); - } - - if (dwOpcode == 0x07) - { - fprintf(fp, " sahf\n"); - fprintf(fp, " rol al, 1\n"); - fprintf(fp, " lahf\n"); - fprintf(fp, " and ah, 0edh\n"); - } - - if (dwOpcode == 0x0f) - { - fprintf(fp, " sahf\n"); - fprintf(fp, " ror al, 1\n"); - fprintf(fp, " lahf\n"); - fprintf(fp, " and ah, 0edh\n"); - } - - if (dwOpcode == 0xe9) - { - fprintf(fp, " mov si, bx\n"); - fprintf(fp, " and esi, 0ffffh\n"); - fprintf(fp, " add esi, ebp\n"); - } - - if (dwOpcode == 0xeb) - fprintf(fp, " xchg [_z80de], bx ; Exchange DE & HL\n"); - - if (dwOpcode == 0x2f) - { - fprintf(fp, " not al\n"); - fprintf(fp, " or ah, 012h ; N And H are now on!\n"); - } - - if (dwOpcode == 0x10) // DJNZ - { - fprintf(fp, " mov dl, [esi] ; Get our relative offset\n"); - fprintf(fp, " inc esi ; Next instruction, please!\n"); - fprintf(fp, " dec ch ; Decrement B\n"); - fprintf(fp, " jz noJump ; Don't take the jump if it's done!\n"); - fprintf(fp, "; Otherwise, take the jump\n"); - - fprintf(fp, " sub edi, 5\n"); - - fprintf(fp, " xchg eax, edx\n"); - fprintf(fp, " cbw\n"); - fprintf(fp, " xchg eax, edx\n"); - fprintf(fp, " sub esi, ebp\n"); - fprintf(fp, " add si, dx\n"); - fprintf(fp, " add esi, ebp\n"); - fprintf(fp, "noJump:\n"); - fprintf(fp, " xor edx, edx\n"); - } - - if (dwOpcode == 0x3a) // LD A,(xxxx) - { - fprintf(fp, " mov dx, [esi] ; Get our address\n"); - fprintf(fp, " add esi, 2 ; Skip past the address\n"); - ReadValueFromMemory("dx", "al"); - fprintf(fp, " xor edx, edx ; Make sure we don't hose things\n"); - } - - if (dwOpcode == 0xf3) // DI - { - fprintf(fp, " and dword [_z80iff], (~IFF1) ; Not in an interrupt\n"); - } - - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - if (dwOpcode == 0x76) // HALT! - { - fprintf(fp, " cpu.z80halted = 1;\n"); - fprintf(fp, " dwElapsedTicks += sdwCyclesRemaining;\n"); - - fprintf(fp, " sdwCyclesRemaining = 0;\n"); - } - else - if (dwOpcode == 0x2f) // CPL - { - fprintf(fp, " cpu.z80A ^= 0xff;\n"); - fprintf(fp, " cpu.z80F |= (Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY);\n"); - } - else - if (dwOpcode == 0xd9) // EXX - { - fprintf(fp, " dwTemp = cpu.z80DE;\n"); - fprintf(fp, " cpu.z80DE = cpu.z80deprime;\n"); - fprintf(fp, " cpu.z80deprime = dwTemp;\n"); - - fprintf(fp, " dwTemp = cpu.z80BC;\n"); - fprintf(fp, " cpu.z80BC = cpu.z80bcprime;\n"); - fprintf(fp, " cpu.z80bcprime = dwTemp;\n"); - - fprintf(fp, " dwTemp = cpu.z80HL;\n"); - fprintf(fp, " cpu.z80HL = cpu.z80hlprime;\n"); - fprintf(fp, " cpu.z80hlprime = dwTemp;\n"); - } - else - if (dwOpcode == 0xf9) // LD SP, HL - { - fprintf(fp, " cpu.z80sp = cpu.z80HL;\n"); - } - else - if (dwOpcode == 0x27) // DAA - { - fprintf(fp, " dwAddr = (((cpu.z80F & Z80_FLAG_CARRY) | \n"); - fprintf(fp, " ((cpu.z80F & Z80_FLAG_HALF_CARRY) >> 3) | \n"); - fprintf(fp, " ((cpu.z80F & Z80_FLAG_NEGATIVE) << 1)) << 8) | cpu.z80A;\n"); - fprintf(fp, " cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_HALF_CARRY | Z80_FLAG_ZERO | Z80_FLAG_SIGN);\n"); - fprintf(fp, " cpu.z80F |= (wDAATable[dwAddr] >> 8);\n"); - fprintf(fp, " cpu.z80A = wDAATable[dwAddr] & 0xff;\n"); - } - else - if (dwOpcode == 0x2a) - { - fprintf(fp, " dwAddr = *pbPC++;\n"); - fprintf(fp, " dwAddr |= ((UINT32) *pbPC++ << 8);\n"); - ReadWordFromMemory("dwAddr", "cpu.z80HL"); - } - else - if (dwOpcode == 0xe3) // EX (SP), HL - { - ReadWordFromMemory("cpu.z80sp", "dwAddr"); - WriteWordToMemory("cpu.z80sp", "cpu.z80HL"); - fprintf(fp, " cpu.z80HL = dwAddr;\n"); - } - else - if (dwOpcode == 0xe9) // JP (HL) - { - fprintf(fp, " pbPC = cpu.z80Base + cpu.z80HL;\n"); - } - else - if (0x08 == dwOpcode) // EX AF, AF' - { - fprintf(fp, " dwAddr = (UINT32) cpu.z80AF;\n"); - fprintf(fp, " cpu.z80AF = cpu.z80afprime;\n"); - fprintf(fp, " cpu.z80afprime = dwAddr;\n"); - } - else - if (0xeb == dwOpcode) // EX DE, HL - { - fprintf(fp, " dwAddr = cpu.z80DE;\n"); - fprintf(fp, " cpu.z80DE = cpu.z80HL;\n"); - fprintf(fp, " cpu.z80HL = dwAddr;\n"); - } - else - if (0x10 == dwOpcode) // DJNZ - { - fprintf(fp, " sdwAddr = (INT8) *pbPC++; /* Get LSB first */\n"); - fprintf(fp, " if (--cpu.z80B)\n"); - fprintf(fp, " {\n"); - fprintf(fp, " dwElapsedTicks += 5; /* 5 More for jump taken */\n"); - fprintf(fp, " cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;\n"); - fprintf(fp, " sdwAddr = (sdwAddr + (INT32) cpu.z80pc) & 0xffff;\n"); - fprintf(fp, " pbPC = cpu.z80Base + sdwAddr; /* Normalize the address */\n"); - fprintf(fp, " }\n"); - } - else - if (0x37 == dwOpcode) // SCF - { - fprintf(fp, " cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE);\n"); - fprintf(fp, " cpu.z80F |= Z80_FLAG_CARRY;\n"); - } - else - if (0x3f == dwOpcode) // CCF - { - fprintf(fp, " bTemp = (cpu.z80F & Z80_FLAG_CARRY) << 4;\n"); - fprintf(fp, " cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE);\n"); - fprintf(fp, " cpu.z80F ^= Z80_FLAG_CARRY;\n"); - } - else - if (0x07 == dwOpcode) // RLCA - { - fprintf(fp, " cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY);\n"); - fprintf(fp, " cpu.z80F |= (cpu.z80A >> 7);\n"); - fprintf(fp, " cpu.z80A = (cpu.z80A << 1) | (cpu.z80A >> 7);\n"); - } - else - if (0x0f == dwOpcode) // RRCA - { - fprintf(fp, " cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY);\n"); - fprintf(fp, " cpu.z80F |= (cpu.z80A & Z80_FLAG_CARRY);\n"); - fprintf(fp, " cpu.z80A = (cpu.z80A >> 1) | (cpu.z80A << 7);\n"); - } - else - if (0x3a == dwOpcode) // LD A, (xxxxh) - { - fprintf(fp, " dwTemp = *pbPC++;\n"); - fprintf(fp, " dwTemp |= (((UINT32) *pbPC++) << 8);\n"); - ReadValueFromMemory("dwTemp", "cpu.z80A"); - } - else - if (0xf3 == dwOpcode) // DI - { - fprintf(fp, " cpu.z80iff &= (~IFF1);\n"); - } - else - if (0xfb == dwOpcode) // EI - { - fprintf(fp, " cpu.z80iff |= IFF1;\n"); - } - else - if (0x00 == dwOpcode) // NOP - { - fprintf(fp, " /* Intentionally not doing anything - NOP! */\n"); - } - else - { - InvalidInstructionC(1); - } - } - else - { - assert(0); - } - -} - -void LdRegPairImmediate(UINT32 dwOpcode) -{ - UINT8 bOp = 0; - - bOp = (dwOpcode >> 4) & 0x3; - - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - if (bOp == 0) - fprintf(fp, " mov cx, [esi] ; Get our immediate value of BC\n"); - else - if (bOp == 2) - fprintf(fp, " mov bx, [esi] ; Get our immediate value of HL\n"); - else - if (bOp == 1) - { - fprintf(fp, " mov dx, [esi] ; Get our immediate value of DE\n"); - fprintf(fp, " mov word [_z80de], dx ; Store DE\n"); - fprintf(fp, " xor edx, edx\n"); - } - else - if (bOp == 3) - { - fprintf(fp, " mov dx, [esi] ; Get our immediate value of SP\n"); - fprintf(fp, " mov word [_z80sp], dx ; Store it!\n"); - fprintf(fp, " xor edx, edx\n"); - } - - fprintf(fp, " add esi, 2\n"); - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, " %s = *pbPC++; /* LSB First */\n", pbRegPairC[bOp]); - fprintf(fp, " %s |= (((UINT32) *pbPC++ << 8)); /* Now the MSB */\n", pbRegPairC[bOp]); - } - else - { - assert(0); - } -} - -void LdRegpairPtrByte(UINT32 dwOpcode) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - if (dwOpcode == 0x36) // Immediate into (HL) - WriteValueToMemory("bx", "[esi]"); - - if (dwOpcode == 0x12) - WriteValueToMemory("[_z80de]", "al"); // (DE), A - - if (dwOpcode == 0x2) // (BC), A - WriteValueToMemory("cx", "al"); - - if (dwOpcode >= 0x70 && dwOpcode < 0x78) - WriteValueToMemory("bx", pbMathReg[dwOpcode & 0x07]); - - fprintf(fp, " xor edx, edx\n"); - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - if (dwOpcode == 0x36) - WriteValueToMemory("cpu.z80HL", "*pbPC++"); - - if (dwOpcode == 0x12) - WriteValueToMemory("cpu.z80DE", "cpu.z80A"); - - if (dwOpcode == 0x02) - WriteValueToMemory("cpu.z80BC", "cpu.z80A"); - - if (dwOpcode >= 0x70 && dwOpcode < 0x78) - WriteValueToMemory("cpu.z80HL", pbMathRegC[dwOpcode & 0x07]); - } - else - { - assert(0); - } -} - -void MathOperation(UINT32 dwOrgOpcode) -{ - UINT8 bRegister; - UINT32 dwOpcode; - UINT8 tempstr[150]; - - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOrgOpcode); - - dwOpcode = dwOrgOpcode; - bRegister = dwOpcode & 0x07; - dwOpcode &= 0xf8; - - if (dwOpcode == 0x80) - strcpy(tempstr, "add"); - if (dwOpcode == 0x88) - strcpy(tempstr, "adc"); - if (dwOpcode == 0x90) - strcpy(tempstr, "sub"); - if (dwOpcode == 0x98) - strcpy(tempstr, "sbb"); - if (dwOpcode == 0xa0) - strcpy(tempstr, "and"); - if (dwOpcode == 0xa8) - strcpy(tempstr, "xor"); - if (dwOpcode == 0xb0) - strcpy(tempstr, "or"); - if (dwOpcode == 0xb8) - strcpy(tempstr, "cmp"); - - // Let's see if we have to deal with (HL) or #xxh - - if (bRegister == 0x6) - { - // We have to deal with (HL) - - ReadValueFromMemory("bx", "dl"); - } - - if (bRegister != 0x06 && bRegister < 0xff) - { - fprintf(fp, " sahf\n"); - fprintf(fp, " %s al, %s\n", tempstr, pbMathReg[bRegister]); - fprintf(fp, " lahf\n"); - } - else // If it's (HL).... - { - fprintf(fp, " sahf\n"); - fprintf(fp, " %s al, dl\n", tempstr); - fprintf(fp, " lahf\n"); - } - - if (dwOpcode != 0xa8 && dwOpcode != 0xa0 && dwOpcode != 0xb0) - SetOverflow(); - - if (dwOpcode == 0xa8) - fprintf(fp, " and ah, 0ech ; Only these flags matter!\n"); - - if (dwOpcode == 0xa0) - { - fprintf(fp, " and ah, 0ech ; Only these flags matter!\n"); - fprintf(fp, " or ah, 010h ; Half carry gets set\n"); - } - - if (dwOpcode == 0xb0) - fprintf(fp, " and ah, 0ech ; No H, N, or C\n"); - - if (dwOpcode == 0xb8) - fprintf(fp, " or ah, 02h ; Set N for compare!\n"); - - if (dwOpcode == 0x80 || dwOpcode == 0x88) - fprintf(fp, " and ah, 0fdh ; No N!\n"); - - if (dwOpcode == 0x90 || dwOpcode == 0x98) - fprintf(fp, " or ah, 02h ; N Gets set!\n"); - - if (bRegister == 0x6) - fprintf(fp, " xor edx, edx ; Zero this...\n"); - - FetchNextInstruction(dwOrgOpcode); - } - else - if (MZ80_C == bWhat) - { - dwOpcode = dwOrgOpcode; - bRegister = dwOpcode & 0x07; - dwOpcode &= 0xf8; - - if (6 == bRegister) // Deal with (HL) - { - ReadValueFromMemory("cpu.z80HL", "bTemp"); - } - - if (dwOpcode == 0xa0) - { - fprintf(fp, " cpu.z80A &= %s;\n", pbMathRegC[bRegister]); - } - else - if (dwOpcode == 0xa8) - { - fprintf(fp, " cpu.z80A ^= %s;\n", pbMathRegC[bRegister]); - } - else - if (dwOpcode == 0xb0) - { - fprintf(fp, " cpu.z80A |= %s;\n", pbMathRegC[bRegister]); - } - else - if (dwOpcode == 0xb8) - { - // Don't do anything. We just do flags! - } - else - if (dwOpcode == 0x88) // ADC - { - fprintf(fp, " bTemp2 = cpu.z80A + %s + (cpu.z80F & Z80_FLAG_CARRY);\n", pbMathRegC[bRegister]); - } - else - if (dwOpcode == 0x90) // SUB - { - fprintf(fp, " bTemp2 = cpu.z80A - %s;\n", pbMathRegC[bRegister]); - } - else - if (dwOpcode == 0x80) // ADD - { - fprintf(fp, " bTemp2 = cpu.z80A + %s;\n", pbMathRegC[bRegister]); - } - else - if (dwOpcode == 0x98) // SBC - { - fprintf(fp, " bTemp2 = cpu.z80A - %s - (cpu.z80F & Z80_FLAG_CARRY);\n", pbMathRegC[bRegister]); - } - else - { - InvalidInstructionC(1); - } - - // Now do flag fixup - - if (0xb0 == dwOpcode || 0xa8 == dwOpcode) - { - 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"); - fprintf(fp, " cpu.z80F |= bPostORFlags[cpu.z80A];\n\n"); - } - - if (0xa0 == dwOpcode) - { - 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"); - fprintf(fp, " cpu.z80F |= bPostANDFlags[cpu.z80A];\n\n"); - } - - if (0xb8 == dwOpcode || 0x90 == dwOpcode) - { - SetSubFlagsSZHVC("cpu.z80A", pbMathRegC[bRegister]); - - if (0x90 == dwOpcode) - { - fprintf(fp, " cpu.z80A = bTemp2;\n"); - } - } - - if (0x80 == dwOpcode) // Add fixup - { - SetAddFlagsSZHVC("cpu.z80A", pbMathRegC[bRegister]); - fprintf(fp, " cpu.z80A = bTemp2;\n"); - } - - if (0x88 == dwOpcode) // Adc fixup - { - SetAdcFlagsSZHVC("cpu.z80A", pbMathRegC[bRegister]); - fprintf(fp, " cpu.z80A = bTemp2;\n"); - } - - if (0x98 == dwOpcode) // Sbc fixup - { - SetSbcFlagsSZHVC("cpu.z80A", pbMathRegC[bRegister]); - fprintf(fp, " cpu.z80A = bTemp2;\n"); - } - } - else - { - assert(0); - } -} - -void RegIntoMemory(UINT32 dwOpcode) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - fprintf(fp, " mov dx, [esi] ; Get our address to write to\n"); - fprintf(fp, " add esi, 2 ; Next address, please...\n"); - - if (0x32 == dwOpcode) // LD (xxxx), A - WriteValueToMemory("dx", "al"); - if (0x22 == dwOpcode) // LD (xxxx), HL - { - WriteWordToMemory("dx", "bx"); - } - - fprintf(fp, " xor edx, edx ; Zero our upper byte\n"); - - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, " dwTemp = *pbPC++;\n"); - fprintf(fp, " dwTemp |= ((UINT32) *pbPC++ << 8);\n"); - - if (0x32 == dwOpcode) - WriteValueToMemory("dwTemp", "cpu.z80A"); - if (0x22 == dwOpcode) - WriteWordToMemory("dwTemp", "cpu.z80HL"); - - return; - } - else - { - assert(0); - } -} - -void JpHandler(UINT32 dwOpcode) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - if (0xc3 == dwOpcode) // If it's a straight jump... - { - fprintf(fp, " mov si, [esi] ; Get our new address\n"); - fprintf(fp, " and esi, 0ffffh ; Only the lower 16 bits\n"); - fprintf(fp, " add esi, ebp ; Our new address!\n"); - } - else // It's a conditional handler... - { - fprintf(fp, " sahf ; Restore our flags\n"); - fprintf(fp, " j%s takeJump%ld ; We're going to take a jump\n", pbFlags[(dwOpcode >> 3) & 0x07], dwGlobalLabel); - fprintf(fp, " add esi, 2 ; Skip past the address\n"); - fprintf(fp, " jmp short nextInst%ld ; Go execute the next instruction\n", dwGlobalLabel); - fprintf(fp, "takeJump%ld:\n", dwGlobalLabel); - - fprintf(fp, " mov si, [esi] ; Get our new offset\n"); - fprintf(fp, " and esi, 0ffffh ; Only the lower WORD is valid\n"); - fprintf(fp, " add esi, ebp ; Our new address!\n"); - fprintf(fp, "nextInst%ld:\n", dwGlobalLabel); - ++dwGlobalLabel; - } - - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, " dwAddr = *pbPC++; /* Get LSB first */\n"); - fprintf(fp, " dwAddr |= ((UINT32) *pbPC++ << 8); /* Get MSB last */\n"); - - if (0xc3 != dwOpcode) - { - fprintf(fp, " if %s\n", pbFlagsC[(dwOpcode >> 3) & 0x07]); - fprintf(fp, " {\n"); - fprintf(fp, " pbPC = cpu.z80Base + dwAddr; /* Normalize the address */\n"); - fprintf(fp, " }\n"); - } - else // Regular jump here - { - fprintf(fp, " pbPC = cpu.z80Base + dwAddr; /* Normalize the address */\n"); - } - } - else - { - assert(0); - } -} - -void LdRegImmediate(UINT32 dwOpcode) -{ - UINT8 bOp; - - bOp = (dwOpcode >> 3) & 0x7; - - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - - if (bOp != 2 && bOp != 3) - fprintf(fp, " mov %s, [esi] ; Get our immediate value\n", pbMathReg[bOp]); - else - { - fprintf(fp, " mov dl, [esi] ; Get our immediate value\n"); - fprintf(fp, " mov %s, dl ; Store our new value\n", pbMathReg[bOp]); - } - - fprintf(fp, " inc esi\n"); - - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, " %s = *pbPC++; /* Get immediate byte into register */\n", pbMathRegC[bOp]); - } - else - { - assert(0); - } -} - -void IncRegister(UINT32 dwOpcode) -{ - UINT32 dwOpcode1 = 0; - - dwOpcode1 = (dwOpcode >> 3) & 0x07; - - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - fprintf(fp, " sahf\n"); - fprintf(fp, " inc %s\n", pbMathReg[dwOpcode1]); - fprintf(fp, " lahf\n"); - SetOverflow(); - fprintf(fp, " and ah, 0fdh ; Knock out N!\n"); - - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, " cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);\n"); - fprintf(fp ," cpu.z80F |= bPostIncFlags[%s++];\n", pbMathRegC[dwOpcode1]); - } - else - { - assert(0); - } -} - -void DecRegister(UINT32 dwOpcode) -{ - UINT32 dwOpcode1 = 0; - - dwOpcode1 = (dwOpcode >> 3) & 0x07; - - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - fprintf(fp, " sahf\n"); - fprintf(fp, " dec %s\n", pbMathReg[dwOpcode1]); - fprintf(fp, " lahf\n"); - SetOverflow(); - fprintf(fp, " or ah, 02h ; Set negative!\n"); - - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, " cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY);\n"); - fprintf(fp ," cpu.z80F |= bPostDecFlags[%s--];\n", pbMathRegC[dwOpcode1]); - } - else - { - assert(0); - } -} - -void IncDecRegpair(UINT32 dwOpcode) -{ - UINT32 dwOpcode1 = 0; - - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - if ((dwOpcode & 0x0f) == 3) // Increment? - fprintf(fp, " inc %s\n", pbRegPairs[(dwOpcode >> 4) & 0x03]); - else - fprintf(fp, " dec %s\n", pbRegPairs[(dwOpcode >> 4) & 0x03]); - - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - if ((dwOpcode & 0x0f) == 3) // Increment - fprintf(fp, " %s++;\n", pbRegPairC[(dwOpcode >> 4) & 0x03]); - else - fprintf(fp, " %s--;\n", pbRegPairC[(dwOpcode >> 4) & 0x03]); - fprintf(fp, " %s &= 0xffff;\n", pbRegPairC[(dwOpcode >> 4) & 0x03]); - } - else - { - assert(0); - } -} - -void LdRegReg(UINT32 dwOpcode) -{ - UINT8 bDestination; - UINT8 bSource; - - bDestination = (dwOpcode >> 3) & 0x07; - bSource = (dwOpcode) & 0x07; - - if (MZ80_ASSEMBLY_X86 == bWhat) - { - - ProcBegin(dwOpcode); - - if (bSource != bDestination) - { - if (bSource == 2 && bDestination == 3) - { - fprintf(fp, " mov dl, byte [_z80de + 1]\n"); - fprintf(fp, " mov [_z80de], dl\n"); - } - else - if (bSource == 3 && bDestination == 2) - { - fprintf(fp, " mov dl, byte [_z80de]\n"); - fprintf(fp, " mov [_z80de + 1], dl\n"); - } - else - fprintf(fp, " mov %s, %s\n", pbMathReg[bDestination], pbMathReg[bSource]); - } - - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - if (bDestination != bSource) - { - fprintf(fp, " %s = %s;\n", - pbMathRegC[bDestination], - pbMathRegC[bSource]); - } - } - else - { - assert(0); - } -} - -void MathOperationDirect(UINT32 dwOpcode) -{ - UINT8 tempstr[4]; - - if (MZ80_ASSEMBLY_X86 == bWhat) - { - if (dwOpcode == 0xc6) - strcpy(tempstr, "add"); - if (dwOpcode == 0xce) - strcpy(tempstr, "adc"); - if (dwOpcode == 0xd6) - strcpy(tempstr, "sub"); - if (dwOpcode == 0xde) - strcpy(tempstr, "sbb"); - if (dwOpcode == 0xe6) - strcpy(tempstr, "and"); - if (dwOpcode == 0xee) - strcpy(tempstr, "xor"); - if (dwOpcode == 0xf6) - strcpy(tempstr, "or"); - if (dwOpcode == 0xfe) - strcpy(tempstr, "cmp"); - - ProcBegin(dwOpcode); - - // Let's see if we have to deal with (HL) or #xxh - - fprintf(fp, " sahf\n"); - fprintf(fp, " %s al, [esi]\n", tempstr); - fprintf(fp, " lahf\n"); - - if (dwOpcode != 0xee && dwOpcode != 0xe6 && dwOpcode != 0xf6) - { - SetOverflow(); - } - - if (dwOpcode == 0xe6) - { - fprintf(fp, " and ah, 0ech ; Only parity, half carry, sign, zero\n"); - fprintf(fp, " or ah, 10h ; Half carry\n"); - } - - if (dwOpcode == 0xc6 || dwOpcode == 0xce) - fprintf(fp, " and ah, 0fdh ; Knock out N!\n"); - - if (dwOpcode == 0xd6 || dwOpcode == 0xde || dwOpcode == 0xfe) - fprintf(fp, " or ah, 02h ; Set negative!\n"); - - if (dwOpcode == 0xf6 || dwOpcode == 0xee) - fprintf(fp, " and ah, 0ech ; No H, N, or C\n"); - - fprintf(fp, " inc esi\n"); - - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - if (0xfe == dwOpcode) // Cp - { - SetSubFlagsSZHVC("cpu.z80A", "*pbPC++"); - } - else - if (0xe6 == dwOpcode) // And - { - fprintf(fp, " cpu.z80A &= *pbPC++;\n"); - 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"); - fprintf(fp, " cpu.z80F |= bPostANDFlags[cpu.z80A];\n\n"); - } - else - if (0xf6 == dwOpcode) // Or - { - fprintf(fp, " cpu.z80A |= *pbPC++;\n"); - 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"); - fprintf(fp, " cpu.z80F |= bPostORFlags[cpu.z80A];\n\n"); - } - else - if (0xc6 == dwOpcode) // Add - { - fprintf(fp, " bTemp = *pbPC++;\n"); - SetAddFlagsSZHVC("cpu.z80A", "bTemp"); - fprintf(fp, " cpu.z80A += bTemp;\n"); - } - else - if (0xce == dwOpcode) // Adc - { - fprintf(fp, " bTemp = *pbPC++ + (cpu.z80F & Z80_FLAG_CARRY);\n"); - SetAdcFlagsSZHVC("cpu.z80A", "bTemp"); - fprintf(fp, " cpu.z80A += bTemp;\n"); - } - else - if (0xd6 == dwOpcode) // Sub - { - fprintf(fp, " bTemp = *pbPC++;\n"); - SetSubFlagsSZHVC("cpu.z80A", "bTemp"); - fprintf(fp, " cpu.z80A -= bTemp;\n"); - } - else - if (0xde == dwOpcode) // Sbc - { - fprintf(fp, " bTemp = *pbPC++ + (cpu.z80F & Z80_FLAG_CARRY);\n"); - SetSbcFlagsSZHVC("cpu.z80A", "bTemp"); - fprintf(fp, " cpu.z80A = cpu.z80A - bTemp;\n"); - } - else - if (0xee == dwOpcode) // Xor - { - fprintf(fp, " cpu.z80A ^= *pbPC++;\n"); - 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"); - fprintf(fp, " cpu.z80F |= bPostORFlags[cpu.z80A];\n\n"); - } - else - InvalidInstructionC(1); - } - else - { - assert(0); - } -} - -// JR cc, addr - -void JrHandler(UINT32 dwOpcode) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - fprintf(fp, " sub esi, ebp\n"); - fprintf(fp, " and esi, 0ffffh\n"); - fprintf(fp, " add esi, ebp\n"); - - fprintf(fp, " mov dl, [esi] ; Get our relative offset\n"); - fprintf(fp, " inc esi ; Next instruction, please!\n"); - - if (dwOpcode != 0x18) - { - fprintf(fp, " sahf\n"); - fprintf(fp, " j%s takeJump%ld\n", pbFlags[(dwOpcode >> 3) & 0x3], dwGlobalLabel); - fprintf(fp, " jmp short noJumpMan%ld\n", dwGlobalLabel); - fprintf(fp, "takeJump%ld:\n", dwGlobalLabel); - - if (FALSE == bNoTiming) - { - fprintf(fp, " sub edi, 5\n"); - } - } - else // It's a JR - { - fprintf(fp, " cmp dl, 0feh ; Jump to self?\n"); - fprintf(fp, " je yesJrMan ; Yup! Bail out!\n"); - } - - fprintf(fp, " xchg eax, edx\n"); - fprintf(fp, " cbw\n"); - fprintf(fp, " xchg eax, edx\n"); - fprintf(fp, " sub esi, ebp\n"); - fprintf(fp, " add si, dx\n"); - fprintf(fp, " and esi, 0ffffh ; Only the lower 16 bits\n"); - fprintf(fp, " add esi, ebp\n"); - fprintf(fp, " xor dh, dh\n"); - fprintf(fp, "noJumpMan%ld:\n", dwGlobalLabel++); - - FetchNextInstruction(dwOpcode); - - if (0x18 == dwOpcode) - { - fprintf(fp,"yesJrMan:\n"); - - fprintf(fp, " xor edx, edx ; Zero me for later\n"); - fprintf(fp, " mov edi, edx\n"); - fprintf(fp, " mov [cyclesRemaining], edx\n"); - fprintf(fp, " sub esi, 2 ; Back to the instruction again\n"); - fprintf(fp, " jmp noMoreExec\n\n"); - } - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, " sdwAddr = (INT8) *pbPC++; /* Get LSB first */\n"); - fprintf(fp, " cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;\n"); - fprintf(fp, " sdwAddr = (sdwAddr + (INT32) cpu.z80pc) & 0xffff;\n"); - - if (0x18 != dwOpcode) - { - fprintf(fp, " if %s\n", pbFlagsC[(dwOpcode >> 3) & 0x03]); - } - - fprintf(fp, " {\n"); - - fprintf(fp, " sdwCyclesRemaining -= 5;\n"); - - fprintf(fp, " pbPC = cpu.z80Base + sdwAddr; /* Normalize the address */\n"); - fprintf(fp, " }\n"); - - } - else - { - assert(0); - } -} - -void CallHandler(UINT32 dwOpcode) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - if (dwOpcode != 0xcd) - { - fprintf(fp, " sahf ; Restore our flags\n"); - fprintf(fp, " j%s takeJump%ld ; We're going call in this case\n", pbFlags[(dwOpcode >> 3) & 0x07], dwGlobalLabel); - fprintf(fp, " add esi, 2 ; Skip past the address\n"); - fprintf(fp, " jmp short noCallTaken%ld ; Go execute the next instruction\n", dwGlobalLabel); - fprintf(fp, "takeJump%ld:\n", dwGlobalLabel); - - fprintf(fp, " sub edi, 7\n"); - } - - - if (bThroughCallHandler) - { - fprintf(fp, " mov dx, [esi] ; Get our call to address\n"); - fprintf(fp, " mov [_z80pc], dx ; Store our new program counter\n"); - fprintf(fp, " add esi, 2 ; Skip to our new address to be pushed\n"); - fprintf(fp, " sub esi, ebp ; Value to push onto the \"stack\"\n"); - fprintf(fp, " mov [_wordval], si ; Store our return address on the stack\n"); - fprintf(fp, " mov si, dx ; Our new address\n"); - fprintf(fp, " add esi, ebp ; And our base address\n"); - fprintf(fp, " call PushWord ; Go push our orgval to the stack\n"); - } - else - { - fprintf(fp, " mov dx, [esi] ; Get our call to address\n"); - fprintf(fp, " mov [_z80pc], dx ; Store our new program counter\n"); - fprintf(fp, " add esi, 2 ; Skip to our new address to be pushed\n"); - fprintf(fp, " sub esi, ebp ; Value to push onto the \"stack\"\n"); - fprintf(fp, " mov dx, word [_z80sp] ; Get the current stack pointer\n"); - fprintf(fp, " sub dx, 2 ; Back up two bytes\n"); - fprintf(fp, " mov [ebp+edx], si ; PUSH It!\n"); - fprintf(fp, " mov word [_z80sp], dx ; Store our new stack pointer\n"); - fprintf(fp, " mov si, [_z80pc] ; Get our new program counter\n"); - fprintf(fp, " add esi, ebp ; Naturalize it!\n"); - } - - if (dwOpcode != 0xcd) - fprintf(fp, "noCallTaken%ld:\n", dwGlobalLabel++); - - fprintf(fp, " xor edx, edx\n"); - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, " dwAddr = *pbPC++; /* Get LSB first */\n"); - fprintf(fp, " dwAddr |= ((UINT32) *pbPC++ << 8); /* Get MSB last */\n"); - - if (0xcd != dwOpcode) - { - fprintf(fp, " if %s\n", pbFlagsC[(dwOpcode >> 3) & 0x07]); - fprintf(fp, " {\n"); - fprintf(fp, " cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;\n"); - fprintf(fp, " pbSP = (cpu.z80Base + cpu.z80sp - 1); /* Normalize the stack pointer */\n"); - fprintf(fp, " *pbSP-- = cpu.z80pc >> 8; /* MSB */\n"); - fprintf(fp, " *pbSP = (UINT8) cpu.z80pc; /* LSB */\n"); - fprintf(fp, " cpu.z80sp -= 2; /* Back our stack up */\n"); - fprintf(fp, " pbPC = cpu.z80Base + dwAddr; /* Normalize the address */\n"); - fprintf(fp, " }\n"); - } - else // Just a regular call - { - fprintf(fp, " cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;\n"); - fprintf(fp, " pbSP = (cpu.z80Base + cpu.z80sp - 1); /* Normalize the stack pointer */\n"); - fprintf(fp, " *pbSP-- = cpu.z80pc >> 8; /* LSB */\n"); - fprintf(fp, " *pbSP = (UINT8) cpu.z80pc; /* MSB */\n"); - fprintf(fp, " cpu.z80sp -= 2; /* Back our stack up */\n"); - fprintf(fp, " pbPC = cpu.z80Base + dwAddr; /* Normalize the address */\n"); - } - } - else - { - assert(0); - } -} - -void RetHandler(UINT32 dwOpcode) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - if (dwOpcode != 0xc9) - { - fprintf(fp, " sahf\n"); - fprintf(fp, " j%s takeReturn%ld\n", pbFlags[(dwOpcode >> 3) & 0x07], dwGlobalLabel); - fprintf(fp, " jmp short retNotTaken%ld\n", dwGlobalLabel); - fprintf(fp, "takeReturn%ld:\n", dwGlobalLabel); - - if (FALSE == bNoTiming) - { - fprintf(fp, " sub edi, byte 6\n"); - } - } - - - if (bThroughCallHandler) - { - fprintf(fp, " call PopWord\n"); - fprintf(fp, " xor esi, esi\n"); - fprintf(fp, " mov si, dx\n"); - fprintf(fp, " add esi, ebp\n"); - fprintf(fp, " xor edx, edx\n"); - } - else - { - fprintf(fp, " mov dx, word [_z80sp] ; Get our current stack pointer\n"); - fprintf(fp, " mov si, [edx+ebp] ; Get our return address\n"); - fprintf(fp, " and esi, 0ffffh ; Only within 64K!\n"); - fprintf(fp, " add esi, ebp ; Add in our base address\n"); - fprintf(fp, " add word [_z80sp], 02h ; Remove our two bytes from the stack\n"); - fprintf(fp, " xor edx, edx\n"); - } - - if (dwOpcode != 0xc9) - fprintf(fp, "retNotTaken%ld:\n", dwGlobalLabel++); - - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - if (dwOpcode != 0xc9) - { - fprintf(fp, " if %s\n", pbFlagsC[(dwOpcode >> 3) & 0x07]); - fprintf(fp, " {\n"); - fprintf(fp, " dwElapsedTicks += 6;\n"); - } - - fprintf(fp, " pbSP = cpu.z80Base + cpu.z80sp; /* Normalize our stack PTR */\n"); - fprintf(fp, " dwAddr = *pbSP++; /* Pop LSB */\n"); - fprintf(fp, " dwAddr |= ((UINT32) *pbSP << 8); /* Pop MSB */\n"); - fprintf(fp, " cpu.z80sp += 2; /* Pop the word off */\n"); - fprintf(fp, " pbPC = (cpu.z80Base + dwAddr); /* Point PC to our return address */\n"); - - if (dwOpcode != 0xc9) - { - fprintf(fp, " }\n"); - } - } - else - { - assert(0); - } -} - -void RestartHandler(UINT32 dwOpcode) -{ - UINT32 dwOpcode1 = 0; - - dwOpcode1 = dwOpcode & 0x38; - - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - if (bThroughCallHandler) - { - fprintf(fp, " sub esi, ebp\n"); - fprintf(fp, " mov [_wordval], si ; Store our return address\n"); - fprintf(fp, " call PushWord\n"); - fprintf(fp, " xor esi, esi\n"); - fprintf(fp, " mov si, %.4lxh\n", dwOpcode1); - fprintf(fp, " add esi, ebp\n"); - } - else - { - fprintf(fp, " mov dx, word [_z80sp] ; Get our stack pointer\n"); - fprintf(fp, " sub dx, 2 ; Make room for the new value!\n"); - fprintf(fp, " mov word [_z80sp], dx ; Store our new stack pointer\n"); - fprintf(fp, " sub esi, ebp ; Get our real PC\n"); - fprintf(fp, " mov [ebp+edx], si ; Our return address\n"); - fprintf(fp, " mov si, 0%.2xh ; Our new call address\n", dwOpcode1); - fprintf(fp, " add esi, ebp ; Back to the base!\n"); - } - - fprintf(fp, " xor edx, edx\n"); - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, " cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;\n"); - fprintf(fp, " pbSP = (cpu.z80Base + cpu.z80sp - 1); /* Normalize the stack pointer */\n"); - fprintf(fp, " *pbSP-- = cpu.z80pc >> 8; /* LSB */\n"); - fprintf(fp, " *pbSP = (UINT8) cpu.z80pc; /* MSB */\n"); - fprintf(fp, " cpu.z80sp -= 2; /* Back our stack up */\n"); - fprintf(fp, " pbPC = cpu.z80Base + 0x%.2x; /* Normalize the address */\n", dwOpcode1); - } - else - { - assert(0); - } -} - -void ToRegFromHl(UINT32 dwOpcode) -{ - UINT8 bReg; - - bReg = (dwOpcode >> 3) & 0x07; - - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - if (bReg != 2 && bReg != 3) - ReadValueFromMemory("bx", pbMathReg[bReg]); - else - { - ReadValueFromMemory("bx", pbLocalReg[bReg]); - fprintf(fp, " mov %s, %s\n", pbMathReg[bReg], pbLocalReg[bReg]); - } - - fprintf(fp, " xor edx, edx\n"); - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - ReadValueFromMemory("cpu.z80HL", pbLocalRegC[bReg]); - } - else - { - assert(0); - } -} - -void AddRegpairOperations(UINT32 dwOpcode) -{ - UINT8 bRegpair; - - bRegpair = (dwOpcode >> 4) & 0x3; - - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - fprintf(fp, " mov dh, ah ; Get our flags\n"); - fprintf(fp, " and dh, 0ech ; Preserve the top three and bits 2 & 3\n"); - - fprintf(fp, " mov [_orgval], bx ; Store our original value\n"); - fprintf(fp, " add bx, %s\n", pbRegPairs[bRegpair]); - fprintf(fp, " lahf\n"); - - fprintf(fp, " mov [cyclesRemaining], edi\n"); - fprintf(fp, " mov di, [_orgval] ; Get original\n"); - fprintf(fp, " xor di, bx ; XOR It with our computed value\n"); - fprintf(fp, " xor di, %s\n", pbRegPairs[bRegpair]); - fprintf(fp, " and di, 1000h ; Just our half carry\n"); - fprintf(fp, " or dx, di ; Or in our flags\n"); - fprintf(fp, " and ah, 01h ; Just carry\n"); - fprintf(fp, " or ah, dh\n"); - fprintf(fp, " mov edi, [cyclesRemaining]\n"); - fprintf(fp, " xor edx, edx\n"); - - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, " cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY);\n"); - fprintf(fp, " dwTemp = cpu.z80HL + %s;\n", pbRegPairsC[bRegpair]); - fprintf(fp, " cpu.z80F |= ((dwTemp >> 16) & Z80_FLAG_CARRY) | (((cpu.z80HL ^ dwTemp ^ %s) >> 8) & Z80_FLAG_HALF_CARRY);\n", pbRegPairsC[bRegpair]); - fprintf(fp, " cpu.z80HL = dwTemp & 0xffff;\n"); - - return; - } - else - { - assert(0); - } -} - -void PushPopOperations(UINT32 dwOpcode) -{ - UINT8 bRegPair; - - bRegPair = ((dwOpcode >> 4) & 0x3) << 1; - - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - if ((dwOpcode & 0xcf) == 0xc5) // Push - { - fprintf(fp, " sub word [_z80sp], 2\n"); - fprintf(fp, " mov dx, [_z80sp]\n"); - WriteWordToMemory("dx", pbPopRegPairs[bRegPair >> 1]); - } - else // Pop - { - fprintf(fp, " mov dx, [_z80sp]\n"); - ReadWordFromMemory("dx", pbPopRegPairs[bRegPair >> 1]); - fprintf(fp, " add word [_z80sp], 2\n"); - } - - fprintf(fp, " xor edx, edx\n"); - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - if ((dwOpcode & 0xcf) == 0xc5) // Push? - { - fprintf(fp, " cpu.z80sp -= 2;\n"); - fprintf(fp, " pbSP = (cpu.z80Base + cpu.z80sp); /* Normalize the stack pointer */\n"); - - WriteWordToMemory("cpu.z80sp", pbPopRegPairC[bRegPair >> 1]); - return; - } - else - { - ReadWordFromMemory("cpu.z80sp", pbPopRegPairC[bRegPair >> 1]); - - fprintf(fp, " cpu.z80sp += 2;\n"); - fprintf(fp, " pbSP = (cpu.z80Base + cpu.z80sp); /* Normalize the stack pointer */\n"); - return; - } - - InvalidInstructionC(1); - } - else - { - assert(0); - } -} - -void RraRlaHandler(UINT32 dwOpcode) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - fprintf(fp, " sahf\n"); - if (dwOpcode == 0x1f) - fprintf(fp, " rcr al, 1\n"); - else - fprintf(fp, " rcl al, 1\n"); - - fprintf(fp, " lahf\n"); - fprintf(fp, " and ah, 0edh\n"); - - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - if (0x1f == dwOpcode) // RRA - { - fprintf(fp, " bTemp = (cpu.z80F & Z80_FLAG_CARRY) << 7;\n"); - fprintf(fp, " cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY)) | (cpu.z80A & Z80_FLAG_CARRY);\n"); - fprintf(fp, " cpu.z80A = ((cpu.z80A >> 1) | bTemp);\n"); - } - else // RLA - { - fprintf(fp, " bTemp = cpu.z80A >> 7;\n"); - fprintf(fp, " cpu.z80A = (cpu.z80A << 1) | (cpu.z80F & Z80_FLAG_CARRY);\n"); - fprintf(fp, " cpu.z80F = (cpu.z80F & ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY)) | bTemp;\n"); - } - } - else - { - assert(0); - } -} - -void LdByteRegpair(UINT32 dwOpcode) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - if (dwOpcode == 0x0a) - ReadValueFromMemory("cx", "al"); - if (dwOpcode == 0x1a) - { - fprintf(fp, " mov dx, [_z80de]\n"); - ReadValueFromMemory("dx", "al"); - } - - fprintf(fp, " xor edx, edx\n"); - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - if (dwOpcode == 0x0a) - ReadValueFromMemory("cpu.z80BC", "cpu.z80A"); - if (dwOpcode == 0x1a) - ReadValueFromMemory("cpu.z80DE", "cpu.z80A"); - } - else - { - assert(0); - } -} - -void IncDecHLPtr(UINT32 dwOpcode) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - ReadValueFromMemory("bx", "dl"); - - fprintf(fp, " sahf\n"); - - if (dwOpcode == 0x34) - fprintf(fp, " inc dl\n"); - else - fprintf(fp, " dec dl\n"); - fprintf(fp, " lahf\n"); - - fprintf(fp, " o16 pushf\n"); - fprintf(fp, " shl edx, 16\n"); - fprintf(fp, " and ah, 0fbh ; Knock out parity/overflow\n"); - fprintf(fp, " pop dx\n"); - fprintf(fp, " and dh, 08h ; Just the overflow\n"); - fprintf(fp, " shr dh, 1 ; Shift it into position\n"); - fprintf(fp, " or ah, dh ; OR It in with the real flags\n"); - - fprintf(fp, " shr edx, 16\n"); - - if (dwOpcode == 0x34) - fprintf(fp, " and ah, 0fdh ; Knock out N!\n"); - else - fprintf(fp, " or ah, 02h ; Make it N!\n"); - - WriteValueToMemory("bx", "dl"); - fprintf(fp, " xor edx, edx\n"); - - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - ReadValueFromMemory("cpu.z80HL", "bTemp"); - - fprintf(fp, " cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);\n"); - - if (0x34 == dwOpcode) - fprintf(fp ," cpu.z80F |= bPostIncFlags[bTemp];\n"); - else - fprintf(fp ," cpu.z80F |= bPostDecFlags[bTemp];\n"); - - if (0x34 == dwOpcode) - fprintf(fp, " bTemp++;\n"); - else - fprintf(fp, " bTemp--;\n"); - - WriteValueToMemory("cpu.z80HL", "bTemp"); - return; - } - else - { - assert(0); - } -} - -void InOutHandler(UINT32 dwOpcode) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - fprintf(fp, " mov dl, [esi] ; Get our address to 'out' to\n"); - fprintf(fp, " inc esi ; Next address\n"); - - if (b16BitIo) - { - fprintf(fp, " mov dh, al ; Upper 8 bits are the A register for 16 bit addressing\n"); - } - - if (0xd3 == dwOpcode) - WriteValueToIo("dx", "al"); - else - ReadValueFromIo("dx", "al"); - - fprintf(fp, " xor edx, edx\n"); - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp ," dwTemp = *pbPC++;\n"); - - if (0xd3 == dwOpcode) - WriteValueToIo("dwTemp", "cpu.z80A"); - else - ReadValueFromIo("dwTemp", "cpu.z80A"); - - // Not supposed to set flags for immediate instruction! - - return; - } - else - { - assert(0); - } -} - -// CB Area - -void RESSETHandler(UINT32 dwOpcode) -{ - UINT8 op = 0; - - op = dwOpcode & 0x07; - - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - if ((2 == op) || (3 == op)) - fprintf(fp, " mov dx, [_z80de] ; Move DE into something half usable\n"); - - if ((dwOpcode & 0x07) == 6) // (HL)? - ReadValueFromMemory("bx", "dl"); - - if ((dwOpcode & 0xc0) == 0x80) - fprintf(fp, " and %s, 0%.2xh ; Reset a bit\n", - pbLocalReg[op], - 0xff - (1 << ((dwOpcode >> 3) & 0x7))); - - if ((dwOpcode & 0xc0) == 0xc0) - fprintf(fp, " or %s, 0%.2xh ; Set a bit\n", - pbLocalReg[op], - (1 << ((dwOpcode >> 3) & 0x7))); - - if ((2 == op) || (3 == op)) - { - fprintf(fp, " mov [_z80de], dx ; Once modified, put it back\n"); - fprintf(fp, " xor edx, edx\n"); - } - - if ((dwOpcode & 0x07) == 6) // (HL)? - { - WriteValueToMemory("bx", "dl"); - fprintf(fp, " xor edx, edx\n"); - } - - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - if (6 == op) // (HL)? - ReadValueFromMemory("cpu.z80HL", "bTemp"); - - if ((dwOpcode & 0xc0) == 0x80) // RES - fprintf(fp, " %s &= 0x%.2x;\n", pbMathRegC[op], (UINT8) ~((UINT8) 1 << ((dwOpcode >> 3) & 0x07))); - else // SET - fprintf(fp, " %s |= 0x%.2x;\n", pbMathRegC[op], 1 << ((dwOpcode >> 3) & 0x07)); - - if (6 == op) // (HL)? - WriteValueToMemory("cpu.z80HL", "bTemp"); - } - else - assert(0); -} - -void BITHandler(UINT32 dwOpcode) -{ - UINT8 op = 0; - UINT8 bBitVal = 0; - - op = dwOpcode & 0x07; - bBitVal = 1 << ((dwOpcode >> 3) & 0x07); - - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - if ((dwOpcode & 0x07) == 6) // (HL)? - ReadValueFromMemory("bx", "dl"); - - fprintf(fp, " mov byte [_z80af], ah ; Store F\n"); - fprintf(fp, " sahf\n"); - - if ((dwOpcode & 0x07) == 6) - fprintf(fp, " test dl, 0%.2xh ; Do a bitwise check\n", 1 << ((dwOpcode >> 3) & 0x7)); - else - fprintf(fp, " test %s, 0%.2xh ; Do a bitwise check\n", pbMathReg[op], 1 << ((dwOpcode >> 3) & 0x7)); - - fprintf(fp, " lahf\n"); - fprintf(fp, " and ah, 0c0h ; Only care about Z and S\n"); - fprintf(fp, " or ah, 10h ; Set half carry to 1\n"); - - fprintf(fp, " and byte [_z80af], 029h ; Only zero/non-zero!\n"); - fprintf(fp, " or ah, byte [_z80af] ; Put it in with the real flags\n"); - - if (6 == (dwOpcode & 0x07)) // (HL)? - fprintf(fp, " xor edx, edx\n"); - - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - if (6 == op) // (HL)? - ReadValueFromMemory("cpu.z80HL", "bTemp"); - - fprintf(fp, " cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO);\n"); - fprintf(fp, " cpu.z80F |= (Z80_FLAG_HALF_CARRY);\n"); - fprintf(fp, " if (!(%s & 0x%.2lx))\n", pbMathRegC[op], bBitVal); - fprintf(fp, " {\n"); - fprintf(fp, " cpu.z80F |= Z80_FLAG_ZERO;\n"); - fprintf(fp, " }\n"); - } - else - assert(0); -} - -void RLCRRCRLRRSLASRASRLHandler(UINT32 dwOpcode) -{ - UINT8 op = 0; - - op = dwOpcode & 0x07; - - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - if ((2 == op) || (3 == op)) - fprintf(fp, " mov dx, [_z80de] ; Move DE into something half usable\n"); - - if ((dwOpcode & 0x07) == 6) // (HL)? - ReadValueFromMemory("bx", "dl"); - - fprintf(fp, " sahf\n"); - - if ((dwOpcode & 0xf8) == 0) - fprintf(fp, " rol %s, 1\n", pbLocalReg[op]); - else - if ((dwOpcode & 0xf8) == 0x08) - fprintf(fp, " ror %s, 1\n", pbLocalReg[op]); - else - if ((dwOpcode & 0xf8) == 0x10) - fprintf(fp, " rcl %s, 1\n", pbLocalReg[op]); - else - if ((dwOpcode & 0xf8) == 0x18) - fprintf(fp, " rcr %s, 1\n", pbLocalReg[op]); - else - if ((dwOpcode & 0xf8) == 0x20 || (dwOpcode & 0xf8) == 0x30) - fprintf(fp, " shl %s, 1\n", pbLocalReg[op]); - else - if ((dwOpcode & 0xf8) == 0x28) - fprintf(fp, " sar %s, 1\n", pbLocalReg[op]); - else - if ((dwOpcode & 0xf8) == 0x38) - fprintf(fp, " shr %s, 1\n", pbLocalReg[op]); - else - assert(0); - - fprintf(fp, " lahf\n"); - - if ((dwOpcode & 0xf8) >= 0x20) - { - if ((dwOpcode & 0xf8) == 0x30) - fprintf(fp, " or %s, 1 ; Slide in a 1 bit (SLIA)\n", pbLocalReg[op]); - fprintf(fp, " and ah, 0edh ; Clear H and N\n"); - } - else - { - fprintf(fp, " and ah, 029h ; Clear H and N\n"); - fprintf(fp, " mov byte [_z80af], ah\n"); - - fprintf(fp, " or %s, %s\n", pbLocalReg[op], pbLocalReg[op]); - - fprintf(fp, " lahf\n"); - fprintf(fp, " and ah, 0c4h ; Sign, zero, and parity\n"); - fprintf(fp, " or ah, byte [_z80af]\n"); - } - - if ((2 == op) || (3 == op)) - { - fprintf(fp, " mov [_z80de], dx ; Once modified, put it back\n"); - fprintf(fp, " xor edx, edx\n"); - } - - if ((dwOpcode & 0x07) == 6) // (HL)? - { - WriteValueToMemory("bx", "dl"); - fprintf(fp, " xor edx, edx\n"); - } - - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - if (6 == op) // (HL)? - ReadValueFromMemory("cpu.z80HL", "bTemp"); - - dwOpcode &= 0xf8; // Just the instruction - - if (0 == dwOpcode) // RLC - { - 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"); - fprintf(fp, " bTemp2 = (%s >> 7);\n", pbMathRegC[op]); - fprintf(fp, " %s = (%s << 1) | bTemp2;\n", pbMathRegC[op], pbMathRegC[op]); - fprintf(fp, " cpu.z80F |= bTemp2 | bPostORFlags[%s];\n", pbMathRegC[op]); - } - else - if (0x08 == dwOpcode) // RRC - { - 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"); - fprintf(fp, " cpu.z80F |= (%s & Z80_FLAG_CARRY);\n", pbMathRegC[op]); - fprintf(fp, " %s = (%s >> 1) | (%s << 7);\n", pbMathRegC[op], pbMathRegC[op], pbMathRegC[op]); - fprintf(fp, " cpu.z80F |= bPostORFlags[%s];\n", pbMathRegC[op]); - } - else - if (0x10 == dwOpcode) // RL - { - fprintf(fp, " bTemp2 = cpu.z80F & Z80_FLAG_CARRY;\n"); - 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"); - fprintf(fp, " cpu.z80F |= (%s >> 7);\n", pbMathRegC[op]); - fprintf(fp, " %s = (%s << 1) | bTemp2;\n", pbMathRegC[op], pbMathRegC[op]); - fprintf(fp, " cpu.z80F |= bPostORFlags[%s];\n", pbMathRegC[op]); - } - else - if (0x18 == dwOpcode) // RR - { - fprintf(fp, " bTemp2 = (cpu.z80F & Z80_FLAG_CARRY) << 7;\n"); - 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"); - fprintf(fp, " cpu.z80F |= (%s & Z80_FLAG_CARRY);\n", pbMathRegC[op]); - fprintf(fp, " %s = (%s >> 1) | bTemp2;\n", pbMathRegC[op], pbMathRegC[op]); - fprintf(fp, " cpu.z80F |= bPostORFlags[%s];\n", pbMathRegC[op]); - } - else - if ((0x20 == dwOpcode) || (0x30 == dwOpcode)) // SLA/SRL - { - 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"); - fprintf(fp, " cpu.z80F |= (%s >> 7);\n", pbMathRegC[op]); - fprintf(fp, " %s = (%s << 1);\n", pbMathRegC[op], pbMathRegC[op]); - fprintf(fp, " cpu.z80F |= bPostORFlags[%s];\n", pbMathRegC[op]); - } - else - if (0x28 == dwOpcode) // SRA - { - 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"); - fprintf(fp, " cpu.z80F |= (%s & Z80_FLAG_CARRY);\n", pbMathRegC[op]); - fprintf(fp, " %s = (%s >> 1) | (%s & 0x80);\n", pbMathRegC[op], pbMathRegC[op], pbMathRegC[op]); - fprintf(fp, " cpu.z80F |= bPostORFlags[%s];\n", pbMathRegC[op]); - } - else - if (0x38 == dwOpcode) // SRL - { - 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"); - fprintf(fp, " cpu.z80F |= (%s & Z80_FLAG_CARRY);\n", pbMathRegC[op]); - fprintf(fp, " %s = (%s >> 1);\n", pbMathRegC[op], pbMathRegC[op], pbMathRegC[op]); - fprintf(fp, " cpu.z80F |= bPostORFlags[%s];\n", pbMathRegC[op]); - } - else - { - InvalidInstructionC(2); - } - - if (6 == op) // (HL)? - WriteValueToMemory("cpu.z80HL", "bTemp"); - } - else - assert(0); -} - -// ED Area - -void RRDRLDHandler(UINT32 dwOpcode) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - ReadValueFromMemory("bx", "dl"); // Get (HL) - fprintf(fp, " mov dh, dl ; Put a copy in DH\n"); - - if (0x6f == dwOpcode) // RLD - { - fprintf(fp, " shr dh, 4 ; Get our upper nibble in position\n"); - fprintf(fp, " shl dl, 4 ; Get our lower nibble into the higher position\n"); - fprintf(fp, " shl ecx, 16 ; Save this for later\n"); - fprintf(fp, " mov cl, al\n"); - fprintf(fp, " and cl, 0fh\n ; Only the lower nibble\n"); - fprintf(fp, " or dl, cl ; OR In A->(HL) transfer\n"); - fprintf(fp, " and al, 0f0h ; Only the upper 4 bits remain\n"); - fprintf(fp, " or al, dh ; OR It in to our accumulator\n"); - fprintf(fp, " shr ecx, 16 ; Restore this\n"); - } - else // RRD - if (0x67 == dwOpcode) - { - fprintf(fp, " shr dl, 4 ; Upper nibble to lower nibble\n"); - fprintf(fp, " shl ecx, 16 ; Save this\n"); - fprintf(fp, " mov cl, al\n"); - fprintf(fp, " shl cl, 4\n"); - fprintf(fp, " or dl, cl ; OR In what was in A\n"); - fprintf(fp, " and al, 0f0h ; Knock out lower part\n"); - fprintf(fp, " and dh, 0fh ; Only the lower nibble\n"); - fprintf(fp, " or al, dh ; OR In our nibble\n"); - fprintf(fp, " shr ecx, 16 ; Restore this\n"); - } - else // Whoops! - assert(0); - - // This routine assumes that the new value to be placed at (HL) is in DL - - fprintf(fp, " and ah, 29h ; Retain carry & two undefined bits\n"); - fprintf(fp, " mov dh, ah ; Store our flags away for later\n"); - - fprintf(fp, " or al, al ; Get our flags\n"); - fprintf(fp, " lahf\n"); - fprintf(fp, " and ah,0c4h ; Only partiy, zero, and sign\n"); - fprintf(fp, " or ah, dh ; OR In our old flags\n"); - - // Now go write the value back - - WriteValueToMemory("bx", "dl"); - fprintf(fp, " xor edx, edx ; Zero out this for later\n"); - - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - if (0x67 == dwOpcode) // RRD - { - ReadValueFromMemory("cpu.z80HL", "bTemp"); - fprintf(fp, " bTemp2 = (cpu.z80A & 0x0f) << 4;\n"); - fprintf(fp, " cpu.z80A = (cpu.z80A & 0xf0) | (bTemp & 0x0f);\n"); - fprintf(fp, " bTemp = (bTemp >> 4) | bTemp2;\n"); - - WriteValueToMemory("cpu.z80HL", "bTemp"); - fprintf(fp, " cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);\n"); - fprintf(fp, " cpu.z80F |= bPostORFlags[cpu.z80A];\n"); - } - else - if (0x6f == dwOpcode) // RLD - { - ReadValueFromMemory("cpu.z80HL", "bTemp"); - - fprintf(fp, " bTemp2 = (cpu.z80A & 0x0f);\n"); - fprintf(fp, " cpu.z80A = (cpu.z80A & 0xf0) | (bTemp >> 4);\n"); - fprintf(fp, " bTemp = (bTemp << 4) | bTemp2;\n"); - - WriteValueToMemory("cpu.z80HL", "bTemp"); - fprintf(fp, " cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);\n"); - fprintf(fp, " cpu.z80F |= bPostORFlags[cpu.z80A];\n"); - } - else - InvalidInstructionC(2); - } - else - assert(0); -} - -void CPICPDCPIRCPDRHandler(UINT32 dwOpcode) -{ - UINT32 dwRepeatOb = 0; - - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - if (dwOpcode == 0xb1 || dwOpcode == 0xb9) - { - fprintf(fp, "cpRepeat%ld:\n", dwGlobalLabel); - dwRepeatOb = dwGlobalLabel; - ++dwGlobalLabel; - } - - // Now go get the data from the source - - ReadValueFromMemory("bx", "dl"); - - // Target data is in DL - - fprintf(fp, " mov byte [_z80af], ah\n"); - fprintf(fp, " sahf\n"); - fprintf(fp, " cmp al, dl ; Do our comparison\n"); - fprintf(fp, " lahf\n"); - fprintf(fp, " and ah, 0fah ; No P/V or carry!\n"); - fprintf(fp, " dec cx ; Dec BC\n"); - fprintf(fp, " jz notBcZero%ld\n", dwGlobalLabel); - fprintf(fp, " or ah, 04h ; P/V set when BC not zero\n"); - fprintf(fp, "notBcZero%ld:\n", dwGlobalLabel); - fprintf(fp, " or ah, 02h ; N Gets set when we do compares\n"); - fprintf(fp, " mov dl, byte [_z80af]\n"); - fprintf(fp, " and dl, 01h\n"); - fprintf(fp, " or ah, dl ; Preserve carry!\n"); - - if (dwOpcode == 0xa1 || dwOpcode == 0xb1) - fprintf(fp, " inc bx ; Increment!\n"); - if (dwOpcode == 0xa9 || dwOpcode == 0xb9) - fprintf(fp, " dec bx ; Decrement!\n"); - - // Let's see if we repeat... - - if (dwOpcode == 0xb1 || dwOpcode == 0xb9) - { - fprintf(fp, " sahf\n"); - fprintf(fp, " jz BCDone%ld\n", dwRepeatOb); - fprintf(fp, " jnp BCDone%ld\n", dwRepeatOb); - - if (FALSE == bNoTiming) - { - fprintf(fp, " sub edi, dword 21\n"); - fprintf(fp, " js BCDoneExit%ld\n", dwRepeatOb); - } - - fprintf(fp, " jmp cpRepeat%ld\n", dwRepeatOb); - - fprintf(fp, "BCDoneExit%ld:\n", dwRepeatOb); - fprintf(fp, " sub esi, 2 ; Back up to the instruction again\n"); - fprintf(fp, " jmp noMoreExec\n\n"); - fprintf(fp, "BCDone%ld:\n", dwRepeatOb); - } - - fprintf(fp, " xor edx, edx\n"); - - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - if (0xb1 == dwOpcode || 0xb9 == dwOpcode) // Repeat instruction? - { - fprintf(fp, " while ((sdwCyclesRemaining >= 0) && (cpu.z80BC))\n"); - } - - fprintf(fp, " {\n"); - - ReadValueFromMemory("cpu.z80HL", "bTemp"); - - if (0xb1 == dwOpcode || 0xa1 == dwOpcode) - { - fprintf(fp, " cpu.z80HL++;\n"); - fprintf(fp, " cpu.z80HL &= 0xffff;\n"); - } - else - { - fprintf(fp, " cpu.z80HL--;\n"); - fprintf(fp, " cpu.z80HL &= 0xffff;\n"); - } - - fprintf(fp, " cpu.z80BC--;\n"); - fprintf(fp, " cpu.z80BC &= 0xffff;\n"); - - if (0xb1 == dwOpcode || 0xb9 == dwOpcode) // Repeat? - { - fprintf(fp, " sdwCyclesRemaining -= 16;\n"); - fprintf(fp, " if (cpu.z80A == bTemp)\n"); - fprintf(fp, " {\n"); - fprintf(fp, " break;\n"); - fprintf(fp, " }\n"); - } - - fprintf(fp, " }\n"); - - // Now figure out what's going on - - fprintf(fp, " cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);\n"); - fprintf(fp, " cpu.z80F |= (pbSubSbcTable[((UINT32) cpu.z80A << 8) | bTemp] & (Z80_FLAG_SIGN | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO));\n"); - fprintf(fp, " if (cpu.z80BC)\n"); - fprintf(fp, " {\n"); - fprintf(fp, " cpu.z80F |= Z80_FLAG_OVERFLOW_PARITY;\n"); - - fprintf(fp, " }\n"); - } - else - assert(0); -} - -void INIRINDRINIINDHandler(UINT32 dwOpcode) -{ - UINT32 dwTempLabel = 0; - - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - dwTempLabel = dwGlobalLabel; - dwGlobalLabel++; - - if (0xba == dwOpcode || 0xb2 == dwOpcode) - fprintf(fp, "loopIt%ld:\n", dwTempLabel); - - // Fetch what's at (C) and put it in (HL) - - fprintf(fp, " push cx ; Save BC\n"); - - if (b16BitIo == FALSE) - fprintf(fp, " xor ch, ch ; We want 8 bit ports\n"); - - ReadValueFromIo("cx", "*dl"); // Put our value in DL - fprintf(fp, " pop cx ; Restore BC\n"); - - WriteValueToMemory("bx", "dl"); - - if (0xa2 == dwOpcode || 0xb2 == dwOpcode) - fprintf(fp, " inc bx ; Increment HL\n"); - else - if (0xaa == dwOpcode || 0xba == dwOpcode) - fprintf(fp, " dec bx ; Decrement HL\n"); - - // Now we decrement B - - fprintf(fp, " dec ch ; Decrement B (of C)\n"); - - // Emit this instruction if we repeat - - if (0xba == dwOpcode || 0xb2 == dwOpcode) - { - fprintf(fp, " jz near finalExit%ld\n", dwTempLabel); - - // Otherwise, we need to loop again - - if (FALSE == bNoTiming) - { - fprintf(fp, " sub edi, dword 21\n"); - fprintf(fp, " js loopExit%ld\n", dwTempLabel); - } - - fprintf(fp, " jmp loopIt%ld\n\n", dwTempLabel); - fprintf(fp, "loopExit%ld:\n", dwTempLabel); - fprintf(fp, " sub esi, 2\n"); - fprintf(fp, " jmp noMoreExec\n\n"); - } - - // Now let's fix up the flags - - fprintf(fp, "finalExit%ld:\n", dwTempLabel); - fprintf(fp, " jnz clearFlag%ld\n", dwTempLabel); - fprintf(fp, " or ah, 040h ; Set the Zero flag!\n"); - fprintf(fp, " jmp short continue%ld\n", dwTempLabel); - fprintf(fp, "clearFlag%ld:\n", dwTempLabel); - fprintf(fp, " and ah, 0bfh ; Clear the zero flag\n"); - fprintf(fp, "continue%ld:\n", dwTempLabel); - fprintf(fp, " or ah, 02h ; Set negative!\n"); - fprintf(fp, " xor edx, edx\n"); - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - if (0xb2 == dwOpcode || 0xba == dwOpcode) // Repeat instruction? - { - fprintf(fp, " while ((sdwCyclesRemaining > 0) && (cpu.z80B))\n"); - } - - fprintf(fp, " {\n"); - - ReadValueFromIo("cpu.z80B", "bTemp"); - WriteValueToMemory("cpu.z80HL", "bTemp"); - - if (0xb2 == dwOpcode || 0xa2 == dwOpcode) - { - fprintf(fp, " cpu.z80HL++;\n"); - fprintf(fp, " cpu.z80HL &= 0xffff;\n"); - } - else - { - fprintf(fp, " cpu.z80HL--;\n"); - fprintf(fp, " cpu.z80HL &= 0xffff;\n"); - } - - fprintf(fp, " sdwCyclesRemaining -= 16;\n"); - - fprintf(fp, " cpu.z80B--;\n"); - fprintf(fp, " }\n"); - - // Now figure out what's going on - - fprintf(fp, " cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);\n"); - fprintf(fp, " cpu.z80F |= (bPostORFlags[bTemp] & (Z80_FLAG_SIGN | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY));\n"); - fprintf(fp, " if (cpu.z80B)\n"); - fprintf(fp, " {\n"); - fprintf(fp, " cpu.z80F |= Z80_FLAG_OVERFLOW_PARITY;\n"); - - fprintf(fp, " pbPC -= 2;\n"); - - fprintf(fp, " }\n"); - } - else - assert(0); -} - -void OTIROTDROUTIOUTDHandler(UINT32 dwOpcode) -{ - UINT32 dwTempLabel = 0; - - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - dwTempLabel = dwGlobalLabel; - dwGlobalLabel++; - - if (0xbb == dwOpcode || 0xb3 == dwOpcode) - fprintf(fp, "loopIt%ld:\n", dwTempLabel); - - // Fetch what's at (HL) and put it in DL - - ReadValueFromMemory("bx", "dl"); - - fprintf(fp, " push cx ; Save BC\n"); - if (b16BitIo == FALSE) - fprintf(fp, " xor ch, ch ; No 16 bit for this instruction!\n"); - WriteValueToIo("cx", "dl"); - fprintf(fp, " pop cx ; Restore BC now that it has been \"OUT\"ed\n"); - - if (0xa3 == dwOpcode || 0xb3 == dwOpcode) - fprintf(fp, " inc bx ; Increment HL\n"); - else - if (0xab == dwOpcode || 0xbb == dwOpcode) - fprintf(fp, " dec bx ; Decrement HL\n"); - - // Now we decrement B - - fprintf(fp, " dec ch ; Decrement B (of C)\n"); - - // Emit this instruction if we repeat - - if (0xbb == dwOpcode || 0xb3 == dwOpcode) - { - fprintf(fp, " jz near finalExit%ld\n", dwTempLabel); - - // Otherwise, we need to loop again - - if (FALSE == bNoTiming) - { - fprintf(fp, " sub edi, dword 21\n"); - fprintf(fp, " js loopExit%ld\n", dwTempLabel); - } - - fprintf(fp, " jmp loopIt%ld\n\n", dwTempLabel); - fprintf(fp, "loopExit%ld:\n", dwTempLabel); - fprintf(fp, " sub esi, 2\n"); - fprintf(fp, " jmp noMoreExec\n\n"); - } - - // Now let's fix up the flags - - fprintf(fp, "finalExit%ld:\n", dwTempLabel); - fprintf(fp, " jnz clearFlag%ld\n", dwTempLabel); - fprintf(fp, " or ah, 040h ; Set the Zero flag!\n"); - fprintf(fp, " jmp short continue%ld\n", dwTempLabel); - fprintf(fp, "clearFlag%ld:\n", dwTempLabel); - fprintf(fp, " and ah, 0bfh ; Clear the zero flag\n"); - fprintf(fp, "continue%ld:\n", dwTempLabel); - fprintf(fp, " or ah, 02h ; Set negative!\n"); - fprintf(fp, " xor edx, edx\n"); - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - if (0xb3 == dwOpcode || 0xbb == dwOpcode) // Repeat instruction? - { - fprintf(fp, " while ((sdwCyclesRemaining > 0) && (cpu.z80B))\n"); - } - - fprintf(fp, " {\n"); - - ReadValueFromMemory("cpu.z80HL", "bTemp"); - WriteValueToIo("cpu.z80BC", "bTemp"); - - if (0xb3 == dwOpcode || 0xa3 == dwOpcode) - { - fprintf(fp, " cpu.z80HL++;\n"); - fprintf(fp, " cpu.z80HL &= 0xffff;\n"); - } - else - { - fprintf(fp, " cpu.z80HL--;\n"); - fprintf(fp, " cpu.z80HL &= 0xffff;\n"); - } - - fprintf(fp, " sdwCyclesRemaining -= 16;\n"); - - fprintf(fp, " cpu.z80B--;\n"); - fprintf(fp, " }\n"); - - // Now figure out what's going on - - fprintf(fp, " cpu.z80F &= ~(Z80_FLAG_ZERO | Z80_FLAG_SIGN | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);\n"); - fprintf(fp, " cpu.z80F |= (bPostORFlags[bTemp] & (Z80_FLAG_SIGN | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY));\n"); - fprintf(fp, " if (cpu.z80B)\n"); - fprintf(fp, " {\n"); - fprintf(fp, " cpu.z80F |= Z80_FLAG_OVERFLOW_PARITY;\n"); - - fprintf(fp, " }\n"); - } - else - assert(0); -} - -void AdcSbcRegpair(UINT32 dwOpcode) -{ - UINT8 bOp = 0; - - bOp = (dwOpcode >> 4) & 0x03; - - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - fprintf(fp, " mov dx, %s ; Get our original register\n", pbRegPairs[bOp]); - fprintf(fp, " mov [_orgval], dx ; Store this for later half carry computation\n"); - fprintf(fp, " mov [_orgval2], bx ; Store this, too\n"); - fprintf(fp, " sahf ; Restore our flags\n"); - - if ((dwOpcode & 0xcf) == 0x4a) - fprintf(fp, " adc bx, dx ; Do the operation!\n"); - else - fprintf(fp, " sbb bx, dx ; Do the operation!\n"); - - fprintf(fp, " lahf ; Get our new flags\n"); - - if ((dwOpcode & 0xcf) != 0x4a) - { - SetOverflow(); - fprintf(fp, " and ah, 0edh ; Knock out negative & half carry flags\n"); - fprintf(fp, " or ah, 02h ; Negative!\n"); - fprintf(fp, " mov [_z80hl], bx\n"); - fprintf(fp, " xor bx, [_orgval]\n"); - fprintf(fp, " xor bx, [_orgval2]\n"); - fprintf(fp, " and bh, 10h ; Half carry?\n"); - fprintf(fp, " or ah, bh ; OR It in if so\n"); - fprintf(fp, " mov bx, [_z80hl]\n"); - } - else - { - SetOverflow(); - fprintf(fp, " and ah, 0edh ; Knock out negative & half carry flags\n"); - fprintf(fp, " mov [_z80hl], bx\n"); - fprintf(fp, " xor bx, [_orgval]\n"); - fprintf(fp, " xor bx, [_orgval2]\n"); - fprintf(fp, " and bh, 10h ; Half carry?\n"); - fprintf(fp, " or ah, bh ; OR It in if so\n"); - fprintf(fp, " mov bx, [_z80hl]\n"); - } - - fprintf(fp, " xor edx, edx ; Make sure we don't hose things\n"); - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - if ((dwOpcode & 0xcf) == 0x4a) // ADC - { - fprintf(fp, " dwTemp = cpu.z80HL + %s + (cpu.z80F & Z80_FLAG_CARRY);\n", pbRegPairsC[bOp]); - 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"); - fprintf(fp, " cpu.z80F |= ((dwTemp >> 8) & Z80_FLAG_SIGN);\n"); - fprintf(fp, " if (0 == (dwTemp & 0xffff))\n"); - fprintf(fp, " {\n"); - fprintf(fp, " cpu.z80F |= Z80_FLAG_ZERO;\n"); - fprintf(fp, " }\n"); - fprintf(fp, " cpu.z80F |= (((cpu.z80HL ^ dwTemp ^ %s) >> 8) & Z80_FLAG_HALF_CARRY);\n", pbRegPairsC[bOp]); - fprintf(fp, " cpu.z80F |= ((((%s ^ cpu.z80HL ^ 0x8000) & (%s ^ dwTemp)) >> 13) & Z80_FLAG_OVERFLOW_PARITY);\n", pbRegPairsC[bOp], pbRegPairsC[bOp]); - fprintf(fp, " cpu.z80F |= ((dwTemp >> 16) & Z80_FLAG_CARRY);\n"); - fprintf(fp, " cpu.z80HL = dwTemp & 0xffff;\n"); - return; - } - else // SBC - { - fprintf(fp, " dwTemp = cpu.z80HL - %s - (cpu.z80F & Z80_FLAG_CARRY);\n", pbRegPairsC[bOp]); - 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"); - fprintf(fp, " cpu.z80F |= ((dwTemp >> 8) & Z80_FLAG_SIGN);\n"); - fprintf(fp, " if (0 == (dwTemp & 0xffff))\n"); - fprintf(fp, " {\n"); - fprintf(fp, " cpu.z80F |= Z80_FLAG_ZERO;\n"); - fprintf(fp, " }\n"); - fprintf(fp, " cpu.z80F |= (((cpu.z80HL ^ dwTemp ^ %s) >> 8) & Z80_FLAG_HALF_CARRY);\n", pbRegPairsC[bOp]); - fprintf(fp, " cpu.z80F |= ((((%s ^ cpu.z80HL) & (%s ^ dwTemp)) >> 13) & Z80_FLAG_OVERFLOW_PARITY);\n", pbRegPairsC[bOp], pbRegPairsC[bOp]); - fprintf(fp, " cpu.z80F |= ((dwTemp >> 16) & Z80_FLAG_CARRY);\n"); - fprintf(fp, " cpu.z80HL = dwTemp & 0xffff;\n"); - return; - } - } - else - assert(0); -} - -void RetIRetNHandler(UINT32 dwOpcode) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - if (bThroughCallHandler) - { - fprintf(fp, " call PopWord\n"); - fprintf(fp, " xor esi, esi\n"); - fprintf(fp, " mov si, dx\n"); - fprintf(fp, " add esi, ebp\n"); - } - else - { - fprintf(fp, " mov dx, word [_z80sp] ; Get our current stack pointer\n"); - fprintf(fp, " mov si, [edx+ebp] ; Get our return address\n"); - fprintf(fp, " and esi, 0ffffh ; Only within 64K!\n"); - fprintf(fp, " add esi, ebp ; Add in our base address\n"); - fprintf(fp, " add word [_z80sp], 02h ; Remove our two bytes from the stack\n"); - } - - if (dwOpcode == 0x45) - { - fprintf(fp, " xor edx, edx\n"); - fprintf(fp, " mov dl, [_z80iff] ; Get interrupt flags\n"); - fprintf(fp, " shr dl, 1 ; Move IFF2->IFF1\n"); - fprintf(fp, " and [_z80iff], dword (~IFF1) ; Get rid of IFF 1\n"); - fprintf(fp, " and dl, IFF1 ; Just want the IFF 1 value now\n"); - fprintf(fp, " or dword [_z80iff], edx\n"); - } - - fprintf(fp, " xor edx, edx ; Make sure we don't hose things\n"); - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - if (0x4d == dwOpcode) // RETI - { - fprintf(fp, " pbSP = cpu.z80Base + cpu.z80sp; /* Normalize our stack PTR */\n"); - fprintf(fp, " dwAddr = *pbSP++; /* Pop LSB */\n"); - fprintf(fp, " dwAddr |= ((UINT32) *pbSP << 8); /* Pop MSB */\n"); - fprintf(fp, " cpu.z80sp += 2; /* Pop the word off */\n"); - fprintf(fp, " pbPC = (cpu.z80Base + dwAddr); /* Point PC to our return address */\n"); - } - else - if (0x45 == dwOpcode) // RETN - { - fprintf(fp, " pbSP = cpu.z80Base + cpu.z80sp; /* Normalize our stack PTR */\n"); - fprintf(fp, " dwAddr = *pbSP++; /* Pop LSB */\n"); - fprintf(fp, " dwAddr |= ((UINT32) *pbSP << 8); /* Pop MSB */\n"); - fprintf(fp, " cpu.z80sp += 2; /* Pop the word off */\n"); - fprintf(fp, " pbPC = (cpu.z80Base + dwAddr); /* Point PC to our return address */\n"); - fprintf(fp, " cpu.z80iff &= ~(IFF1); /* Keep IFF2 around */\n"); - fprintf(fp, " cpu.z80iff |= ((cpu.z80iff >> 1) & IFF1); /* IFF2->IFF1 */\n"); - } - else - { - InvalidInstructionC(2); - } - } - else - assert(0); -} - -void ExtendedOutHandler(UINT32 dwOpcode) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - if (b16BitIo == FALSE) - fprintf(fp, " mov dl, cl ; Address in DX... (C)\n"); - else - fprintf(fp, " mov dx, cx ; Address in DX... (BC)\n"); - - WriteValueToIo("dx", pbMathReg[(dwOpcode >> 3) & 0x07]); - - fprintf(fp, " xor edx, edx\n"); - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - if (b16BitIo == FALSE) - fprintf(fp, " dwAddr = cpu.z80C;\n"); - else - fprintf(fp, " dwAddr = cpu.z80BC;\n"); - - WriteValueToIo("dwAddr", pbMathRegC[(dwOpcode >> 3) & 0x07]); - } - else - assert(0); -} - -void ExtendedInHandler(UINT32 dwOpcode) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - if (b16BitIo == FALSE) - fprintf(fp, " mov dl, cl ; Address in DX... (C)\n"); - else - fprintf(fp, " mov dx, cx ; Address in DX... (BC)\n"); - - ReadValueFromIo("dx", pbMathReg[(dwOpcode >> 3) & 0x07]); - - fprintf(fp, ";\n; Remember, this variant of the IN instruction modifies the flags\n;\n\n"); - fprintf(fp, " sahf ; Restore our flags\n"); - fprintf(fp, " mov dh, ah ; Save flags for later\n"); - - if (0x50 == dwOpcode || 0x58 == dwOpcode) - { - fprintf(fp, " mov dl, %s\n", pbMathReg[(dwOpcode >> 3) & 0x07]); - fprintf(fp, " or dl, dl\n"); - } - else - fprintf(fp, " or %s, %s;\n", pbMathReg[(dwOpcode >> 3) & 0x07], pbMathReg[(dwOpcode >> 3) & 0x07]); - - fprintf(fp, " lahf\n"); - fprintf(fp, " and dh, 029h ; Only keep carry and two unused flags\n"); - fprintf(fp, " and ah, 0d4h\n"); - fprintf(fp, " or ah, dh\n"); - - fprintf(fp, " xor edx, edx\n"); - - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - if (b16BitIo == FALSE) - fprintf(fp, " dwAddr = cpu.z80C;\n"); - else - fprintf(fp, " dwAddr = cpu.z80BC;\n"); - - ReadValueFromIo("dwAddr", pbMathRegC[(dwOpcode >> 3) & 0x07]); - - // Set flags! - - fprintf(fp, " cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);\n"); - fprintf(fp, " cpu.z80F |= bPostORFlags[%s];\n", pbMathRegC[(dwOpcode >> 3) & 0x07]); - } - else - assert(0); -} - -void NegHandler(UINT32 dwOpcode) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - fprintf(fp, " sahf\n"); - fprintf(fp, " sub dh, al\n"); - fprintf(fp, " lahf\n"); - fprintf(fp, " mov al, dh\n"); - - SetOverflow(); - fprintf(fp, " or ah, 02h\n"); - fprintf(fp, " xor edx, edx\n"); - - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - SetSubFlagsSZHVC("0", "cpu.z80A"); - fprintf(fp, " cpu.z80A = 0 - cpu.z80A;\n"); - } - else - assert(0); -} - -void ExtendedRegIntoMemory(UINT32 dwOpcode) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - fprintf(fp, " mov dx, [esi] ; Get our address to write to\n"); - fprintf(fp, " add esi, 2 ; Next address, please...\n"); - - if (dwOpcode == 0x43) - WriteValueToMemory("dx", "cl"); - if (dwOpcode == 0x53) - WriteValueToMemory("dx", "byte [_z80de]"); - if (dwOpcode == 0x63) - WriteValueToMemory("dx", "bl"); - if (dwOpcode == 0x73) - WriteValueToMemory("dx", "byte [_z80sp]"); - - fprintf(fp, " inc dx\n"); - - if (dwOpcode == 0x43) - WriteValueToMemory("dx", "ch"); - if (dwOpcode == 0x53) - WriteValueToMemory("dx", "byte [_z80de + 1]"); - if (dwOpcode == 0x63) - WriteValueToMemory("dx", "bh"); - if (dwOpcode == 0x73) - WriteValueToMemory("dx", "byte [_z80sp + 1]"); - - fprintf(fp, " xor edx, edx ; Zero our upper word\n"); - - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, " dwTemp = *pbPC++;\n"); - fprintf(fp, " dwTemp |= ((UINT32) *pbPC++ << 8);\n"); - - if (0x43 == dwOpcode) // LD (xxxxh), BC - WriteWordToMemory("dwTemp", "cpu.z80BC"); - if (0x53 == dwOpcode) // LD (xxxxh), DE - WriteWordToMemory("dwTemp", "cpu.z80DE"); - if (0x63 == dwOpcode) // LD (xxxxh), HL - WriteWordToMemory("dwTemp", "cpu.z80HL"); - if (0x73 == dwOpcode) // LD (xxxxh), SP - WriteWordToMemory("dwTemp", "cpu.z80sp"); - } - else - assert(0); -} - -void LdRegpair(UINT32 dwOpcode) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - fprintf(fp, " mov dx, [esi] ; Get address to load\n"); - fprintf(fp, " add esi, 2 ; Skip over it so we don't execute it\n"); - - if (dwOpcode == 0x4b) - ReadValueFromMemory("dx", "cl"); - if (dwOpcode == 0x5b) - ReadValueFromMemory("dx", "byte [_z80de]"); - if (dwOpcode == 0x7b) - ReadValueFromMemory("dx", "byte [_z80sp]"); - - fprintf(fp, " inc dx\n"); - - if (dwOpcode == 0x4b) - ReadValueFromMemory("dx", "ch"); - if (dwOpcode == 0x5b) - ReadValueFromMemory("dx", "byte [_z80de + 1]"); - if (dwOpcode == 0x7b) - ReadValueFromMemory("dx", "byte [_z80sp + 1]"); - - fprintf(fp, " xor edx, edx\n"); - - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, " dwTemp = *pbPC++;\n"); - fprintf(fp, " dwTemp |= ((UINT32) *pbPC++ << 8);\n"); - - if (0x4b == dwOpcode) - ReadWordFromMemory("dwTemp", "cpu.z80BC"); - if (0x5b == dwOpcode) - ReadWordFromMemory("dwTemp", "cpu.z80DE"); - if (0x7b == dwOpcode) - ReadWordFromMemory("dwTemp", "cpu.z80sp"); - } - else - assert(0); -} - -void LDILDRLDIRLDDRHandler(UINT32 dwOpcode) -{ - UINT32 dwOrgGlobal = 0; - - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - if (dwOpcode == 0xb0 || dwOpcode == 0xb8) - { - dwOrgGlobal = dwGlobalLabel; - fprintf(fp, "ldRepeat%ld:\n", dwGlobalLabel); - } - - ReadValueFromMemory("bx", "dl"); - - // Here we write the byte back to the target - - WriteValueToMemory("[_z80de]", "dl"); - - // Now we decide what to do - - if ((dwOpcode & 0x0f) == 0) - { - fprintf(fp, " inc bx ; Increment HL\n"); - fprintf(fp, " inc word [_z80de] ; Increment DE\n"); - } - else - { - fprintf(fp, " dec bx ; Decrement HL\n"); - fprintf(fp, " dec word [_z80de] ; Decrement DE\n"); - } - - fprintf(fp, " dec cx ; Decrement BC\n"); - - if (dwOpcode == 0xb0 || dwOpcode == 0xb8) - { - if (FALSE == bNoTiming) - { - fprintf(fp, " jz noMore%ld\n", dwGlobalLabel); - fprintf(fp, " sub edi, dword 16 ; 16 T-States per iteration\n"); - fprintf(fp, " js noMore%ld\n", dwGlobalLabel); - } - else - { - fprintf(fp, " jz noMore%ld\n", dwGlobalLabel); - } - - fprintf(fp, " jmp ldRepeat%ld ; Loop until we're done!\n", dwOrgGlobal); - fprintf(fp, "noMore%ld:\n", dwGlobalLabel); - } - - fprintf(fp, " and ah, 0e9h ; Knock out H & N and P/V\n"); - fprintf(fp, " or cx, cx ; Flag BC\n"); - fprintf(fp, " jz atZero%ld ; We're done!\n", dwGlobalLabel); - - if (dwOpcode == 0xb0 || dwOpcode == 0xb8) - { - // It's a repeat, so let's readjust ESI, shall we? - - fprintf(fp, " or ah, 04h ; Non-zero - we're still going!\n"); - fprintf(fp, " sub esi, 2 ; Adjust back to the beginning of the instruction\n"); - fprintf(fp, " jmp noMoreExec\n\n"); - } - else - if (dwOpcode == 0xa0 || dwOpcode == 0xa8) - { - fprintf(fp, " or ah, 04h ; Non-zero - we're still going!\n"); - } - - fprintf(fp, "atZero%ld:\n", dwGlobalLabel); - ++dwGlobalLabel; - - fprintf(fp, " xor edx, edx ; Make sure we don't hose things\n"); - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - // This is the actual move - - if (0xb0 == dwOpcode || 0xb8 == dwOpcode) // Repeat instruction? - { - fprintf(fp, " while ((sdwCyclesRemaining > 0) && (cpu.z80BC))\n"); - - fprintf(fp, " {\n"); - } - - ReadValueFromMemory("cpu.z80HL", "bTemp"); - WriteValueToMemory("cpu.z80DE", "bTemp"); - - if ((dwOpcode & 0x0f) == 0) - { - fprintf(fp, " ++cpu.z80HL;\n"); - fprintf(fp, " ++cpu.z80DE;\n"); - } - else - { - fprintf(fp, " --cpu.z80HL;\n"); - fprintf(fp, " --cpu.z80DE;\n"); - } - - fprintf(fp, " --cpu.z80BC;\n"); - fprintf(fp, " cpu.z80HL &= 0xffff;\n"); - fprintf(fp, " cpu.z80DE &= 0xffff;\n"); - fprintf(fp, " cpu.z80BC &= 0xffff;\n"); - - if (0xb0 == dwOpcode || 0xb8 == dwOpcode) // Repeat instruction? - { - fprintf(fp, " sdwCyclesRemaining -= 21;\n"); - - fprintf(fp, " }\n"); - } - - // Time for a flag fixup! - - fprintf(fp, " cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_OVERFLOW_PARITY);\n"); - fprintf(fp, " if (cpu.z80BC)\n"); - fprintf(fp, " {\n"); - - if (0xb0 == dwOpcode || 0xb8 == dwOpcode) - { - fprintf(fp, " pbPC -= 2; /* Back up so we hit this instruction again */\n"); - } - - fprintf(fp, " cpu.z80F |= Z80_FLAG_OVERFLOW_PARITY;\n"); - fprintf(fp, " }\n"); - - if (0xb0 == dwOpcode || 0xb8 == dwOpcode) // Repeat instruction? - { - fprintf(fp, " sdwCyclesRemaining -= 16;\n"); - } - } - else - assert(0); -} - -void IMHandler(UINT32 dwOpcode) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - if (dwOpcode == 0x46) - fprintf(fp, " mov dword [_z80interruptMode], 0 ; IM 0\n"); - - if (dwOpcode == 0x56) - { - fprintf(fp, " mov dword [_z80interruptMode], 1 ; Interrupt mode 1\n"); - fprintf(fp, " mov word [_z80intAddr], 038h ; Interrupt mode 1 cmd!\n"); - } - - if (dwOpcode == 0x5e) - fprintf(fp, " mov dword [_z80interruptMode], 2 ; IM 2\n"); - - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - if (0x46 == dwOpcode) // IM 0 - fprintf(fp, " cpu.z80interruptMode = 0;\n"); - - if (0x56 == dwOpcode) // IM 1 - { - fprintf(fp, " cpu.z80interruptMode = 1;\n"); - fprintf(fp, " cpu.z80intAddr = 0x38;\n"); - } - - if (0x5e == dwOpcode) // IM 2 - fprintf(fp, " cpu.z80interruptMode = 2;\n"); - } - else - assert(0); - -} - -void IRHandler(UINT32 dwOpcode) -{ - char *src, *dst; - - if (MZ80_ASSEMBLY_X86 == bWhat) - { - switch(dwOpcode) - { - case 0x57: - dst = "al"; src="[_z80i]"; break; - case 0x5F: - dst = "al"; src="[_z80r]"; break; - case 0x47: - dst = "[_z80i]"; src="al"; break; - case 0x4F: - dst = "[_z80r]"; src="al"; break; - } - - ProcBegin(dwOpcode); - - fprintf(fp, " mov %s, %s\n",dst,src); - - if (dwOpcode == 0x5f) - { - fprintf(fp, " and ah, 029h ; No N, H, Z, or S!\n"); - fprintf(fp, " or al,al ; Get appropriate flags\n"); - fprintf(fp, " o16 pushf\n"); - fprintf(fp, " pop dx\n"); - fprintf(fp, " and dl, 0c0h\n"); - fprintf(fp, " or ah, dl ; OR In our S & Z flags\n"); - - fprintf(fp, " mov dl, [_z80iff]\n"); - fprintf(fp, " and dl, IFF2\n"); - fprintf(fp, " shl dl, 1\n"); - fprintf(fp, " or ah, dl\n"); - - // Randomize R - - fprintf(fp, " mov edx, [dwLastRSample]\n"); - fprintf(fp, " sub edx, edi\n"); - fprintf(fp, " add edx, [_z80rCounter]\n"); - fprintf(fp, " shr edx, 2\n"); - fprintf(fp, " and edx, 07fh\n"); - fprintf(fp, " and byte [_z80r], 80h\n"); - fprintf(fp, " or byte [_z80r], dl\n"); - - fprintf(fp, " xor edx, edx\n"); - fprintf(fp, " mov [dwLastRSample], edi\n"); - } - - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - if (0x5f == dwOpcode) // LD A, R - { - fprintf(fp, " cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);\n"); - fprintf(fp, " cpu.z80F |= bPostORFlags[cpu.z80r];\n"); - fprintf(fp, " cpu.z80F = (cpu.z80F & ~(Z80_FLAG_OVERFLOW_PARITY)) | ((cpu.z80iff & IFF2) << 1);\n"); - fprintf(fp, " cpu.z80A = cpu.z80r;\n"); - - // Now randomize a little - - fprintf(fp, " bTemp = (cpu.z80r + (cpu.z80B + sdwCyclesRemaining + 1 + cpu.z80H)) ^ cpu.z80A;\n"); - fprintf(fp, " cpu.z80r = (cpu.z80r & 0x80) | (bTemp & 0x7f);\n"); - } - else - if (0x47 == dwOpcode) // LD I, A - { - fprintf(fp, " cpu.z80i = cpu.z80A;\n"); - } - else - if (0x57 == dwOpcode) // LD A, I - { - fprintf(fp, " cpu.z80F &= ~(Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE | Z80_FLAG_ZERO | Z80_FLAG_SIGN);\n"); - fprintf(fp, " cpu.z80F |= ((cpu.z80iff & IFF2) << 1);\n"); - fprintf(fp, " cpu.z80A = cpu.z80i;\n"); - fprintf(fp, " cpu.z80F |= bPostORFlags[cpu.z80A];\n"); - } - else - if (0x4f == dwOpcode) // LD R, A - { - fprintf(fp, " cpu.z80r = cpu.z80A;\n"); - } - else - { - InvalidInstructionC(2); - } - } - else - assert(0); -} - -// DD/FD Area - -void DDFDCBHandler(UINT32 dwOpcode) -{ - UINT32 dwData = 0; - - if (MZ80_ASSEMBLY_X86 == bWhat) - { - fprintf(fp, "%sInst%.2x:\n", majorOp, dwOpcode); - fprintf(fp, " mov dx, [esi] ; Get our instruction (and offset)\n"); - fprintf(fp, " add esi, 2 ; Increment our PC\n"); - - fprintf(fp, " mov byte [_orgval], dl ; Store our value\n"); - fprintf(fp, " or dl, dl\n"); - fprintf(fp, " js notNeg%ld\n", dwGlobalLabel); - fprintf(fp, " mov byte [_orgval + 1], 00h;\n"); - - fprintf(fp, " jmp short jumpHandler%ld\n", dwGlobalLabel); - fprintf(fp, "notNeg%ld:\n", dwGlobalLabel); - fprintf(fp, " mov byte [_orgval + 1], 0ffh; It's negative\n"); - fprintf(fp, "jumpHandler%ld:\n", dwGlobalLabel++); - fprintf(fp, " shl ebx, 16 ; Save BX away\n"); - fprintf(fp, " mov bx, [_z80%s]\n", mz80Index); - fprintf(fp, " add [_orgval], bx\n"); - fprintf(fp, " shr ebx, 16 ; Restore BX\n"); - fprintf(fp, " mov dl, dh ; Get our instruction\n"); - fprintf(fp, " xor dh, dh ; Zero this\n"); - fprintf(fp, " jmp dword [z80ddfdcbInstructions+edx*4]\n\n"); - } - else - if (MZ80_C == bWhat) - { - if (strcmp("cpu.z80IX", mz80Index) == 0) - dwData = 0; - else - dwData = 1; - - fprintf(fp, " DDFDCBHandler(%d);\n", dwData); - } - else - assert(0); -} - -void LoadIndexReg(UINT32 dwOpcode) -{ - UINT8 string[150]; - - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - sprintf(string, "[_z80%s]", mz80Index); - - fprintf(fp, " mov dx, [esi] ; Get our address to store\n"); - fprintf(fp, " add esi, 2\n"); - - ReadWordFromMemory("dx", string); - fprintf(fp, " xor edx, edx\n"); - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, " dwAddr = *pbPC++;\n"); - fprintf(fp, " dwAddr |= ((UINT32) *pbPC++ << 8);\n"); - ReadWordFromMemory("dwAddr", mz80Index); - } - else - assert(0); -} - -void StoreIndexReg(UINT32 dwOpcode) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - fprintf(fp, " mov dx, [esi] ; Get our address to store\n"); - fprintf(fp, " add esi, 2\n"); - fprintf(fp, " mov [_orgval], dx\n"); - - fprintf(fp, " mov dl, [_z80%s]\n", mz80Index); - WriteValueToMemory("[_orgval]", "dl"); - - fprintf(fp, " inc word [_orgval]\n"); - - fprintf(fp, " mov dl, [_z80%s + 1]\n", mz80Index); - WriteValueToMemory("[_orgval]", "dl"); - fprintf(fp, " xor edx, edx\n"); - - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, " dwAddr = *pbPC++;\n"); - fprintf(fp, " dwAddr |= ((UINT32) *pbPC++ << 8);\n"); - WriteWordToMemory("dwAddr", mz80Index); - } - else - assert(0); -} - -void LdIndexPtrReg(UINT32 dwOpcode) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - IndexedOffset(mz80Index); - - // DX Contains the address - - WriteValueToMemory("dx", pbMathReg[dwOpcode & 0x07]); - fprintf(fp, " xor edx, edx\n"); - - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, " sdwAddr = (INT8) *pbPC++; // Get the offset\n"); - fprintf(fp, " sdwAddr = ((INT32) %s + sdwAddr) & 0xffff;\n", mz80Index); - - WriteValueToMemory("sdwAddr", pbMathRegC[dwOpcode & 0x07]); - } - else - assert(0); -} - -void UndocMathIndex(UINT32 dwOpcode) -{ - UINT32 dwOpcode1 = 0; - UINT8 *pbIndexReg = NULL; - - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - if (dwOpcode & 1) - fprintf(fp, " mov dl, byte [_z80%s]\n", mz80Index); - else - fprintf(fp, " mov dl, byte [_z80%s + 1]\n", mz80Index); - - // Info is in DL - let's do the math operation - - fprintf(fp, " sahf ; Store our flags in x86 flag reg\n"); - - dwOpcode1 = (dwOpcode & 0xf8); // Only the operation - - if (dwOpcode1 == 0x80) - fprintf(fp, " add al, dl\n"); - else - if (dwOpcode1 == 0x88) - fprintf(fp, " adc al, dl\n"); - else - if (dwOpcode1 == 0x90) - fprintf(fp, " sub al, dl\n"); - else - if (dwOpcode1 == 0x98) - fprintf(fp, " sbb al, dl\n"); - else - if (dwOpcode1 == 0xa0) - fprintf(fp, " and al, dl\n"); - else - if (dwOpcode1 == 0xa8) - fprintf(fp, " xor al, dl\n"); - else - if (dwOpcode1 == 0xb0) - fprintf(fp, " or al, dl\n"); - else - if (dwOpcode1 == 0xb8) - fprintf(fp, " cmp al, dl\n"); - else - assert(0); - - fprintf(fp, " lahf ; Get flags back into AH\n"); - - if (dwOpcode1 != 0xa8 && dwOpcode1 != 0xa0 && dwOpcode1 != 0xb0) - { - SetOverflow(); - } - - if (dwOpcode1 == 0xa8) - fprintf(fp, " and ah, 0ech ; Only these flags matter!\n"); - - if (dwOpcode1 == 0xa0) - { - fprintf(fp, " and ah, 0ech ; Only these flags matter!\n"); - fprintf(fp, " or ah, 010h ; Half carry gets set\n"); - } - - if (dwOpcode1 == 0xb0) - fprintf(fp, " and ah, 0ech ; No H, N, or C\n"); - - if (dwOpcode1 == 0xb8) - fprintf(fp, " or ah, 02h ; Negative gets set on a compare\n"); - - if (dwOpcode1 == 0x80 || dwOpcode1 == 0x88) - fprintf(fp, " and ah, 0fdh ; No N!\n"); - - if (dwOpcode1 == 0x90 || dwOpcode1 == 0x98) - fprintf(fp, " or ah, 02h ; N Gets set!\n"); - - if (dwOpcode1 == 0xb0) - fprintf(fp, " and ah, 0ech ; No H, N, or C\n"); - - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - if (dwOpcode & 1) - pbIndexReg = mz80IndexHalfLow; - else - pbIndexReg = mz80IndexHalfHigh; - - dwOpcode1 = (dwOpcode & 0xf8); // Only the operation - - if (0x80 == dwOpcode1) // ADD - { - fprintf(fp, " bTemp2 = cpu.z80A + %s;\n", pbIndexReg); - SetAddFlagsSZHVC("cpu.z80A", pbIndexReg); - } - else - if (0x88 == dwOpcode1) // ADC - { - fprintf(fp, " bTemp2 = cpu.z80A + %s + (cpu.z80F & Z80_FLAG_CARRY);\n", pbIndexReg); - SetAdcFlagsSZHVC("cpu.z80A", pbIndexReg); - } - else - if (0x90 == dwOpcode1) // SUB - { - fprintf(fp, " bTemp2 = cpu.z80A - %s;\n", pbIndexReg); - SetSubFlagsSZHVC("cpu.z80A", pbIndexReg); - } - else - if (0x98 == dwOpcode1) // SBC - { - fprintf(fp, " bTemp2 = cpu.z80A - %s - (cpu.z80F & Z80_FLAG_CARRY);\n", pbIndexReg); - SetSbcFlagsSZHVC("cpu.z80A", pbIndexReg); - } - else - if (0xa0 == dwOpcode1) // AND - { - fprintf(fp, " cpu.z80A &= %s;\n", pbIndexReg); - 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"); - fprintf(fp, " cpu.z80F |= bPostANDFlags[cpu.z80A];\n\n"); - } - else - if (0xa8 == dwOpcode1) // XOR - { - fprintf(fp, " cpu.z80A ^= %s;\n", pbIndexReg); - 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"); - fprintf(fp, " cpu.z80F |= bPostORFlags[cpu.z80A];\n\n"); - } - else - if (0xb0 == dwOpcode1) // OR - { - fprintf(fp, " cpu.z80A |= %s;\n", pbIndexReg); - 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"); - fprintf(fp, " cpu.z80F |= bPostORFlags[cpu.z80A];\n\n"); - } - else - if (0xb8 == dwOpcode1) // CP - Don't do anything! Just flags! - { - 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"); - fprintf(fp, " cpu.z80F |= bPostORFlags[cpu.z80A];\n\n"); - } - else - { - assert(0); - } - - InvalidInstructionC(2); - } - else - assert(0); -} - -void UndocLoadHalfIndexReg(UINT32 dwOpcode) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - fprintf(fp, " mov dl, [esi] ; Get immediate byte to load\n"); - fprintf(fp, " inc esi ; Next byte\n"); - - if (dwOpcode == 0x26) - fprintf(fp, " mov byte [_z80%s + 1], dl\n", mz80Index); - if (dwOpcode == 0x2e) - fprintf(fp, " mov byte [_z80%s], dl\n", mz80Index); - - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - if (dwOpcode & 0x08) - fprintf(fp, " %s = *pbPC++;\n", mz80IndexHalfLow); - else - fprintf(fp, " %s = *pbPC++;\n", mz80IndexHalfHigh); - } - else - assert(0); -} - -void UndocIncDecIndexReg(UINT32 dwOpcode) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - fprintf(fp, " sahf\n"); - - if (dwOpcode == 0x24) - fprintf(fp, " inc byte [_z80%s + 1]\n", mz80Index); - if (dwOpcode == 0x25) - fprintf(fp, " dec byte [_z80%s + 1]\n", mz80Index); - - if (dwOpcode == 0x2c) - fprintf(fp, " inc byte [_z80%s]\n", mz80Index); - if (dwOpcode == 0x2d) - fprintf(fp, " dec byte [_z80%s]\n", mz80Index); - - fprintf(fp, " lahf\n"); - SetOverflow(); - - if ((0x24 == dwOpcode) || (0x2c == dwOpcode)) - fprintf(fp, " and ah, 0fdh ; Knock out N!\n"); - else - fprintf(fp, " or ah, 02h ; Set negative!\n"); - - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, " cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);\n"); - - if (0x24 == dwOpcode || 0x2c == dwOpcode) - { - if (dwOpcode & 0x08) - fprintf(fp, " cpu.z80F |= bPostIncFlags[%s++];\n", mz80IndexHalfLow); - else - fprintf(fp, " cpu.z80F |= bPostIncFlags[%s++];\n", mz80IndexHalfHigh); - } - else - { - if (dwOpcode & 0x08) - fprintf(fp, " cpu.z80F |= bPostDecFlags[%s--];\n", mz80IndexHalfLow); - else - fprintf(fp, " cpu.z80F |= bPostDecFlags[%s--];\n", mz80IndexHalfHigh); - } - } - else - assert(0); -} - -void ExIndexed(UINT32 dwOpcode) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - if( bThroughCallHandler ) - { - fprintf(fp, " mov dx, word [_z80%s]\n", mz80Index); - fprintf(fp, " push dx\n"); - fprintf(fp, " call PopWord\n"); - fprintf(fp, " mov [_z80%s], dx\n", mz80Index); - fprintf(fp, " pop dx\n"); - fprintf(fp, " mov [_wordval], dx\n" ); - fprintf(fp, " call PushWord\n" ); - } - else - { - fprintf(fp, " mov [cyclesRemaining], edi\n"); - fprintf(fp, " mov dx, word [_z80sp]\n"); - fprintf(fp, " xor edi, edi\n"); - fprintf(fp, " mov di, [_z80%s]\n", mz80Index); - fprintf(fp, " xchg di, [ebp+edx]\n"); - fprintf(fp, " mov [_z80%s], di\n", mz80Index); - fprintf(fp, " xor edx, edx\n"); - fprintf(fp, " mov edi, [cyclesRemaining]\n"); - } - - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - ReadWordFromMemory("cpu.z80sp", "dwAddr"); - WriteWordToMemory("cpu.z80sp", mz80Index); - fprintf(fp, " %s = dwAddr;\n", mz80Index); - } - else - assert(0); -} - -void IncDecIndexReg(UINT32 dwOpcode) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - if (dwOpcode == 0x23) - fprintf(fp, " inc word [_z80%s] ; Increment our mz80Index register\n", mz80Index); - else - fprintf(fp, " dec word [_z80%s] ; Increment our mz80Index register\n", mz80Index); - - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - if (0x23 == dwOpcode) - { - fprintf(fp, " %s++;\n", mz80Index); - } - else - { - fprintf(fp, " %s--;\n", mz80Index); - } - - fprintf(fp, " %s &= 0xffff;\n", mz80Index); - } - else - assert(0); -} - -void LdRegIndexOffset(UINT32 dwOpcode) -{ - UINT32 dwOpcode1 = 0; - - dwOpcode1 = (dwOpcode & 0x38) >> 3; - - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - IndexedOffset(mz80Index); - - ReadValueFromMemory("dx", pbMathReg[dwOpcode1]); - - fprintf(fp, " xor edx, edx ; Make sure we don't hose things\n"); - dwGlobalLabel++; - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, " sdwAddr = (INT8) *pbPC++; // Get the offset\n"); - fprintf(fp, " sdwAddr = ((INT32) %s + sdwAddr) & 0xffff;\n", mz80Index); - - ReadValueFromMemory("sdwAddr", pbMathRegC[dwOpcode1]); - } - else - assert(0); -} - -void LdByteToIndex(UINT32 dwOpcode) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - fprintf(fp, " mov dx, [esi] ; Get our address\n"); - fprintf(fp, " add esi, 2 ; Skip over our storage bytes\n"); - fprintf(fp, " mov [cyclesRemaining], edi\n"); - fprintf(fp, " mov di, dx ; Store it here for later\n"); - fprintf(fp, " xor dh, dh\n"); - fprintf(fp, " or dl, dl\n"); - fprintf(fp, " jns noNegate%ld\n", dwGlobalLabel); - fprintf(fp, " dec dh\n"); - fprintf(fp, "noNegate%ld:\n", dwGlobalLabel); - fprintf(fp, " add dx, [_z80%s] ; Add in our index\n", mz80Index); - fprintf(fp, " mov [_orgval], dx ; Store our address to write to\n"); - fprintf(fp, " mov dx, di\n"); - fprintf(fp, " xchg dh, dl\n"); - fprintf(fp, " mov edi, [cyclesRemaining]\n"); - - WriteValueToMemory("[_orgval]", "dl"); - - fprintf(fp, " xor edx, edx\n"); - ++dwGlobalLabel; - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, " sdwAddr = (INT8) *pbPC++; // Get the offset\n"); - fprintf(fp, " sdwAddr = ((INT32) %s + sdwAddr) & 0xffff;\n", mz80Index); - - WriteValueToMemory("sdwAddr", "*pbPC++"); - } - else - assert(0); -} - - -void SPToIndex(UINT32 dwOpcode) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - fprintf(fp, " mov dx, [_z80%s] ; Get our source register\n", mz80Index); - fprintf(fp, " mov word [_z80sp], dx ; Store our new SP\n"); - fprintf(fp, " xor edx, edx\n"); - - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, " cpu.z80sp = %s;\n", mz80Index); - } - else - assert(0); -} - -void AddIndexHandler(UINT32 dwOpcode) -{ - UINT8 bRegPair; - - bRegPair = dwOpcode >> 4; - - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - fprintf(fp, " mov dh, ah ; Get our flags\n"); - fprintf(fp, " and dh, 0ech ; Preserve the top three and bits 2 & 3\n"); - - fprintf(fp, " mov [cyclesRemaining], edi\n"); - fprintf(fp, " mov di, [_z80%s] ; Get our value\n", mz80Index); - fprintf(fp, " mov [_orgval], di ; Store our original value\n"); - fprintf(fp, " add di, %s\n", pbIndexedRegPairs[(dwOpcode & 0x30) >> 4]); - fprintf(fp, " lahf\n"); - fprintf(fp, " mov [_z80%s], di ; Store our register back\n", mz80Index); - - fprintf(fp, " mov di, [_orgval] ; Get original\n"); - fprintf(fp, " xor di, word [_z80%s] ; XOR It with our computed value\n", mz80Index); - fprintf(fp, " xor di, %s\n", pbIndexedRegPairs[(dwOpcode & 0x30) >> 4]); - fprintf(fp, " and di, 1000h ; Just our half carry\n"); - fprintf(fp, " or dx, di ; Or in our flags\n"); - fprintf(fp, " and ah, 01h ; Just carry\n"); - fprintf(fp, " or ah, dh\n"); - fprintf(fp, " mov edi, [cyclesRemaining]\n"); - fprintf(fp, " xor edx, edx\n"); - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - if (bRegPair != 2) - { - fprintf(fp, " cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY);\n"); - fprintf(fp, " dwTemp = %s + %s;\n", mz80Index, pbRegPairsC[bRegPair]); - fprintf(fp, " cpu.z80F |= ((dwTemp >> 16) & Z80_FLAG_CARRY) | (((%s ^ dwTemp ^ %s) >> 8) & Z80_FLAG_HALF_CARRY);\n", mz80Index, pbRegPairsC[bRegPair]); - fprintf(fp, " %s = dwTemp & 0xffff;\n", mz80Index); - } - else - { - fprintf(fp, " cpu.z80F &= ~(Z80_FLAG_CARRY | Z80_FLAG_NEGATIVE | Z80_FLAG_HALF_CARRY);\n"); - fprintf(fp, " dwTemp = %s + %s;\n", mz80Index, mz80Index); - fprintf(fp, " cpu.z80F |= ((dwTemp >> 16) & Z80_FLAG_CARRY) | (((%s ^ dwTemp ^ %s) >> 8) & Z80_FLAG_HALF_CARRY);\n", mz80Index, pbRegPairsC[bRegPair]); - fprintf(fp, " %s = dwTemp & 0xffff;\n", mz80Index); - } - } - else - assert(0); -} - -void JPIXIYHandler(UINT32 dwOpcode) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - fprintf(fp, " mov dx, [_z80%s] ; Get our value\n", mz80Index); - fprintf(fp, " mov esi, edx ; New PC!\n"); - fprintf(fp, " add esi, ebp ; Add in our base\n"); - fprintf(fp, " xor edx, edx\n"); - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, " pbPC = cpu.z80Base + %s;\n", mz80Index); - } - else - assert(0); -} - -void IncDecIndexed(UINT32 dwOpcode) -{ - UINT8 szIndex[30]; - - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - IndexedOffset(mz80Index); - - fprintf(fp, " mov [_orgval], dx\n"); - - ReadValueFromMemory("dx", "dl"); - - fprintf(fp, " sahf\n"); - - if (dwOpcode == 0x34) - fprintf(fp, " inc dl\n"); - else - fprintf(fp, " dec dl\n"); - fprintf(fp, " lahf\n"); - - fprintf(fp, " o16 pushf\n"); - fprintf(fp, " shl edx, 16\n"); - fprintf(fp, " and ah, 0fbh ; Knock out parity/overflow\n"); - fprintf(fp, " pop dx\n"); - fprintf(fp, " and dh, 08h ; Just the overflow\n"); - fprintf(fp, " shr dh, 1 ; Shift it into position\n"); - fprintf(fp, " or ah, dh ; OR It in with the real flags\n"); - - fprintf(fp, " shr edx, 16\n"); - - if (dwOpcode == 0x34) - fprintf(fp, " and ah, 0fdh ; Knock out N!\n"); - else - fprintf(fp, " or ah, 02h ; Make it N!\n"); - - WriteValueToMemory("[_orgval]", "dl"); - - fprintf(fp, " xor edx, edx\n"); - - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, " sdwAddr = (INT8) *pbPC++; /* Get LSB first */\n"); - fprintf(fp, " dwAddr = (sdwAddr + (INT32) %s) & 0xffff;\n", mz80Index); - - ReadValueFromMemory("dwAddr", "bTemp"); - - fprintf(fp, " cpu.z80F &= ~(Z80_FLAG_SIGN | Z80_FLAG_ZERO | Z80_FLAG_HALF_CARRY | Z80_FLAG_OVERFLOW_PARITY | Z80_FLAG_NEGATIVE);\n"); - - if (0x34 == dwOpcode) - { - fprintf(fp ," cpu.z80F |= bPostIncFlags[bTemp++];\n"); - } - else - { - fprintf(fp ," cpu.z80F |= bPostDecFlags[bTemp--];\n"); - } - - WriteValueToMemory("dwAddr", "bTemp"); - } - else - assert(0); -} - -void MathOperationIndexed(UINT32 dwOpcode) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - IndexedOffset(mz80Index); - ReadValueFromMemory("dx", "dl"); - - fprintf(fp, " sahf\n"); - - if (dwOpcode == 0x86) // Add - fprintf(fp, " add al, dl\n"); - if (dwOpcode == 0x8e) // Adc - fprintf(fp, " adc al, dl\n"); - if (dwOpcode == 0x96) // Sub - fprintf(fp, " sub al, dl\n"); - if (dwOpcode == 0x9e) // Sbc - fprintf(fp, " sbb al, dl\n"); - if (dwOpcode == 0xa6) // And - fprintf(fp, " and al, dl\n"); - if (dwOpcode == 0xae) // Xor - fprintf(fp, " xor al, dl\n"); - if (dwOpcode == 0xb6) // Or - fprintf(fp, " or al, dl\n"); - if (dwOpcode == 0xbe) // Cp - fprintf(fp, " cmp al, dl\n"); - - fprintf(fp, " lahf\n"); - - if (dwOpcode == 0x86 || dwOpcode == 0x8e) - { - SetOverflow(); - fprintf(fp, " and ah, 0fdh ; Knock out negative\n"); - } - - if (dwOpcode == 0x96 || dwOpcode == 0x9e || dwOpcode == 0xbe) - { - SetOverflow(); - fprintf(fp, " or ah, 02h ; Set negative\n"); - } - - if (dwOpcode == 0xae || dwOpcode == 0xb6) - fprintf(fp, " and ah, 0ech ; Knock out H, N, and C\n"); - - if (dwOpcode == 0xa6) - { - fprintf(fp, " and ah,0fch ; Knock out N & C\n"); - fprintf(fp, " or ah, 10h ; Set half carry\n"); - } - - fprintf(fp, " xor edx, edx\n"); - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, " sdwAddr = (INT8) *pbPC++; /* Get LSB first */\n"); - fprintf(fp, " dwAddr = (sdwAddr + (INT32) %s) & 0xffff;\n", mz80Index); - - ReadValueFromMemory("dwAddr", "bTemp"); - - if (0x86 == dwOpcode) // ADD A, (IX/IY+nn) - { - SetAddFlagsSZHVC("cpu.z80A", "bTemp"); - fprintf(fp, " cpu.z80A += bTemp;\n"); - } - else - if (0x8e == dwOpcode) // ADC A, (IX/IY+nn) - { - fprintf(fp, " bTemp2 = (cpu.z80F & Z80_FLAG_CARRY);\n"); - SetAdcFlagsSZHVC("cpu.z80A", "bTemp"); - fprintf(fp, " cpu.z80A += bTemp + bTemp2;\n"); - } - else - if (0x96 == dwOpcode) // SUB A, (IX/IY+nn) - { - SetSubFlagsSZHVC("cpu.z80A", "bTemp"); - fprintf(fp, " cpu.z80A -= bTemp;\n"); - } - else - if (0x9e == dwOpcode) // SBC A, (IX/IY+nn) - { - fprintf(fp, " bTemp2 = cpu.z80A;\n"); - fprintf(fp, " cpu.z80A = cpu.z80A - bTemp - (cpu.z80F & Z80_FLAG_CARRY);\n"); - SetSbcFlagsSZHVC("bTemp2", "bTemp"); - } - else - if (0xa6 == dwOpcode) // AND A, (IX/IY+nn) - { - fprintf(fp, " cpu.z80A &= bTemp;\n"); - 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"); - fprintf(fp, " cpu.z80F |= bPostANDFlags[cpu.z80A];\n\n"); - } - else - if (0xae == dwOpcode) // XOR A, (IX/IY+nn) - { - fprintf(fp, " cpu.z80A ^= bTemp;\n"); - 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"); - fprintf(fp, " cpu.z80F |= bPostORFlags[cpu.z80A];\n\n"); - } - else - if (0xb6 == dwOpcode) // OR A, (IX/IY+nn) - { - fprintf(fp, " cpu.z80A |= bTemp;\n"); - 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"); - fprintf(fp, " cpu.z80F |= bPostORFlags[cpu.z80A];\n\n"); - } - else - if (0xbe == dwOpcode) // CP A, (IX/IY+nn) - { - SetSubFlagsSZHVC("cpu.z80A", "bTemp"); - } - else - InvalidInstructionC(2); - } - else - assert(0); -} - -void UndocIndexToReg(UINT32 dwOpcode) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - if ((dwOpcode & 0x07) == 2 || (dwOpcode & 0x07) == 3) - fprintf(fp, " mov dx, [_z80de] ; Get DE\n"); - - if ((dwOpcode & 0x07) == 4) - fprintf(fp, " mov dh, byte [_z80%s + 1]\n", mz80Index); - if ((dwOpcode & 0x07) == 5) - fprintf(fp, " mov dl, byte [_z80%s]\n", mz80Index); - - fprintf(fp, " mov byte [_z80%s + %ld], %s\n", mz80Index, 1 - ((dwOpcode & 0x08) >> 3), pbLocalReg[dwOpcode & 0x07]); - fprintf(fp, " xor edx, edx\n"); - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - if (dwOpcode != 0x64 && dwOpcode != 0x65 && dwOpcode != 0x6c && dwOpcode != 0x6d) - { - if (dwOpcode & 0x08) - fprintf(fp, " %s = %s;\n", mz80IndexHalfLow, pbLocalRegC[dwOpcode & 0x07]); - else - fprintf(fp, " %s = %s;\n", mz80IndexHalfHigh, pbLocalRegC[dwOpcode & 0x07]); - } - else // IX/IY High/low weirdness afoot... - { - // We don't generate any code for ld indexH, indexH and ld indexL, indexL - - if (0x65 == dwOpcode) // LD indexH, indexL - { - fprintf(fp, " %s = %s;\n", mz80IndexHalfHigh, mz80IndexHalfLow); - } - else - if (0x6c == dwOpcode) // LD indexH, indexL - { - fprintf(fp, " %s = %s;\n", mz80IndexHalfLow, mz80IndexHalfHigh); - } - } - } - else - assert(0); -} - -void UndocRegToIndex(UINT32 dwOpcode) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - if ((dwOpcode & 0x38) == 0x10 || (dwOpcode & 0x38) == 0x18) - fprintf(fp, " mov dx, [_z80de] ; Get a usable copy of DE here\n"); - - fprintf(fp, " mov %s, byte [_z80%s + %ld]\n", pbLocalReg[(dwOpcode >> 3) & 0x07], mz80Index, 1 - (dwOpcode & 1)); - - if ((dwOpcode & 0x38) == 0x10 || (dwOpcode & 0x38) == 0x18) - fprintf(fp, " mov [_z80de], dx ; Put it back!\n"); - - fprintf(fp, " xor edx, edx\n"); - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - if (dwOpcode & 1) - fprintf(fp, " %s = %s;\n", pbLocalRegC[(dwOpcode >> 3) & 0x07], mz80IndexHalfLow); - else - fprintf(fp, " %s = %s;\n", pbLocalRegC[(dwOpcode >> 3) & 0x07], mz80IndexHalfHigh); - } - else - assert(0); -} - -void LoadImmediate(UINT32 dwOpcode) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - fprintf(fp, " mov dx, [esi] ; Get our word to load\n"); - fprintf(fp, " add esi, 2 ; Advance past the word\n"); - fprintf(fp, " mov [_z80%s], dx ; Store our new value\n", mz80Index); - fprintf(fp, " xor edx, edx\n"); - - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, " %s = *pbPC++;\n", mz80Index); - fprintf(fp, " %s |= ((UINT32) *pbPC++ << 8);\n", mz80Index); - } - else - assert(0); -} - -void PushPopOperationsIndexed(UINT32 dwOpcode) -{ - UINT8 bRegPair; - UINT8 bRegBaseLsb[25]; - UINT8 bRegBaseMsb[25]; - UINT8 string[150]; - - if (MZ80_ASSEMBLY_X86 == bWhat) - { - sprintf(bRegBaseLsb, "byte [_z80%s]", mz80Index); - sprintf(bRegBaseMsb, "byte [_z80%s + 1]", mz80Index); - - sprintf(string, "[_z80%s]", mz80Index); - - ProcBegin(dwOpcode); - - if (dwOpcode == 0xe5) // Push IX/IY - { - fprintf(fp, " sub word [_z80sp], 2\n"); - fprintf(fp, " mov dx, [_z80sp]\n"); - - WriteWordToMemory("dx", string); - } - else // Pop - { - fprintf(fp, " mov dx, [_z80sp]\n"); - ReadWordFromMemory("dx", string); - fprintf(fp, " add word [_z80sp], 2\n"); - } - - fprintf(fp, " xor edx, edx\n"); - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - if (0xe5 == dwOpcode) // Push IX/IY - { - fprintf(fp, " cpu.z80sp -= 2;\n"); - fprintf(fp, " pbSP = (cpu.z80Base + cpu.z80sp); /* Normalize the stack pointer */\n"); - - WriteWordToMemory("cpu.z80sp", mz80Index); - } - else - if (0xe1 == dwOpcode) // Pop IX/IY - { - ReadWordFromMemory("cpu.z80sp", mz80Index); - - fprintf(fp, " cpu.z80sp += 2;\n"); - fprintf(fp, " pbSP = (cpu.z80Base + cpu.z80sp); /* Normalize the stack pointer */\n"); - return; - } - } - else - assert(0); -} - -// DDFD XXCB Instructions - -void ddcbBitWise(UINT32 dwOpcode) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - ProcBegin(dwOpcode); - - // NOTE: _orgval contains the address to get from. It includes the offset - // already computed plus the mz80Index register. - - // Read our byte - - fprintf(fp, " mov dx, [_orgval] ; Get our target address\n"); - ReadValueFromMemory("dx", "dl"); - - // Do the operation - - if (dwOpcode != 0x06 && dwOpcode != 0x0e && - dwOpcode != 0x16 && dwOpcode != 0x1e && - dwOpcode != 0x26 && dwOpcode != 0x2e && - dwOpcode != 0x3e && (dwOpcode & 0xc7) != 0x86 && - (dwOpcode & 0xc7) != 0xc6) - { - fprintf(fp, " mov dh, ah ; Store our original flags\n"); - fprintf(fp, " and dh, 29h ; Keep our old flags\n"); - } - - if ((dwOpcode & 0xc7) != 0x86 && (dwOpcode & 0xc7) != 0xc6) - fprintf(fp, " sahf ; Restore our flags\n"); - - if (dwOpcode == 0x06) - fprintf(fp, " rol dl, 1\n"); - if (dwOpcode == 0x0e) - fprintf(fp, " ror dl, 1\n"); - if (dwOpcode == 0x16) - fprintf(fp, " rcl dl, 1\n"); - if (dwOpcode == 0x1e) - fprintf(fp, " rcr dl, 1\n"); - if (dwOpcode == 0x26) - fprintf(fp, " shl dl, 1\n"); - if (dwOpcode == 0x2e) - fprintf(fp, " sar dl, 1\n"); - if (dwOpcode == 0x3e) - fprintf(fp, " shr dl, 1\n"); - - // BIT, AND, and OR - - if ((dwOpcode & 0xc7) == 0x46) - fprintf(fp, " test dl, 0%.2xh ; Is it set?\n", (1 << ((dwOpcode >> 3) & 0x07))); - else - if ((dwOpcode & 0xc7) == 0x86) - fprintf(fp, " and dl, 0%.2xh ; Reset the bit\n", - 0xff - (1 << ((dwOpcode >> 3) & 0x07))); - else - if ((dwOpcode & 0xc7) == 0xc6) - fprintf(fp, " or dl, 0%.2xh ; Set the bit\n", - (1 << ((dwOpcode >> 3) & 0x07))); - - if ((dwOpcode & 0xc7) != 0x86 && (dwOpcode & 0xc7) != 0xc6) - fprintf(fp, " lahf ; Get our flags back\n"); - - // Do the flag fixup (if any) - - if (dwOpcode == 0x26 || dwOpcode == 0x2e || ((dwOpcode & 0xc7) == 0x46)) - fprintf(fp, " and ah, 0edh ; No Half carry or negative!\n"); - - if (dwOpcode == 0x06 || dwOpcode == 0x0e || - dwOpcode == 0x16 || dwOpcode == 0x1e || - dwOpcode == 0x3e) - fprintf(fp, " and ah, 0edh ; Knock out H & N\n"); - - // BIT! - - if ((dwOpcode & 0xc7) == 0x46) - { - fprintf(fp, " or ah, 10h ; OR In our half carry\n"); - fprintf(fp, " and ah, 0d0h ; New flags\n"); - fprintf(fp, " or ah, dh ; OR In our old flags\n"); - } - - // Now write our data back if it's not a BIT instruction - - if ((dwOpcode & 0xc7) != 0x46) // If it's not a BIT, write it back - WriteValueToMemory("[_orgval]", "dl"); - - fprintf(fp, " xor edx, edx\n"); - FetchNextInstruction(dwOpcode); - } - else - if (MZ80_C == bWhat) - { - if (0x06 == dwOpcode) // RLC - { - 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"); - fprintf(fp, " bTemp2 = (bTemp >> 7);\n"); - fprintf(fp, " bTemp = (bTemp << 1) | bTemp2;\n"); - fprintf(fp, " cpu.z80F |= bTemp2 | bPostORFlags[bTemp];\n"); - WriteValueToMemory("dwAddr", "bTemp"); - } - else - if (0x0e == dwOpcode) // RRC - { - 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"); - fprintf(fp, " cpu.z80F |= (bTemp & Z80_FLAG_CARRY);\n"); - fprintf(fp, " bTemp = (bTemp >> 1) | (bTemp << 7);\n"); - fprintf(fp, " cpu.z80F |= bPostORFlags[bTemp];\n"); - WriteValueToMemory("dwAddr", "bTemp"); - } - else - if (0x16 == dwOpcode) // RL - { - fprintf(fp, " bTemp2 = cpu.z80F & Z80_FLAG_CARRY;\n"); - 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"); - fprintf(fp, " cpu.z80F |= (bTemp >> 7);\n"); - fprintf(fp, " bTemp = (bTemp << 1) | bTemp2;\n"); - fprintf(fp, " cpu.z80F |= bPostORFlags[bTemp];\n"); - WriteValueToMemory("dwAddr", "bTemp"); - } - else - if (0x1e == dwOpcode) // RR - { - fprintf(fp, " bTemp2 = (cpu.z80F & Z80_FLAG_CARRY) << 7;\n"); - 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"); - fprintf(fp, " cpu.z80F |= (bTemp & Z80_FLAG_CARRY);\n"); - fprintf(fp, " bTemp = (bTemp >> 1) | bTemp2;\n"); - fprintf(fp, " cpu.z80F |= bPostORFlags[bTemp];\n"); - WriteValueToMemory("dwAddr", "bTemp"); - } - else - if (0x26 == dwOpcode) // SLA - { - 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"); - fprintf(fp, " cpu.z80F |= (bTemp >> 7);\n"); - fprintf(fp, " bTemp = (bTemp << 1);\n"); - fprintf(fp, " cpu.z80F |= bPostORFlags[bTemp];\n"); - WriteValueToMemory("dwAddr", "bTemp"); - } - else - if (0x2e == dwOpcode) // SRA - { - 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"); - fprintf(fp, " cpu.z80F |= (bTemp & Z80_FLAG_CARRY);\n"); - fprintf(fp, " bTemp = (bTemp >> 1) | (bTemp & 0x80);\n"); - fprintf(fp, " cpu.z80F |= bPostORFlags[bTemp];\n"); - WriteValueToMemory("dwAddr", "bTemp"); - } - else - if (0x3e == dwOpcode) // SRL - { - 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"); - fprintf(fp, " cpu.z80F |= (bTemp & Z80_FLAG_CARRY);\n"); - fprintf(fp, " bTemp = (bTemp >> 1);\n"); - fprintf(fp, " cpu.z80F |= bPostORFlags[bTemp];\n"); - WriteValueToMemory("dwAddr", "bTemp"); - } - else - if ((dwOpcode & 0xc0) == 0x40) // BIT - { - fprintf(fp, " cpu.z80F = (cpu.z80F & ~(Z80_FLAG_ZERO | Z80_FLAG_NEGATIVE)) | Z80_FLAG_HALF_CARRY;\n"); - fprintf(fp, " if (!(bTemp & 0x%.2x))\n", 1 << ((dwOpcode >> 3) & 0x07)); - fprintf(fp, " {\n"); - fprintf(fp, " cpu.z80F |= Z80_FLAG_ZERO;\n"); - fprintf(fp, " }\n"); - } - else - if ((dwOpcode & 0xc0) == 0x80) // RES - { - fprintf(fp, " bTemp &= 0x%.2x;\n", ~(1 << ((dwOpcode >> 3) & 0x07)) & 0xff); - WriteValueToMemory("dwAddr", "bTemp"); - } - else - if ((dwOpcode & 0xc0) == 0xC0) // SET - { - fprintf(fp, " bTemp |= 0x%.2x;\n", 1 << ((dwOpcode >> 3) & 0x07)); - WriteValueToMemory("dwAddr", "bTemp"); - } - else - InvalidInstructionC(4); - } - else - assert(0); -} - -GetTicksCode() -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - fprintf(fp, " global _%sGetElapsedTicks\n", cpubasename); - fprintf(fp, " global %sGetElapsedTicks_\n", cpubasename); - fprintf(fp, " global %sGetElapsedTicks\n", cpubasename); - - Alignment(); - sprintf(procname, "%sGetElapsedTicks_", cpubasename); - ProcBegin(0xffffffff); - fprintf(fp, "_%sGetElapsedTicks:\n", cpubasename); - fprintf(fp, "%sGetElapsedTicks:\n", cpubasename); - - if (bUseStack) - fprintf(fp, " mov eax, [esp+4] ; Get our context address\n"); - - fprintf(fp, " or eax, eax ; Should we clear it?\n"); - fprintf(fp, " jz getTicks\n"); - fprintf(fp, " xor eax, eax\n"); - fprintf(fp, " xchg eax, [dwElapsedTicks]\n"); - fprintf(fp, " ret\n"); - fprintf(fp, "getTicks:\n"); - fprintf(fp, " mov eax, [dwElapsedTicks]\n"); - fprintf(fp, " ret\n"); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, "/* This will return the elapsed ticks */\n\n"); - fprintf(fp, "UINT32 %sGetElapsedTicks(UINT32 dwClear)\n", cpubasename); - fprintf(fp, "{\n"); - fprintf(fp, " UINT32 dwTemp = dwElapsedTicks;\n\n"); - fprintf(fp, " if (dwClear)\n"); - fprintf(fp, " {\n"); - fprintf(fp, " dwElapsedTicks = 0;\n"); - fprintf(fp, " }\n\n"); - fprintf(fp, " return(dwTemp);\n"); - fprintf(fp, "}\n\n"); - } - else - { - assert(0); - } -} - -ReleaseTimesliceCode() -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - fprintf(fp, " global _%sReleaseTimeslice\n", cpubasename); - fprintf(fp, " global %sReleaseTimeslice_\n", cpubasename); - fprintf(fp, " global %sReleaseTimeslice\n", cpubasename); - - Alignment(); - sprintf(procname, "%sReleaseTimeslice_", cpubasename); - ProcBegin(0xffffffff); - fprintf(fp, "_%sReleaseTimeslice:\n", cpubasename); - fprintf(fp, "%sReleaseTimeslice:\n", cpubasename); - - fprintf(fp, " mov eax, [cyclesRemaining]\n"); - fprintf(fp, " sub [dwOriginalExec], eax\n"); - fprintf(fp, " mov [cyclesRemaining], dword 0\n"); - - fprintf(fp, " ret\n\n"); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, "/* Releases mz80 from its current timeslice */\n\n"); - fprintf(fp, "void %sReleaseTimeslice(void)\n", cpubasename); - fprintf(fp, "{\n"); - fprintf(fp, " dwOriginalCycles -= sdwCyclesRemaining;\n"); - fprintf(fp, " sdwCyclesRemaining = 0;\n"); - fprintf(fp, "}\n\n"); - } - else - { - assert(0); - } -} - -DataSegment() -{ - UINT32 dwLoop = 0; - UINT8 bUsed[256]; - - if (MZ80_ASSEMBLY_X86 == bWhat) - { - if (bOS2) - fprintf(fp, " section .DATA32 use32 flat class=data\n"); - else - fprintf(fp, " section .data use32 flat class=data\n"); - - Alignment(); - fprintf(fp, " global _%scontextBegin\n", cpubasename); - fprintf(fp, "_%scontextBegin:\n", cpubasename); - - fprintf(fp, " global _z80pc\n"); - fprintf(fp, " global z80pc_\n"); - - if (bPlain) - fprintf(fp, " global z80pc\n"); - - fprintf(fp, " global _z80nmiAddr\n"); - fprintf(fp, " global _z80intAddr\n"); - fprintf(fp, " global z80intAddr\n"); - - fprintf(fp, "\n"); - fprintf(fp, "; DO NOT CHANGE THE ORDER OF AF, BC, DE, HL and THE PRIME REGISTERS!\n"); - fprintf(fp, "\n"); - fprintf(fp, "_z80Base dd 0 ; Base address for Z80 stuff\n"); - fprintf(fp, "_z80MemRead dd 0 ; Offset of memory read structure array\n"); - fprintf(fp, "_z80MemWrite dd 0 ; Offset of memory write structure array\n"); - fprintf(fp, "_z80IoRead dd 0 ; Base address for I/O reads list\n"); - fprintf(fp, "_z80IoWrite dd 0 ; Base address for I/O write list\n"); - fprintf(fp, "_z80clockticks dd 0 ; # Of clock tips that have elapsed\n"); - fprintf(fp, "_z80iff dd 0 ; Non-zero if we're in an interrupt\n"); - fprintf(fp, "_z80interruptMode dd 0 ; Interrupt mode\n"); - fprintf(fp, "_z80halted dd 0 ; 0=Not halted, 1=Halted\n"); -#ifdef MZ80_TRAP - fprintf(fp, "_z80trapList dd 0 ; pointer to trap list\n"); - fprintf(fp, "_z80trapAddr dw 0 ; PC where trap occurred\n"); -#endif - fprintf(fp, "_z80af dd 0 ; A Flag & Flags\n"); - fprintf(fp, "_z80bc dd 0 ; BC\n"); - fprintf(fp, "_z80de dd 0 ; DE\n"); - fprintf(fp, "_z80hl dd 0 ; HL\n"); - fprintf(fp, "_z80afprime dd 0 ; A Flag & Flags prime\n"); - fprintf(fp, "_z80bcprime dd 0 ; BC prime\n"); - fprintf(fp, "_z80deprime dd 0 ; DE prime\n"); - fprintf(fp, "_z80hlprime dd 0 ; HL prime\n"); - fprintf(fp, "\n"); - fprintf(fp, "; The order of the following registers can be changed without adverse\n"); - fprintf(fp, "; effect. Keep the WORD and DWORDs on boundaries of two for faster access\n"); - fprintf(fp, "\n"); - fprintf(fp, "_z80ix dd 0 ; IX\n"); - fprintf(fp, "_z80iy dd 0 ; IY\n"); - fprintf(fp, "_z80sp dd 0 ; Stack pointer\n"); - - if (bPlain) - fprintf(fp,"z80pc:\n"); - - fprintf(fp, "z80pc_:\n"); - fprintf(fp, "_z80pc dd 0 ; PC\n"); - fprintf(fp, "_z80nmiAddr dd 0 ; Address to jump to for NMI\n"); - fprintf(fp, "z80intAddr:\n"); - fprintf(fp, "_z80intAddr dd 0 ; Address to jump to for INT\n"); - fprintf(fp, "_z80rCounter dd 0 ; R Register counter\n"); - fprintf(fp, "_z80i db 0 ; I register\n"); - fprintf(fp, "_z80r db 0 ; R register\n"); - fprintf(fp, "_z80intPending db 0 ; Non-zero if an interrupt is pending\n"); - fprintf(fp, "\n"); - fprintf(fp, "_%scontextEnd:\n", cpubasename); - Alignment(); - fprintf(fp, "dwElapsedTicks dd 0 ; # Of ticks elapsed\n"); - fprintf(fp, "cyclesRemaining dd 0 ; # Of cycles remaining\n"); - fprintf(fp, "dwOriginalExec dd 0 ; # Of cycles originally executing\n"); - fprintf(fp, "dwLastRSample dd 0 ; Last sample for R computation\n"); - fprintf(fp, "dwEITiming dd 0 ; Used when we cause an interrupt\n"); - fprintf(fp, "_orgval dw 0 ; Scratch area\n"); - fprintf(fp, "_orgval2 dw 0 ; Scratch area\n"); - fprintf(fp, "_wordval dw 0 ; Scratch area\n"); - fprintf(fp, "_intData db 0 ; Interrupt data when an interrupt is pending\n"); - fprintf(fp, "bEIExit db 0 ; Are we exiting because of an EI instruction?\n"); - fprintf(fp, "\n"); - - // Debugger junk - - fprintf(fp, "RegTextPC db 'PC',0\n"); - fprintf(fp, "RegTextAF db 'AF',0\n"); - fprintf(fp, "RegTextBC db 'BC',0\n"); - fprintf(fp, "RegTextDE db 'DE',0\n"); - fprintf(fp, "RegTextHL db 'HL',0\n"); - fprintf(fp, "RegTextAFP db 'AF',27h,0\n"); - fprintf(fp, "RegTextBCP db 'BC',27h,0\n"); - fprintf(fp, "RegTextDEP db 'DE',27h,0\n"); - fprintf(fp, "RegTextHLP db 'HL',27h,0\n"); - fprintf(fp, "RegTextIX db 'IX',0\n"); - fprintf(fp, "RegTextIY db 'IY',0\n"); - fprintf(fp, "RegTextSP db 'SP',0\n"); - fprintf(fp, "RegTextI db 'I',0\n"); - fprintf(fp, "RegTextR db 'R',0\n"); - - // 8 Byte textual info - - fprintf(fp, "RegTextA db 'A',0\n"); - fprintf(fp, "RegTextB db 'B',0\n"); - fprintf(fp, "RegTextC db 'C',0\n"); - fprintf(fp, "RegTextD db 'D',0\n"); - fprintf(fp, "RegTextE db 'E',0\n"); - fprintf(fp, "RegTextH db 'H',0\n"); - fprintf(fp, "RegTextL db 'L',0\n"); - fprintf(fp, "RegTextF db 'F',0\n"); - - // Individual flags - - fprintf(fp, "RegTextCarry db 'Carry',0\n"); - fprintf(fp, "RegTextNegative db 'Negative',0\n"); - fprintf(fp, "RegTextParity db 'Parity',0\n"); - fprintf(fp, "RegTextOverflow db 'Overflow',0\n"); - fprintf(fp, "RegTextHalfCarry db 'HalfCarry',0\n"); - fprintf(fp, "RegTextZero db 'Zero',0\n"); - fprintf(fp, "RegTextSign db 'Sign',0\n"); - fprintf(fp, "RegTextIFF1 db 'IFF1',0\n"); - fprintf(fp, "RegTextIFF2 db 'IFF2',0\n\n"); - - // Timing for interrupt modes - - fprintf(fp, "intModeTStates:\n"); - fprintf(fp, " db 13 ; IM 0 - 13 T-States\n"); - fprintf(fp, " db 11 ; IM 1 - 11 T-States\n"); - fprintf(fp, " db 11 ; IM 2 - 11 T-States\n\n"); - - // Now the master reg/flag table - - fprintf(fp, "\n;\n"); - fprintf(fp, "; Info is in: pointer to text, address, shift value, mask value, size of data chunk\n"); - fprintf(fp, ";\n\n"); - fprintf(fp, "RegTable:\n"); - - // Pointer to text, address, shift value, mask, size - - fprintf(fp, " dd RegTextPC, _z80pc - _%scontextBegin, 0, 0ffffh\n", cpubasename); - fprintf(fp, " dd RegTextSP, _z80sp - _%scontextBegin, 0, 0ffffh\n", cpubasename); - fprintf(fp, " dd RegTextAF, _z80af - _%scontextBegin, 0, 0ffffh\n", cpubasename); - fprintf(fp, " dd RegTextBC, _z80bc - _%scontextBegin, 0, 0ffffh\n", cpubasename); - fprintf(fp, " dd RegTextDE, _z80de - _%scontextBegin, 0, 0ffffh\n", cpubasename); - fprintf(fp, " dd RegTextHL, _z80hl - _%scontextBegin, 0, 0ffffh\n", cpubasename); - fprintf(fp, " dd RegTextAFP, _z80af - _%scontextBegin, 0, 0ffffh\n", cpubasename); - fprintf(fp, " dd RegTextBCP, _z80bc - _%scontextBegin, 0, 0ffffh\n", cpubasename); - fprintf(fp, " dd RegTextDEP, _z80de - _%scontextBegin, 0, 0ffffh\n", cpubasename); - fprintf(fp, " dd RegTextHLP, _z80hl - _%scontextBegin, 0, 0ffffh\n", cpubasename); - fprintf(fp, " dd RegTextIX, _z80ix - _%scontextBegin, 0, 0ffffh\n", cpubasename); - fprintf(fp, " dd RegTextIY, _z80iy - _%scontextBegin, 0, 0ffffh\n", cpubasename); - fprintf(fp, " dd RegTextI, _z80i - _%scontextBegin, 0, 0ffh\n", cpubasename); - fprintf(fp, " dd RegTextR, _z80r - _%scontextBegin, 0, 0ffh\n", cpubasename); - - // Individual regs - - fprintf(fp, " dd RegTextA, (_z80af + 1) - _%scontextBegin, 0, 0ffh\n", cpubasename); - fprintf(fp, " dd RegTextF, _z80af - _%scontextBegin, 0, 0ffh\n", cpubasename); - fprintf(fp, " dd RegTextB, (_z80bc + 1) - _%scontextBegin, 0, 0ffh\n", cpubasename); - fprintf(fp, " dd RegTextC, _z80bc - _%scontextBegin, 0, 0ffh\n", cpubasename); - fprintf(fp, " dd RegTextD, (_z80de + 1) - _%scontextBegin, 0, 0ffh\n", cpubasename); - fprintf(fp, " dd RegTextE, _z80de - _%scontextBegin, 0, 0ffh\n", cpubasename); - fprintf(fp, " dd RegTextH, (_z80hl + 1) - _%scontextBegin, 0, 0ffh\n", cpubasename); - fprintf(fp, " dd RegTextL, _z80hl - _%scontextBegin, 0, 0ffh\n", cpubasename); - - // IFF register - - fprintf(fp, " dd RegTextIFF1, _z80iff - _%scontextBegin, 0, 01h\n", cpubasename); - fprintf(fp, " dd RegTextIFF2, _z80iff - _%scontextBegin, 1, 01h\n", cpubasename); - - // Individual flags - - fprintf(fp, " dd RegTextCarry, _z80af - _%scontextBegin, 0, 01h\n", cpubasename); - fprintf(fp, " dd RegTextNegative, _z80af - _%scontextBegin, 1, 01h\n", cpubasename); - fprintf(fp, " dd RegTextParity, _z80af - _%scontextBegin, 2, 01h\n", cpubasename); - fprintf(fp, " dd RegTextOverflow, _z80af - _%scontextBegin, 2, 01h\n", cpubasename); - fprintf(fp, " dd RegTextHalfCarry, _z80af - _%scontextBegin, 4, 01h\n", cpubasename); - fprintf(fp, " dd RegTextZero, _z80af - _%scontextBegin, 6, 01h\n", cpubasename); - fprintf(fp, " dd RegTextSign, _z80af - _%scontextBegin, 7, 01h\n", cpubasename); - - // Now we write out our tables - - Alignment(); - - for (dwLoop = 0; dwLoop < 256; dwLoop++) - bUsed[dwLoop] = 0; - - // Now rip through and find out what is and isn't used - - dwLoop = 0; - - while (StandardOps[dwLoop].Emitter) - { - assert(StandardOps[dwLoop].bOpCode < 0x100); - if (bUsed[StandardOps[dwLoop].bOpCode]) - { - fprintf(stderr, "Oops! %.2x\n", dwLoop); - fclose(fp); - exit(1); - } - bUsed[StandardOps[dwLoop].bOpCode] = 1; - dwLoop++; - } - - // Now that that's taken care of, emit the table - - fprintf(fp, "z80regular:\n"); - - dwLoop = 0; - - while (dwLoop < 0x100) - { - fprintf(fp, " dd "); - if (bUsed[dwLoop]) - fprintf(fp, "RegInst%.2x", dwLoop); - else - fprintf(fp, "invalidInsByte"); - fprintf(fp, "\n"); - dwLoop++; - } - fprintf(fp, "\n"); - - // Now rip through and find out what is and isn't used (CB Ops) - - for (dwLoop = 0; dwLoop < 0x100; dwLoop++) - bUsed[dwLoop] = 0; - - dwLoop = 0; - - while (CBOps[dwLoop].Emitter) - { - assert(CBOps[dwLoop].bOpCode < 0x100); - if (bUsed[CBOps[dwLoop].bOpCode]) - { - fprintf(stderr, "Oops CB! %.2x\n", dwLoop); - fclose(fp); - exit(1); - } - bUsed[CBOps[dwLoop].bOpCode] = 1; - dwLoop++; - } - - dwLoop = 0; - - // Let's emit the CB prefixes - - fprintf(fp, "z80PrefixCB:\n"); - - while (dwLoop < 0x100) - { - fprintf(fp, " dd "); - if (bUsed[dwLoop]) - fprintf(fp, "CBInst%.2x", dwLoop); - else - fprintf(fp, "invalidInsWord"); - fprintf(fp, "\n"); - dwLoop++; - } - fprintf(fp, "\n"); - - // Now rip through and find out what is and isn't used (ED Ops) - - for (dwLoop = 0; dwLoop < 0x100; dwLoop++) - bUsed[dwLoop] = 0; - - dwLoop = 0; - - while (EDOps[dwLoop].Emitter) - { - assert(EDOps[dwLoop].bOpCode < 0x100); - if (bUsed[EDOps[dwLoop].bOpCode]) - { - fprintf(stderr, "Oops ED! %.2x\n", dwLoop); - fclose(fp); - exit(1); - } - bUsed[EDOps[dwLoop].bOpCode] = 1; - dwLoop++; - } - - dwLoop = 0; - - // Let's emit the ED prefixes - - fprintf(fp, "z80PrefixED:\n"); - - while (dwLoop < 0x100) - { - fprintf(fp, " dd "); - if (bUsed[dwLoop]) - fprintf(fp, "EDInst%.2x", dwLoop); - else - fprintf(fp, "invalidInsWord"); - fprintf(fp, "\n"); - dwLoop++; - } - fprintf(fp, "\n"); - - // Now rip through and find out what is and isn't used (DD Ops) - - for (dwLoop = 0; dwLoop < 0x100; dwLoop++) - bUsed[dwLoop] = 0; - - dwLoop = 0; - - while (DDFDOps[dwLoop].Emitter) - { - assert(DDFDOps[dwLoop].bOpCode < 0x100); - if (bUsed[DDFDOps[dwLoop].bOpCode]) - { - fprintf(stderr, "Oops DD! %.2x\n", bUsed[DDFDOps[dwLoop].bOpCode]); - fclose(fp); - exit(1); - } - bUsed[DDFDOps[dwLoop].bOpCode] = 1; - dwLoop++; - } - - dwLoop = 0; - - // Let's emit the DD prefixes - - fprintf(fp, "z80PrefixDD:\n"); - - while (dwLoop < 0x100) - { - fprintf(fp, " dd "); - if (bUsed[dwLoop]) - fprintf(fp, "DDInst%.2x", dwLoop); - else - fprintf(fp, "invalidInsWord"); - fprintf(fp, "\n"); - dwLoop++; - } - fprintf(fp, "\n"); - - // Now rip through and find out what is and isn't used (FD Ops) - - for (dwLoop = 0; dwLoop < 0x100; dwLoop++) - bUsed[dwLoop] = 0; - - dwLoop = 0; - - while (DDFDOps[dwLoop].Emitter) - { - assert(DDFDOps[dwLoop].bOpCode < 0x100); - if (bUsed[DDFDOps[dwLoop].bOpCode]) - { - fprintf(stderr, "Oops FD! %.2x\n", dwLoop); - fclose(fp); - exit(1); - } - bUsed[DDFDOps[dwLoop].bOpCode] = 1; - dwLoop++; - } - - for (dwLoop = 0; dwLoop < 0x100; dwLoop++) - bUsed[dwLoop] = 0; - - // Let's emit the DDFD prefixes - - for (dwLoop = 0; dwLoop < 0x100; dwLoop++) - bUsed[dwLoop] = 0; - - dwLoop = 0; - - while (DDFDOps[dwLoop].Emitter) - { - assert(DDFDOps[dwLoop].bOpCode < 0x100); - if (bUsed[DDFDOps[dwLoop].bOpCode]) - { - fprintf(stderr, "Oops FD! %.2x\n", dwLoop); - exit(1); - } - bUsed[DDFDOps[dwLoop].bOpCode] = 1; - dwLoop++; - } - - dwLoop = 0; - - // Let's emit the DDFD prefixes - - fprintf(fp, "z80PrefixFD:\n"); - - while (dwLoop < 0x100) - { - fprintf(fp, " dd "); - if (bUsed[dwLoop]) - fprintf(fp, "FDInst%.2x", dwLoop); - else - fprintf(fp, "invalidInsWord"); - fprintf(fp, "\n"); - dwLoop++; - } - - for (dwLoop = 0; dwLoop < 0x100; dwLoop++) - bUsed[dwLoop] = 0; - - dwLoop = 0; - - while (DDFDCBOps[dwLoop].Emitter) - { - assert(DDFDCBOps[dwLoop].bOpCode < 0x100); - if (bUsed[DDFDCBOps[dwLoop].bOpCode]) - { - fprintf(stderr, "Oops CBFDDD! %.2x\n", bUsed[DDFDCBOps[dwLoop].bOpCode]); - fclose(fp); - exit(1); - } - bUsed[DDFDCBOps[dwLoop].bOpCode] = 1; - dwLoop++; - } - - // Let's emit the DDFD prefixes - - dwLoop = 0; - - fprintf(fp, "z80ddfdcbInstructions:\n"); - - while (dwLoop < 0x100) - { - fprintf(fp, " dd "); - if (bUsed[dwLoop]) - fprintf(fp, "DDFDCBInst%.2x", dwLoop); - else - fprintf(fp, "invalidInsWord"); - fprintf(fp, "\n"); - dwLoop++; - } - fprintf(fp, "\n"); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, "/* Modular global variables go here*/\n\n"); - fprintf(fp, "static CONTEXTMZ80 cpu; /* CPU Context */\n"); - fprintf(fp, "static UINT8 *pbPC; /* Program counter normalized */\n"); - fprintf(fp, "static UINT8 *pbSP; /* Stack pointer normalized */\n"); - fprintf(fp, "static struct MemoryReadByte *psMemRead; /* Read memory structure */\n"); - fprintf(fp, "static struct MemoryWriteByte *psMemWrite; /* Write memory structure */\n"); - fprintf(fp, "static struct z80PortRead *psIoRead; /* Read I/O structure */\n"); - fprintf(fp, "static struct z80PortWrite *psIoWrite; /* Write memory structure */\n"); - fprintf(fp, "static INT32 sdwCyclesRemaining; /* Used as a countdown */\n"); - fprintf(fp, "static UINT32 dwReturnCode; /* Return code from exec() */\n"); - fprintf(fp, "static UINT32 dwOriginalCycles; /* How many cycles did we start with? */\n"); - fprintf(fp, "static UINT32 dwElapsedTicks; /* How many ticks did we elapse? */\n"); - fprintf(fp, "static INT32 sdwAddr; /* Temporary address storage */\n"); - fprintf(fp, "static UINT32 dwAddr; /* Temporary stack address */\n"); - fprintf(fp, "static UINT8 *pbAddAdcTable; /* Pointer to add/adc flag table */\n"); - fprintf(fp, "static UINT8 *pbSubSbcTable; /* Pointer to sub/sbc flag table */\n"); - fprintf(fp, "static UINT32 dwTemp; /* Temporary value */\n\n"); - fprintf(fp, "static UINT8 bTemp; /* Temporary value */\n\n"); - fprintf(fp, "static UINT8 bTemp2; /* Temporary value */\n\n"); - - fprintf(fp, "/* Precomputed flag tables */\n\n"); - - fprintf(fp, "static UINT8 bPostIncFlags[0x100] = \n"); - fprintf(fp, "{\n"); - fprintf(fp, " 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,\n"); - fprintf(fp, " 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,\n"); - fprintf(fp, " 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,\n"); - fprintf(fp, " 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,\n"); - fprintf(fp, " 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,\n"); - fprintf(fp, " 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,\n"); - fprintf(fp, " 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,\n"); - fprintf(fp, " 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x94,\n"); - fprintf(fp, " 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x90,\n"); - fprintf(fp, " 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x90,\n"); - fprintf(fp, " 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x90,\n"); - fprintf(fp, " 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x90,\n"); - fprintf(fp, " 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x90,\n"); - fprintf(fp, " 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x90,\n"); - fprintf(fp, " 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x90,\n"); - fprintf(fp, " 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x50\n"); - fprintf(fp, "};\n\n"); - - fprintf(fp, "static UINT8 bPostDecFlags[0x100] = \n"); - fprintf(fp, "{\n"); - fprintf(fp, " 0x92,0x42,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,\n"); - fprintf(fp, " 0x12,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,\n"); - fprintf(fp, " 0x12,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,\n"); - fprintf(fp, " 0x12,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,\n"); - fprintf(fp, " 0x12,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,\n"); - fprintf(fp, " 0x12,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,\n"); - fprintf(fp, " 0x12,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,\n"); - fprintf(fp, " 0x12,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,\n"); - fprintf(fp, " 0x16,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,\n"); - fprintf(fp, " 0x92,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,\n"); - fprintf(fp, " 0x92,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,\n"); - fprintf(fp, " 0x92,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,\n"); - fprintf(fp, " 0x92,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,\n"); - fprintf(fp, " 0x92,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,\n"); - fprintf(fp, " 0x92,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,\n"); - fprintf(fp, " 0x92,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82\n"); - fprintf(fp, "};\n\n"); - - fprintf(fp, "static UINT8 bPostORFlags[0x100] = \n"); - fprintf(fp, "{\n"); - fprintf(fp, " 0x44,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,\n"); - fprintf(fp, " 0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,\n"); - fprintf(fp, " 0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,\n"); - fprintf(fp, " 0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,\n"); - fprintf(fp, " 0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,\n"); - fprintf(fp, " 0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,\n"); - fprintf(fp, " 0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,\n"); - fprintf(fp, " 0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,\n"); - fprintf(fp, " 0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,\n"); - fprintf(fp, " 0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,\n"); - fprintf(fp, " 0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,\n"); - fprintf(fp, " 0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,\n"); - fprintf(fp, " 0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,\n"); - fprintf(fp, " 0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,\n"); - fprintf(fp, " 0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,\n"); - fprintf(fp, " 0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84\n"); - fprintf(fp, "};\n\n"); - - fprintf(fp, "static UINT8 bPostANDFlags[0x100] = \n"); - fprintf(fp, "{\n"); - fprintf(fp, " 0x54,0x10,0x10,0x14,0x10,0x14,0x14,0x10,0x10,0x14,0x14,0x10,0x14,0x10,0x10,0x14,\n"); - fprintf(fp, " 0x10,0x14,0x14,0x10,0x14,0x10,0x10,0x14,0x14,0x10,0x10,0x14,0x10,0x14,0x14,0x10,\n"); - fprintf(fp, " 0x10,0x14,0x14,0x10,0x14,0x10,0x10,0x14,0x14,0x10,0x10,0x14,0x10,0x14,0x14,0x10,\n"); - fprintf(fp, " 0x14,0x10,0x10,0x14,0x10,0x14,0x14,0x10,0x10,0x14,0x14,0x10,0x14,0x10,0x10,0x14,\n"); - fprintf(fp, " 0x10,0x14,0x14,0x10,0x14,0x10,0x10,0x14,0x14,0x10,0x10,0x14,0x10,0x14,0x14,0x10,\n"); - fprintf(fp, " 0x14,0x10,0x10,0x14,0x10,0x14,0x14,0x10,0x10,0x14,0x14,0x10,0x14,0x10,0x10,0x14,\n"); - fprintf(fp, " 0x14,0x10,0x10,0x14,0x10,0x14,0x14,0x10,0x10,0x14,0x14,0x10,0x14,0x10,0x10,0x14,\n"); - fprintf(fp, " 0x10,0x14,0x14,0x10,0x14,0x10,0x10,0x14,0x14,0x10,0x10,0x14,0x10,0x14,0x14,0x10,\n"); - fprintf(fp, " 0x90,0x94,0x94,0x90,0x94,0x90,0x90,0x94,0x94,0x90,0x90,0x94,0x90,0x94,0x94,0x90,\n"); - fprintf(fp, " 0x94,0x90,0x90,0x94,0x90,0x94,0x94,0x90,0x90,0x94,0x94,0x90,0x94,0x90,0x90,0x94,\n"); - fprintf(fp, " 0x94,0x90,0x90,0x94,0x90,0x94,0x94,0x90,0x90,0x94,0x94,0x90,0x94,0x90,0x90,0x94,\n"); - fprintf(fp, " 0x90,0x94,0x94,0x90,0x94,0x90,0x90,0x94,0x94,0x90,0x90,0x94,0x90,0x94,0x94,0x90,\n"); - fprintf(fp, " 0x94,0x90,0x90,0x94,0x90,0x94,0x94,0x90,0x90,0x94,0x94,0x90,0x94,0x90,0x90,0x94,\n"); - fprintf(fp, " 0x90,0x94,0x94,0x90,0x94,0x90,0x90,0x94,0x94,0x90,0x90,0x94,0x90,0x94,0x94,0x90,\n"); - fprintf(fp, " 0x90,0x94,0x94,0x90,0x94,0x90,0x90,0x94,0x94,0x90,0x90,0x94,0x90,0x94,0x94,0x90,\n"); - fprintf(fp, " 0x94,0x90,0x90,0x94,0x90,0x94,0x94,0x90,0x90,0x94,0x94,0x90,0x94,0x90,0x90,0x94\n"); - fprintf(fp, "};\n\n"); - - fprintf(fp, "static UINT16 wDAATable[0x800] = \n"); - fprintf(fp, "{\n"); - fprintf(fp, " 0x5400,0x1001,0x1002,0x1403,0x1004,0x1405,0x1406,0x1007,\n"); - fprintf(fp, " 0x1008,0x1409,0x1010,0x1411,0x1412,0x1013,0x1414,0x1015,\n"); - fprintf(fp, " 0x1010,0x1411,0x1412,0x1013,0x1414,0x1015,0x1016,0x1417,\n"); - fprintf(fp, " 0x1418,0x1019,0x1020,0x1421,0x1422,0x1023,0x1424,0x1025,\n"); - fprintf(fp, " 0x1020,0x1421,0x1422,0x1023,0x1424,0x1025,0x1026,0x1427,\n"); - fprintf(fp, " 0x1428,0x1029,0x1430,0x1031,0x1032,0x1433,0x1034,0x1435,\n"); - fprintf(fp, " 0x1430,0x1031,0x1032,0x1433,0x1034,0x1435,0x1436,0x1037,\n"); - fprintf(fp, " 0x1038,0x1439,0x1040,0x1441,0x1442,0x1043,0x1444,0x1045,\n"); - fprintf(fp, " 0x1040,0x1441,0x1442,0x1043,0x1444,0x1045,0x1046,0x1447,\n"); - fprintf(fp, " 0x1448,0x1049,0x1450,0x1051,0x1052,0x1453,0x1054,0x1455,\n"); - fprintf(fp, " 0x1450,0x1051,0x1052,0x1453,0x1054,0x1455,0x1456,0x1057,\n"); - fprintf(fp, " 0x1058,0x1459,0x1460,0x1061,0x1062,0x1463,0x1064,0x1465,\n"); - fprintf(fp, " 0x1460,0x1061,0x1062,0x1463,0x1064,0x1465,0x1466,0x1067,\n"); - fprintf(fp, " 0x1068,0x1469,0x1070,0x1471,0x1472,0x1073,0x1474,0x1075,\n"); - fprintf(fp, " 0x1070,0x1471,0x1472,0x1073,0x1474,0x1075,0x1076,0x1477,\n"); - fprintf(fp, " 0x1478,0x1079,0x9080,0x9481,0x9482,0x9083,0x9484,0x9085,\n"); - fprintf(fp, " 0x9080,0x9481,0x9482,0x9083,0x9484,0x9085,0x9086,0x9487,\n"); - fprintf(fp, " 0x9488,0x9089,0x9490,0x9091,0x9092,0x9493,0x9094,0x9495,\n"); - fprintf(fp, " 0x9490,0x9091,0x9092,0x9493,0x9094,0x9495,0x9496,0x9097,\n"); - fprintf(fp, " 0x9098,0x9499,0x5500,0x1101,0x1102,0x1503,0x1104,0x1505,\n"); - fprintf(fp, " 0x5500,0x1101,0x1102,0x1503,0x1104,0x1505,0x1506,0x1107,\n"); - fprintf(fp, " 0x1108,0x1509,0x1110,0x1511,0x1512,0x1113,0x1514,0x1115,\n"); - fprintf(fp, " 0x1110,0x1511,0x1512,0x1113,0x1514,0x1115,0x1116,0x1517,\n"); - fprintf(fp, " 0x1518,0x1119,0x1120,0x1521,0x1522,0x1123,0x1524,0x1125,\n"); - fprintf(fp, " 0x1120,0x1521,0x1522,0x1123,0x1524,0x1125,0x1126,0x1527,\n"); - fprintf(fp, " 0x1528,0x1129,0x1530,0x1131,0x1132,0x1533,0x1134,0x1535,\n"); - fprintf(fp, " 0x1530,0x1131,0x1132,0x1533,0x1134,0x1535,0x1536,0x1137,\n"); - fprintf(fp, " 0x1138,0x1539,0x1140,0x1541,0x1542,0x1143,0x1544,0x1145,\n"); - fprintf(fp, " 0x1140,0x1541,0x1542,0x1143,0x1544,0x1145,0x1146,0x1547,\n"); - fprintf(fp, " 0x1548,0x1149,0x1550,0x1151,0x1152,0x1553,0x1154,0x1555,\n"); - fprintf(fp, " 0x1550,0x1151,0x1152,0x1553,0x1154,0x1555,0x1556,0x1157,\n"); - fprintf(fp, " 0x1158,0x1559,0x1560,0x1161,0x1162,0x1563,0x1164,0x1565,\n"); - fprintf(fp, " 0x1560,0x1161,0x1162,0x1563,0x1164,0x1565,0x1566,0x1167,\n"); - fprintf(fp, " 0x1168,0x1569,0x1170,0x1571,0x1572,0x1173,0x1574,0x1175,\n"); - fprintf(fp, " 0x1170,0x1571,0x1572,0x1173,0x1574,0x1175,0x1176,0x1577,\n"); - fprintf(fp, " 0x1578,0x1179,0x9180,0x9581,0x9582,0x9183,0x9584,0x9185,\n"); - fprintf(fp, " 0x9180,0x9581,0x9582,0x9183,0x9584,0x9185,0x9186,0x9587,\n"); - fprintf(fp, " 0x9588,0x9189,0x9590,0x9191,0x9192,0x9593,0x9194,0x9595,\n"); - fprintf(fp, " 0x9590,0x9191,0x9192,0x9593,0x9194,0x9595,0x9596,0x9197,\n"); - fprintf(fp, " 0x9198,0x9599,0x95a0,0x91a1,0x91a2,0x95a3,0x91a4,0x95a5,\n"); - fprintf(fp, " 0x95a0,0x91a1,0x91a2,0x95a3,0x91a4,0x95a5,0x95a6,0x91a7,\n"); - fprintf(fp, " 0x91a8,0x95a9,0x91b0,0x95b1,0x95b2,0x91b3,0x95b4,0x91b5,\n"); - fprintf(fp, " 0x91b0,0x95b1,0x95b2,0x91b3,0x95b4,0x91b5,0x91b6,0x95b7,\n"); - fprintf(fp, " 0x95b8,0x91b9,0x95c0,0x91c1,0x91c2,0x95c3,0x91c4,0x95c5,\n"); - fprintf(fp, " 0x95c0,0x91c1,0x91c2,0x95c3,0x91c4,0x95c5,0x95c6,0x91c7,\n"); - fprintf(fp, " 0x91c8,0x95c9,0x91d0,0x95d1,0x95d2,0x91d3,0x95d4,0x91d5,\n"); - fprintf(fp, " 0x91d0,0x95d1,0x95d2,0x91d3,0x95d4,0x91d5,0x91d6,0x95d7,\n"); - fprintf(fp, " 0x95d8,0x91d9,0x91e0,0x95e1,0x95e2,0x91e3,0x95e4,0x91e5,\n"); - fprintf(fp, " 0x91e0,0x95e1,0x95e2,0x91e3,0x95e4,0x91e5,0x91e6,0x95e7,\n"); - fprintf(fp, " 0x95e8,0x91e9,0x95f0,0x91f1,0x91f2,0x95f3,0x91f4,0x95f5,\n"); - fprintf(fp, " 0x95f0,0x91f1,0x91f2,0x95f3,0x91f4,0x95f5,0x95f6,0x91f7,\n"); - fprintf(fp, " 0x91f8,0x95f9,0x5500,0x1101,0x1102,0x1503,0x1104,0x1505,\n"); - fprintf(fp, " 0x5500,0x1101,0x1102,0x1503,0x1104,0x1505,0x1506,0x1107,\n"); - fprintf(fp, " 0x1108,0x1509,0x1110,0x1511,0x1512,0x1113,0x1514,0x1115,\n"); - fprintf(fp, " 0x1110,0x1511,0x1512,0x1113,0x1514,0x1115,0x1116,0x1517,\n"); - fprintf(fp, " 0x1518,0x1119,0x1120,0x1521,0x1522,0x1123,0x1524,0x1125,\n"); - fprintf(fp, " 0x1120,0x1521,0x1522,0x1123,0x1524,0x1125,0x1126,0x1527,\n"); - fprintf(fp, " 0x1528,0x1129,0x1530,0x1131,0x1132,0x1533,0x1134,0x1535,\n"); - fprintf(fp, " 0x1530,0x1131,0x1132,0x1533,0x1134,0x1535,0x1536,0x1137,\n"); - fprintf(fp, " 0x1138,0x1539,0x1140,0x1541,0x1542,0x1143,0x1544,0x1145,\n"); - fprintf(fp, " 0x1140,0x1541,0x1542,0x1143,0x1544,0x1145,0x1146,0x1547,\n"); - fprintf(fp, " 0x1548,0x1149,0x1550,0x1151,0x1152,0x1553,0x1154,0x1555,\n"); - fprintf(fp, " 0x1550,0x1151,0x1152,0x1553,0x1154,0x1555,0x1556,0x1157,\n"); - fprintf(fp, " 0x1158,0x1559,0x1560,0x1161,0x1162,0x1563,0x1164,0x1565,\n"); - fprintf(fp, " 0x1406,0x1007,0x1008,0x1409,0x140a,0x100b,0x140c,0x100d,\n"); - fprintf(fp, " 0x100e,0x140f,0x1010,0x1411,0x1412,0x1013,0x1414,0x1015,\n"); - fprintf(fp, " 0x1016,0x1417,0x1418,0x1019,0x101a,0x141b,0x101c,0x141d,\n"); - fprintf(fp, " 0x141e,0x101f,0x1020,0x1421,0x1422,0x1023,0x1424,0x1025,\n"); - fprintf(fp, " 0x1026,0x1427,0x1428,0x1029,0x102a,0x142b,0x102c,0x142d,\n"); - fprintf(fp, " 0x142e,0x102f,0x1430,0x1031,0x1032,0x1433,0x1034,0x1435,\n"); - fprintf(fp, " 0x1436,0x1037,0x1038,0x1439,0x143a,0x103b,0x143c,0x103d,\n"); - fprintf(fp, " 0x103e,0x143f,0x1040,0x1441,0x1442,0x1043,0x1444,0x1045,\n"); - fprintf(fp, " 0x1046,0x1447,0x1448,0x1049,0x104a,0x144b,0x104c,0x144d,\n"); - fprintf(fp, " 0x144e,0x104f,0x1450,0x1051,0x1052,0x1453,0x1054,0x1455,\n"); - fprintf(fp, " 0x1456,0x1057,0x1058,0x1459,0x145a,0x105b,0x145c,0x105d,\n"); - fprintf(fp, " 0x105e,0x145f,0x1460,0x1061,0x1062,0x1463,0x1064,0x1465,\n"); - fprintf(fp, " 0x1466,0x1067,0x1068,0x1469,0x146a,0x106b,0x146c,0x106d,\n"); - fprintf(fp, " 0x106e,0x146f,0x1070,0x1471,0x1472,0x1073,0x1474,0x1075,\n"); - fprintf(fp, " 0x1076,0x1477,0x1478,0x1079,0x107a,0x147b,0x107c,0x147d,\n"); - fprintf(fp, " 0x147e,0x107f,0x9080,0x9481,0x9482,0x9083,0x9484,0x9085,\n"); - fprintf(fp, " 0x9086,0x9487,0x9488,0x9089,0x908a,0x948b,0x908c,0x948d,\n"); - fprintf(fp, " 0x948e,0x908f,0x9490,0x9091,0x9092,0x9493,0x9094,0x9495,\n"); - fprintf(fp, " 0x9496,0x9097,0x9098,0x9499,0x949a,0x909b,0x949c,0x909d,\n"); - fprintf(fp, " 0x909e,0x949f,0x5500,0x1101,0x1102,0x1503,0x1104,0x1505,\n"); - fprintf(fp, " 0x1506,0x1107,0x1108,0x1509,0x150a,0x110b,0x150c,0x110d,\n"); - fprintf(fp, " 0x110e,0x150f,0x1110,0x1511,0x1512,0x1113,0x1514,0x1115,\n"); - fprintf(fp, " 0x1116,0x1517,0x1518,0x1119,0x111a,0x151b,0x111c,0x151d,\n"); - fprintf(fp, " 0x151e,0x111f,0x1120,0x1521,0x1522,0x1123,0x1524,0x1125,\n"); - fprintf(fp, " 0x1126,0x1527,0x1528,0x1129,0x112a,0x152b,0x112c,0x152d,\n"); - fprintf(fp, " 0x152e,0x112f,0x1530,0x1131,0x1132,0x1533,0x1134,0x1535,\n"); - fprintf(fp, " 0x1536,0x1137,0x1138,0x1539,0x153a,0x113b,0x153c,0x113d,\n"); - fprintf(fp, " 0x113e,0x153f,0x1140,0x1541,0x1542,0x1143,0x1544,0x1145,\n"); - fprintf(fp, " 0x1146,0x1547,0x1548,0x1149,0x114a,0x154b,0x114c,0x154d,\n"); - fprintf(fp, " 0x154e,0x114f,0x1550,0x1151,0x1152,0x1553,0x1154,0x1555,\n"); - fprintf(fp, " 0x1556,0x1157,0x1158,0x1559,0x155a,0x115b,0x155c,0x115d,\n"); - fprintf(fp, " 0x115e,0x155f,0x1560,0x1161,0x1162,0x1563,0x1164,0x1565,\n"); - fprintf(fp, " 0x1566,0x1167,0x1168,0x1569,0x156a,0x116b,0x156c,0x116d,\n"); - fprintf(fp, " 0x116e,0x156f,0x1170,0x1571,0x1572,0x1173,0x1574,0x1175,\n"); - fprintf(fp, " 0x1176,0x1577,0x1578,0x1179,0x117a,0x157b,0x117c,0x157d,\n"); - fprintf(fp, " 0x157e,0x117f,0x9180,0x9581,0x9582,0x9183,0x9584,0x9185,\n"); - fprintf(fp, " 0x9186,0x9587,0x9588,0x9189,0x918a,0x958b,0x918c,0x958d,\n"); - fprintf(fp, " 0x958e,0x918f,0x9590,0x9191,0x9192,0x9593,0x9194,0x9595,\n"); - fprintf(fp, " 0x9596,0x9197,0x9198,0x9599,0x959a,0x919b,0x959c,0x919d,\n"); - fprintf(fp, " 0x919e,0x959f,0x95a0,0x91a1,0x91a2,0x95a3,0x91a4,0x95a5,\n"); - fprintf(fp, " 0x95a6,0x91a7,0x91a8,0x95a9,0x95aa,0x91ab,0x95ac,0x91ad,\n"); - fprintf(fp, " 0x91ae,0x95af,0x91b0,0x95b1,0x95b2,0x91b3,0x95b4,0x91b5,\n"); - fprintf(fp, " 0x91b6,0x95b7,0x95b8,0x91b9,0x91ba,0x95bb,0x91bc,0x95bd,\n"); - fprintf(fp, " 0x95be,0x91bf,0x95c0,0x91c1,0x91c2,0x95c3,0x91c4,0x95c5,\n"); - fprintf(fp, " 0x95c6,0x91c7,0x91c8,0x95c9,0x95ca,0x91cb,0x95cc,0x91cd,\n"); - fprintf(fp, " 0x91ce,0x95cf,0x91d0,0x95d1,0x95d2,0x91d3,0x95d4,0x91d5,\n"); - fprintf(fp, " 0x91d6,0x95d7,0x95d8,0x91d9,0x91da,0x95db,0x91dc,0x95dd,\n"); - fprintf(fp, " 0x95de,0x91df,0x91e0,0x95e1,0x95e2,0x91e3,0x95e4,0x91e5,\n"); - fprintf(fp, " 0x91e6,0x95e7,0x95e8,0x91e9,0x91ea,0x95eb,0x91ec,0x95ed,\n"); - fprintf(fp, " 0x95ee,0x91ef,0x95f0,0x91f1,0x91f2,0x95f3,0x91f4,0x95f5,\n"); - fprintf(fp, " 0x95f6,0x91f7,0x91f8,0x95f9,0x95fa,0x91fb,0x95fc,0x91fd,\n"); - fprintf(fp, " 0x91fe,0x95ff,0x5500,0x1101,0x1102,0x1503,0x1104,0x1505,\n"); - fprintf(fp, " 0x1506,0x1107,0x1108,0x1509,0x150a,0x110b,0x150c,0x110d,\n"); - fprintf(fp, " 0x110e,0x150f,0x1110,0x1511,0x1512,0x1113,0x1514,0x1115,\n"); - fprintf(fp, " 0x1116,0x1517,0x1518,0x1119,0x111a,0x151b,0x111c,0x151d,\n"); - fprintf(fp, " 0x151e,0x111f,0x1120,0x1521,0x1522,0x1123,0x1524,0x1125,\n"); - fprintf(fp, " 0x1126,0x1527,0x1528,0x1129,0x112a,0x152b,0x112c,0x152d,\n"); - fprintf(fp, " 0x152e,0x112f,0x1530,0x1131,0x1132,0x1533,0x1134,0x1535,\n"); - fprintf(fp, " 0x1536,0x1137,0x1138,0x1539,0x153a,0x113b,0x153c,0x113d,\n"); - fprintf(fp, " 0x113e,0x153f,0x1140,0x1541,0x1542,0x1143,0x1544,0x1145,\n"); - fprintf(fp, " 0x1146,0x1547,0x1548,0x1149,0x114a,0x154b,0x114c,0x154d,\n"); - fprintf(fp, " 0x154e,0x114f,0x1550,0x1151,0x1152,0x1553,0x1154,0x1555,\n"); - fprintf(fp, " 0x1556,0x1157,0x1158,0x1559,0x155a,0x115b,0x155c,0x115d,\n"); - fprintf(fp, " 0x115e,0x155f,0x1560,0x1161,0x1162,0x1563,0x1164,0x1565,\n"); - fprintf(fp, " 0x5600,0x1201,0x1202,0x1603,0x1204,0x1605,0x1606,0x1207,\n"); - fprintf(fp, " 0x1208,0x1609,0x1204,0x1605,0x1606,0x1207,0x1208,0x1609,\n"); - fprintf(fp, " 0x1210,0x1611,0x1612,0x1213,0x1614,0x1215,0x1216,0x1617,\n"); - fprintf(fp, " 0x1618,0x1219,0x1614,0x1215,0x1216,0x1617,0x1618,0x1219,\n"); - fprintf(fp, " 0x1220,0x1621,0x1622,0x1223,0x1624,0x1225,0x1226,0x1627,\n"); - fprintf(fp, " 0x1628,0x1229,0x1624,0x1225,0x1226,0x1627,0x1628,0x1229,\n"); - fprintf(fp, " 0x1630,0x1231,0x1232,0x1633,0x1234,0x1635,0x1636,0x1237,\n"); - fprintf(fp, " 0x1238,0x1639,0x1234,0x1635,0x1636,0x1237,0x1238,0x1639,\n"); - fprintf(fp, " 0x1240,0x1641,0x1642,0x1243,0x1644,0x1245,0x1246,0x1647,\n"); - fprintf(fp, " 0x1648,0x1249,0x1644,0x1245,0x1246,0x1647,0x1648,0x1249,\n"); - fprintf(fp, " 0x1650,0x1251,0x1252,0x1653,0x1254,0x1655,0x1656,0x1257,\n"); - fprintf(fp, " 0x1258,0x1659,0x1254,0x1655,0x1656,0x1257,0x1258,0x1659,\n"); - fprintf(fp, " 0x1660,0x1261,0x1262,0x1663,0x1264,0x1665,0x1666,0x1267,\n"); - fprintf(fp, " 0x1268,0x1669,0x1264,0x1665,0x1666,0x1267,0x1268,0x1669,\n"); - fprintf(fp, " 0x1270,0x1671,0x1672,0x1273,0x1674,0x1275,0x1276,0x1677,\n"); - fprintf(fp, " 0x1678,0x1279,0x1674,0x1275,0x1276,0x1677,0x1678,0x1279,\n"); - fprintf(fp, " 0x9280,0x9681,0x9682,0x9283,0x9684,0x9285,0x9286,0x9687,\n"); - fprintf(fp, " 0x9688,0x9289,0x9684,0x9285,0x9286,0x9687,0x9688,0x9289,\n"); - fprintf(fp, " 0x9690,0x9291,0x9292,0x9693,0x9294,0x9695,0x9696,0x9297,\n"); - fprintf(fp, " 0x9298,0x9699,0x1334,0x1735,0x1736,0x1337,0x1338,0x1739,\n"); - fprintf(fp, " 0x1340,0x1741,0x1742,0x1343,0x1744,0x1345,0x1346,0x1747,\n"); - fprintf(fp, " 0x1748,0x1349,0x1744,0x1345,0x1346,0x1747,0x1748,0x1349,\n"); - fprintf(fp, " 0x1750,0x1351,0x1352,0x1753,0x1354,0x1755,0x1756,0x1357,\n"); - fprintf(fp, " 0x1358,0x1759,0x1354,0x1755,0x1756,0x1357,0x1358,0x1759,\n"); - fprintf(fp, " 0x1760,0x1361,0x1362,0x1763,0x1364,0x1765,0x1766,0x1367,\n"); - fprintf(fp, " 0x1368,0x1769,0x1364,0x1765,0x1766,0x1367,0x1368,0x1769,\n"); - fprintf(fp, " 0x1370,0x1771,0x1772,0x1373,0x1774,0x1375,0x1376,0x1777,\n"); - fprintf(fp, " 0x1778,0x1379,0x1774,0x1375,0x1376,0x1777,0x1778,0x1379,\n"); - fprintf(fp, " 0x9380,0x9781,0x9782,0x9383,0x9784,0x9385,0x9386,0x9787,\n"); - fprintf(fp, " 0x9788,0x9389,0x9784,0x9385,0x9386,0x9787,0x9788,0x9389,\n"); - fprintf(fp, " 0x9790,0x9391,0x9392,0x9793,0x9394,0x9795,0x9796,0x9397,\n"); - fprintf(fp, " 0x9398,0x9799,0x9394,0x9795,0x9796,0x9397,0x9398,0x9799,\n"); - fprintf(fp, " 0x97a0,0x93a1,0x93a2,0x97a3,0x93a4,0x97a5,0x97a6,0x93a7,\n"); - fprintf(fp, " 0x93a8,0x97a9,0x93a4,0x97a5,0x97a6,0x93a7,0x93a8,0x97a9,\n"); - fprintf(fp, " 0x93b0,0x97b1,0x97b2,0x93b3,0x97b4,0x93b5,0x93b6,0x97b7,\n"); - fprintf(fp, " 0x97b8,0x93b9,0x97b4,0x93b5,0x93b6,0x97b7,0x97b8,0x93b9,\n"); - fprintf(fp, " 0x97c0,0x93c1,0x93c2,0x97c3,0x93c4,0x97c5,0x97c6,0x93c7,\n"); - fprintf(fp, " 0x93c8,0x97c9,0x93c4,0x97c5,0x97c6,0x93c7,0x93c8,0x97c9,\n"); - fprintf(fp, " 0x93d0,0x97d1,0x97d2,0x93d3,0x97d4,0x93d5,0x93d6,0x97d7,\n"); - fprintf(fp, " 0x97d8,0x93d9,0x97d4,0x93d5,0x93d6,0x97d7,0x97d8,0x93d9,\n"); - fprintf(fp, " 0x93e0,0x97e1,0x97e2,0x93e3,0x97e4,0x93e5,0x93e6,0x97e7,\n"); - fprintf(fp, " 0x97e8,0x93e9,0x97e4,0x93e5,0x93e6,0x97e7,0x97e8,0x93e9,\n"); - fprintf(fp, " 0x97f0,0x93f1,0x93f2,0x97f3,0x93f4,0x97f5,0x97f6,0x93f7,\n"); - fprintf(fp, " 0x93f8,0x97f9,0x93f4,0x97f5,0x97f6,0x93f7,0x93f8,0x97f9,\n"); - fprintf(fp, " 0x5700,0x1301,0x1302,0x1703,0x1304,0x1705,0x1706,0x1307,\n"); - fprintf(fp, " 0x1308,0x1709,0x1304,0x1705,0x1706,0x1307,0x1308,0x1709,\n"); - fprintf(fp, " 0x1310,0x1711,0x1712,0x1313,0x1714,0x1315,0x1316,0x1717,\n"); - fprintf(fp, " 0x1718,0x1319,0x1714,0x1315,0x1316,0x1717,0x1718,0x1319,\n"); - fprintf(fp, " 0x1320,0x1721,0x1722,0x1323,0x1724,0x1325,0x1326,0x1727,\n"); - fprintf(fp, " 0x1728,0x1329,0x1724,0x1325,0x1326,0x1727,0x1728,0x1329,\n"); - fprintf(fp, " 0x1730,0x1331,0x1332,0x1733,0x1334,0x1735,0x1736,0x1337,\n"); - fprintf(fp, " 0x1338,0x1739,0x1334,0x1735,0x1736,0x1337,0x1338,0x1739,\n"); - fprintf(fp, " 0x1340,0x1741,0x1742,0x1343,0x1744,0x1345,0x1346,0x1747,\n"); - fprintf(fp, " 0x1748,0x1349,0x1744,0x1345,0x1346,0x1747,0x1748,0x1349,\n"); - fprintf(fp, " 0x1750,0x1351,0x1352,0x1753,0x1354,0x1755,0x1756,0x1357,\n"); - fprintf(fp, " 0x1358,0x1759,0x1354,0x1755,0x1756,0x1357,0x1358,0x1759,\n"); - fprintf(fp, " 0x1760,0x1361,0x1362,0x1763,0x1364,0x1765,0x1766,0x1367,\n"); - fprintf(fp, " 0x1368,0x1769,0x1364,0x1765,0x1766,0x1367,0x1368,0x1769,\n"); - fprintf(fp, " 0x1370,0x1771,0x1772,0x1373,0x1774,0x1375,0x1376,0x1777,\n"); - fprintf(fp, " 0x1778,0x1379,0x1774,0x1375,0x1376,0x1777,0x1778,0x1379,\n"); - fprintf(fp, " 0x9380,0x9781,0x9782,0x9383,0x9784,0x9385,0x9386,0x9787,\n"); - fprintf(fp, " 0x9788,0x9389,0x9784,0x9385,0x9386,0x9787,0x9788,0x9389,\n"); - fprintf(fp, " 0x9790,0x9391,0x9392,0x9793,0x9394,0x9795,0x9796,0x9397,\n"); - fprintf(fp, " 0x9398,0x9799,0x9394,0x9795,0x9796,0x9397,0x9398,0x9799,\n"); - fprintf(fp, " 0x97fa,0x93fb,0x97fc,0x93fd,0x93fe,0x97ff,0x5600,0x1201,\n"); - fprintf(fp, " 0x1202,0x1603,0x1204,0x1605,0x1606,0x1207,0x1208,0x1609,\n"); - fprintf(fp, " 0x160a,0x120b,0x160c,0x120d,0x120e,0x160f,0x1210,0x1611,\n"); - fprintf(fp, " 0x1612,0x1213,0x1614,0x1215,0x1216,0x1617,0x1618,0x1219,\n"); - fprintf(fp, " 0x121a,0x161b,0x121c,0x161d,0x161e,0x121f,0x1220,0x1621,\n"); - fprintf(fp, " 0x1622,0x1223,0x1624,0x1225,0x1226,0x1627,0x1628,0x1229,\n"); - fprintf(fp, " 0x122a,0x162b,0x122c,0x162d,0x162e,0x122f,0x1630,0x1231,\n"); - fprintf(fp, " 0x1232,0x1633,0x1234,0x1635,0x1636,0x1237,0x1238,0x1639,\n"); - fprintf(fp, " 0x163a,0x123b,0x163c,0x123d,0x123e,0x163f,0x1240,0x1641,\n"); - fprintf(fp, " 0x1642,0x1243,0x1644,0x1245,0x1246,0x1647,0x1648,0x1249,\n"); - fprintf(fp, " 0x124a,0x164b,0x124c,0x164d,0x164e,0x124f,0x1650,0x1251,\n"); - fprintf(fp, " 0x1252,0x1653,0x1254,0x1655,0x1656,0x1257,0x1258,0x1659,\n"); - fprintf(fp, " 0x165a,0x125b,0x165c,0x125d,0x125e,0x165f,0x1660,0x1261,\n"); - fprintf(fp, " 0x1262,0x1663,0x1264,0x1665,0x1666,0x1267,0x1268,0x1669,\n"); - fprintf(fp, " 0x166a,0x126b,0x166c,0x126d,0x126e,0x166f,0x1270,0x1671,\n"); - fprintf(fp, " 0x1672,0x1273,0x1674,0x1275,0x1276,0x1677,0x1678,0x1279,\n"); - fprintf(fp, " 0x127a,0x167b,0x127c,0x167d,0x167e,0x127f,0x9280,0x9681,\n"); - fprintf(fp, " 0x9682,0x9283,0x9684,0x9285,0x9286,0x9687,0x9688,0x9289,\n"); - fprintf(fp, " 0x928a,0x968b,0x928c,0x968d,0x968e,0x928f,0x9690,0x9291,\n"); - fprintf(fp, " 0x9292,0x9693,0x1334,0x1735,0x1736,0x1337,0x1338,0x1739,\n"); - fprintf(fp, " 0x173a,0x133b,0x173c,0x133d,0x133e,0x173f,0x1340,0x1741,\n"); - fprintf(fp, " 0x1742,0x1343,0x1744,0x1345,0x1346,0x1747,0x1748,0x1349,\n"); - fprintf(fp, " 0x134a,0x174b,0x134c,0x174d,0x174e,0x134f,0x1750,0x1351,\n"); - fprintf(fp, " 0x1352,0x1753,0x1354,0x1755,0x1756,0x1357,0x1358,0x1759,\n"); - fprintf(fp, " 0x175a,0x135b,0x175c,0x135d,0x135e,0x175f,0x1760,0x1361,\n"); - fprintf(fp, " 0x1362,0x1763,0x1364,0x1765,0x1766,0x1367,0x1368,0x1769,\n"); - fprintf(fp, " 0x176a,0x136b,0x176c,0x136d,0x136e,0x176f,0x1370,0x1771,\n"); - fprintf(fp, " 0x1772,0x1373,0x1774,0x1375,0x1376,0x1777,0x1778,0x1379,\n"); - fprintf(fp, " 0x137a,0x177b,0x137c,0x177d,0x177e,0x137f,0x9380,0x9781,\n"); - fprintf(fp, " 0x9782,0x9383,0x9784,0x9385,0x9386,0x9787,0x9788,0x9389,\n"); - fprintf(fp, " 0x938a,0x978b,0x938c,0x978d,0x978e,0x938f,0x9790,0x9391,\n"); - fprintf(fp, " 0x9392,0x9793,0x9394,0x9795,0x9796,0x9397,0x9398,0x9799,\n"); - fprintf(fp, " 0x979a,0x939b,0x979c,0x939d,0x939e,0x979f,0x97a0,0x93a1,\n"); - fprintf(fp, " 0x93a2,0x97a3,0x93a4,0x97a5,0x97a6,0x93a7,0x93a8,0x97a9,\n"); - fprintf(fp, " 0x97aa,0x93ab,0x97ac,0x93ad,0x93ae,0x97af,0x93b0,0x97b1,\n"); - fprintf(fp, " 0x97b2,0x93b3,0x97b4,0x93b5,0x93b6,0x97b7,0x97b8,0x93b9,\n"); - fprintf(fp, " 0x93ba,0x97bb,0x93bc,0x97bd,0x97be,0x93bf,0x97c0,0x93c1,\n"); - fprintf(fp, " 0x93c2,0x97c3,0x93c4,0x97c5,0x97c6,0x93c7,0x93c8,0x97c9,\n"); - fprintf(fp, " 0x97ca,0x93cb,0x97cc,0x93cd,0x93ce,0x97cf,0x93d0,0x97d1,\n"); - fprintf(fp, " 0x97d2,0x93d3,0x97d4,0x93d5,0x93d6,0x97d7,0x97d8,0x93d9,\n"); - fprintf(fp, " 0x93da,0x97db,0x93dc,0x97dd,0x97de,0x93df,0x93e0,0x97e1,\n"); - fprintf(fp, " 0x97e2,0x93e3,0x97e4,0x93e5,0x93e6,0x97e7,0x97e8,0x93e9,\n"); - fprintf(fp, " 0x93ea,0x97eb,0x93ec,0x97ed,0x97ee,0x93ef,0x97f0,0x93f1,\n"); - fprintf(fp, " 0x93f2,0x97f3,0x93f4,0x97f5,0x97f6,0x93f7,0x93f8,0x97f9,\n"); - fprintf(fp, " 0x97fa,0x93fb,0x97fc,0x93fd,0x93fe,0x97ff,0x5700,0x1301,\n"); - fprintf(fp, " 0x1302,0x1703,0x1304,0x1705,0x1706,0x1307,0x1308,0x1709,\n"); - fprintf(fp, " 0x170a,0x130b,0x170c,0x130d,0x130e,0x170f,0x1310,0x1711,\n"); - fprintf(fp, " 0x1712,0x1313,0x1714,0x1315,0x1316,0x1717,0x1718,0x1319,\n"); - fprintf(fp, " 0x131a,0x171b,0x131c,0x171d,0x171e,0x131f,0x1320,0x1721,\n"); - fprintf(fp, " 0x1722,0x1323,0x1724,0x1325,0x1326,0x1727,0x1728,0x1329,\n"); - fprintf(fp, " 0x132a,0x172b,0x132c,0x172d,0x172e,0x132f,0x1730,0x1331,\n"); - fprintf(fp, " 0x1332,0x1733,0x1334,0x1735,0x1736,0x1337,0x1338,0x1739,\n"); - fprintf(fp, " 0x173a,0x133b,0x173c,0x133d,0x133e,0x173f,0x1340,0x1741,\n"); - fprintf(fp, " 0x1742,0x1343,0x1744,0x1345,0x1346,0x1747,0x1748,0x1349,\n"); - fprintf(fp, " 0x134a,0x174b,0x134c,0x174d,0x174e,0x134f,0x1750,0x1351,\n"); - fprintf(fp, " 0x1352,0x1753,0x1354,0x1755,0x1756,0x1357,0x1358,0x1759,\n"); - fprintf(fp, " 0x175a,0x135b,0x175c,0x135d,0x135e,0x175f,0x1760,0x1361,\n"); - fprintf(fp, " 0x1362,0x1763,0x1364,0x1765,0x1766,0x1367,0x1368,0x1769,\n"); - fprintf(fp, " 0x176a,0x136b,0x176c,0x136d,0x136e,0x176f,0x1370,0x1771,\n"); - fprintf(fp, " 0x1772,0x1373,0x1774,0x1375,0x1376,0x1777,0x1778,0x1379,\n"); - fprintf(fp, " 0x137a,0x177b,0x137c,0x177d,0x177e,0x137f,0x9380,0x9781,\n"); - fprintf(fp, " 0x9782,0x9383,0x9784,0x9385,0x9386,0x9787,0x9788,0x9389,\n"); - fprintf(fp, " 0x938a,0x978b,0x938c,0x978d,0x978e,0x938f,0x9790,0x9391,\n"); - fprintf(fp, " 0x9392,0x9793,0x9394,0x9795,0x9796,0x9397,0x9398,0x9799 \n"); - fprintf(fp, "};\n\n"); - - fprintf(fp, "void DDFDCBHandler(UINT32 dwWhich);\n\n"); - - fprintf(fp, "\n"); - } - else - { - assert(0); - } -} - -CodeSegmentBegin() -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - fprintf(fp, " section .text use32 flat class=code\n"); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, "static void InvalidInstruction(UINT32 dwCount)\n"); - fprintf(fp, "{\n"); - - fprintf(fp, " pbPC -= dwCount; /* Invalid instruction - back up */\n"); - fprintf(fp, " dwReturnCode = (UINT32) pbPC - (UINT32) cpu.z80Base;\n"); - fprintf(fp, " dwOriginalCycles -= sdwCyclesRemaining;\n"); - fprintf(fp, " sdwCyclesRemaining = 0;\n"); - - fprintf(fp, "}\n\n"); - } - else - { - assert(0); - } -} - -CodeSegmentEnd() -{ -} - -ProgramEnd() -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - fprintf(fp, " end\n"); - } - else - if (MZ80_C == bWhat) - { - } - else - { - assert(0); - } -} - -EmitRegularInstructions() -{ - UINT32 dwLoop = 0; - UINT32 dwLoop2 = 0; - - bCurrentMode = TIMING_REGULAR; - - if (MZ80_ASSEMBLY_X86 == bWhat) - { - while (dwLoop < 0x100) - { - dwLoop2 = 0; - sprintf(procname, "RegInst%.2x", dwLoop); - - while (StandardOps[dwLoop2].bOpCode != dwLoop && StandardOps[dwLoop2].bOpCode != 0xffffffff) - dwLoop2++; - - assert(dwLoop2 < 0x100); - if (StandardOps[dwLoop2].Emitter - && StandardOps[dwLoop2].bOpCode != 0xffffffff) - StandardOps[dwLoop2].Emitter((UINT32) dwLoop); - - dwLoop++; - } - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, "/* Main execution entry point */\n\n"); - - fprintf(fp, "UINT32 %sexec(UINT32 dwCycles)\n", cpubasename); - fprintf(fp, "{\n"); - fprintf(fp, " UINT8 bOpcode;\n\n"); - - fprintf(fp, " dwReturnCode = 0x80000000; /* Assume it'll work */\n"); - - fprintf(fp, " sdwCyclesRemaining = dwCycles;\n"); - fprintf(fp, " dwOriginalCycles = dwCycles;\n"); - - fprintf(fp, " if (cpu.z80halted)\n"); - fprintf(fp, " {\n"); - - fprintf(fp, " dwElapsedTicks += dwCycles;\n"); - fprintf(fp, " return(0x80000000);\n"); - - fprintf(fp, " }\n\n"); - - - fprintf(fp, " pbPC = cpu.z80Base + cpu.z80pc;\n\n"); - - fprintf(fp, " while (sdwCyclesRemaining > 0)\n"); - - fprintf(fp, " {\n"); - fprintf(fp, " bOpcode = *pbPC++;\n"); - fprintf(fp, " switch (bOpcode)\n"); - fprintf(fp, " {\n"); - - while (dwLoop < 0x100) - { - dwLoop2 = 0; - - fprintf(fp, " case 0x%.2x:\n", dwLoop); - fprintf(fp, " {\n"); - - while (StandardOps[dwLoop2].bOpCode != dwLoop && StandardOps[dwLoop2].bOpCode != 0xffffffff) - dwLoop2++; - - if (bTimingRegular[dwLoop]) - { - fprintf(fp, " sdwCyclesRemaining -= %ld;\n", bTimingRegular[dwLoop]); - } - - if (StandardOps[dwLoop2].Emitter) - { - StandardOps[dwLoop2].Emitter(dwLoop); - } - - fprintf(fp, " break;\n"); - fprintf(fp, " }\n"); - ++dwLoop; - } - - fprintf(fp, " }\n"); - fprintf(fp, " }\n\n"); - - fprintf(fp, " dwElapsedTicks += (dwOriginalCycles - sdwCyclesRemaining);\n\n"); - - fprintf(fp, " cpu.z80pc = (UINT32) pbPC - (UINT32) cpu.z80Base;\n"); - - fprintf(fp, " return(dwReturnCode); /* Indicate success */\n"); - fprintf(fp, "}\n\n"); - } - else - { - assert(0); - } -} - -EmitCBInstructions() -{ - UINT32 dwLoop = 0; - UINT32 dwLoop2 = 0; - - bCurrentMode = TIMING_CB; - - if (MZ80_ASSEMBLY_X86 == bWhat) - { - while (dwLoop < 0x100) - { - sprintf(procname, "CBInst%.2x", dwLoop); - dwLoop2 = 0; - - while (CBOps[dwLoop2].bOpCode != dwLoop && CBOps[dwLoop2].bOpCode != 0xffffffff) - dwLoop2++; - - assert(dwLoop2 < 0x100); - if (CBOps[dwLoop2].Emitter && CBOps[dwLoop2].bOpCode != 0xffffffff) - CBOps[dwLoop2].Emitter((UINT32) dwLoop); - - dwLoop++; - } - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, "void CBHandler(void)\n"); - fprintf(fp, "{\n"); - fprintf(fp, " switch (*pbPC++)\n"); - fprintf(fp, " {\n"); - - while (dwLoop < 0x100) - { - dwLoop2 = 0; - - fprintf(fp, " case 0x%.2x:\n", dwLoop); - fprintf(fp, " {\n"); - - while (CBOps[dwLoop2].bOpCode != dwLoop && CBOps[dwLoop2].bOpCode != 0xffffffff) - dwLoop2++; - - if (bTimingCB[dwLoop]) - { - fprintf(fp, " sdwCyclesRemaining -= %ld;\n", bTimingCB[dwLoop]); - } - - if (CBOps[dwLoop2].Emitter) - { - CBOps[dwLoop2].Emitter(dwLoop); - } - else - { - InvalidInstructionC(2); - } - - fprintf(fp, " break;\n"); - fprintf(fp, " }\n"); - ++dwLoop; - } - - fprintf(fp, " }\n"); - fprintf(fp, "}\n"); - } - else - { - assert(0); - } -} - -EmitEDInstructions() -{ - UINT32 dwLoop = 0; - UINT32 dwLoop2 = 0; - - bCurrentMode = TIMING_ED; - - if (MZ80_ASSEMBLY_X86 == bWhat) - { - while (dwLoop < 0x100) - { - sprintf(procname, "EDInst%.2x", dwLoop); - dwLoop2 = 0; - - while (EDOps[dwLoop2].bOpCode != dwLoop && EDOps[dwLoop2].bOpCode != 0xffffffff) - dwLoop2++; - - assert(dwLoop2 < 0x100); - if (EDOps[dwLoop2].Emitter && EDOps[dwLoop2].bOpCode != 0xffffffff) - EDOps[dwLoop2].Emitter((UINT32) dwLoop); - - dwLoop++; - } - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, "void EDHandler(void)\n"); - fprintf(fp, "{\n"); - fprintf(fp, " switch (*pbPC++)\n"); - fprintf(fp, " {\n"); - - while (dwLoop < 0x100) - { - dwLoop2 = 0; - - fprintf(fp, " case 0x%.2x:\n", dwLoop); - fprintf(fp, " {\n"); - - while (EDOps[dwLoop2].bOpCode != dwLoop && EDOps[dwLoop2].bOpCode != 0xffffffff) - dwLoop2++; - - if (bTimingED[dwLoop]) - { - fprintf(fp, " sdwCyclesRemaining -= %ld;\n", bTimingED[dwLoop]); - } - - if (EDOps[dwLoop2].Emitter) - { - EDOps[dwLoop2].Emitter(dwLoop); - } - else - { - InvalidInstructionC(2); - } - - fprintf(fp, " break;\n"); - fprintf(fp, " }\n"); - ++dwLoop; - } - - fprintf(fp, " }\n"); - fprintf(fp, "}\n"); - } - else - { - assert(0); - } - - fprintf(fp, "\n"); -} - -EmitDDInstructions() -{ - UINT32 dwLoop = 0; - UINT32 dwLoop2 = 0; - - bCurrentMode = TIMING_DDFD; - - if (MZ80_ASSEMBLY_X86 == bWhat) - { - while (dwLoop < 0x100) - { - sprintf(procname, "DDInst%.2x", dwLoop); - dwLoop2 = 0; - - while (DDFDOps[dwLoop2].bOpCode != dwLoop && DDFDOps[dwLoop2].bOpCode != 0xffffffff) - dwLoop2++; - - assert(dwLoop2 < 0x100); - if (DDFDOps[dwLoop2].Emitter && DDFDOps[dwLoop2].bOpCode != 0xffffffff) - DDFDOps[dwLoop2].Emitter((UINT32) dwLoop); - - dwLoop++; - } - - bCurrentMode = TIMING_XXCB; - - dwLoop = 0; - - while (dwLoop < 0x100) - { - sprintf(procname, "DDFDCBInst%.2x", dwLoop); - dwLoop2 = 0; - - while (DDFDCBOps[dwLoop2].bOpCode != dwLoop && DDFDCBOps[dwLoop2].bOpCode != 0xffffffff) - dwLoop2++; - - assert(dwLoop2 < 0x100); - if (DDFDCBOps[dwLoop2].Emitter && DDFDCBOps[dwLoop2].bOpCode != 0xffffffff) - DDFDCBOps[dwLoop2].Emitter((UINT32) dwLoop); - - dwLoop++; - } - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, "void DDHandler(void)\n"); - fprintf(fp, "{\n"); - fprintf(fp, " switch (*pbPC++)\n"); - fprintf(fp, " {\n"); - - while (dwLoop < 0x100) - { - dwLoop2 = 0; - - fprintf(fp, " case 0x%.2x:\n", dwLoop); - fprintf(fp, " {\n"); - - while (DDFDOps[dwLoop2].bOpCode != dwLoop && DDFDOps[dwLoop2].bOpCode != 0xffffffff) - dwLoop2++; - - if (bTimingDDFD[dwLoop]) - { - fprintf(fp, " sdwCyclesRemaining -= %ld;\n", bTimingDDFD[dwLoop]); - } - - if (DDFDOps[dwLoop2].Emitter) - { - DDFDOps[dwLoop2].Emitter(dwLoop); - } - else - { - InvalidInstructionC(2); - } - - fprintf(fp, " break;\n"); - fprintf(fp, " }\n"); - ++dwLoop; - } - - fprintf(fp, " }\n"); - fprintf(fp, "}\n"); - - // DDFD Handler - - bCurrentMode = TIMING_XXCB; - - dwLoop = 0; - - fprintf(fp, "void DDFDCBHandler(UINT32 dwWhich)\n"); - fprintf(fp, "{\n"); - fprintf(fp, " if (dwWhich)\n"); - fprintf(fp, " {\n"); - fprintf(fp, " dwAddr = (UINT32) ((INT32) cpu.z80IY + ((INT32) *pbPC++)) & 0xffff;\n"); - fprintf(fp, " }\n"); - fprintf(fp, " else\n"); - fprintf(fp, " {\n"); - fprintf(fp, " dwAddr = (UINT32) ((INT32) cpu.z80IX + ((INT32) *pbPC++)) & 0xffff;\n"); - fprintf(fp, " }\n\n"); - - ReadValueFromMemory("dwAddr", "bTemp"); - - fprintf(fp, " switch (*pbPC++)\n"); - fprintf(fp, " {\n"); - - while (dwLoop < 0x100) - { - dwLoop2 = 0; - - fprintf(fp, " case 0x%.2x:\n", dwLoop); - fprintf(fp, " {\n"); - - while (DDFDCBOps[dwLoop2].bOpCode != dwLoop && DDFDCBOps[dwLoop2].bOpCode != 0xffffffff) - dwLoop2++; - - if (bTimingXXCB[dwLoop]) - { - fprintf(fp, " sdwCyclesRemaining -= %ld;\n", bTimingXXCB[dwLoop]); - } - - if (DDFDCBOps[dwLoop2].Emitter) - { - DDFDCBOps[dwLoop2].Emitter(dwLoop); - } - else - { - InvalidInstructionC(4); - } - - fprintf(fp, " break;\n"); - fprintf(fp, " }\n"); - ++dwLoop; - } - - fprintf(fp, " }\n"); - fprintf(fp, "}\n"); - } - else - { - assert(0); - } -} - -EmitFDInstructions() -{ - UINT32 dwLoop = 0; - UINT32 dwLoop2 = 0; - - bCurrentMode = TIMING_DDFD; - - if (MZ80_ASSEMBLY_X86 == bWhat) - { - while (dwLoop < 0x100) - { - sprintf(procname, "FDInst%.2x", dwLoop); - dwLoop2 = 0; - - while (DDFDOps[dwLoop2].bOpCode != dwLoop && DDFDOps[dwLoop2].bOpCode != 0xffffffff) - dwLoop2++; - - assert(dwLoop2 < 0x100); - if (DDFDOps[dwLoop2].Emitter && DDFDOps[dwLoop2].bOpCode != 0xffffffff) - DDFDOps[dwLoop2].Emitter((UINT32) dwLoop); - - dwLoop++; - } - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, "void FDHandler(void)\n"); - fprintf(fp, "{\n"); - fprintf(fp, " switch (*pbPC++)\n"); - fprintf(fp, " {\n"); - - while (dwLoop < 0x100) - { - dwLoop2 = 0; - - fprintf(fp, " case 0x%.2x:\n", dwLoop); - fprintf(fp, " {\n"); - - while (DDFDOps[dwLoop2].bOpCode != dwLoop && DDFDOps[dwLoop2].bOpCode != 0xffffffff) - dwLoop2++; - - if (bTimingDDFD[dwLoop]) - { - fprintf(fp, " sdwCyclesRemaining -= %ld;\n", bTimingDDFD[dwLoop]); - } - - if (DDFDOps[dwLoop2].Emitter) - { - DDFDOps[dwLoop2].Emitter(dwLoop); - } - else - { - InvalidInstructionC(2); - } - - fprintf(fp, " break;\n"); - fprintf(fp, " }\n"); - ++dwLoop; - } - - fprintf(fp, " }\n"); - fprintf(fp, "}\n"); - } - else - { - assert(0); - } -} - -/* These are the meta routines */ - -void ReadMemoryByteHandler() -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - Alignment(); - fprintf(fp, "; This is a generic read memory byte handler when a foreign\n"); - fprintf(fp, "; handler is to be called\n\n"); - fprintf(fp, "; EDI=Handler address, EDX=Address\n"); - fprintf(fp, "; On return, EDX & EDI are undisturbed and AL=Byte read\n\n"); - fprintf(fp, "ReadMemoryByte:\n"); - - fprintf(fp, " mov [_z80af], ax ; Save AF\n"); - fprintf(fp, " cmp [edi+8], dword 0 ; Null handler?\n"); - fprintf(fp, " je directReadHandler ; Yep! It's a direct read!\n\n"); - - fprintf(fp, " mov [_z80hl], bx ; Save HL\n"); - fprintf(fp, " mov [_z80bc], cx ; Save BC\n"); - - fprintf(fp, " sub esi, ebp ; Our program counter\n", cpubasename); - fprintf(fp, " mov [_z80pc], si ; Save our program counter\n", cpubasename); - - // Now adjust the proper timing - - fprintf(fp, " mov esi, [dwOriginalExec] \n"); - fprintf(fp, " sub esi, [cyclesRemaining]\n"); - fprintf(fp, " add [dwElapsedTicks], esi\n"); - fprintf(fp, " add [_z80rCounter], esi\n"); - fprintf(fp, " sub [dwOriginalExec], esi\n"); - - fprintf(fp, " push edi ; Save our structure address\n"); - fprintf(fp, " push edx ; And our desired address\n"); - - if (FALSE == bUseStack) - { - fprintf(fp, " mov eax, edx ; Get our desired address reg\n"); - fprintf(fp, " mov edx, edi ; Pointer to the structure\n"); - } - - fprintf(fp, " call dword [edi + 8] ; Go call our handler\n"); - - fprintf(fp, " pop edx ; Restore our address\n"); - fprintf(fp, " pop edi ; Restore our handler's address\n"); - - fprintf(fp, " xor ebx, ebx ; Zero our future HL\n"); - fprintf(fp, " xor esi, esi ; Zero it!\n"); - fprintf(fp, " mov ebp, [_z80Base] ; Base pointer comes back\n", cpubasename); - fprintf(fp, " mov si, [_z80pc] ; Get our program counter back\n", cpubasename); - fprintf(fp, " xor ecx, ecx ; Zero our future BC\n"); - fprintf(fp, " add esi, ebp ; Rebase it properly\n"); - - fprintf(fp, " mov bx, [_z80hl] ; Get HL back\n"); - fprintf(fp, " mov cx, [_z80bc] ; Get BC back\n"); - - // Note: the callee must restore AF! - - fprintf(fp, " ret\n\n"); - fprintf(fp, "directReadHandler:\n"); - fprintf(fp, " mov eax, [edi+12] ; Get our base address\n"); - fprintf(fp, " sub edx, [edi] ; Subtract our base (low) address\n"); - fprintf(fp, " mov al, [edx+eax] ; Get our data byte\n"); - fprintf(fp, " and eax, 0ffh ; Only the lower byte matters!\n"); - fprintf(fp, " add edx, [edi] ; Add our base back\n"); - fprintf(fp, " ret ; Return to caller!\n\n"); - } - else - if (MZ80_C == bWhat) - { - } - else - { - assert(0); - } -} - -void WriteMemoryByteHandler() -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - Alignment(); - fprintf(fp, "; This is a generic read memory byte handler when a foreign\n"); - fprintf(fp, "; handler is to be called.\n"); - fprintf(fp, "; EDI=Handler address, AL=Byte to write, EDX=Address\n"); - fprintf(fp, "; EDI and EDX Are undisturbed on exit\n\n"); - fprintf(fp, "WriteMemoryByte:\n"); - - fprintf(fp, " cmp [edi+8], dword 0 ; Null handler?\n"); - fprintf(fp, " je directWriteHandler\n\n"); - - - fprintf(fp, " mov [_z80hl], bx ; Save HL\n"); - fprintf(fp, " mov [_z80bc], cx ; Save BX\n"); - - fprintf(fp, " sub esi, ebp ; Our program counter\n", cpubasename); - fprintf(fp, " mov [_z80pc], si ; Save our program counter\n", cpubasename); - - // Now adjust the proper timing - - fprintf(fp, " mov esi, [dwOriginalExec] \n"); - fprintf(fp, " sub esi, [cyclesRemaining]\n"); - fprintf(fp, " add [dwElapsedTicks], esi\n"); - fprintf(fp, " add [_z80rCounter], esi\n"); - fprintf(fp, " sub [dwOriginalExec], esi\n"); - - fprintf(fp, " push edi ; Save our structure address\n"); - - if (bUseStack) - fprintf(fp, " push eax ; Data to write\n"); - - fprintf(fp, " push edx ; And our desired address\n"); - - if (FALSE == bUseStack) - { - fprintf(fp, " xchg eax, edx ; Swap address/data around\n"); - fprintf(fp, " mov ebx, edi ; Our MemoryWriteByte structure address\n"); - } - - fprintf(fp, " call dword [edi + 8] ; Go call our handler\n"); - - fprintf(fp, " pop edx ; Restore our address\n"); - - if (bUseStack) - fprintf(fp, " pop eax ; Restore our data written\n"); - - fprintf(fp, " pop edi ; Save our structure address\n"); - - fprintf(fp, " xor ebx, ebx ; Zero our future HL\n"); - fprintf(fp, " xor ecx, ecx ; Zero our future BC\n"); - fprintf(fp, " mov bx, [_z80hl] ; Get HL back\n"); - fprintf(fp, " mov cx, [_z80bc] ; Get BC back\n"); - fprintf(fp, " mov ax, [_z80af] ; Get AF back\n"); - fprintf(fp, " xor esi, esi ; Zero it!\n"); - fprintf(fp, " mov si, [_z80pc] ; Get our program counter back\n", cpubasename); - fprintf(fp, " mov ebp, [_z80Base] ; Base pointer comes back\n", cpubasename); - fprintf(fp, " add esi, ebp ; Rebase it properly\n"); - - fprintf(fp, " ret\n\n"); - - fprintf(fp, "directWriteHandler:\n"); - fprintf(fp, " sub edx, [edi] ; Subtract our offset\n"); - fprintf(fp, " add edx, [edi+12] ; Add in the base address\n"); - fprintf(fp, " mov [edx], al ; Store our byte\n"); - fprintf(fp, " sub edx, [edi+12] ; Restore our base address\n"); - fprintf(fp, " add edx, [edi] ; And put our offset back\n"); - fprintf(fp, " ret\n\n"); - } - else - if (MZ80_C == bWhat) - { - } - else - { - assert(0); - } -} - -void PushWordHandler() -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - Alignment(); - - fprintf(fp, ";\n"); - fprintf(fp, "; DX=Top of SP, [_wordval]=word value to push\n"); - fprintf(fp, ";\n\n"); - fprintf(fp, "PushWord:\n"); - fprintf(fp, " mov dx, [_z80sp]\n"); - fprintf(fp, " dec dx\n"); - WriteValueToMemory("dx", "byte [_wordval+1]"); - fprintf(fp, " dec dx\n"); - WriteValueToMemory("dx", "byte [_wordval]"); - fprintf(fp, " sub [_z80sp], word 2\n"); - fprintf(fp, " xor edx, edx\n"); - fprintf(fp, " ret\n\n"); - } -} - -void PopWordHandler() -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - Alignment(); - - fprintf(fp, ";\n"); - fprintf(fp, "; [_z80sp]=Top of SP, DX=Word value read\n"); - fprintf(fp, ";\n\n"); - fprintf(fp, "PopWord:\n"); - fprintf(fp, " mov dx, [_z80sp]\n"); - - ReadWordFromMemory("dx", "dx"); - fprintf(fp, " ret\n\n"); - } -} - -void ReadIoHandler() -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - Alignment(); - - fprintf(fp, "; This is a generic I/O read byte handler for when a foreign\n"); - fprintf(fp, "; handler is to be called\n"); - - fprintf(fp, "; EDI=Handler address, EDX=I/O Address\n"); - fprintf(fp, "; On return, EDX & EDI are undisturbed and AL=Byte read\n\n"); - fprintf(fp, "ReadIOByte:\n"); - - fprintf(fp, " mov [_z80af], ax ; Save AF\n"); - fprintf(fp, " mov [_z80hl], bx ; Save HL\n"); - fprintf(fp, " mov [_z80bc], cx ; Save BC\n"); - - fprintf(fp, " sub esi, ebp ; Our program counter\n", cpubasename); - fprintf(fp, " mov [_z80pc], si ; Save our program counter\n", cpubasename); - - // Now adjust the proper timing - - fprintf(fp, " mov esi, [dwOriginalExec] \n"); - fprintf(fp, " sub esi, [cyclesRemaining]\n"); - fprintf(fp, " add [dwElapsedTicks], esi\n"); - fprintf(fp, " add [_z80rCounter], esi\n"); - fprintf(fp, " sub [dwOriginalExec], esi\n"); - - fprintf(fp, " push edi ; Save our structure address\n"); - fprintf(fp, " push edx ; And our desired I/O port\n"); - - if (FALSE == bUseStack) - { - fprintf(fp, " mov eax, edx ; Get our desired address reg\n"); - fprintf(fp, " mov edx, edi ; Pointer to the structure\n"); - } - - fprintf(fp, " call dword [edi + 4] ; Go call our handler\n"); - - fprintf(fp, " pop edx ; Restore our address\n"); - fprintf(fp, " pop edi ; Restore our handler's address\n"); - - fprintf(fp, " xor ebx, ebx ; Zero our future HL\n"); - fprintf(fp, " xor ecx, ecx ; Zero our future BC\n"); - fprintf(fp, " xor esi, esi ; Zero it!\n"); - fprintf(fp, " mov si, [_z80pc] ; Get our program counter back\n", cpubasename); - fprintf(fp, " mov ebp, [_z80Base] ; Base pointer comes back\n", cpubasename); - fprintf(fp, " add esi, ebp ; Rebase it properly\n"); - - fprintf(fp, " mov bx, [_z80hl] ; Get HL back\n"); - fprintf(fp, " mov cx, [_z80bc] ; Get BC back\n"); - - // Note: the callee must restore AF! - - fprintf(fp, " ret\n\n"); - } - else - if (MZ80_C == bWhat) - { - } - else - { - assert(0); - } -} - -void WriteIoHandler() -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - Alignment(); - - fprintf(fp, "; This is a generic write I/O byte handler when a foreign handler is to\n"); - fprintf(fp, "; be called\n"); - fprintf(fp, "; EDI=Handler address, AL=Byte to write, EDX=I/O Address\n"); - fprintf(fp, "; EDI and EDX Are undisturbed on exit\n\n"); - fprintf(fp, "WriteIOByte:\n"); - - fprintf(fp, " mov [_z80hl], bx ; Save HL\n"); - fprintf(fp, " mov [_z80bc], cx ; Save BX\n"); - - fprintf(fp, " sub esi, ebp ; Our program counter\n", cpubasename); - fprintf(fp, " mov [_z80pc], si ; Save our program counter\n", cpubasename); - - // Now adjust the proper timing - - fprintf(fp, " mov esi, [dwOriginalExec] \n"); - fprintf(fp, " sub esi, [cyclesRemaining]\n"); - fprintf(fp, " add [dwElapsedTicks], esi\n"); - fprintf(fp, " add [_z80rCounter], esi\n"); - fprintf(fp, " sub [dwOriginalExec], esi\n"); - - fprintf(fp, " push edi ; Save our structure address\n"); - - if (bUseStack) - fprintf(fp, " push eax ; Data to write\n"); - - fprintf(fp, " push edx ; And our desired I/O address\n"); - - if (FALSE == bUseStack) - { - fprintf(fp, " xchg eax, edx ; Swap address/data around\n"); - fprintf(fp, " mov ebx, edi ; Our z80IoWrite structure address\n"); - } - - fprintf(fp, " call dword [edi + 4] ; Go call our handler\n"); - - fprintf(fp, " pop edx ; Restore our address\n"); - - if (bUseStack) - fprintf(fp, " pop eax ; Restore our data written\n"); - - fprintf(fp, " pop edi ; Save our structure address\n"); - - fprintf(fp, " xor ebx, ebx ; Zero our future HL\n"); - fprintf(fp, " xor ecx, ecx ; Zero our future BC\n"); - fprintf(fp, " mov bx, [_z80hl] ; Get HL back\n"); - fprintf(fp, " mov cx, [_z80bc] ; Get BC back\n"); - fprintf(fp, " mov ax, [_z80af] ; Get AF back\n"); - fprintf(fp, " xor esi, esi ; Zero it!\n"); - fprintf(fp, " mov si, [_z80pc] ; Get our program counter back\n", cpubasename); - fprintf(fp, " mov ebp, [_z80Base] ; Base pointer comes back\n", cpubasename); - fprintf(fp, " add esi, ebp ; Rebase it properly\n"); - - fprintf(fp, " ret\n\n"); - } - else - if (MZ80_C == bWhat) - { - } - else - { - assert(0); - } -} - -ExecCode() -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - fprintf(fp, " global _%sexec\n", cpubasename); - fprintf(fp, " global %sexec_\n", cpubasename); - - if (bPlain) - fprintf(fp, " global %sexec\n", cpubasename); - - sprintf(procname, "%sexec_", cpubasename); - ProcBegin(0xffffffff); - - fprintf(fp, "_%sexec:\n", cpubasename); - - if (bPlain) - fprintf(fp, "%sexec:\n", cpubasename); - - if (bUseStack) - fprintf(fp, " mov eax, [esp+4] ; Get our execution cycle count\n"); - - fprintf(fp, " push ebx ; Save all registers we use\n"); - fprintf(fp, " push ecx\n"); - fprintf(fp, " push edx\n"); - fprintf(fp, " push ebp\n"); - fprintf(fp, " push esi\n"); - fprintf(fp, " push edi\n"); - fprintf(fp, "\n"); - - fprintf(fp, " mov edi, eax\n"); - fprintf(fp, " mov dword [cyclesRemaining], eax ; Store # of instructions to\n"); - fprintf(fp, " mov [dwLastRSample], eax\n"); - fprintf(fp, " mov [dwOriginalExec], eax ; Store this!\n"); - - fprintf(fp, " cmp dword [_z80halted], 0\n"); - fprintf(fp, " je goCpu\n"); - fprintf(fp, " add [_z80rCounter], eax\n"); - - if (FALSE == bNoTiming) - { - fprintf(fp, " add dword [dwElapsedTicks], eax\n"); - } - - fprintf(fp, " mov dword [cyclesRemaining], 0 ; Nothing left!\n"); - fprintf(fp, " mov eax, 80000000h ; Successful exection\n"); - fprintf(fp, " jmp popReg\n"); - fprintf(fp, "goCpu:\n"); - fprintf(fp, " cld ; Go forward!\n"); - fprintf(fp, "\n"); - fprintf(fp, " xor eax, eax ; Zero EAX 'cause we use it!\n"); - fprintf(fp, " xor ebx, ebx ; Zero EBX, too\n"); - fprintf(fp, " xor ecx, ecx ; Zero ECX\n"); - fprintf(fp, " xor edx, edx ; And EDX\n"); - fprintf(fp, " xor esi, esi ; Zero our source address\n"); - fprintf(fp, "\n"); - fprintf(fp, " mov ax, [_z80af] ; Accumulator & flags\n"); - fprintf(fp, " xchg ah, al ; Swap these for later\n"); - fprintf(fp, " mov bx, [_z80hl] ; Get our HL value\n"); - fprintf(fp, " mov cx, [_z80bc] ; And our BC value\n"); - fprintf(fp, " mov ebp, [_z80Base] ; Get the base address\n"); - fprintf(fp, " mov si, [_z80pc] ; Get our program counter\n"); - fprintf(fp, " add esi, ebp ; Add in our base address\n"); - - fprintf(fp, " cmp [_z80intPending], byte 0 ; Interrupt pending?\n"); - fprintf(fp, " jz masterExecTarget\n\n"); - fprintf(fp, " call causeInternalInterrupt\n\n"); - fprintf(fp, "masterExecTarget:\n"); - fprintf(fp, " mov dl, [esi]\n"); - fprintf(fp, " inc esi\n"); - fprintf(fp, " jmp dword [z80regular+edx*4]\n\n"); - fprintf(fp, "; We get to invalidInsWord if it's a double byte invalid opcode\n"); - fprintf(fp, "\n"); - fprintf(fp, "invalidInsWord:\n"); - - fprintf(fp, " dec esi\n"); - fprintf(fp, "\n"); - fprintf(fp, "; We get to invalidInsByte if it's a single byte invalid opcode\n"); - fprintf(fp, "\n"); - - fprintf(fp, "invalidInsByte:\n"); - fprintf(fp, " xchg ah, al ; Swap them back so they look good\n"); - fprintf(fp, " mov [_z80af], ax ; Store A & flags\n"); - fprintf(fp, " dec esi ; Back up one instruction...\n"); - fprintf(fp, " mov edx, esi ; Get our address in EAX\n"); - fprintf(fp, " sub edx, ebp ; And subtract our base for\n"); - fprintf(fp, " ; an invalid instruction\n"); - fprintf(fp, " jmp short emulateEnd\n"); - fprintf(fp, "\n"); - fprintf(fp, "noMoreExec:\n"); - fprintf(fp, " cmp [bEIExit], byte 0 ; Are we exiting because of an EI?\n"); - fprintf(fp, " jne checkEI\n"); - fprintf(fp, "noMoreExecNoEI:\n"); - fprintf(fp, " xchg ah, al ; Swap these for later\n"); - fprintf(fp, " mov [_z80af], ax ; Store A & flags\n"); - - fprintf(fp, " mov edx, [dwOriginalExec] ; Original exec time\n"); - fprintf(fp, " sub edx, edi ; Subtract # of cycles remaining\n"); - fprintf(fp, " add [_z80rCounter], edx\n"); - fprintf(fp, " add [dwElapsedTicks], edx ; Add our executed time\n"); - - fprintf(fp, " mov edx, 80000000h ; Indicate successful exec\n"); - fprintf(fp, " jmp short emulateEnd ; All finished!\n"); - fprintf(fp, "\n"); - fprintf(fp, "; Now let's tuck away the virtual registers for next time\n"); - fprintf(fp, "\n"); - fprintf(fp, "storeFlags:\n"); - fprintf(fp, " xchg ah, al ; Swap these for later\n"); - fprintf(fp, " mov [_z80af], ax ; Store A & flags\n"); - fprintf(fp, "emulateEnd:\n"); - fprintf(fp, " mov [_z80hl], bx ; Store HL\n"); - fprintf(fp, " mov [_z80bc], cx ; Store BC\n"); - fprintf(fp, " sub esi, [_z80Base] ; Knock off physical address\n"); - fprintf(fp, " mov [_z80pc], si ; And store virtual address\n"); - fprintf(fp, " mov eax, edx ; Result code return\n"); - fprintf(fp, "\n"); - fprintf(fp, "popReg:\n"); - fprintf(fp, " pop edi ; Restore registers\n"); - fprintf(fp, " pop esi\n"); - fprintf(fp, " pop ebp\n"); - fprintf(fp, " pop edx\n"); - fprintf(fp, " pop ecx\n"); - fprintf(fp, " pop ebx\n"); - fprintf(fp, "\n"); - fprintf(fp, " ret\n"); - fprintf(fp, "\n"); - Alignment(); - fprintf(fp, "checkEI:\n"); - fprintf(fp, " xor edx, edx\n"); - fprintf(fp, " mov [bEIExit], byte 0\n"); - fprintf(fp, " sub edx, edi ; Find out how much time has passed\n"); - fprintf(fp, " mov edi, [dwEITiming]\n"); - fprintf(fp, " sub edi, edx\n"); - fprintf(fp, " js noMoreExecNoEI\n"); - fprintf(fp, " xor edx, edx\n"); - - fprintf(fp, " cmp [_z80intPending], byte 0\n"); - fprintf(fp, " je near masterExecTarget\n"); - fprintf(fp, " call causeInternalInterrupt\n"); - fprintf(fp, " jmp masterExecTarget\n\n"); - - Alignment(); - fprintf(fp, "causeInternalInterrupt:\n"); - fprintf(fp, " mov dword [_z80halted], 0 ; We're not halted anymore!\n"); - fprintf(fp, " test [_z80iff], byte IFF1 ; Interrupt enabled yet?\n"); - fprintf(fp, " jz near internalInterruptsDisabled\n"); - - fprintf(fp, "\n; Interrupts enabled. Clear IFF1 and IFF2\n\n"); - - fprintf(fp, " mov [_z80intPending], byte 0\n"); - - fprintf(fp, "\n; Save off our active register sets\n\n"); - - fprintf(fp, " xchg ah, al ; Swap these for later\n"); - fprintf(fp, " mov [_z80af], ax ; Store A & flags\n"); - fprintf(fp, " mov [_z80hl], bx ; Store HL\n"); - fprintf(fp, " mov [_z80bc], cx ; Store BC\n"); - fprintf(fp, " sub esi, ebp ; Knock off physical address\n"); - fprintf(fp, " mov [_z80pc], si ; And store virtual address\n"); - - fprintf(fp, " xor eax, eax\n"); - fprintf(fp, " mov al, [_intData]\n\n"); - - fprintf(fp, "\n"); - fprintf(fp, " push edi\n"); - fprintf(fp, "\n"); - - if (bThroughCallHandler) - { - fprintf(fp, " pushad\n" ); - fprintf(fp, " xor edx, edx\n" ); - fprintf(fp, " mov ax, [_z80pc]\n"); - fprintf(fp, " mov [_wordval], ax\n"); - fprintf(fp, " push ecx\n"); - fprintf(fp, " push ebx\n"); - fprintf(fp, " push esi\n"); - - fprintf(fp, " mov ax, [_z80af]\n"); // Get AF - fprintf(fp, " mov bx, [_z80hl]\n"); // Get HL - fprintf(fp, " mov cx, [_z80bc]\n"); // Get BC - fprintf(fp, " call PushWord\n"); - - fprintf(fp, " pop esi\n"); - fprintf(fp, " pop ebx\n"); - fprintf(fp, " pop ecx\n"); - fprintf(fp, " popad\n" ); - } - else - { - fprintf(fp, " mov dx, [_z80pc]\n"); - fprintf(fp, " xor edi, edi\n"); - fprintf(fp, " mov di, word [_z80sp]\n"); - fprintf(fp, " sub di, 2\n"); - fprintf(fp, " mov word [_z80sp], di\n"); - fprintf(fp, " mov [ebp+edi], dx\n"); - } - - fprintf(fp, " cmp dword [_z80interruptMode], 2 ; Are we lower than mode 2?\n"); - fprintf(fp, " jb internalJustModeTwo\n"); - fprintf(fp, " mov ah, [_z80i] ; Get our high address here\n"); - fprintf(fp, " and eax, 0ffffh ; Only the lower part\n"); - fprintf(fp, " mov ax, [eax+ebp] ; Get our vector\n"); - fprintf(fp, " jmp short internalSetNewVector ; Go set it!\n"); - fprintf(fp, "internalJustModeTwo:\n"); - fprintf(fp, " mov ax, word [_z80intAddr]\n"); - fprintf(fp, "internalSetNewVector:\n"); - fprintf(fp, " mov [_z80pc], ax\n"); - fprintf(fp, "\n"); - fprintf(fp, " pop edi\n"); - fprintf(fp, "\n"); - fprintf(fp, " xor eax, eax ; Zero this so we can use it as an index\n"); - - fprintf(fp, " mov al, [_z80interruptMode]\n"); - fprintf(fp, " mov al, [intModeTStates+eax]\n"); - fprintf(fp, " sub edi, eax\n"); - fprintf(fp, " add [_z80rCounter], eax\n"); - - fprintf(fp, "\n; Restore all the registers and whatnot\n\n"); - - fprintf(fp, " mov ax, [_z80af] ; Accumulator & flags\n"); - fprintf(fp, " xchg ah, al ; Swap these for later\n"); - fprintf(fp, " mov bx, [_z80hl] ; Get our HL value\n"); - fprintf(fp, " mov cx, [_z80bc] ; And our BC value\n"); - fprintf(fp, " mov ebp, [_z80Base] ; Get the base address\n"); - fprintf(fp, " mov si, [_z80pc] ; Get our program counter\n"); - fprintf(fp, " add esi, ebp ; Add in our base address\n"); - - fprintf(fp, "internalInterruptsDisabled:\n"); - fprintf(fp, " xor edx, edx\n"); - fprintf(fp, " ret\n"); - } - else - if (MZ80_C == bWhat) - { - } - else - { - assert(0); - } -} - -NmiCode() -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - fprintf(fp, " global _%snmi\n", cpubasename); - fprintf(fp, " global %snmi_\n", cpubasename); - - if (bPlain) - fprintf(fp, " global %snmi\n", cpubasename); - - sprintf(procname, "%snmi_", cpubasename); - ProcBegin(0xffffffff); - fprintf(fp, "_%snmi:\n", cpubasename); - - if (bPlain) - fprintf(fp, "%snmi:\n", cpubasename); - - fprintf(fp, " mov dword [_z80halted], 0 ; We're not halted anymore!\n"); - fprintf(fp, " mov al, [_z80iff] ; Get our IFF setting\n"); - fprintf(fp, " and al, IFF1 ; Just IFF 1\n"); - fprintf(fp, " shl al, 1 ; Makes IFF1->IFF2 and zeros IFF1\n"); - fprintf(fp, " mov [_z80iff], al ; Store it back to the interrupt state!\n"); - fprintf(fp, "\n"); - fprintf(fp, " push ebp\n"); - fprintf(fp, " push edi\n"); - fprintf(fp, " mov ebp, [_z80Base]\n"); - fprintf(fp, "\n"); - - fprintf(fp, " xor eax, eax\n"); - fprintf(fp, " mov ax, [_z80pc]\n"); - - if (bThroughCallHandler) - { - fprintf(fp, " push esi\n"); - fprintf(fp, " push ebx\n"); - fprintf(fp, " push ecx\n"); - - fprintf(fp, " mov [_wordval], ax\n"); - fprintf(fp, " mov esi, ebp\n"); - fprintf(fp, " add esi, eax\n"); - fprintf(fp, " mov ax, [_z80af]\n"); // Get AF - fprintf(fp, " mov bx, [_z80hl]\n"); // Get HL - fprintf(fp, " mov cx, [_z80bc]\n"); // Get BC - fprintf(fp, " push ebx\n"); - fprintf(fp, " push ecx\n"); - fprintf(fp, " push edx\n"); - fprintf(fp, " push esi\n"); - fprintf(fp, " push eax\n"); - fprintf(fp, " call PushWord\n"); - fprintf(fp, " pop eax\n"); - fprintf(fp, " pop esi\n"); - fprintf(fp, " pop edx\n"); - fprintf(fp, " pop ecx\n"); - fprintf(fp, " pop ebx\n"); - - fprintf(fp, " pop ecx\n"); - fprintf(fp, " pop ebx\n"); - fprintf(fp, " pop esi\n"); - } - else - { - fprintf(fp, " xor edi, edi\n"); - fprintf(fp, " mov di, word [_z80sp]\n"); - fprintf(fp, " sub di, 2\n"); - fprintf(fp, " mov word [_z80sp], di\n"); - fprintf(fp, " mov [ebp+edi], ax\n"); - } - - fprintf(fp, " mov ax, [_z80nmiAddr]\n"); - fprintf(fp, " mov [_z80pc], ax\n"); - fprintf(fp, "\n"); - fprintf(fp, " add [dwElapsedTicks], dword 11 ; 11 T-States for NMI\n"); - fprintf(fp, " add [_z80rCounter], dword 11\n"); - fprintf(fp, " pop edi\n"); - fprintf(fp, " pop ebp\n"); - fprintf(fp, "\n"); - fprintf(fp, " xor eax, eax ; Indicate we took the interrupt\n"); - fprintf(fp, " ret\n"); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, "/* NMI Handler */\n\n"); - fprintf(fp, "UINT32 %snmi(void)\n", cpubasename); - fprintf(fp, "{\n"); - - fprintf(fp, " cpu.z80halted = 0;\n"); - fprintf(fp, " pbSP = (cpu.z80Base + cpu.z80sp - 1); /* Normalize the stack pointer */\n"); - fprintf(fp, " *pbSP-- = cpu.z80pc >> 8; /* LSB */\n"); - fprintf(fp, " *pbSP = (UINT8) cpu.z80pc; /* MSB */\n"); - fprintf(fp, " cpu.z80sp -= 2; /* Back our stack up */\n"); - fprintf(fp, " cpu.z80pc = cpu.z80nmiAddr; /* Our NMI */\n"); - - fprintf(fp, " return(0);\n"); - fprintf(fp, "}\n\n"); - } - else - { - assert(0); - } -} - -IntCode() -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - fprintf(fp, " global _%sint\n", cpubasename); - fprintf(fp, " global %sint_\n", cpubasename); - - if (bPlain) - fprintf(fp, " global %sint\n", cpubasename); - - sprintf(procname, "%sint_", cpubasename); - ProcBegin(0xffffffff); - fprintf(fp, "_%sint:\n", cpubasename); - - if (bPlain) - fprintf(fp, "%sint:\n", cpubasename); - - if (bUseStack) - fprintf(fp, " mov eax, [esp+4] ; Get our (potential) lower interrupt address\n"); - - fprintf(fp, " mov dword [_z80halted], 0 ; We're not halted anymore!\n"); - - fprintf(fp, " mov ah, IFF1 ; Is IFF1 enabled?\n"); - fprintf(fp, " and ah, [_z80iff] ; Well, is it?\n"); - fprintf(fp, " jz near interruptsDisabled\n"); - - fprintf(fp, "\n; Interrupts enabled. Clear IFF1 and IFF2\n\n"); - - fprintf(fp, " and dword [_z80iff], ~(IFF1 | IFF2);\n\n"); - fprintf(fp, " mov [_z80intPending], byte 0\n"); - - fprintf(fp, "\n"); - fprintf(fp, " push ebp\n"); - fprintf(fp, " push edi\n"); - fprintf(fp, " push edx\n"); - fprintf(fp, " mov ebp, [_z80Base]\n"); - fprintf(fp, "\n"); - - - if (bThroughCallHandler) - { - fprintf(fp, " pushad\n" ); - fprintf(fp, " xor edx, edx\n" ); - fprintf(fp, " mov ax, [_z80pc]\n"); - fprintf(fp, " mov [_wordval], ax\n"); - fprintf(fp, " push ecx\n"); - fprintf(fp, " push ebx\n"); - fprintf(fp, " push esi\n"); - - fprintf(fp, " mov ax, [_z80af]\n"); // Get AF - fprintf(fp, " mov bx, [_z80hl]\n"); // Get HL - fprintf(fp, " mov cx, [_z80bc]\n"); // Get BC - fprintf(fp, " call PushWord\n"); - - fprintf(fp, " pop esi\n"); - fprintf(fp, " pop ebx\n"); - fprintf(fp, " pop ecx\n"); - fprintf(fp, " popad\n" ); - } - else - { - fprintf(fp, " mov dx, [_z80pc]\n"); - fprintf(fp, " xor edi, edi\n"); - fprintf(fp, " mov di, word [_z80sp]\n"); - fprintf(fp, " sub di, 2\n"); - fprintf(fp, " mov word [_z80sp], di\n"); - fprintf(fp, " mov [ebp+edi], dx\n"); - } - - fprintf(fp, " cmp dword [_z80interruptMode], 2 ; Are we lower than mode 2?\n"); - fprintf(fp, " jb justModeTwo\n"); - fprintf(fp, " mov ah, [_z80i] ; Get our high address here\n"); - fprintf(fp, " and eax, 0ffffh ; Only the lower part\n"); - fprintf(fp, " mov ax, [eax+ebp] ; Get our vector\n"); - fprintf(fp, " jmp short setNewVector ; Go set it!\n"); - fprintf(fp, "justModeTwo:\n"); - fprintf(fp, " mov ax, word [_z80intAddr]\n"); - fprintf(fp, "setNewVector:\n"); - fprintf(fp, " mov [_z80pc], ax\n"); - fprintf(fp, "\n"); - fprintf(fp, " pop edx\n"); - fprintf(fp, " pop edi\n"); - fprintf(fp, " pop ebp\n"); - fprintf(fp, "\n"); - fprintf(fp, " xor eax, eax ; Zero this so we can use it as an index\n"); - - fprintf(fp, " mov al, [_z80interruptMode]\n"); - fprintf(fp, " mov al, [intModeTStates+eax]\n"); - fprintf(fp, " add [dwElapsedTicks], eax\n"); - fprintf(fp, " add [_z80rCounter], eax\n"); - fprintf(fp, " xor eax, eax ; Indicate we took the interrupt\n"); - - fprintf(fp, " jmp short z80intExit\n"); - fprintf(fp, "\n"); - fprintf(fp, "interruptsDisabled:\n"); - fprintf(fp, " mov [_z80intPending], byte 1\n"); - fprintf(fp, " mov [_intData], al ; Save this info for later\n"); - fprintf(fp, " mov eax, 0ffffffffh ; Indicate we didn't take it\n"); - fprintf(fp, "\n"); - fprintf(fp, "z80intExit:\n"); - fprintf(fp, " ret\n\n"); - - - fprintf(fp, " global _%sClearPendingInterrupt\n", cpubasename); - fprintf(fp, " global %sClearPendingInterrupt_\n", cpubasename); - - if (bPlain) - fprintf(fp, " global %sClearPendingInterrupt\n", cpubasename); - - sprintf(procname, "%sClearPendingInterrupt_", cpubasename); - ProcBegin(0xffffffff); - fprintf(fp, "_%sClearPendingInterrupt:\n", cpubasename); - - if (bPlain) - fprintf(fp, "%sClearPendingInterrupt:\n", cpubasename); - - fprintf(fp, " mov [_z80intPending], byte 0\n"); - fprintf(fp, " ret\n\n"); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, "/* Interrupt handler */\n\n"); - fprintf(fp, "UINT32 %sint(UINT32 dwLowAddr)\n", cpubasename); - fprintf(fp, "{\n"); - fprintf(fp, " cpu.z80halted = 0;\n"); - - fprintf(fp, " if (0 == (cpu.z80iff & IFF1))\n"); - fprintf(fp, " return(0xffffffff);\n"); - - fprintf(fp, " cpu.z80iff &= ~(IFF1 | IFF2);\n"); - fprintf(fp, " pbSP = (cpu.z80Base + cpu.z80sp - 1); /* Normalize the stack pointer */\n"); - fprintf(fp, " *pbSP-- = cpu.z80pc >> 8; /* LSB */\n"); - fprintf(fp, " *pbSP = (UINT8) cpu.z80pc; /* MSB */\n"); - fprintf(fp, " cpu.z80sp -= 2; /* Back our stack up */\n"); - - fprintf(fp, " if (2 == cpu.z80interruptMode)\n"); - fprintf(fp, " {\n"); - fprintf(fp, " cpu.z80pc = ((UINT16) cpu.z80i << 8) | (dwLowAddr & 0xff);\n"); - fprintf(fp, " cpu.z80pc = ((UINT16) cpu.z80Base[cpu.z80pc + 1] << 8) | (cpu.z80Base[cpu.z80pc]);\n"); - fprintf(fp, " }\n"); - fprintf(fp, " else\n"); - fprintf(fp, " {\n"); - fprintf(fp, " cpu.z80pc = cpu.z80intAddr;\n"); - fprintf(fp, " }\n"); - - fprintf(fp, " pbPC = cpu.z80Base + cpu.z80pc; /* Normalize the address */\n"); - - fprintf(fp, " return(0);\n"); - fprintf(fp, "}\n\n"); - } - else - { - assert(0); - } -} - -ResetCode() -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - fprintf(fp, " global _%sreset\n", cpubasename); - fprintf(fp, " global %sreset_\n", cpubasename); - - if (bPlain) - fprintf(fp, " global %sreset\n", cpubasename); - sprintf(procname, "%sreset_", cpubasename); - ProcBegin(0xffffffff); - - fprintf(fp, "_%sreset:\n", cpubasename); - - if (bPlain) - fprintf(fp, "%sreset:\n", cpubasename); - - fprintf(fp, " xor eax, eax ; Zero AX\n"); - fprintf(fp, "\n"); - fprintf(fp, " mov dword [_z80halted], eax ; We're not halted anymore!\n"); - fprintf(fp, " mov word [_z80af], 0040h ; Zero A & flags - zero flag set\n"); - fprintf(fp, " mov word [_z80bc], ax ; Zero BC\n"); - fprintf(fp, " mov word [_z80de], ax ; Zero DE\n"); - fprintf(fp, " mov word [_z80hl], ax ; Zero HL\n"); - fprintf(fp, " mov word [_z80afprime], ax ; Zero AF Prime\n"); - fprintf(fp, " mov word [_z80bcprime], ax ; Zero BC prime\n"); - fprintf(fp, " mov word [_z80deprime], ax ; Zero DE prime\n"); - fprintf(fp, " mov word [_z80hlprime], ax ; Zero HL prime\n"); - fprintf(fp, " mov byte [_z80i], al ; Zero Interrupt register\n"); - fprintf(fp, " mov byte [_z80r], al ; Zero refresh register\n"); - fprintf(fp, " mov word [_z80ix], 0ffffh ; Default mz80Index register\n"); - fprintf(fp, " mov word [_z80iy], 0ffffh ; Default mz80Index register\n"); - fprintf(fp, " mov word [_z80pc], ax ; Zero program counter\n"); - fprintf(fp, " mov word [_z80sp], ax ; And the stack pointer\n"); - fprintf(fp, " mov dword [_z80iff], eax ; IFF1/IFF2 disabled!\n"); - fprintf(fp, " mov dword [_z80interruptMode], eax ; Clear our interrupt mode (0)\n"); - fprintf(fp, " mov word [_z80intAddr], 38h ; Set default interrupt address\n"); - fprintf(fp, " mov word [_z80nmiAddr], 66h ; Set default nmi addr\n"); - fprintf(fp, "\n"); - fprintf(fp, " ret\n"); - fprintf(fp, "\n"); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, "/* This routine is mz80's reset handler */\n\n"); - fprintf(fp, "void %sreset(void)\n", cpubasename); - fprintf(fp, "{\n"); - fprintf(fp, " cpu.z80halted = 0;\n"); - fprintf(fp, " cpu.z80AF = 0;\n"); - fprintf(fp, " cpu.z80F = Z80_FLAG_ZERO;\n"); - fprintf(fp, " cpu.z80BC = 0;\n"); - fprintf(fp, " cpu.z80DE = 0;\n"); - fprintf(fp, " cpu.z80HL = 0;\n"); - fprintf(fp, " cpu.z80afprime = 0;\n"); - fprintf(fp, " cpu.z80bcprime = 0;\n"); - fprintf(fp, " cpu.z80deprime = 0;\n"); - fprintf(fp, " cpu.z80hlprime = 0;\n"); - fprintf(fp, " cpu.z80i = 0;\n"); - fprintf(fp, " cpu.z80r = 0;\n"); - fprintf(fp, " cpu.z80IX = 0xffff; /* Yes, this is intentional */\n"); - fprintf(fp, " cpu.z80IY = 0xffff; /* Yes, this is intentional */\n"); - fprintf(fp, " cpu.z80pc = 0;\n"); - fprintf(fp, " cpu.z80sp = 0;\n"); - fprintf(fp, " cpu.z80interruptMode = 0;\n"); - fprintf(fp, " cpu.z80intAddr = 0x38;\n"); - fprintf(fp, " cpu.z80nmiAddr = 0x66;\n"); - fprintf(fp, "}\n\n"); - } - else - { - assert(0); - } -} - -SetContextCode() -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - fprintf(fp, " global _%sSetContext\n", cpubasename); - fprintf(fp, " global %sSetContext_\n", cpubasename); - - if (bPlain) - fprintf(fp, " global %sSetContext\n", cpubasename); - - sprintf(procname, "%sSetContext_", cpubasename); - ProcBegin(0xffffffff); - fprintf(fp, "_%sSetContext:\n", cpubasename); - - if (bPlain) - fprintf(fp, "%sSetContext:\n", cpubasename); - - if (bUseStack) - fprintf(fp, " mov eax, [esp+4] ; Get our context address\n"); - - fprintf(fp, " push esi ; Save registers we use\n"); - fprintf(fp, " push edi\n"); - fprintf(fp, " push ecx\n"); - fprintf(fp, " push es\n"); - fprintf(fp, " mov di, ds\n"); - fprintf(fp, " mov es, di\n"); - fprintf(fp, " mov edi, _%scontextBegin\n", cpubasename); - fprintf(fp, " mov esi, eax ; Source address in ESI\n"); - fprintf(fp, " mov ecx, (_%scontextEnd - _%scontextBegin) >> 2\n", cpubasename, cpubasename); - fprintf(fp, " rep movsd\n"); - fprintf(fp, " mov ecx, (_%scontextEnd - _%scontextBegin) & 0x03\n", cpubasename, cpubasename); - fprintf(fp, " rep movsb\n"); - fprintf(fp, " pop es\n"); - fprintf(fp, " pop ecx\n"); - fprintf(fp, " pop edi\n"); - fprintf(fp, " pop esi\n"); - fprintf(fp, " ret ; No return code\n"); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, "/* Set mz80's context */\n\n"); - fprintf(fp, "void %sSetContext(void *pData)\n", cpubasename); - fprintf(fp, "{\n"); - fprintf(fp, " memcpy(&cpu, pData, sizeof(CONTEXTMZ80));\n"); - fprintf(fp, "}\n\n"); - } - else - { - assert(0); - } -} - -GetContextCode() -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - fprintf(fp, " global _%sGetContext\n", cpubasename); - fprintf(fp, " global %sGetContext_\n", cpubasename); - - if (bPlain) - fprintf(fp, " global %sGetContext\n", cpubasename); - - sprintf(procname, "%sGetContext_", cpubasename); - ProcBegin(0xffffffff); - fprintf(fp, "_%sGetContext:\n", cpubasename); - - if (bPlain) - fprintf(fp, "%sGetContext:\n", cpubasename); - - if (bUseStack) - fprintf(fp, " mov eax, [esp+4] ; Get our context address\n"); - - fprintf(fp, " push esi ; Save registers we use\n"); - fprintf(fp, " push edi\n"); - fprintf(fp, " push ecx\n"); - fprintf(fp, " push es\n"); - fprintf(fp, " mov di, ds\n"); - fprintf(fp, " mov es, di\n"); - - fprintf(fp, " mov esi, _%scontextBegin\n", cpubasename); - fprintf(fp, " mov edi, eax ; Source address in ESI\n"); - - fprintf(fp, " mov ecx, (_%scontextEnd - _%scontextBegin) >> 2\n", cpubasename, cpubasename); - fprintf(fp, " rep movsd\n"); - fprintf(fp, " mov ecx, (_%scontextEnd - _%scontextBegin) & 0x03\n", cpubasename, cpubasename); - fprintf(fp, " rep movsb\n"); - - fprintf(fp, " pop es\n"); - fprintf(fp, " pop ecx\n"); - fprintf(fp, " pop edi\n"); - fprintf(fp, " pop esi\n"); - fprintf(fp, " ret ; No return code\n"); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, "/* Get mz80's context */\n\n"); - fprintf(fp, "void %sGetContext(void *pData)\n", cpubasename); - fprintf(fp, "{\n"); - fprintf(fp, " memcpy(pData, &cpu, sizeof(CONTEXTMZ80));\n"); - fprintf(fp, "}\n\n"); - } - else - { - assert(0); - } -} - -GetContextSizeCode() -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - fprintf(fp, " global _%sGetContextSize\n", cpubasename); - fprintf(fp, " global %sGetContextSize_\n", cpubasename); - - if (bPlain) - fprintf(fp, " global %sGetContextSize\n", cpubasename); - - sprintf(procname, "%sGetContextSize_", cpubasename); - ProcBegin(0xffffffff); - - fprintf(fp, "_%sGetContextSize:\n", cpubasename); - - if (bPlain) - fprintf(fp, "%sGetContextSize:\n", cpubasename); - - fprintf(fp, " mov eax, _%scontextEnd - _%scontextBegin\n", cpubasename, cpubasename); - fprintf(fp, " ret\n\n"); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, "/* Get mz80's context size */\n\n"); - fprintf(fp, "UINT32 %sGetContextSize(void)\n", cpubasename); - fprintf(fp, "{\n"); - fprintf(fp, " return(sizeof(CONTEXTMZ80));\n"); - fprintf(fp, "}\n\n"); - } - else - { - assert(0); - } -} - -void InitCode(void) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - fprintf(fp, " global _%sinit\n", cpubasename); - fprintf(fp, " global %sinit_\n", cpubasename); - - if (bPlain) - fprintf(fp, " global %sinit\n", cpubasename); - - sprintf(procname, "%sinit_", cpubasename); - ProcBegin(0xffffffff); - - fprintf(fp, "_%sinit:\n", cpubasename); - - if (bPlain) - fprintf(fp, "%sinit:\n", cpubasename); - - fprintf(fp, " ret\n\n"); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, "/* Initialize MZ80 for action */\n\n"); - fprintf(fp, "void %sinit(void)\n", cpubasename); - fprintf(fp, "{\n"); - - fprintf(fp, " UINT32 dwLoop;\n"); - fprintf(fp, " UINT8 *pbTempPtr;\n"); - fprintf(fp, " UINT8 *pbTempPtr2;\n"); - fprintf(fp, " UINT8 bNewAdd;\n"); - fprintf(fp, " UINT8 bNewSub;\n"); - fprintf(fp, " UINT8 bFlag;\n"); - fprintf(fp, " UINT8 bLow;\n"); - fprintf(fp, " UINT8 bHigh;\n"); - fprintf(fp, " UINT8 bCarry;\n"); - fprintf(fp, "\n"); - fprintf(fp, " if (NULL == pbAddAdcTable)\n"); - fprintf(fp, " {\n"); - fprintf(fp, " pbAddAdcTable = malloc(256*256*2);\n"); - fprintf(fp, "\n"); - fprintf(fp, " if (NULL == pbAddAdcTable)\n"); - fprintf(fp, " {\n"); - fprintf(fp, " return;\n"); - fprintf(fp, " }\n"); - fprintf(fp, "\n"); - fprintf(fp, " pbTempPtr = pbAddAdcTable;\n\n"); - fprintf(fp, " pbSubSbcTable = malloc(256*256*2);\n"); - fprintf(fp, "\n"); - fprintf(fp, " if (NULL == pbSubSbcTable)\n"); - fprintf(fp, " {\n"); - fprintf(fp, " return;\n"); - fprintf(fp, " }\n"); - fprintf(fp, "\n"); - fprintf(fp, " pbTempPtr2 = pbSubSbcTable;\n"); - fprintf(fp, "\n"); - fprintf(fp, " for (dwLoop = 0; dwLoop < (256*256*2); dwLoop++)\n"); - fprintf(fp, " {\n"); - fprintf(fp, " bLow = dwLoop & 0xff;\n"); - fprintf(fp, " bHigh = (dwLoop >> 8) & 0xff;\n"); - fprintf(fp, " bCarry = (dwLoop >> 16);\n"); - fprintf(fp, "\n"); - fprintf(fp, " bFlag = 0;\n"); - fprintf(fp, " bNewAdd = bHigh + bLow + bCarry;\n"); - fprintf(fp, "\n"); - fprintf(fp, " if (0 == bNewAdd)\n"); - fprintf(fp, " {\n"); - fprintf(fp, " bFlag |= Z80_FLAG_ZERO;\n"); - fprintf(fp, " }\n"); - fprintf(fp, " else\n"); - fprintf(fp, " {\n"); - fprintf(fp, " bFlag = bNewAdd & 0x80; /* Sign flag */\n"); - fprintf(fp, " }\n"); - fprintf(fp, "\n"); - fprintf(fp, " if (((UINT32) bLow + (UINT32) bHigh + (UINT32) bCarry) >= 0x100)\n"); - fprintf(fp, " {\n"); - fprintf(fp, " bFlag |= Z80_FLAG_CARRY;\n"); - fprintf(fp, " }\n"); - fprintf(fp, "\n"); - fprintf(fp, " if ( ((bLow ^ bHigh ^ 0x80) & (bLow ^ (bNewAdd & 0x80))) & 0x80)\n"); - fprintf(fp, " {\n"); - fprintf(fp, " bFlag |= Z80_FLAG_OVERFLOW_PARITY;\n"); - fprintf(fp, " }\n"); - fprintf(fp, "\n"); - fprintf(fp, " if (((bLow & 0x0f) + (bHigh & 0x0f) + bCarry) >= 0x10)\n"); - fprintf(fp, " {\n"); - fprintf(fp, " bFlag |= Z80_FLAG_HALF_CARRY;\n"); - fprintf(fp, " }\n"); - fprintf(fp, "\n"); - fprintf(fp, " *pbTempPtr++ = bFlag; /* Store our new flag */\n\n"); - - fprintf(fp, " // Now do subtract - Zero\n"); - fprintf(fp, "\n"); - fprintf(fp, " bFlag = Z80_FLAG_NEGATIVE;\n"); - fprintf(fp, " bNewSub = bHigh - bLow - bCarry;\n"); - fprintf(fp, "\n"); - fprintf(fp, " if (0 == bNewSub)\n"); - fprintf(fp, " {\n"); - fprintf(fp, " bFlag |= Z80_FLAG_ZERO;\n"); - fprintf(fp, " }\n"); - fprintf(fp, " else\n"); - fprintf(fp, " {\n"); - fprintf(fp, " bFlag |= bNewSub & 0x80; /* Sign flag */\n"); - fprintf(fp, " }\n"); - fprintf(fp, "\n"); - fprintf(fp, " if ( ((INT32) bHigh - (INT32) bLow - (INT32) bCarry) < 0)\n"); - fprintf(fp, " {\n"); - fprintf(fp, " bFlag |= Z80_FLAG_CARRY;\n"); - fprintf(fp, " }\n"); - fprintf(fp, "\n"); - fprintf(fp, " if ( ((INT32) (bHigh & 0xf) - (INT32) (bLow & 0x0f) - (INT32) bCarry) < 0)\n"); - fprintf(fp, " {\n"); - fprintf(fp, " bFlag |= Z80_FLAG_HALF_CARRY;\n"); - fprintf(fp, " }\n"); - fprintf(fp, "\n"); - fprintf(fp, " if ( ((bLow ^ bHigh) & (bHigh ^ bNewSub) & 0x80) )\n"); - fprintf(fp, " {\n"); - fprintf(fp, " bFlag |= Z80_FLAG_OVERFLOW_PARITY;\n"); - fprintf(fp, " }\n"); - fprintf(fp, "\n"); - fprintf(fp, " *pbTempPtr2++ = bFlag; /* Store our sub flag */\n"); - fprintf(fp, "\n"); - fprintf(fp, " }\n"); - fprintf(fp, " }\n"); - fprintf(fp, "}\n"); - } - else - { - assert(0); - } -} - -void ShutdownCode(void) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - fprintf(fp, " global _%sshutdown\n", cpubasename); - fprintf(fp, " global %sshutdown_\n", cpubasename); - - if (bPlain) - fprintf(fp, " global %sshutdown\n", cpubasename); - - sprintf(procname, "%sshutdown_", cpubasename); - ProcBegin(0xffffffff); - - fprintf(fp, "_%sshutdown:\n", cpubasename); - - if (bPlain) - fprintf(fp, "%sshutdown:\n", cpubasename); - - fprintf(fp, " ret\n\n"); - } - else - if (MZ80_C == bWhat) - { - fprintf(fp, "/* Shut down MZ80 */\n\n"); - fprintf(fp, "void %sshutdown(void)\n", cpubasename); - fprintf(fp, "{\n"); - - fprintf(fp, "}\n\n"); - } - else - { - assert(0); - } -} - -void DebuggerCode(void) -{ - if (MZ80_ASSEMBLY_X86 == bWhat) - { - Alignment(); - - fprintf(fp, ";\n"); - fprintf(fp, "; In : EAX=Reg #, ESI=Context address\n"); - fprintf(fp, "; Out: EAX=Value of register\n"); - fprintf(fp, ";\n"); - - fprintf(fp, "getRegValueInternal:\n"); - - fprintf(fp, " push ecx\n"); - fprintf(fp, " push edx\n\n"); - - fprintf(fp, " cmp eax, CPUREG_MAXINDEX\n"); - fprintf(fp, " jae badIndex2\n\n"); - - fprintf(fp, " shl eax, 4 ; Times 16 for table entry size\n"); - fprintf(fp, " add eax, RegTable ; Now it's the memory location\n"); - - fprintf(fp, " mov edx, [eax+4] ; Get the offset of the register\n"); - fprintf(fp, " mov edx, [edx + esi] ; Get our value\n"); - - fprintf(fp, " mov ecx, [eax+8] ; Get our shift value\n"); - fprintf(fp, " shr edx, cl ; Shift it right by a value\n"); - - fprintf(fp, " and edx, [eax+12] ; Mask off any unneeded bits\n"); - fprintf(fp, " mov eax, edx ; Put our value in EAX\n"); - fprintf(fp, " jmp short indexExit ; Index's exit!\n"); - - fprintf(fp, "badIndex2:\n"); - fprintf(fp, " mov eax, 0ffffffffh\n\n"); - fprintf(fp, "indexExit:\n"); - fprintf(fp, " pop edx\n"); - fprintf(fp, " pop ecx\n"); - fprintf(fp, " ret\n\n"); - - Alignment(); - - fprintf(fp, ";\n"); - fprintf(fp, "; In : EAX=Value, EDX=Reg #, ESI=Context address\n"); - fprintf(fp, "; Out: EAX=Value of register\n"); - fprintf(fp, ";\n"); - - fprintf(fp, "convertValueToText:\n"); - - fprintf(fp, " push ecx\n"); - fprintf(fp, " push edx\n\n"); - - fprintf(fp, " cmp edx, CPUREG_MAXINDEX\n"); - fprintf(fp, " jae badIndex3\n\n"); - - fprintf(fp, " shl edx, 4 ; Times 16 for table entry size\n"); - fprintf(fp, " add edx, RegTable ; Now it's the memory location\n"); - fprintf(fp, " mov edx, [edx + 12] ; Shift mask\n"); - fprintf(fp, " xor ecx, ecx ; Zero our shift\n"); - - fprintf(fp, "shiftLoop:\n"); - fprintf(fp, " test edx, 0f0000000h ; High nibble nonzero yet?\n"); - fprintf(fp, " jnz convertLoop ; Yup!\n"); - fprintf(fp, " shl edx, 4 ; Move over, bacon\n"); - fprintf(fp, " shl eax, 4 ; Move the value over, too\n"); - fprintf(fp, " jmp short shiftLoop ; Keep shiftin'\n\n"); - - fprintf(fp, "convertLoop:\n"); - fprintf(fp, " mov ecx, eax ; Get our value\n"); - fprintf(fp, " shr ecx, 28 ; Only the top nibble\n"); - fprintf(fp, " add cl, '0' ; Convert to ASCII\n"); - fprintf(fp, " cmp cl, '9' ; Greater than 9?\n"); - fprintf(fp, " jbe noAdd ; Nope! Don't add it\n"); - fprintf(fp, " add cl, 32+7 ; Convert from lowercase a-f\n"); - fprintf(fp, "noAdd:\n"); - fprintf(fp, " mov [edi], cl ; New value storage\n"); - fprintf(fp, " inc edi ; Next byte, please\n"); - fprintf(fp, " shl eax, 4 ; Move the mask over\n"); - fprintf(fp, " shl edx, 4 ; Move the mask over\n"); - fprintf(fp, " jnz convertLoop ; Keep convertin'\n\n"); - - - fprintf(fp, "badIndex3:\n"); - fprintf(fp, " mov [edi], byte 0 ; Null terminate the sucker!\n"); - fprintf(fp, " pop edx\n"); - fprintf(fp, " pop ecx\n"); - fprintf(fp, " ret\n\n"); - - fprintf(fp, " global _%sSetRegisterValue\n", cpubasename); - fprintf(fp, " global %sSetRegisterValue_\n", cpubasename); - - if (bPlain) - fprintf(fp, " global %sSetRegisterValue\n", cpubasename); - - sprintf(procname, "%sSetRegisterValue_", cpubasename); - ProcBegin(0xffffffff); - - fprintf(fp, "_%sSetRegisterValue:\n", cpubasename); - if (bPlain) - fprintf(fp, "%sSetRegisterValue:\n", cpubasename); - - fprintf(fp, " push esi\n"); - fprintf(fp, " push edi\n"); - fprintf(fp, " push edx\n"); - fprintf(fp, " push ecx\n"); - - if (bUseStack) - { - fprintf(fp, " mov eax, [esp+20] ; Get our register #\n"); - fprintf(fp, " mov esi, [esp+24] ; Get our context address\n"); - fprintf(fp, " mov edi, [esp+28] ; Value to assign\n"); - } - else - { - fprintf(fp, " mov esi, eax ; Get context\n"); - fprintf(fp, " mov eax, edx ; Get register # in EAX\n"); - fprintf(fp, " mov edi, ebx ; Get value to assign\n"); - } - - fprintf(fp, " or esi, esi ; Are we NULL?\n"); - fprintf(fp, " jnz userDefined\n"); - - fprintf(fp, " mov esi, _%scontextBegin\n", cpubasename); - fprintf(fp, "userDefined:\n\n"); - fprintf(fp, " shl eax, 4 ; Times 16 for reg entry size\n"); - fprintf(fp, " add eax, RegTable\n"); - fprintf(fp, " mov edx, [eax+12] ; Our mask\n"); - fprintf(fp, " not edx ; Invert EDX!\n"); - fprintf(fp, " test edi, edx ; Did we set any invalid bits?\n"); - fprintf(fp, " jnz rangeViolation\n\n"); - - fprintf(fp, " not edx ; Toggle it back to normal\n"); - fprintf(fp, " mov ecx, [eax+8] ; Get our shift value\n"); - fprintf(fp, " shl edx, cl ; Shift our mask\n"); - fprintf(fp, " shl eax, cl ; And our value to OR in\n"); - - fprintf(fp, " not edx ; Make it the inverse of what we want\n"); - fprintf(fp, " mov eax, [eax+4] ; Get our offset into the context\n"); - fprintf(fp, " and [esi+eax], edx ; Mask off the bits we're changin\n"); - fprintf(fp, " or [esi+eax], edi ; Or in our new value\n\n"); - fprintf(fp, " xor eax, eax\n"); - fprintf(fp, " jmp short setExit\n\n"); - - fprintf(fp, "rangeViolation:\n"); - fprintf(fp, " mov eax, 0ffffffffh\n\n"); - - fprintf(fp, "setExit:\n"); - fprintf(fp, " pop ecx\n"); - fprintf(fp, " pop edx\n"); - fprintf(fp, " pop edi\n"); - fprintf(fp, " pop esi\n\n"); - - fprintf(fp, " ret\n\n"); - - Alignment(); - - fprintf(fp, " global _%sGetRegisterValue\n", cpubasename); - fprintf(fp, " global %sGetRegisterValue_\n", cpubasename); - - if (bPlain) - fprintf(fp, " global %sGetRegisterValue\n", cpubasename); - - sprintf(procname, "%sGetRegisterValue_", cpubasename); - ProcBegin(0xffffffff); - - fprintf(fp, "_%sGetRegisterValue:\n", cpubasename); - if (bPlain) - fprintf(fp, "%sGetRegisterValue:\n", cpubasename); - - fprintf(fp, " push esi\n"); - - if (bUseStack) - { - fprintf(fp, " mov eax, [esp+8] ; Get our register #\n"); - fprintf(fp, " mov esi, [esp+12] ; Get our context address\n"); - } - else - { - fprintf(fp, " mov esi, eax ; Get context\n"); - fprintf(fp, " mov eax, edx ; Get register # in EAX\n"); - } - - fprintf(fp, " or esi, esi ; Is context NULL?\n"); - fprintf(fp, " jnz getVal ; Nope - use it!\n"); - fprintf(fp, " mov esi, _%scontextBegin\n\n", cpubasename); - - fprintf(fp, "getVal:\n"); - fprintf(fp, " call getRegValueInternal\n\n"); - - fprintf(fp, " pop esi\n"); - - fprintf(fp, " ret\n\n"); - - Alignment(); - - fprintf(fp, " global _%sGetRegisterName\n", cpubasename); - fprintf(fp, " global %sGetRegisterName_\n", cpubasename); - - if (bPlain) - fprintf(fp, " global %sGetRegisterName\n", cpubasename); - - sprintf(procname, "%sGetRegisterName_", cpubasename); - ProcBegin(0xffffffff); - - fprintf(fp, "_%sGetRegisterName:\n", cpubasename); - if (bPlain) - fprintf(fp, "%sGetRegisterName:\n", cpubasename); - - if (bUseStack) - { - fprintf(fp, " mov eax, [esp+4] ; Get our register #\n"); - } - - fprintf(fp, " cmp eax, CPUREG_MAXINDEX\n"); - fprintf(fp, " jae badIndex\n"); - - fprintf(fp, " shl eax, 4 ; Times 16 bytes for each entry\n"); - fprintf(fp, " mov eax, [eax+RegTable]\n"); - fprintf(fp, " jmp nameExit\n\n"); - - fprintf(fp, "badIndex:\n"); - fprintf(fp, " xor eax, eax\n\n"); - - fprintf(fp, "nameExit:\n"); - fprintf(fp, " ret\n\n"); - - Alignment(); - - fprintf(fp, " global _%sGetRegisterTextValue\n", cpubasename); - fprintf(fp, " global %sGetRegisterTextValue_\n", cpubasename); - - if (bPlain) - fprintf(fp, " global %sGetRegisterTextValue\n", cpubasename); - - sprintf(procname, "%sGetRegisterTextValue_", cpubasename); - ProcBegin(0xffffffff); - - fprintf(fp, "_%sGetRegisterTextValue:\n", cpubasename); - if (bPlain) - fprintf(fp, "%sGetRegisterTextValue:\n", cpubasename); - - fprintf(fp, " push esi\n"); - fprintf(fp, " push edi\n"); - fprintf(fp, " push edx\n"); - - if (bUseStack) - { - fprintf(fp, " mov eax, [esp+16] ; Get our register #\n"); - fprintf(fp, " mov esi, [esp+20] ; Get our context address\n"); - fprintf(fp, " mov edi, [esp+24] ; Address to place text\n"); - } - else - { - fprintf(fp, " mov esi, eax ; Get context\n"); - fprintf(fp, " mov eax, edx ; Get register # in EAX\n"); - fprintf(fp, " mov edi, ebx ; Address to place text\n"); - } - - fprintf(fp, " or esi, esi ; Is context NULL?\n"); - fprintf(fp, " jnz getVal2 ; Nope - use it!\n"); - fprintf(fp, " mov esi, _%scontextBegin\n\n", cpubasename); - - fprintf(fp, "getVal2:\n"); - fprintf(fp, " mov edx, eax ; Save off our index for later\n"); - fprintf(fp, " call getRegValueInternal\n\n"); - - fprintf(fp, "; EAX Holds the value, EDX=Register #, and EDI=Destination!\n\n"); - - fprintf(fp, " call convertValueToText\n\n"); - - fprintf(fp, " pop edx\n"); - fprintf(fp, " pop esi\n"); - fprintf(fp, " pop edi\n"); - - fprintf(fp, " ret\n\n"); - - Alignment(); - - fprintf(fp, " global _%sWriteValue\n", cpubasename); - fprintf(fp, " global %sWriteValue_\n", cpubasename); - - if (bPlain) - fprintf(fp, " global %sWriteValue\n", cpubasename); - - sprintf(procname, "%sWriteValue_", cpubasename); - ProcBegin(0xffffffff); - - fprintf(fp, "_%sWriteValue:\n", cpubasename); - if (bPlain) - fprintf(fp, "%sWriteValue:\n", cpubasename); - - fprintf(fp, " push esi\n"); - fprintf(fp, " push edi\n"); - fprintf(fp, " push edx\n"); - fprintf(fp, " push ebx\n"); - fprintf(fp, " push ecx\n"); - fprintf(fp, " push ebp\n"); - - if (bUseStack) - { - fprintf(fp, " mov eax, [esp+28] ; What kind of write is this?\n"); - fprintf(fp, " mov ebx, [esp+32] ; Address\n"); - fprintf(fp, " mov edx, [esp+36] ; Value\n"); - } - else - { - fprintf(fp, " xchg edx, ebx ; Addr=EBX, value=EDX\n"); - } - - fprintf(fp, " cmp eax, 1 ; Is it a word write?\n"); - fprintf(fp, " je near invalidWrite ; Yep - it's not valid\n"); - fprintf(fp, " cmp eax, 2 ; Is it a dword write?\n"); - fprintf(fp, " je near invalidWrite ; Yep - it's not valid\n\n"); - fprintf(fp, " or eax, eax ; Is it a byte write?\n"); - fprintf(fp, " jnz itsIoDummy ; Nope... it's an I/O write\n\n"); - - // Here we do a write memory byte - - fprintf(fp, " mov ebp, [_z80Base] ; Base pointer comes back\n"); - fprintf(fp, " mov edi, [_z80MemWrite] ; Point to the write array\n"); - - fprintf(fp, "checkLoop:\n"); - fprintf(fp, " cmp [edi], word 0ffffh ; End of our list?\n"); - fprintf(fp, " je memoryWrite ; Yes - go write it!\n"); - fprintf(fp, " cmp bx, [edi] ; Are we smaller?\n"); - fprintf(fp, " jb nextAddr ; Yes... go to the next addr\n"); - fprintf(fp, " cmp bx, [edi+4] ; Are we smaller?\n"); - fprintf(fp, " jbe callRoutine ; If not, go call it!\n"); - - fprintf(fp, "nextAddr:\n"); - fprintf(fp, " add edi, 10h ; Next structure, please\n"); - fprintf(fp, " jmp short checkLoop\n"); - - fprintf(fp, "callRoutine:\n"); - - fprintf(fp, "\n;\n; EBX=Address to target, DL=Byte to write \n;\n\n"); - - fprintf(fp, " cmp [edi+8], dword 0 ; Null handler?\n"); - fprintf(fp, " je directWriteHandler2\n\n"); - - if (FALSE == bUseStack) - { - fprintf(fp, " mov eax, ebx ; Address\n"); - fprintf(fp, " mov ebx, edi ; Pointer to struct (EDX Already has the byte to write)\n"); - } - else - { - fprintf(fp, " push edi ; Handler\n"); - fprintf(fp, " push edx ; Byte\n"); - fprintf(fp, " push ebx ; Address\n"); - } - - fprintf(fp, " call dword [edi + 8] ; Go call our handler\n"); - - if (bUseStack) - { - fprintf(fp, " add esp, 12\n"); - } - - fprintf(fp, " jmp short itsGood\n"); - - fprintf(fp, "directWriteHandler2:\n"); - fprintf(fp, " sub ebx, [edi] ; Subtract our offset\n"); - fprintf(fp, " add ebx, [edi+12] ; Add in the base address\n"); - fprintf(fp, " mov [ebx], dl ; Store our byte\n"); - fprintf(fp, " jmp short itsGood\n"); - fprintf(fp, "memoryWrite:\n"); - fprintf(fp, " mov [ebp + ebx], dl\n\n"); - fprintf(fp, " jmp short itsGood\n"); - - // Here we do an "out" - - fprintf(fp, "itsIoDummy:\n"); - - fprintf(fp, " mov edi, [_z80IoWrite] ; Point to the I/O write array\n"); - - fprintf(fp, "IOCheck:\n"); - fprintf(fp, " cmp [edi], word 0ffffh ; End of our list?\n"); - fprintf(fp, " je itsGood ; Yes - ignore it!\n"); - fprintf(fp, " cmp bx, [edi] ; Are we smaller?\n"); - fprintf(fp, " jb nextIOAddr ; Yes... go to the next addr\n"); - fprintf(fp, " cmp bx, [edi+2] ; Are we bigger?\n"); - fprintf(fp, " jbe callIOHandler ; If not, go call it!\n"); - - fprintf(fp, "nextIOAddr:\n"); - fprintf(fp, " add edi, 0ch ; Next structure, please\n"); - fprintf(fp, " jmp short IOCheck\n"); - - fprintf(fp, "callIOHandler:\n"); - - if (FALSE == bUseStack) - { - fprintf(fp, " mov eax, ebx ; Address\n"); - fprintf(fp, " mov ebx, edi ; Pointer to struct (EDX Already has the byte to write)\n"); - } - else - { - fprintf(fp, " push edi ; Handler\n"); - fprintf(fp, " push edx ; Byte\n"); - fprintf(fp, " push ebx ; Address\n"); - } - - fprintf(fp, " call dword [edi+4] ; Call the handler!\n"); - - if (bUseStack) - fprintf(fp, " add esp, 12\n"); - - fprintf(fp, " jmp short itsGood\n\n"); - - // Errors and whatnot - - fprintf(fp, "invalidWrite:\n"); - fprintf(fp, " mov eax, 0ffffffffh\n"); - fprintf(fp, " jmp short writeValueExit\n\n"); - - fprintf(fp, "itsGood:\n"); - fprintf(fp, " xor eax, eax\n\n"); - - fprintf(fp, "writeValueExit:\n"); - - fprintf(fp, " pop ebp\n"); - fprintf(fp, " pop ecx\n"); - fprintf(fp, " pop ebx\n"); - fprintf(fp, " pop edx\n"); - fprintf(fp, " pop esi\n"); - fprintf(fp, " pop edi\n"); - - fprintf(fp, " ret\n\n"); - - Alignment(); - - fprintf(fp, " global _%sReadValue\n", cpubasename); - fprintf(fp, " global %sReadValue_\n", cpubasename); - - if (bPlain) - fprintf(fp, " global %sReadValue\n", cpubasename); - - sprintf(procname, "%sReadValue_", cpubasename); - ProcBegin(0xffffffff); - - fprintf(fp, "_%sReadValue:\n", cpubasename); - if (bPlain) - fprintf(fp, "%sReadValue:\n", cpubasename); - - fprintf(fp, " push esi\n"); - fprintf(fp, " push edi\n"); - fprintf(fp, " push edx\n"); - fprintf(fp, " push ebx\n"); - fprintf(fp, " push ecx\n"); - fprintf(fp, " push ebp\n"); - - if (bUseStack) - { - fprintf(fp, " mov eax, [esp+28] ; What kind of read is this?\n"); - fprintf(fp, " mov ebx, [esp+32] ; Address\n"); - } - else - { - fprintf(fp, " xchg edx, ebx ; Addr=EBX\n"); - } - - fprintf(fp, " cmp eax, 1 ; Is it a word read?\n"); - fprintf(fp, " je near invalidRead ; Yep - it's not valid\n"); - fprintf(fp, " cmp eax, 2 ; Is it a dword read?\n"); - fprintf(fp, " je near invalidRead ; Yep - it's not valid\n\n"); - fprintf(fp, " or eax, eax ; Is it a byte read?\n"); - fprintf(fp, " jnz itsIoDummyRead ; Nope... it's an I/O read\n\n"); - - // Here we do a read memory byte - - fprintf(fp, " mov ebp, [_z80Base] ; Base pointer comes back\n"); - fprintf(fp, " mov edi, [_z80MemRead] ; Point to the read array\n"); - - fprintf(fp, "checkLoopRead:\n"); - fprintf(fp, " cmp [edi], word 0ffffh ; End of our list?\n"); - fprintf(fp, " je memoryRead ; Yes - go read it!\n"); - fprintf(fp, " cmp bx, [edi] ; Are we smaller?\n"); - fprintf(fp, " jb nextAddrRead ; Yes... go to the next addr\n"); - fprintf(fp, " cmp bx, [edi+4] ; Are we smaller?\n"); - fprintf(fp, " jbe callRoutineRead ; If not, go call it!\n"); - - fprintf(fp, "nextAddrRead:\n"); - fprintf(fp, " add edi, 10h ; Next structure, please\n"); - fprintf(fp, " jmp short checkLoopRead\n"); - - fprintf(fp, "callRoutineRead:\n"); - - fprintf(fp, "\n;\n; EBX=Address to target\n;\n\n"); - - fprintf(fp, " cmp [edi+8], dword 0 ; NULL HAndler?\n"); - fprintf(fp, " je handleSharedRead\n\n"); - - if (FALSE == bUseStack) - { - fprintf(fp, " mov eax, ebx ; Address\n"); - fprintf(fp, " mov edx, edi ; Pointer to struct\n"); - } - else - { - fprintf(fp, " push edi ; Handler\n"); - fprintf(fp, " push ebx ; Address\n"); - } - - fprintf(fp, " call dword [edi + 8] ; Go call our handler\n"); - fprintf(fp, " mov dl, al ; Get our byte read\n"); - - if (bUseStack) - { - fprintf(fp, " add esp, 8\n"); - } - - fprintf(fp, " jmp short itsGoodRead\n\n"); - - fprintf(fp, "memoryRead:\n"); - fprintf(fp, " mov dl, [ebp+ebx]\n\n"); - fprintf(fp, " jmp short itsGoodRead\n\n"); - - fprintf(fp, "handleSharedRead:\n"); - fprintf(fp, " sub ebx, [edi]\n"); - fprintf(fp, " add ebx, [edi+12]\n"); - fprintf(fp, " mov dl, [ebx]\n"); - fprintf(fp, " jmp short itsGoodRead\n\n"); - - // Here we do an "out" - - fprintf(fp, "itsIoDummyRead:\n"); - - fprintf(fp, " mov edi, [_z80IoRead] ; Point to the I/O read array\n"); - fprintf(fp, " mov dl, 0ffh ; Assume no handler\n"); - - fprintf(fp, "IOCheckRead:\n"); - fprintf(fp, " cmp [edi], word 0ffffh ; End of our list?\n"); - fprintf(fp, " je itsGoodRead ; Yes - ignore it!\n"); - fprintf(fp, " cmp bx, [edi] ; Are we smaller?\n"); - fprintf(fp, " jb nextIOAddrRead ; Yes... go to the next addr\n"); - fprintf(fp, " cmp bx, [edi+2] ; Are we bigger?\n"); - fprintf(fp, " jbe callIOHandlerRead ; If not, go call it!\n"); - - fprintf(fp, "nextIOAddrRead:\n"); - fprintf(fp, " add edi, 0ch ; Next structure, please\n"); - fprintf(fp, " jmp short IOCheckRead\n"); - - fprintf(fp, "callIOHandlerRead:\n"); - - if (FALSE == bUseStack) - { - fprintf(fp, " mov eax, ebx ; Address\n"); - fprintf(fp, " mov edx, edi ; Pointer to struct (EDX Already has the byte to write)\n"); - } - else - { - fprintf(fp, " push edi ; Handler\n"); - fprintf(fp, " push ebx ; Address\n"); - } - - fprintf(fp, " call dword [edi+4] ; Call the handler!\n"); - fprintf(fp, " mov dl, al ; Get our byte read\n"); - - if (bUseStack) - fprintf(fp, " add esp, 8\n"); - - fprintf(fp, " jmp short itsGoodRead\n\n"); - - // Errors and whatnot - - fprintf(fp, "invalidRead:\n"); - fprintf(fp, " mov eax, 0ffffffffh\n"); - fprintf(fp, " jmp short ReadValueExit\n\n"); - - fprintf(fp, "itsGoodRead:\n"); - fprintf(fp, " xor eax, eax\n"); - fprintf(fp, " mov al, dl\n\n"); - - fprintf(fp, "ReadValueExit:\n"); - - fprintf(fp, " pop ebp\n"); - fprintf(fp, " pop ecx\n"); - fprintf(fp, " pop ebx\n"); - fprintf(fp, " pop edx\n"); - fprintf(fp, " pop esi\n"); - fprintf(fp, " pop edi\n"); - - fprintf(fp, " ret\n\n"); - - - - } - else - if (MZ80_C == bWhat) - { - } -} - - -EmitCode() -{ - CodeSegmentBegin(); - EmitCBInstructions(); - EmitEDInstructions(); - - if (MZ80_ASSEMBLY_X86 == bWhat) - strcpy(mz80Index, "ix"); - - else - { - strcpy(mz80Index, "cpu.z80IX"); - strcpy(mz80IndexHalfHigh, "cpu.z80XH"); - strcpy(mz80IndexHalfLow, "cpu.z80XL"); - } - - strcpy(majorOp, "DD"); - EmitDDInstructions(); - - if (MZ80_ASSEMBLY_X86 == bWhat) - strcpy(mz80Index, "iy"); - else - { - strcpy(mz80Index, "cpu.z80IY"); - strcpy(mz80IndexHalfHigh, "cpu.z80YH"); - strcpy(mz80IndexHalfLow, "cpu.z80YL"); - } - - strcpy(majorOp, "FD"); - EmitFDInstructions(); - majorOp[0] = '\0'; - EmitRegularInstructions(); - ReadMemoryByteHandler(); - WriteMemoryByteHandler(); - - if (bThroughCallHandler) - { - PushWordHandler(); - PopWordHandler(); - } - - ReadIoHandler(); - WriteIoHandler(); - GetContextCode(); - SetContextCode(); - GetContextSizeCode(); - GetTicksCode(); - ReleaseTimesliceCode(); - ResetCode(); - IntCode(); - NmiCode(); - ExecCode(); - InitCode(); - ShutdownCode(); - DebuggerCode(); - CodeSegmentEnd(); -} - -main(int argc, char **argv) -{ - UINT32 dwLoop = 0; - - printf("MakeZ80 - V%s - Copyright 1996-2000 Neil Bradley (neil@synthcom.com)\n", VERSION); - - if (argc < 2) - { - printf("Usage: %s outfile [option1] [option2] ....\n", argv[0]); - printf("\n -s - Stack calling conventions (DJGPP, MSVC, Borland)\n"); - printf(" -x86 - Emit an assembly version of mz80\n"); - printf(" -c - Emit a C version of mz80\n"); - printf(" -cs - All stack operations go through handlers\n"); - printf(" -16 - Treat all I/O input and output as 16 bit (BC) instead of (C)\n"); - printf(" -l - Create 'plain' labels - ones without leading or trailing _'s\n"); - printf(" -nt - No timing additions occur\n"); - printf(" -os2 - Emit OS/2 compatible segmentation pragmas\n"); - exit(1); - } - - dwLoop = 1; - - while (dwLoop < argc) - { - if (strcmp("-x86", argv[dwLoop]) == 0 || strcmp("-X86", argv[dwLoop]) == 0) - bWhat = MZ80_ASSEMBLY_X86; - if (strcmp("-c", argv[dwLoop]) == 0 || strcmp("-C", argv[dwLoop]) == 0) - bWhat = MZ80_C; - if (strcmp("-cs", argv[dwLoop]) == 0 || strcmp("-cs", argv[dwLoop]) == 0) - bThroughCallHandler = TRUE; - if (strcmp("-s", argv[dwLoop]) == 0 || strcmp("-S", argv[dwLoop]) == 0) - bUseStack = 1; - if (strcmp("-l", argv[dwLoop]) == 0 || strcmp("-L", argv[dwLoop]) == 0) - bPlain = TRUE; - if (strcmp("-16", argv[dwLoop]) == 0) - b16BitIo = TRUE; - if (strcmp("-os2", argv[dwLoop]) == 0 || strcmp("-OS2", argv[dwLoop]) == 0) - bOS2 = TRUE; - if (strcmp("-nt", argv[dwLoop]) == 0) - { - bNoTiming = TRUE; - } - - dwLoop++; - } - - if (bWhat == MZ80_UNKNOWN) - { - fprintf(stderr, "Need emitted type qualifier\n"); - exit(1); - } - - for (dwLoop = 1; dwLoop < argc; dwLoop++) - if (argv[dwLoop][0] != '-') - { - fp = fopen(argv[dwLoop], "w"); - break; - } - - if (NULL == fp) - { - fprintf(stderr, "Can't open %s for writing\n", argv[1]); - exit(1); - } - - strcpy(cpubasename, "mz80"); - - StandardHeader(); - DataSegment(); - EmitCode(); - ProgramEnd(); - - fclose(fp); -} diff --git a/cpu/mz80/mz80.c b/cpu/mz80/mz80.c deleted file mode 100644 index b7733fd3..00000000 --- a/cpu/mz80/mz80.c +++ /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 -#include -#include -#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 index 1e2c47c7..00000000 --- a/cpu/mz80/mz80.h +++ /dev/null @@ -1,394 +0,0 @@ -/* Multi-Z80 32 Bit emulator */ - -/* Copyright 1996, Neil Bradley, All rights reserved - * - * License agreement: - * - * The mZ80 emulator 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 object only form. - * - * 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. - */ - -/* General z80 based defines */ - -#ifndef _MZ80_H_ -#define _MZ80_H_ - -#ifndef UINT32 -#define UINT32 unsigned long int -#endif - -#ifndef UINT16 -#define UINT16 unsigned short int -#endif - -#ifndef UINT8 -#define UINT8 unsigned char -#endif - -#ifndef INT32 -#define INT32 signed long int -#endif - -#ifndef INT16 -#define INT16 signed short int -#endif - -#ifndef INT8 -#define INT8 signed char -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _MEMORYREADWRITEBYTE_ -#define _MEMORYREADWRITEBYTE_ - -struct MemoryWriteByte -{ - UINT32 lowAddr; - UINT32 highAddr; - void (*memoryCall)(UINT32, UINT8, struct MemoryWriteByte *); - void *pUserArea; -}; - -struct MemoryReadByte -{ - UINT32 lowAddr; - UINT32 highAddr; - UINT8 (*memoryCall)(UINT32, struct MemoryReadByte *); - void *pUserArea; -}; - -#endif // _MEMORYREADWRITEBYTE_ - -struct z80PortWrite -{ - UINT16 lowIoAddr; - UINT16 highIoAddr; - void (*IOCall)(UINT16, UINT8, struct z80PortWrite *); - void *pUserArea; -}; - -struct z80PortRead -{ - UINT16 lowIoAddr; - UINT16 highIoAddr; - UINT16 (*IOCall)(UINT16, struct z80PortRead *); - void *pUserArea; -}; - -struct z80TrapRec -{ - UINT16 trapAddr; - UINT8 skipCnt; - UINT8 origIns; -}; - -typedef union -{ - UINT32 af; - - struct - { -#ifdef WORDS_BIGENDIAN - UINT16 wFiller; - UINT8 a; - UINT8 f; -#else - UINT8 f; - UINT8 a; - UINT16 wFiller; -#endif - } half; -} reg_af; - -#define z80AF z80af.af -#define z80A z80af.half.a -#define z80F z80af.half.f - -typedef union -{ - UINT32 bc; - - struct - { -#ifdef WORDS_BIGENDIAN - UINT16 wFiller; - UINT8 b; - UINT8 c; -#else - UINT8 c; - UINT8 b; - UINT16 wFiller; -#endif - } half; -} reg_bc; - -#define z80BC z80bc.bc -#define z80B z80bc.half.b -#define z80C z80bc.half.c - -typedef union -{ - UINT32 de; - - struct - { -#ifdef WORDS_BIGENDIAN - UINT16 wFiller; - UINT8 d; - UINT8 e; -#else - UINT8 e; - UINT8 d; - UINT16 wFiller; -#endif - } half; -} reg_de; - -#define z80DE z80de.de -#define z80D z80de.half.d -#define z80E z80de.half.e - -typedef union -{ - UINT32 hl; - - struct - { -#ifdef WORDS_BIGENDIAN - UINT16 wFiller; - UINT8 h; - UINT8 l; -#else - UINT8 l; - UINT8 h; - UINT16 wFiller; -#endif - } half; -} reg_hl; - -#define z80HL z80hl.hl -#define z80H z80hl.half.h -#define z80L z80hl.half.l - -#define z80SP z80sp.sp - -typedef union -{ - UINT32 ix; - - struct - { -#ifdef WORDS_BIGENDIAN - UINT16 wFiller; - UINT8 xh; - UINT8 xl; -#else - UINT8 xl; - UINT8 xh; - UINT16 wFiller; -#endif - } half; -} reg_ix; - -#define z80IX z80ix.ix -#define z80XH z80ix.half.xh -#define z80XL z80ix.half.xl - -typedef union -{ - UINT32 iy; - - struct - { -#ifdef WORDS_BIGENDIAN - UINT16 wFiller; - UINT8 yh; - UINT8 yl; -#else - UINT8 yl; - UINT8 yh; - UINT16 wFiller; -#endif - } half; -} reg_iy; - -#define z80IY z80iy.iy -#define z80YH z80iy.half.yh -#define z80YL z80iy.half.yl - -struct mz80context -{ - UINT8 *z80Base; - struct MemoryReadByte *z80MemRead; - struct MemoryWriteByte *z80MemWrite; - struct z80PortRead *z80IoRead; - struct z80PortWrite *z80IoWrite; - UINT32 z80clockticks; - UINT32 z80iff; - UINT32 z80interruptMode; - UINT32 z80halted; - - reg_af z80af; - reg_bc z80bc; - reg_de z80de; - reg_hl z80hl; - UINT32 z80afprime; - UINT32 z80bcprime; - UINT32 z80deprime; - UINT32 z80hlprime; - reg_ix z80ix; - reg_iy z80iy; - UINT32 z80sp; - UINT32 z80pc; - UINT32 z80nmiAddr; - UINT32 z80intAddr; - UINT32 z80rCounter; - UINT8 z80i; - UINT8 z80r; - UINT8 z80intPending; -}; - -// These are the enumerations used for register access. DO NOT ALTER THEIR -// ORDER! It must match the same order as in the mz80.c/mz80.asm files! - -enum -{ -#ifndef CPUREG_PC - CPUREG_PC = 0, -#endif - CPUREG_Z80_AF = 1, - CPUREG_Z80_BC, - CPUREG_Z80_DE, - CPUREG_Z80_HL, - CPUREG_Z80_AFPRIME, - CPUREG_Z80_BCPRIME, - CPUREG_Z80_DEPRIME, - CPUREG_Z80_HLPRIME, - CPUREG_Z80_IX, - CPUREG_Z80_IY, - CPUREG_Z80_SP, - CPUREG_Z80_I, - CPUREG_Z80_R, - CPUREG_Z80_A, - CPUREG_Z80_B, - CPUREG_Z80_C, - CPUREG_Z80_D, - CPUREG_Z80_E, - CPUREG_Z80_H, - CPUREG_Z80_L, - CPUREG_Z80_F, - CPUREG_Z80_CARRY, - CPUREG_Z80_NEGATIVE, - CPUREG_Z80_PARITY, - CPUREG_Z80_OVERFLOW, - CPUREG_Z80_HALFCARRY, - CPUREG_Z80_ZERO, - CPUREG_Z80_SIGN, - CPUREG_Z80_IFF1, - CPUREG_Z80_IFF2, - - // Leave this here! - - CPUREG_Z80_MAX_INDEX -}; - -extern UINT32 mz80exec(UINT32); -extern UINT32 mz80GetContextSize(void); -extern UINT32 mz80GetElapsedTicks(UINT32); -extern void mz80ReleaseTimeslice(void); -extern void mz80GetContext(void *); -extern void mz80SetContext(void *); -extern void mz80reset(void); -extern void mz80ClearPendingInterrupt(void); -extern UINT32 mz80int(UINT32); -extern UINT32 mz80nmi(void); -extern void mz80init(void); -extern void mz80shutdown(void); -extern UINT32 z80intAddr; -extern UINT32 z80nmiAddr; - -// Debugger useful routines - -extern UINT8 mz80SetRegisterValue(void *, UINT32, UINT32); -extern UINT32 mz80GetRegisterValue(void *, UINT32); -extern UINT32 mz80GetRegisterTextValue(void *, UINT32, UINT8 *); -extern UINT8 *mz80GetRegisterName(UINT32); - -// Memory/IO read/write commands - -#ifndef VALUE_BYTE -#define VALUE_BYTE 0 -#endif - -#ifndef VALUE_WORD -#define VALUE_WORD 1 -#endif - -#ifndef VALUE_DWORD -#define VALUE_DWORD 2 -#endif - -#ifndef VALUE_IO -#define VALUE_IO 3 -#endif - -extern void mz80WriteValue(UINT8 bWhat, UINT32 dwAddr, UINT32 dwData); -extern UINT32 mz80ReadValue(UINT8 bWhat, UINT32 dwAddr); - -// Flag definitions - -#define Z80_FLAG_CARRY 0x01 -#define Z80_FLAG_NEGATIVE 0x02 -#define Z80_FLAG_OVERFLOW_PARITY 0x04 -#define Z80_FLAG_UNDEFINED1 0x08 -#define Z80_FLAG_HALF_CARRY 0x10 -#define Z80_FLAG_UNDEFINED2 0x20 -#define Z80_FLAG_ZERO 0x40 -#define Z80_FLAG_SIGN 0x80 - -#define IFF1 0x01 -#define IFF2 0x02 - -typedef struct mz80context CONTEXTMZ80; - -#ifdef __cplusplus -}; -#endif - -#endif // _MZ80_H_ diff --git a/cpu/mz80/mz80.txt b/cpu/mz80/mz80.txt deleted file mode 100644 index c4f84447..00000000 --- a/cpu/mz80/mz80.txt +++ /dev/null @@ -1,809 +0,0 @@ -Multi-Z80 32 Bit emulator -Copyright 1996, 1997, 1998, 1999, 2000 - Neil Bradley, All rights reserved - - MZ80 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 x86, giving maximum performance. - - MZ80 Contact information - ------------------------- - -Author : Neil Bradley (neil@synthcom.com) -Distribution: ftp://ftp.synthcom.com/pub/emulators/cpu/makez80.zip (latest) - -You can join the cpuemu mailing list on Synthcom for discussion of Neil -Bradley's Z80 (and other) CPU emulators. Send a message to -"cpuemu-request@synthcom.com" with "subscribe" in the message body. The -traffic is fairly low, and is used as a general discussion and announcement -for aforementioned emulators. - - - MZ80 Documentation - ------------------- - -MZ80 Is a full featured Z80 emulator coded in 32 bit assembly. It runs well -over a hundred games, in addition to it supporting many undocumented Z80 -instructions required to run some of the Midway MCR games, Galaga, and -countless other wonderful Z80 based arcade games. - -MZ80 Contains a makez80.c program that must be compiled. It is the program -that emits the assembly code that NASM will compile. This minimizes the -possibility of bugs creeping in to MZ80 for the different addressing modes -for each instruction. It requires NASM 0.97 or greater. - -The goal of MZ80 is to have a high performance Z80 emulator that is capable -of running multiple emulations concurrently at full speed, even on lower-end -machines (486/33). MZ80 Harnesses the striking similarities of both the Z80 -and the x86 instruction sets to take advantage of flag handling which greatly -reduces the time required to emulate a processor, so no extra time is spent -computing things that are already available in the native x86 processor, -allowing it to perform leaps and bounds over comparable C based Z80 emulators -on the same platform. - -MZ80 Is designed exclusively for use with NASM, the Netwide Assembler. This -gives the ultimate in flexibility, as NASM can emit object files that work -with Watcom, Microsoft Visual C++ (4.0-current), DJGPP, Borland C++, and -gcc under FreeBSD or Linux. MZ80 Has been tested with each one of these -compilers and is known to work properly on each. - - - What's in the package - --------------------- - -MZ80.TXT - This text file - -MAKEZ80.C - Multi Z80 32 Bit emulator emitter program - -MZ80.H - C Header file for MZ80 functions - - - What's new in this release - -------------------------- - -Revision 3.4: - - * Fixed the overflow flag not getting cleared in the SetOverflow() - routine. It caused strange problems with a handful of Genesis games - * Removed invalid instruction in the C version so that more - instructions will execute - -Revision 3.3: - - * Undocumented opcodes added to the C emitter - * Bug fix to the C emission that properly handles shared RAM regions - (I.E. with handlers that are NULL) - * Now using 32 bit registers to do register/memory access. Slight - speed increase (assembly version only) - -Revision 3.2: - - * R Register emulation now accurate with a real Z80 - * mz80int() Called when interrupts are disabled causes the - z80intPending flag to be set, and an interrupt will be caused after - the execution of EI and the next instruction. See "IMPORTANT NOTE - ABOUT INTERRUPTS" below - * The instruction after EI executes fully before interrupt status is - checked. (as does a real Z80) - - -Revision 3.1: - - * Fixed bug in memory dereference when handler was set to NULL (keeps - system from crashing or faulting) - * Removed the only stricmp() from the entire file and replaced it - with strcmp() so that stdlibs without it will compile - * Changed cyclesRemaining > 0 to cyclesRemaining >= 0 to be compatible - with the ASM core - * Removed additional sub [dwCyclesRemaining], 5 at the beginning of - mz80exec() (ASM Core only). Increases timing accuracy. - * NMIs And INTs add additional time to dwElapsedTicks as it should - * mz80ReleaseTimeslice() Sets remaining clocks to 0 instead of 1 - - -Revision 3.0: - - * All instructions validated against a real Z80. Used an ISA card - with a Z80 on it to validate flag handling, instruction handling, - timing, and other goodies. The only thing not implemented/emulated - is flag bit 3 & 5 emulation. Believed to be 100% bug free! - * 80% Speed improvement over version 2.7 of mz80 - * z80stb.c Removed. Use -c to emit a C version of mz80! API compatible! - Note that this is mostly, but not fully, debugged, so consider the - C version a beta! It's at least healthier than z80stb.c was. The C - version does not include the undocumented Z80 instructions. - * mz80nmi() No longer trashes registers it uses when using -cs - * IN/OUT Instructions work properly when using -16 - * IN A, (xxh) uses A as high 8 bits of I/O fetch address when using -16 - * IM 0/IM 1 Description in documentation fixed - * Sizes of all context registers increased to 32 bits - for speed! - * IFF1/IFF2 Now properly emulated - * JR Instruction offset can fetch from $ffff and properly wrap - * LDIR/LDDR Instruction now won't go to completion - instead it will - run until BC=0 or the # of cycles to execute have expired. These - instructions used to run to completion - even beyond the # of cycles - left to execute - * INI/IND/INIR/INDR countdown bug fixed - it was decrementing B twice - for each IN! Whoops! - * If you specify NULL as a handler address to a memory region, mz80 will - use vpData as a pointer to where that block of data resides. Quite - useful for multiprocessor emulations that share the same memory. - * EDI Now keeps track of cycle counting for faster execution - * Modified memory region scanning code to use 32 bit registers instead - of their 16 bit counterparts - * Get/SetContext() uses rep movsd/movsb. Insignificant overall, but - why waste the time? - * Debugging routines added. See the "DEBUGGING" section below for more - information. NOTE: The debugging routines are not yet available in - the C emission. - * Timing done slightly differently now. Mz80 now executes one - instruction past the timing given on input. For example, mz80exec(0) - will cause a single instruction to be executed (thusly -ss was - removed). - -Revision 2.7: - - * Fixed OTIR/OTDR/INIR/INDR instructions so their 16 bit counterparts - work properly - * Emulation core 30-70% faster overall than 2.6 due to optimization to - the timing routines - * Replaced word reads/writes with a special word write routine rather - than the standard calling to read/write byte functions - * z80stb.c (the C equivalent of mz80) compiles properly now - * Fixed OS/2 text/segment issue - * Fixed bug in set/getCPU context that ensures that ES=DS and avoids - crashes. Caused crashes under OS/2 and other OS's - -Revision 2.6: - - * Emulator core 5-30% faster overall. Some 16 and 8 bit instructions - sped up when using their 32 bit equivalents. - * Fix to -l so that proper labels without leading and trailing - underscores so Linux/FreeBSD compiles will work properly - * Single step now executes the # of instructions passed in to z80exec() - instead of just 1 as it had in prior releases. This is only active - when the -ss option is used. - * The -nt option was added. This will cause the timing information to - not be added in, speeding up execution. Warning: Only do this if your - emulated target does not require instruction timing! - * Updated documentation errors - * C Version of mz80 (mz80.c) that is API compliant is distributed with - the archive (With kind permission of Edward Massey). - -Revision 2.5: - - * Fixed an unconditional flag being cleared in the ddcbxx instructions. - It caused Donkey Kong's barrels to not roll. - -Revision 2.4: - - * Fixed improper HALT handling (didn't advance the PTR when it should) - * Fixed SRL (IX+$xx) instruction so that carry wasn't trashed - * Fixed single stepping problems with it giving too much time to - any given instruction - * Fixed half carry flag handling with 16 bit SBC and ADD instructions - * Fixed DAA emulation so that parity flags weren't getting trashed - -Revision 2.3: - - * Fixed many stack handling bugs - * Timing problems fixed. The prior version was causing massive - overruns on maximum timeslices with some insutructions. - -Revision 2.2: - - * Fixed a bug in CPI/CPD/CPIR/CPDR that mishandled flags - * All known bugs are out of mz80 now - * Added the -cs option to route all stack operations through the - handlers (required for games like Galaga) - -Revision 2.1: - - * Fixed a bug in CPI/CPD/CPIR/CPDR that caused intermittent lockups. - Also fixed a bug that caused erratic behavior in several video games. - * Added INI/IND/INIR/INDR instruction group - * Added OUTI/OUTD/OTIR/OTDR instruction group - -Revision 1.0: - - * First release! The whole thing is new! - - -ASSEMBLING FOR USE WITH WATCOM C/C++ ------------------------------------- - -Watcom, by default, uses register calling conventions, as does MZ80. To -create a proper emulator for Watcom: - - makez80 MZ80.asm -x86 - -From here: - - nasm -f win32 MZ80.asm - -Link the MZ80.obj with your Watcom linker. - - -ASSEMBLING FOR USE WITH MICROSOFT VISUAL C++ AND BORLAND C++ --------------------------------------------------------------------- - -Visual C++ and Borland C++ use stack calling conventions by default. To -create a proper emulator for these compilers: - - makez80 MZ80.asm -s -x86 - -For Visual C++ or Borland C++: - - nasm -f win32 MZ80.asm - -Link with your standard Visual C++ or Borland C++. - - -ASSEMBLING FOR USE WITH DJGPP, GCC/FREEBSD, OR GCC/LINUX --------------------------------------------------------------------- - -DJGPP Uses stack calling conventions: - - makez80 MZ80.asm -s -x86 - -To assemble: - - nasm -f coff MZ80.asm - -Link with your standard DJGPP linker. The same holds true for GCC under -FreeBSD or Linux. If you're using GCC, use the -l option to generate "plain" -labels so that gcc's linker will properly link things. - - -MAKEZ80 COMMAND LINE OPTIONS ----------------------------- - --s - Use stack calling conventions (DJGPP, MSVC, Borland, etc...) - --cs - Force all stack operations to go through the Read/Write memory handlers. - This slows things down, but is useful when needed. - --16 - Treat all I/O input and output as 16 bit (BC) - --l - Create 'plain' labels - ones without leading and trailing underscores - --nt - Do not generate timing code - this speeds the emulator up, but the - downside is that no timing info is available. - --c - Emit a C mz80 emulator (API Compatible with the assembly version - - handy for porters!) - --x86 - Emit an assembly (x86) mz80 emulator - --os2 - Generate OS/2 compatible segmentation - - -IMPORTANT NOTE ABOUT INTERRUPTS -------------------------------- - -A minor change was made between the 3.1 and 3.2 versions of makez80 in the -way that interrupts were handled. - -On a real Z80, the !INT line is a level triggered interrupt, meaning that if -the interrupt line is held low, the Z80 will continue to take interrupts -immediately after the instruction after the EI instruction is executed until -the interrupt line is high again. - -In 3.1, if an interrupt came in and interrupts were disabled, the interrupt -would never be "latched" for later execution. The Z80 does not have any -internal latching capabilities, however external hardware often does hold -the interrupt line low until the interrupt is executed, in effect, a latch. - -I've only found one video game so far that requires the "raising/lowering" -of the interrupt line (Ataxx). In the games that I've tried, it has improved -performance, in some cases drastically, and in others not at all. This can -be accounted for by interrupts being taken now, where they were being dropped -in prior mz80 releases. - -mz80 Emulates the most commonly used scenario. Now when mz80int() is executed -and a nonzero value is returned (indicating interrupts were disabled), it -will set z80intPending, and the interrupt will be taken after execution of -one instruction beyond the EI instruction. - -So now, if mz80int() returns a nonzero value, that means an interrupt is -latched. If clearing this latch is desired or the old behavior of 3.1 is -desired, make a call to the mz80ClearPendingInterrupt() call. It's a 2 -instruction call that has extremely small overhead and will not affect -performance in any measurable way. - -In any case, MZ80 will now execute one instruction after EI regardless of -how much time is available to avoid the possibility of an interrupt request -coming in directly after the EI instruction. - - -STEPS TO EMULATION ------------------- - -NOTE: -16 Is a command line option that will treat all I/O as 16 bit. That -is, in an instruction like "IN AL, (C)", the addressed passed to the I/O -handler will be BC instead of just C. Bear this in mind when considering your -emulated platform. - -There are a few steps you want to go through to get proper emulation, and a -few guidelines must be followed. - -1) Create a MZ80CONTEXT - -2) Create your virtual 64K memory space using whatever means of obtaining - memory you need to do. - -3) Set mz80Base in your context to be the base of your 64K memory space - -4) Load up your image to be emulated within that 64K address space. - -5) Set z80IoRead and z80IoWrite to their appropriate structure arrays. Here's - an example: - -struct z80PortRead ReadPorts[] = -{ - {0x10, 0x1f, SoundChip1Read}, - {0x20, 0x2f, SoundChip2Read} - {(UINT32) -1, (UINT32) -1, NULL} -}; - -When an IN instruction occurs, mz80 will probe this table looking for a -handler to the address of the "IN" instruction. If it is found in the list, -it's up to the handler to return the proper value. Otherwise, a value of -0ffh is returned internally if no handler for that I/O address is found. In -the case above, SoundChip1Read is called when the I/O address is between 0x10- -0x1f. A similar structure is used for I/O writes as well (OUT): - -struct z80PortWrite WritePorts[] = -{ - {0x20, 0x2f, SoundChip2Write}, - {0x30, 0x36, VideoCtrlWrite}, - {(UINT32) -1, (UINT32) -1, NULL} -} - -Of course, this does the opposite that the z80PortRead struct, and instead -looks for a handler to hand some data to. If it doesn't find an appropriate -handler, nothing happens. - -6) Set mz80MemoryRead & mz80MemoryWrite to their appropriate structure - arrays. Here is an example: - -struct MemoryWriteByte GameWrite[] = -{ - {0x3000, 0x3fff, VideoWrite}, - {0x4000, 0x4fff, SpriteWrite}, - {(UINT32) -1, (UINT32) -1, NULL} -}; - -The above example says that any time a write occurs in the 0x3000-0x3fff -range, call the VideoWrite routine. The same holds true for the SpriteWrite -region as well. - -NOTE: When your write handler is called, it is passed the address of the -write and the data that is to be written to it. If your handler doesn't -write the data to the virtual image, the mz80 internal code will not. - -NOTE: These routines will *NOT* be called when execution asks for these -addresses. It will only call them when a particular instruction uses the -memory at these locations. - -If you wish for a region to be RAM, just leave it out of your memory region -exception list. The WriteMemoryByte routine will treat it as read/write -RAM and will write to mz80Base + addr directly. - -If you wish to protect ROM regions (not often necessary), create a range that -encompasses the ROM image, and have it call a routine that does nothing. This -will prevent data from being written back onto the ROM image. - -Leave your last entry in the table as shown above, with a null handler and -0xffffffff-0xffffffff as your read address. Even though the Z80 only -addresses 64K of space, the read/write handlers are defined as 32 bit so -the compiler won't pass junk in the upper 16 bits of the address lines. Not -only that, it allows orthoganality for future CPU emulators that may use -these upper bits. - -You can do a mz80GetContext() if you'd like to read the current context of -the registers. Note that by the time your handler gets called, the program -counter will be pointing to the *NEXT* instruction. - -struct MemoryReadByte GameRead[] = -{ - {0x2000, 0x200f, ReadHandler}, - {(UINT32) -1, (UINT32) -1, NULL} -}; - -Same story here. If you have a special handler for an attempted read at a -particular address, place its range in this table and create a handler -routine for it. - -If you don't define a handler for a particular region, then the ReadMemoryByte -in mz80.ASM will actually read the value out of mz80Base + the offset -required to complete the instruction. - -7) Set the intAddr and nmiAddr to the addresses where you want mz80 to start - executing when an interrupt or NMI happens. Take a look at the section - entitled "INTERRUPTS" below for more information on this. - -8) Call mz80SetContext() on your Z80 context - -9) Call mz80Reset(). This will prime the program counter and cause a virtual - CPU-wide reset. - -10) Once you have those defined, you're ready to begin emulation. There's some - sort of main loop that you'll want. Maybe something like: - - while (hit == 0) - { - if (lastSec != (UINT32) time(0)) - { - diff = (mz80clockticks - prior) / 3000000; - printf("%ld Clockticks, %ld frames, %ld Times original speed\n", MZ80clockticks - prior, frames, diff); - frames = 0; - prior = mz80clockticks; - lastSec = time(0); - if (kbhit()) - { - getch(); - hit = 1; - } - } - - /* 9000 Cycles per NMI (~3 milliseconds @ 3MHZ) */ - - dwResult = mz80exec(9000); - mz80clockticks += mz80GetElapsedTicks(TRUE); - mz80nmi(); - - /* If the result is not 0x80000000, it's an address where - an invalid instruction was hit. */ - - if (0x80000000 != dwResult) - { - mz80GetContext(&sCpu1); - printf("Invalid instruction at %.2x\n", sCpu1.MZ80pc); - exit(1); - } - } - -Call mz80exec() With the # of virtual CPU cycles you'd like mz80 to -execute. Be sure to use the mz80GetElapsedTicks() call *AFTER* execution to -see how many virtual CPU cycles it actually executed. For example, if you tell -mz80 to execute 500 virtual CPU cycles, it will execute slightly more. Anything -from 500 to 524 (24 cycles being the longest any 1 instruction takes in the -Z80). - -Use the mz80GetElapsedTicks() call for more accurate cycle counting. Of course, -this is only if you have *NOT* included the -nt option. - -If you pass FALSE to the mz80GetElapsedTicks() function, the internal CPU -elapsed tick clock will not be reset. The elapsed tick counter is something -that continues to increase every emulated instruction, and like an odometer, -will keep counting unless you pass TRUE to mz80GetElapsedTicks(), of which -case it will return you the current value of the elapsed ticks and set it to -0 when complete. - -NOTE: The bigger value you pass to mz80exec, the greater benefit you get out -of the virtual registers persisting within the emulator, and it will run -faster. Pass in a value that is large enough to take advantage of it, but -not so often that you can't handle nmi or int's properly. - -If you wish to create a virtual NMI, call mz80nmi(), and it will be taken -the next time you call mz80exec, or alternately if you have a handler call -mz80nmi/mz80int(), the interrupt will be taken upon return. Note that -mz80nmi() doesn't actually execute any code - it only primes the emulator to -begin executing NMI/INT code. - -NOTE: mz80int() is defined with a UINT32 as a formal parameter. Depending -upon what interrupt mode you're executing in (described later), it may or may -not take a value. - -NMI's can interrupt interrupts, but not the other way around - just like a -real Z80. If your program is already in an interrupt, another one will not be -taken. The same holds true for an NMI - Just like a real Z80! - - -MUTLI-PROCESSOR NOTES ---------------------- - -Doing multi processor support is a bit trickier, but is still fairly straight- -forward. - -For each processor to be emulated, go through steps 1-7 above - giving each -CPU its own memory space, register storage, and read/write handlers. - - -EXECUTION OF MULTI-CPUS: -------------------------- - -When you're ready to execute a given CPU, do the following: - - mz80SetContext(contextPointer); - -This will load up all information saved before into the emulator and ready it -for execution. Then execute step 7 above to do your virtual NMI's, interrupts, -etc... All CPU state information is saved within a context. - -When the execution cycle is complete, do the following to save the updated -context away for later: - - mz80GetContext(contextPointer); - -Give each virtual processor a slice of time to execute. Don't make the values -too small or it will spend its time swapping contexts. While this in itself -isn't particularly CPU expensive, the more time you spend executing the better. -mz80 Keeps all of the Z80 register in native x86 register (including most -of the flags, HL, BC, and A). If no context swap is needed, then you get the -added advantage of the register storage. For example, let's say you were -running two Z80s - one at 2.0MHZ and one at 3.0MHZ. An example like this -might be desirable: - - mz80SetContext(cpu1Context); // Set CPU #1's information - mz80exec(2000); // 2000 Instructions for 2.0MHZ CPU - mz80GetContext(cpu1Context); // Get CPU #1's state info - - mz80SetContext(cpu2Context); // Set CPU #2's state information - mz80exec(3000); // 3000 Instructions for 3.0MHZ CPU - mz80GetContext(cpu2Context); // Get CPU #2's state information - -This isn't entirely realistic, but if you keep the instruction or timing -ratios between the emulated CPUs even, then timing is a bit more accurate. - -NOTE: If you need to make a particular CPU give up its own time cycle because -of a memory read/write, simply trap a particular address (say, a write to a -slave processor) and call mz80ReleaseTimeslice(). It will not execute any -further instructions, and will give up its timeslice. Put this in your -read/write memory trap. - -NOTE: You are responsible for "holding back" the processor emulator from -running too fast. - - -INTERRUPTS ----------- - -The Z80 has three interrupt modes: IM 0 - IM 2. Each act differently. Here's -a description of each: - -IM 0 - -This mode will cause the Z80 to be able to pull a "single byte instruction" -off the bus when an interrupt occurs. Since we're not doing bus cycle -emulation, it acts identically to mode 1 (described below). The formal -parameter to mz80int() is ignored. There is really no point in actually -emulating the instruction execution since any instruction that would be -executed would be a branch instruction! - -IM 1 - -This mode is the "default" mode that the Z80 (and mz80 for that matter) comes -up in. When you call mz80reset(), the interrupt address is set to 38h and -the NMI address is set to 66h. So when you're in IM 1 and mz80int() is -called, the formal parameter is ignored and the z80intAddr/z80nmiAddr values -are appropriately loaded into the program counter. - -IM 2 - -This mode causes the Z80 to read the upper 8 bits from the current value -of the "I" register, and the lower 8 bits from the value passed into mz80int(). -So, if I contained 35h, and you did an mz80int(0x64), then an interrupt at -address 3564h would be taken. Simple! - - -OTHER GOODIES -------------- - -MZ80 Has a nice feature for allowing the same handler to handle different -data regions on a single handler. Here's an example: - -struct PokeyDataStruct Pokey1; -struct PokeyDataStruct Pokey2; - -struct MemoryWriteByte GameWrite[] = -{ - {0x1000, 0x100f, PokeyHandler, Pokey1}, - {0x1010, 0x101f, PokeyHandler, Pokey2}, - {(UINT32) -1, (UINT32) -1, NULL} -}; - -void PokeyHandler(UINT32 dwAddr, UINT8 bData, struct sMemoryWriteByte *psMem) -{ - struct PokeyDataStruct *psPokey = psMem->pUserArea; - - // Do stuff with psPokey here.... -} - -This passes in the pointer to the sMemoryWriteByte structure that caused -the handler to be called. The pUserArea is a user defined address that can -be anything. It is not necessary to fill it in with anything or even -initialize it if the handler doesn't actually use it. - -This allows a single handler to handle multiple data references. This is -particularly useful when handling sound chip emulation, where there might -be more than one of a given device. Sure beats having multiple unique -handlers that are identical with the exception of the data area where it -writes! This allows a good deal of flexibility. - -The same construct holds for MemoryReadByte, z80PortRead, and z80PortWrite, -so all can take advantage of this feature. - - -SHARED MEMORY FEATURES ----------------------- - -MZ80 Also has another useful feature for dealing with shared memory regions: - -UINT8 bSharedRAM[0x100]; - -struct MemoryWriteByte Processor1[] = -{ - {0x1000, 0x10ff, NULL, bSharedRAM}, - {(UINT32) -1, (UINT32) -1, NULL} -}; - -struct MemoryWriteByte Processor2[] = -{ - {0x1000, 0x10ff, NULL, bSharedRAM}, - {(UINT32) -1, (UINT32) -1, NULL} -}; - -If the handler address is NULL, mz80 will look at the pUserArea field as a -pointer to RAM to read from/write to. This comes in extremely handy when you -have an emulation that requires two or more processors writing to the same -memory block. And it's lots faster than creating a handler that writes to -a common area as well. - - -DEBUGGING ---------- - -Several new functions have been added to mz80 that assist the emulator -author by providing a standard set of functions for register access: - -UINT8 mz80SetRegisterValue(void *pContext, UINT32 dwRegister, UINT32 dwValue) - -This allows setting of any register within the Z80. The register field can be -one of the following values (defined in mz80.h): - - CPUREG_PC - CPUREG_Z80_AF - CPUREG_Z80_BC - CPUREG_Z80_DE - CPUREG_Z80_HL - CPUREG_Z80_AFPRIME - CPUREG_Z80_BCPRIME - CPUREG_Z80_DEPRIME - CPUREG_Z80_HLPRIME - CPUREG_Z80_IX - CPUREG_Z80_IY - CPUREG_Z80_SP - CPUREG_Z80_I - CPUREG_Z80_R - CPUREG_Z80_A - CPUREG_Z80_B - CPUREG_Z80_C - CPUREG_Z80_D - CPUREG_Z80_E - CPUREG_Z80_H - CPUREG_Z80_L - CPUREG_Z80_F - CPUREG_Z80_CARRY - CPUREG_Z80_NEGATIVE - CPUREG_Z80_PARITY - CPUREG_Z80_OVERFLOW - CPUREG_Z80_HALFCARRY - CPUREG_Z80_ZERO - CPUREG_Z80_SIGN - CPUREG_Z80_IFF1 - CPUREG_Z80_IFF2 - -Each individual register's value can be set, including the flags at the end. -The only valid values for the flags are 1 and 0. Setting these will -automatically adjust the "F" register. - -If pContext is NULL, then the registers in the currently active context are -changed. If pContext points to a non-NULL area, that area is assumed to be -a CONTEXTMZ80 structure where the new register value will be written. - -If mz80SetRegisterValue() returns a nonzero value, either the register value -or register is out of range or invalid. - - -UINT32 mz80GetRegisterValue(void *pContext, UINT32 dwRegister) - -This returns the value of the register given on input (listed above as -CPUREG_Z80_xxxxx). Flag values will be 1 or 0. - -If pContext is NULL, then the registers in the currently active context are -read. If pContext points to a non-NULL area, that area is assumed to be -a CONTEXTMZ80 structure from which register values are pulled. - - -UINT32 mz80GetRegisterTextValue(void *pContext, UINT32 dwRegister, - UINT8 *pbTextArea) - -This returns the textual representation of the value of a given register. -It is a text printable string that can be used in sprintf() statements and -the like. This function is useful because different representations for -registers (like flags) can be a group of 8 flag bytes instead of a single -value. - -On entry, pContext being set to NULL indicates that mz80 should get the -register value from the currently active context. Otherwise, it is assumed -to be pointing to a CONTEXTMZ80 structure, which contains the value of the -registers to be read. - -pbTextArea points to a buffer where the value text can be written. This points -to a user supplied buffer. - -On exit, if any nonzero value is encountered, either the register # is out -of range or pbTextArea is NULL. - - -UINT8 *mz80GetRegisterName(UINT32 dwRegister) - -This returns a pointer to the textual name of the register passed in. NULL -Is returned if the register index (CPUREG_Z80_xxxx table described above) is -out of range. DO NOT MODIFY THE TEXT! It is static data. - - -FINAL NOTES ------------ - -I have debugged MZ80.ASM to the best of my abilities. There might still be -a few bugs floating around in it, but I'm not aware of any. I've validated -all instructions (That I could) against a custom built Z80 on an ISA card -(that fits in a PC) so I'm quite confident that it works just like a real -Z80. - -If you see any problems, please point them out to me, as I am eager to make -mz80 the best emulator that I can. - -If you have questions, comments, etc... about mz80, please don't hesitate -to send me an email. And if you use mz80 in your emulator, I'd love to take -a look at your work. If you have special needs, or need implementation -specific hints, feel free to email me, Neil Bradley (neil@synthcom.com). I -will do my best to help you. - -Enjoy! - -Neil Bradley -neil@synthcom.com - - diff --git a/pico/pico.h b/pico/pico.h index da0a9a72..561cae1a 100644 --- a/pico/pico.h +++ b/pico/pico.h @@ -225,13 +225,6 @@ extern short *PsndOut; extern void (*PsndMix_32_to_16l)(short *dest, int *src, int count); void PsndRerate(int preserve_state); -// Utils.c -extern int PicuAnd; -int PicuQuick(unsigned short *dest,unsigned short *src); -int PicuShrink(unsigned short *dest,int destLen,unsigned short *src,int srcLen); -int PicuShrinkReverse(unsigned short *dest,int destLen,unsigned short *src,int srcLen); -int PicuMerge(unsigned short *dest,int destLen,unsigned short *src,int srcLen); - #ifdef __cplusplus } // End of extern "C" #endif diff --git a/pico/utils.c b/pico/utils.c deleted file mode 100644 index 467bc785..00000000 --- a/pico/utils.c +++ /dev/null @@ -1,108 +0,0 @@ -// This is part of Pico Library - -// (c) Copyright 2004 Dave, All rights reserved. -// (c) Copyright 2006 notaz, All rights reserved. -// Free for non-commercial use. - -// For commercial use, separate licencing terms must be obtained. - - -#include "pico_int.h" - -int PicuAnd=0xf7de; - -// Quick low-quality conversion of 320 to 176: -int PicuQuick(unsigned short *dest,unsigned short *src) -{ - unsigned short *end=NULL; - - src+=13; end=src+290; - dest++; - - do - { - *dest++=*src++; - *dest++=*src; src+=2; - *dest++=*src; src+=2; - *dest++=*src++; - *dest++=*src; src+=2; - *dest++=*src; src+=2; - } - while (src>=1; bias+=destLen; } - *dest++=(unsigned short)pa; - - pa=*src++; bias-=sub; - if (bias<0) { pa+=*src++; pa>>=1; bias+=destLen; } - *dest++=(unsigned short)pa; - } - while (dest>=1; bias+=destLen; } - *(--dest)=(unsigned short)pa; - - pa=*src++; bias-=sub; - if (bias<0) { pa+=*src++; pa>>=1; bias+=destLen; } - *(--dest)=(unsigned short)pa; - } - while (dest>end); - - return 0; -} - -int PicuMerge(unsigned short *dest,int destLen,unsigned short *src,int srcLen) -{ - unsigned short *end=NULL; - int bias=0,pa=0,mask=PicuAnd,sub=0; - - end=dest+destLen; - sub=srcLen-destLen; - - do - { - pa=*src++; bias-=sub; - if (bias<0) { pa+=*src++; pa>>=1; bias+=destLen; } - pa&=mask; pa+=(*dest)&mask; pa>>=1; - *dest++=(unsigned short)pa; - - pa=*src++; bias-=sub; - if (bias<0) { pa+=*src++; pa>>=1; bias+=destLen; } - pa&=mask; pa+=(*dest)&mask; pa>>=1; - *dest++=(unsigned short)pa; - } - while (dest - -// names -_LIT(KServerName, "PicodriveNServ"); -_LIT(KServerWGName, "Picosmall"); // window group name -_LIT(KClientName, "PicodriveN"); -_LIT(KClientFind, "PicodriveN*"); // client search mask (for TFindLibrary) - - -// opcodes used in message passing between client and server -enum TPicoServRqst { - PicoMsgLoadState, - PicoMsgSaveState, - PicoMsgLoadROM, - PicoMsgResume, - PicoMsgReset, - PicoMsgKeys, - PicoMsgPause, - PicoMsgQuit, - PicoMsgConfigChange, // launcher -> emu - PicoMsgRetrieveConfig, // emu -> launcher - PicoMsgRetrieveDebugStr,// fixed to 512 bytes 4 now - kDefaultMessageSlots // this is how many messages we need :) -}; - - -// event messages to launcher -enum TPicoLauncherEvents { - EEventKeyCfgDone = EEventUser + 1, - EEventGamePaused, -}; - - -// configuration data to be sent between server and client -struct TPicoConfig { - enum TPicoScreenRotation { - PRot0, - PRot90, - PRot180, - PRot270 - }; - enum TPicoScreenMode { - PMCenter, - PMFit, - PMFit2 - }; - enum TPicoFrameSkip { - PFSkipAuto = -1, - PFSkip0 - }; - TInt32 iScreenRotation; - TInt32 iScreenMode; - TUint32 iFlags; // LSb->MSb: use_sram, show_fps, enable_sound, sound_rate(3bits), gzip_saves{=0x40}, dont_use_mot_vol - // enable_ym2612&dac, enable_sn76496, enable_z80, stereo_sound; - // alt_renderer, 6button_gamepad, accurate_timing - TInt32 iPicoOpt; - TInt32 iFrameskip; - TUint32 iKeyBinds[32]; - TUint32 iAreaBinds[19]; - TInt32 PicoRegion; -}; - - -#endif // __CLIENTSERVER_H diff --git a/platform/uiq2/Makefile b/platform/uiq2/Makefile deleted file mode 100644 index 3b96009e..00000000 --- a/platform/uiq2/Makefile +++ /dev/null @@ -1,321 +0,0 @@ -# environmental vars required: -# EPOCROOT2 - root of your SDK with slash at the end - -# settings -#dprint = 1 -#mz80 = 1 -#debug_cyclone = 1 -asm_memory = 1 -#asm_render = 1 -#use_musashi = 1 - -EPOCBLDUREL = _BUILD -EPOCTRGUREL = $(EPOCROOT2)EPOC32\RELEASE\ARMI\UREL -EPOCLINKUREL = $(EPOCTRGUREL) -EPOCSTATLINKUREL = $(EPOCTRGUREL) - - -# must set both PATH and Path to make it work correctly (?) -Path:=$(EPOCROOT2)EPOC32\gcc\bin;$(Path) -PATH:=$(Path) -ERASE = @erase 2>>nul - - -ALL : UREL -UREL : CHECKENV MAKEDIRS -UREL : $(EPOCTRGUREL)\PICOSMALL.EXE - -CLEAN : - @perl -S ermdir.pl "$(EPOCBLDUREL)" - @del *.o 2> NUL - -CLEANZ : - del ..\..\zlib\*.o 2> NUL - -CLEANM : - del ..\..\musashi\*.o 2> NUL - -CLEANALL : CLEAN CLEANZ CLEANM - - -# check for EPOCROOT2 -CHECKENV : $(EPOCROOT2)epoc32 - -$(EPOCROOT2)epoc32 : - @echo Please set EPOCROOT2 environmental variable to full path to your SDK - @echo with ending slash (something like C:\Uiq_21\) - @cd : 2> NUL # do something stupid to make it silently fail - - -# GCC -INCDIR = -I. -I "..\..\" -I "$(EPOCROOT2)EPOC32\INCLUDE" -I "$(EPOCROOT2)EPOC32\INCLUDE\LIBC" - -GCCFLAGS = -nostdinc -Wall -Wno-ctor-dtor-privacy -Wno-unknown-pragmas -march=armv4t -mthumb-interwork -pipe -O3 -fomit-frame-pointer - -GCCDEFS = -D__SYMBIAN32__ -D__GCC32__ -D__EPOC32__ -D__MARM__ -D__MARM_ARMI__ -D__EXE__ -DNDEBUG -D_UNICODE -DARM - -# dprint -ifeq "$(dprint)" "1" -GCCDEFS += -D__DEBUG_PRINT -endif -# drz80/mz80 -ifeq "$(mz80)" "1" -GCCDEFS += -D_USE_MZ80 -else -GCCDEFS += -D_USE_DRZ80 -endif -# debug_cyclone -ifeq "$(debug_cyclone)" "1" -use_musashi := 1 -GCCDEFS += -DEMU_C68K -asm_memory := 0 -endif -# musashi -ifeq "$(use_musashi)" "1" -GCCDEFS += -DEMU_M68K -else -GCCDEFS += -DEMU_C68K -endif - - -GCC = gcc -c $(GCCFLAGS) $(GCCDEFS) $(INCDIR) - - -LIBSUREL = \ - $(EPOCSTATLINKUREL)\EGCC.LIB \ - $(EPOCLINKUREL)\ESTLIB.LIB \ - $(EPOCLINKUREL)\WS32.LIB \ - $(EPOCLINKUREL)\HAL.LIB \ - $(EPOCLINKUREL)\EUSER.LIB \ - $(EPOCLINKUREL)\EFSRV.LIB \ - $(EPOCLINKUREL)\EZLIB.LIB - -$(EPOCTRGUREL)\PICOSMALL.EXE : $(EPOCBLDUREL)\PICOSMALL.in $(EPOCSTATLINKUREL)\EEXE.LIB $(LIBSUREL) - @echo * linking and finishing - @ld -s -e _E32Startup -u _E32Startup \ - --base-file "$(EPOCBLDUREL)\PICOSMALL.bas" -o "$(EPOCBLDUREL)\PICOSMALL.EXE" \ - "$(EPOCSTATLINKUREL)\EEXE.LIB" --whole-archive "$(EPOCBLDUREL)\PICOSMALL.in" \ - --no-whole-archive $(LIBSUREL) $(USERLDFLAGS) - -$(ERASE) "$(EPOCBLDUREL)\PICOSMALL.EXE" - @dlltool -m arm_interwork \ - --base-file "$(EPOCBLDUREL)\PICOSMALL.bas" \ - --output-exp "$(EPOCBLDUREL)\PICOSMALL.exp" - -$(ERASE) "$(EPOCBLDUREL)\PICOSMALL.bas" - @ld -s -e _E32Startup -u _E32Startup \ - "$(EPOCBLDUREL)\PICOSMALL.exp" \ - -Map "$(EPOCBLDUREL)\PICOSMALL.EXE.map" -o "$(EPOCBLDUREL)\PICOSMALL.EXE" \ - "$(EPOCSTATLINKUREL)\EEXE.LIB" --whole-archive "$(EPOCBLDUREL)\PICOSMALL.in" \ - --no-whole-archive $(LIBSUREL) $(USERLDFLAGS) - -$(ERASE) "$(EPOCBLDUREL)\PICOSMALL.exp" -ifeq "$(noecompxl)" "1" - @petran "$(EPOCBLDUREL)\PICOSMALL.EXE" "$@" \ - -nocall -uid1 0x1000007a -uid2 0x00000000 -uid3 0x00000000 \ - -heap 0x00000001 0x00800000 -else - @petran_ "$(EPOCBLDUREL)\PICOSMALL.EXE" "$@" \ - -nocall -uid1 0x1000007a -uid2 0x00000000 -uid3 0x00000000 \ - -heap 0x00000001 0x00800000 -stack 0x80000000 -endif -# -$(ERASE) "$(EPOCBLDUREL)\PICOSMALL.EXE" - @perl -S ecopyfile.pl "$@" "PICOSMALL.EXE" -ifeq "$(up)" "1" - @quploadpico.cmd -endif - - -OBJECTSUREL= \ - $(EPOCBLDUREL)\debug.o \ - $(EPOCBLDUREL)\CART.o \ - $(EPOCBLDUREL)\DRAW.o \ - $(EPOCBLDUREL)\DRAW2.o \ - $(EPOCBLDUREL)\MAIN.o \ - $(EPOCBLDUREL)\MEMORY.o \ - $(EPOCBLDUREL)\PICO.o \ - $(EPOCBLDUREL)\SEK.o \ - $(EPOCBLDUREL)\VIDEOPORT.o \ - $(EPOCBLDUREL)\SIMPLESERVER.o \ - $(EPOCBLDUREL)\VID.o \ - $(EPOCBLDUREL)\Utils.o \ - $(EPOCBLDUREL)\Area.o \ - $(EPOCBLDUREL)\Misc.o \ - $(EPOCBLDUREL)\unzip.o \ - ..\..\zlib\gzio_symb.o \ - $(EPOCBLDUREL)\sound.o \ - $(EPOCBLDUREL)\sn76496.o \ - $(EPOCBLDUREL)\ym2612.o \ - $(EPOCBLDUREL)\blit.o - -ifeq "$(debug_cyclone)" "1" -OBJECTSUREL += $(EPOCBLDUREL)\Cyclone.o $(EPOCBLDUREL)\_cyclone_debug.o -endif -# the MUSASHI core -ifeq "$(use_musashi)" "1" -OBJECTSUREL += \ - ..\..\musashi\m68kcpu.o \ - ..\..\musashi\m68kops.o \ - ..\..\musashi\m68kopac.o \ - ..\..\musashi\m68kopdm.o \ - ..\..\musashi\m68kopnz.o \ - ..\..\musashi\m68kdasm.o -else -OBJECTSUREL += $(EPOCBLDUREL)\Cyclone.o -endif - -ifeq "$(mz80)" "1" -OBJECTSUREL := $(OBJECTSUREL) $(EPOCBLDUREL)\mz80.o -else -OBJECTSUREL := $(OBJECTSUREL) $(EPOCBLDUREL)\DrZ80.o -endif - -ifeq "$(asm_memory)" "1" -ASMDEFINES += -D_ASM_MEMORY_C -OBJECTSUREL := $(OBJECTSUREL) $(EPOCBLDUREL)\memory_asm.o -endif - -ifeq "$(asm_render)" "1" -ASMDEFINES += -D_ASM_DRAW_C -OBJECTSUREL := $(OBJECTSUREL) $(EPOCBLDUREL)\draw_asm.o $(EPOCBLDUREL)\draw2_asm.o -endif - -$(EPOCBLDUREL)\PICOSMALL.in : $(OBJECTSUREL) - @echo * ar - @if exist "$@" del "$@" - @ar cr $@ $^ - -..\..\Cyclone\proj\Cyclone.s : - @echo You need to build Cyclone first. See Cyclone.txt in cyclone directory. - @cd : 2> NUL # do something stupid to make it silently fail - -$(EPOCBLDUREL)\Cyclone.o : ..\..\Cyclone\proj\Cyclone.s - @echo * assembling Cyclone.. - @as -marmv4t -mthumb-interwork -o $@ $^ - -$(EPOCBLDUREL)\DrZ80.o : ..\..\pico\sound\DrZ80.s ..\..\pico\sound\DrZ80.h - @echo * assembling DrZ80.. - @as -marmv4t -mthumb-interwork -o $@ ..\..\pico\sound\DrZ80.s - - -# Source - -$(EPOCBLDUREL)\debug.o : debug.cpp debug.h - @echo * debug.cpp - @$(GCC) -o $@ debug.cpp - -$(EPOCBLDUREL)\MAIN.o : Main.cpp ..\..\pico\picoInt.h vid.h SimpleServer.h ClientServer.h audio.h debug.h - @echo * Main.cpp - @$(GCC) -o $@ "Main.cpp" - -$(EPOCBLDUREL)\VID.o : VID.cpp vid.h ClientServer.h ..\..\pico\picoInt.h - @echo * Vid.cpp - @$(GCC) -o $@ "VID.cpp" - -$(EPOCBLDUREL)\SIMPLESERVER.o : SIMPLESERVER.cpp version.h ClientServer.h SimpleServer.h ..\..\pico\picoInt.h debug.h - @echo * SimpleServer.cpp - @$(GCC) -o $@ "SIMPLESERVER.cpp" - -$(EPOCBLDUREL)\CART.o : ..\..\pico\Cart.c ..\..\pico\picoInt.h ..\..\pico\Pico.h ..\..\unzip\unzip.h - @echo * Cart.c - @$(GCC) -D_UNZIP_SUPPORT -o $@ "..\..\pico\Cart.c" - -$(EPOCBLDUREL)\DRAW.o : ..\..\pico\Draw.c ..\..\pico\picoInt.h ..\..\pico\Pico.h - @echo * Draw.c - @$(GCC) $(ASMDEFINES) -o $@ "..\..\pico\Draw.c" -# - -$(EPOCBLDUREL)\DRAW2.o : ..\..\pico\Draw2.c ..\..\pico\picoInt.h ..\..\pico\Pico.h - @echo * Draw2.c - @$(GCC) $(ASMDEFINES) -o $@ "..\..\pico\Draw2.c" - -$(EPOCBLDUREL)\MEMORY.o : ..\..\pico\Memory.c ..\..\pico\picoInt.h ..\..\pico\Pico.h - @echo * Memory.c - @$(GCC) $(ASMDEFINES) -o $@ "..\..\pico\Memory.c" - -$(EPOCBLDUREL)\PICO.o : ..\..\pico\Pico.c ..\..\pico\picoInt.h ..\..\pico\Pico.h - @echo * Pico.c - @$(GCC) -o $@ "..\..\pico\Pico.c" - -$(EPOCBLDUREL)\SEK.o : ..\..\pico\Sek.c ..\..\pico\picoInt.h ..\..\pico\Pico.h - @echo * Sek.c - @$(GCC) -o $@ "..\..\pico\Sek.c" - -$(EPOCBLDUREL)\VIDEOPORT.o : ..\..\pico\Videoport.c ..\..\pico\picoInt.h ..\..\pico\Pico.h - @echo * Videoport.c - @$(GCC) -o $@ "..\..\pico\Videoport.c" - -$(EPOCBLDUREL)\Utils.o : ..\..\pico\Utils.c ..\..\pico\picoInt.h ..\..\pico\Pico.h - @echo * Utils.c - @$(GCC) -o $@ "..\..\pico\Utils.c" - -$(EPOCBLDUREL)\Area.o : ..\..\pico\Area.c ..\..\pico\picoInt.h ..\..\pico\Pico.h - @echo * Area.c - @$(GCC) -o $@ "..\..\pico\Area.c" - -$(EPOCBLDUREL)\Misc.o : ..\..\pico\Misc.c ..\..\pico\picoInt.h ..\..\pico\Pico.h - @echo * Misc.c - @$(GCC) -o $@ "..\..\pico\Misc.c" - -$(EPOCBLDUREL)\unzip.o : ..\..\unzip\unzip.c ..\..\unzip\unzip.h - @echo * unzip.c - @$(GCC) -o $@ "..\..\unzip\unzip.c" - -# assembly "optimized" stuff -$(EPOCBLDUREL)\blit.o : blit.s - @echo * blit.s - @as -marmv4t -mthumb-interwork -o $@ blit.s - -$(EPOCBLDUREL)\draw_asm.o : ..\..\pico\draw.s - @echo * draw.s - @as -marmv4t -mthumb-interwork -o $@ ..\..\pico\draw.s - -$(EPOCBLDUREL)\draw2_asm.o : ..\..\pico\draw2.s - @echo * draw2.s - @as -marmv4t -mthumb-interwork -o $@ ..\..\pico\draw2.s - -$(EPOCBLDUREL)\memory_asm.o : ..\..\pico\memory.s - @echo * memory.s - @as -marmv4t -mthumb-interwork -o $@ ..\..\pico\memory.s - -# sound stuff -$(EPOCBLDUREL)\sound.o : ..\..\pico\sound\sound.c ..\..\pico\sound\sound.h - @echo * sound.c - @$(GCC) -o $@ "..\..\pico\sound\sound.c" - -$(EPOCBLDUREL)\ym2612.o : ..\..\pico\sound\ym2612.c ..\..\pico\sound\ym2612.h ..\..\pico\sound\driver.h - @echo * ym2612.c - @$(GCC) -o $@ "..\..\pico\sound\ym2612.c" - -$(EPOCBLDUREL)\sn76496.o : ..\..\pico\sound\sn76496.c ..\..\pico\sound\sn76496.h ..\..\pico\sound\driver.h - @echo * sn76496.c - @$(GCC) -o $@ "..\..\pico\sound\sn76496.c" - -$(EPOCBLDUREL)\mz80.o : ..\..\pico\sound\mz80.c ..\..\pico\sound\mz80.h - @echo * mz80.c - @$(GCC) -o $@ "..\..\pico\sound\mz80.c" - -# -D__DEBUG_PRINT_SND - -# misc - -$(EPOCBLDUREL)\_cyclone_debug.o : ..\..\pico\_cyclone_debug.c - @echo * _cyclone_debug.c - @$(GCC) -o $@ "..\..\pico\_cyclone_debug.c" - -# generic rule for generic C stuff - -.c.o: - @echo * $< - @$(GCC) $< -o $@ - - - -# --- SRCFILES END --- - - -# Rules to create all necessary directories - -MAKEDIRS : \ - _build - -_build : - @echo * making build dir - @perl -S emkdir.pl $@ diff --git a/platform/uiq2/SimpleServer.cpp b/platform/uiq2/SimpleServer.cpp deleted file mode 100644 index d220b3fd..00000000 --- a/platform/uiq2/SimpleServer.cpp +++ /dev/null @@ -1,430 +0,0 @@ -// SimpleServer.cpp - -#include -#include -#include - -#include - -#include "debug.h" - -#include "version.h" -#include "ClientServer.h" -#include "SimpleServer.h" -#include "pico\picoInt.h" - -extern TInt machineUid; -extern int gamestate, gamestate_prev; -extern TPicoConfig currentConfig; -extern TPicoKeyConfigEntry keyConfigMotA[]; -extern const char *actionNames[]; -const char *RomFileName = 0; -int pico_was_reset = 0; - - -// utility -unsigned int bigend(unsigned int l) -{ - return (l>>24)|((l>>8)&0xff00)|((l<<8)&0xff0000)|(l<<24); -} - - -//********************************** -//CPicoServServer -//********************************** - - -CPicoServServer::CPicoServServer(TInt aPriority) - : CServer(aPriority) -{ -} - - -// Create and start a new count server. -void CPicoServServer::New() -{ - CPicoServServer *pS=new CPicoServServer(EPriority); - __ASSERT_ALWAYS(pS!=NULL,PanicServer(ESvrCreateServer)); - pS->StartL(KServerName); -} - - -// Create a new server session. -CSharableSession *CPicoServServer::NewSessionL(const TVersion &aVersion) const -{ - // check we're the right version - TVersion v(KPicoMajorVersionNumber,KPicoMinorVersionNumber,0); - if (!User::QueryVersionSupported(v,aVersion)) - User::Leave(KErrNotSupported); - // make new session - RThread aClient = Message().Client(); - return CPicoServSession::NewL(aClient, (CPicoServServer*)this); -} - - -//********************************** -//CPicoServSession -//********************************** - - -// constructor - must pass client to CSession -CPicoServSession::CPicoServSession(RThread &aClient, CPicoServServer *aServer) -: CSession(aClient), rom_data(0) -{ -// iPicoSvr=aServer; -} - -CPicoServSession* CPicoServSession::NewL(RThread &aClient, CPicoServServer * aServer) -{ - return new(ELeave) CPicoServSession(aClient,aServer); -} - - -void CPicoServSession::ServiceL(const RMessage& aMessage) -{ - TRAPD(err,DispatchMessageL(aMessage)); - aMessage.Complete(err); -} - - - -// service a client request; test the opcode and then do appropriate servicing -void CPicoServSession::DispatchMessageL(const RMessage &aMessage) -{ - switch (aMessage.Function()) { - case PicoMsgLoadState: - if(!rom_data) User::Leave(-1); // no ROM - User::LeaveIfError(saveLoadGame(1)); - gamestate = PGS_Running; - return; - - case PicoMsgSaveState: - if(!rom_data) User::Leave(-1); - User::LeaveIfError(saveLoadGame(0)); - gamestate = PGS_Running; - return; - - case PicoMsgLoadROM: - loadROM(); - return; - - case PicoMsgResume: - if(rom_data) gamestate = PGS_Running; - return; - - case PicoMsgReset: - if(rom_data) { - PicoReset(); - pico_was_reset = 1; - gamestate = PGS_Running; - } - return; - - case PicoMsgKeys: - gamestate = PGS_KeyConfig; - return; - - case PicoMsgPause: - gamestate = PGS_Paused; - return; - - case PicoMsgQuit: - DEBUGPRINT(_L("got quit msg.")); - gamestate = PGS_Quit; - return; - - // config change - case PicoMsgConfigChange: // launcher -> emu - changeConfig(); - return; - - case PicoMsgRetrieveConfig: // emu -> launcher - sendConfig(); - return; - - case PicoMsgRetrieveDebugStr: // emu -> launcher - sendDebug(); - return; - - // requests we don't understand at all are a different thing, - // so panic the client here, this function also completes the message - default: - PanicClient(EBadRequest); - return; - } -} - - -void CPicoServSession::loadROM() -{ - TInt res; - - const TAny* pD=Message().Ptr0(); - - // TInt desLen=Message().Client().GetDesLength(pD); - - if(rom_data) { - // save SRAM for previous ROM - if(currentConfig.iFlags & 1) - saveLoadGame(0, 1); - } - - RomFileName = 0; - if(rom_data) { - free(rom_data); - rom_data = 0; - } - - // read the contents of the client pointer into a TPtr. - static TBuf8 writeBuf; - TRAP(res,Message().ReadL(pD,writeBuf)); - if (res!=KErrNone) { - PanicClient(EBadDescriptor); - return; - } - - // detect wrong extensions (.srm and .mds) - TBuf8<5> ext; - ext.Copy(writeBuf.Right(4)); - ext.LowerCase(); - if(!strcmp((char *)ext.PtrZ(), ".srm") || !strcmp((char *)ext.PtrZ(), "s.gz") || // .mds.gz - !strcmp((char *)ext.PtrZ(), ".mds")) { - User::Leave(3); - return; - } - - FILE *rom = fopen((char *) writeBuf.PtrZ(), "rb"); - if(!rom) { - DEBUGPRINT(_L("failed to open rom.")); - User::Leave(1); - return; - } - - - unsigned int rom_size = 0; - // zipfile support - if(!strcmp((char *)ext.PtrZ(), ".zip")) { - fclose(rom); - res = CartLoadZip((const char *) writeBuf.PtrZ(), &rom_data, &rom_size); - if(res) { - User::Leave(res); - return; - } - } else { - if( (res = PicoCartLoad(rom, &rom_data, &rom_size)) ) { - DEBUGPRINT(_L("PicoCartLoad() failed.")); - fclose(rom); - User::Leave(2); - return; - } - fclose(rom); - } - - // detect wrong files (Pico crashes on very small files), also see if ROM EP is good - if(rom_size <= 0x200 || strncmp((char *)rom_data, "Pico", 4) == 0 || - ((*(TUint16 *)(rom_data+4)<<16)|(*(TUint16 *)(rom_data+6))) >= (int)rom_size) { - free(rom_data); - rom_data = 0; - User::Leave(3); // not a ROM - } - - DEBUGPRINT(_L("PicoCartInsert(0x%08X, %d);"), rom_data, rom_size); - if(PicoCartInsert(rom_data, rom_size)) { - User::Leave(2); - return; - } - - pico_was_reset = 1; - - // global ROM file name for later use - RomFileName = (const char *) writeBuf.PtrZ(); - - // load SRAM for this ROM - if(currentConfig.iFlags & 1) - saveLoadGame(1, 1); - - // debug - #ifdef __DEBUG_PRINT - TInt cells = User::CountAllocCells(); - TInt mem; - User::AllocSize(mem); - DEBUGPRINT(_L("comm: cels=%d, size=%d KB"), cells, mem/1024); - gamestate = PGS_DebugHeap; - gamestate_prev = PGS_Running; - #else - gamestate = PGS_Running; - #endif -} - - -void CPicoServSession::changeConfig() -{ - DEBUGPRINT(_L("got new config.")); - - // receve it - const TAny* pD=Message().Ptr0(); - TPtr8 descr((TUint8*) ¤tConfig, sizeof(currentConfig)); - TRAPD(res,Message().ReadL(pD, descr)); - if (res!=KErrNone) { - PanicClient(EBadDescriptor); - return; - } - - // Motorola: enable experimental volume control - if((machineUid&0xfffffff0) == 0x101f6b20) { // Motorolas - if(currentConfig.iFlags & 0x40) { - currentConfig.iKeyBinds[11] = 0x00100000; // vol up - currentConfig.iKeyBinds[12] = 0x00200000; // vol down - keyConfigMotA[11].flags |= 0x40; // add "not configurable" flag - keyConfigMotA[12].flags |= 0x40; - } else { - currentConfig.iKeyBinds[11] &= ~0x00100000; // remove vol actions - currentConfig.iKeyBinds[12] &= ~0x00200000; - keyConfigMotA[11].flags &= ~0x40; // remove "not configurable" flag - keyConfigMotA[12].flags &= ~0x40; - } - } - - // set region, PicoOpt and rate - PicoRegionOverride = currentConfig.PicoRegion; - PicoOpt = currentConfig.iPicoOpt; - switch((currentConfig.iFlags>>3)&3) { - case 1: PsndRate=11025; break; - case 2: PsndRate=16000; break; - case 3: PsndRate=22050; break; - default: PsndRate= 8000; break; - } - - // 6 button pad, enable XYZM config if needed - if(PicoOpt & 0x20) { - actionNames[8] = "Z"; - actionNames[9] = "Y"; - actionNames[10] = "X"; - actionNames[11] = "MODE"; - } else { - actionNames[8] = actionNames[9] = actionNames[10] = actionNames[11] = 0; - } - - // if we are in center 90||270 modes, we can bind renderer switcher - if(currentConfig.iScreenMode == TPicoConfig::PMCenter && - (currentConfig.iScreenRotation == TPicoConfig::PRot90 || currentConfig.iScreenRotation == TPicoConfig::PRot270)) - actionNames[25] = "RENDERER"; - else actionNames[25] = 0; -} - - -void CPicoServSession::sendConfig() -{ - // send current config to client - currentConfig.iPicoOpt = PicoOpt; - TPtrC8 descr((TUint8*) ¤tConfig, sizeof(currentConfig)); - Write(Message().Ptr0(), descr); -} - -#ifdef __DEBUG_PRINT -extern "C" char *debugString(); -#endif - -void CPicoServSession::sendDebug() -{ -#ifdef __DEBUG_PRINT - char *str = debugString(); - // send current config to client - currentConfig.iPicoOpt = PicoOpt; - TPtrC8 descr((TUint8*) str, 1024); - Write(Message().Ptr0(), descr); -#endif -} - -// panic the client -void CPicoServSession::PanicClient(TInt aPanic) const -{ - Panic(_L("PicoN client"), aPanic); - // client screwed up - there is nothing for us to do now - RProcess me; - me.Terminate(1); -} - - -// write to the client thread; if unsuccessful, panic the client -void CPicoServSession::Write(const TAny* aPtr,const TDesC8& aDes,TInt anOffset) -{ - TRAPD(ret,WriteL(aPtr,aDes,anOffset);) - if (ret!=KErrNone) - PanicClient(EBadDescriptor); -} - - - -//********************************** -//Global functions -//********************************** - - -// The server thread. -TInt CPicoServServer::ThreadFunction(TAny* anArg) -{ - // install our exception hanler first - RThread().SetExceptionHandler(&ExceptionHandler, -1); - - // convert argument into semaphore reference -// RSemaphore& semaphore=*(RSemaphore *)anArg; - - // start scheduler and server - CActiveScheduler *pA=new CActiveScheduler; - __ASSERT_ALWAYS(pA!=NULL,PanicServer(EMainSchedulerError)); - CActiveScheduler::Install(pA); - //CTrapCleanup::New(); // docs say this is created automatically, but I somehow got E32USER-CBase 69 panic - CPicoServServer::New(); - // signal that we've started -// semaphore.Signal(); - // start fielding requests from clients - CActiveScheduler::Start(); - // finished - return(KErrNone); -} - - -// Panic the server -//GLDEF_C -void PanicServer(TPicoServPanic aPanic) -{ - User::Panic(_L("PicoN server"),aPanic); -} - - -// Create the server thread -// This function is exported from the DLL and called from the client -//EXPORT_C -TInt StartThread() -{ - TInt res=KErrNone; - // create server - if one of this name does not already exist - TFindServer findPicoServer(KServerName); - TFullName name; - if(findPicoServer.Next(name) == KErrNone) return -1; // we already exist - - RThread thread; -// RSemaphore semaphore; -// semaphore.CreateLocal(0); // create a semaphore so we know when thread finished - res=thread.Create(KServerName, // create new server thread - CPicoServServer::ThreadFunction, // thread's main function - KDefaultStackSize, - KMinHeapSize, - KPicoMaxHeapSize, -// &semaphore // passed as TAny* argument to thread function - 0 - ); - - if(res==KErrNone) { // thread created ok - now start it going - thread.SetPriority(EPriorityNormal); - thread.Resume(); // start it going -// semaphore.Wait(); // wait until it's initialized - thread.Close(); // we're no longer interested in the other thread - } - -// semaphore.Close(); - - return res; -} - diff --git a/platform/uiq2/SimpleServer.h b/platform/uiq2/SimpleServer.h deleted file mode 100644 index b88e4d7e..00000000 --- a/platform/uiq2/SimpleServer.h +++ /dev/null @@ -1,121 +0,0 @@ -// SimpleServer.h - -#ifndef __SIMPLESERVER_H -#define __SIMPLESERVER_H - -#include - - -TInt StartThread(); - - -// engine states -enum TPicoGameState { - PGS_Running, - PGS_Paused, - PGS_Quit, - PGS_KeyConfig, - PGS_DebugHeap, -}; - -// needed for creating server thread. -const TUint KPicoMaxHeapSize=0x00800000; - -// reasons for server panic -enum TPicoServPanic -{ - EBadRequest, - EBadDescriptor, - EMainSchedulerError, - ESvrCreateServer, - ESvrStartServer, - ECreateTrapCleanup, - ENotImplementedYet, -}; - - -// key config entry (touchpad areas) -struct TPicoAreaConfigEntry { - TRect rect; - //unsigned long actions; -}; - -struct TPicoKeyConfigEntry -{ - unsigned short keyCode; - unsigned char scanCode; - unsigned char flags; // lsb->msb: key_down, pulse_only, ?, ?, ?, ?, not_configurable, disabled - TInt32 handle1; // for CancelCaptureKeyUpAndDowns() - TInt32 handle2; // for CancelCaptureKey() - char *name; -}; - - -//********************************** -//CPicoServServer -//********************************** -//The server class; an active object. -//Contains an instance of RServer; a handle to the kernel server representation which is used -//to receive messages. - -class CPicoServServer : public CServer -{ -public: - enum {EPriority=950}; -public: - static void New(); - virtual CSharableSession *NewSessionL(const TVersion &aVersion) const; - static TInt ThreadFunction(TAny* aStarted); -protected: - CPicoServServer(TInt aPriority); -private: - TInt iActive; -}; - - -//********************************** -//CPicoServSession -//********************************** -//This class represents a session in the server. -//CSession::Client() returns the client thread. -//Functions are provided to respond appropriately to client messages. - - -class CPicoServSession : public CSession -{ -public: - // construct/destruct - CPicoServSession(RThread &aClient, CPicoServServer * aServer); - static CPicoServSession* NewL(RThread &aClient, CPicoServServer * aServer); - //service request - virtual void ServiceL(const RMessage &aMessage); - void DispatchMessageL(const RMessage &aMessage); - - // services available - void loadROM(); - void changeConfig(); - void sendConfig(); - void sendDebug(); - -protected: - // panic the client - void PanicClient(TInt aPanic) const; - // safewrite between client and server - void Write(const TAny* aPtr,const TDesC8& aDes,TInt anOffset=0); -private: - //CPicoServServer *iPicoSvr; - - unsigned char *rom_data; -}; - - - -//********************************** -//global functions -//********************************** - -// function to panic the server -GLREF_C void PanicServer(TPicoServPanic aPanic); -int saveLoadGame(int load, int sram=0); - -#endif // __SIMPLESERVER_H diff --git a/platform/uiq2/_out/PicodriveN.pkg b/platform/uiq2/_out/PicodriveN.pkg deleted file mode 100644 index 74bf4fdf..00000000 --- a/platform/uiq2/_out/PicodriveN.pkg +++ /dev/null @@ -1,24 +0,0 @@ -#{"PicodriveN"},(0x1000C193),0,93,0 - -; -; For the UIQ? -(0x101F617B), 2, 0, 0, {"UIQ20ProductID"} - -; -; PicodriveN (Frontend) -; -"..\..\..\..\..\epoc32\release\armi\urel\PicodriveN.app"-"!:\system\apps\PicodriveN\PicodriveN.app" -"..\..\..\..\..\epoc32\data\z\system\apps\PicodriveN\PicodriveN.rsc"-"!:\system\apps\PicodriveN\PicodriveN.rsc" -"..\..\..\..\..\epoc32\data\z\system\apps\PicodriveN\PicodriveN.aif"-"!:\system\apps\PicodriveN\PicodriveN.aif" -"..\audio\audio_mediaserver.dll"-"!:\system\apps\PicodriveN\audio_mediaserver.dll" -"..\audio\audio_motorola.dll"-"!:\system\apps\PicodriveN\audio_motorola.dll" - -; -; Picosmall -; -"..\PICOSMALL.EXE"-"!:\system\apps\PicodriveN\PICOSMALL.EXE" - -; -; Text to show during installation, not copied to destination -; -".\install.txt"-"!:\system\apps\PicodriveN\install.txt",FILETEXT diff --git a/platform/uiq2/_out/install.txt b/platform/uiq2/_out/install.txt deleted file mode 100644 index e646d049..00000000 --- a/platform/uiq2/_out/install.txt +++ /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. - -Key configuration tutorial: -http://notaz.atspace.com/pico_tut/ - -You can also hold power button to exit (PXXX only). -(Motorola users, try the 'end' button). - -Some quick sound related notes: -* You must use auto frameskip or you will get stuttering sound. -* 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. -* if you change sound settings AFTER loading a ROM, you may need to reset game to get sound (this depends on a ROM itself). - -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. - -See readme for more details. diff --git a/platform/uiq2/_out/readme.txt b/platform/uiq2/_out/readme.txt deleted file mode 100644 index ea5e6e43..00000000 --- a/platform/uiq2/_out/readme.txt +++ /dev/null @@ -1,347 +0,0 @@ - -About ------ - -PicodriveN is another port of PicoDrive, Dave's Megadrive / Genesis -emulator for Pocket PC. This version is based on PicoDrive 0.030 and is -made for Symbian UIQ devices. It is alternative version to another port by -AnotherGuest / Someone and is not based on it (so it has a little -different name). It also has full sound support (starting -from version 0.70) . - - -Features --------- - -* Good compatibility (> 90%) -* Improved Cyclone 68000 core. -* Zipped ROMs and savestates. -* SRAM support, including serial SRAM. -* Game screen rotation with many render modes (like 'centered' and 'fit'). -* Selectable frameskip. -* Configurable keys and touchpad. -* Flip-closed mode for SE phones. -* Full sound support. - - -Problems / limitations ----------------------- - -* 32x, Sega CD, SVP are not emulated. -* Various VDP quirks (window bug, scroll size 2, etc.) are not emulated, - as very few games use this. -* Some games don't work or have glitches because of inaccurate sync. - - -Configuration -------------- - -1. Keys: - -If it looks confusing to you, check this tutorial first: -http://notaz.atspace.com/pico_tut/ - -There are no default settings. -When you start key configuration mode, black screen with dark-red squares will -appear. Also there will be little 'control' on the right with the function -name in it, and arrows on the corners of it. You can tap on these corners to -select a function. You can also tap on these squares to bind that function to -them. This way you can associate touchpad areas with game-controls or functions. -I also made a small square in every corner of the screen to be used as a virtual -button for some function, like save state. You can bind it as you like. To -bind phone buttons, simply select the function you need, and press a button -you want. To unbind any key or touchpad area, simply push or tap it again. -To configure flip-closed mode, enter configuration mode and close flip. - -When finished, select 'done' and press any key. You can also hold 'Power' -button for a while to exit (seems to work on PXXX only). - -You need to bind 'pause emu' function to be able exit game when ROM is loaded. -You can also exit game by holding 'power' button (possibly 'end' for motorola -users (?)). - -2. Main Settings: - -Here you can set the orientation of screen and the drawing mode. The "fit" -option will scale the image so it fully fits in the screen, but some detail -will be lost. "center" displays the game at the center of the screen, but -non-fitting parts are not visible then (better for RPG games with lots of -text, which becomes unreadable in 'fit' mode). "fit2" was meant for Pxxx FC -gaming and will always use 208x146 for P800 and 208x208 for all other phones. - -"Fast renderer" enables faster rendering method, but it works only with some -games (some other have serious glitches or even hang). - -"Accurate timing" is needed for some games to run (like Red Zone). It should -be kept off for all other games, because it slows emulation down. Some games -also need this option for proper sound, so enable this if game has any -glitches. - -"Accurate sprites" fixes sprite priority problems, for example if game -character is in front of or behind some object it should not be, this option -should fix it. This option does not work in "Fast renderer" mode. - -"Show FPS" shows game frames per second in format XX/YY, where XX is the -number of frames shown per previous second, and YY is the number of frames -emulated, but not necessarily shown. By calculating YY-XX you get the number -of skipped frames per second. - -3. Sound settings: - -Sound emulation is very picky on CPU power (in most cases sound alone uses -more CPU power than everything else altogether), but it is still possible to -play some games. When using sound, the recommended display modes are "fit 0" -and "fit 180", because these are the fastest ones. Also try "Alternative -renderer", but it might cause graphical glitches. You must use auto frameskip -when using sound, or else you will get stuttering sound. Also, it is -recommended to exit all other non-vital apps (you can use SMan for this), -disable bluetooth and any other devices your phone may have. I also noticed -that simply connecting the phone battery charger strangely slows everything -down. - -"Enable sound" tries to enable sound output on your device, but that alone is -not enough to get sound. You need to enable the sound chips below: -"Z80" is secondary CPU in genesis and is mostly used to control the other 2 -sound chips. So if you disable Z80, sound will be lost in most games, with -some exceptions like Sonic1. It is possible to use Z80 for other things, -some games do that and Z80 must be enabled to run them at all. -"YM2612" is a fairly complex Frequency Modulation (FM) sound synthesis chip. -It was the main sound output device in genesis and is horrible CPU hog when -is tried to be emulated in software. Disabling it gives large speed -improvement, but most of the sound is lost. -"SN76496" is programmable sound generator (PSG) chip, used for various sound -effects and music elements. -The lowest setting is audio quality setting, which should be left set to -"8000Hz mono", because other choces slow everything down terribly and -are left for testing and possibly for use in other ports to faster future -devices with faster CPUs. - -Note: if you change sound settings AFTER loading a ROM, you may need to reset -game to get sound. This is because most games initialize sound chips on -startup, and this data is lost when sound chips are being enabled/disabled. - -4. Misc: - -"6 button pad" will enable 6 button gamepad emulation and will add additional -X, Y, Z and MODE actions to key configuration. -Note: if you enable this, games may detect that and use different button -configuration, for example A ("high punch") will change to "low punch" in -Mortal Kombat and you will need to bind X for "high punch". - -"gzip save states" enables gzip (similar to ordinary zip, but a little -different) compression on your save states to save space. The compression -ratio is 50-90%, so it's worth to enable this. - -"Use SRAM saves" option enables emulation of batery-backed save RAM some game -cartridges had. RPG games used it alot, but there were some others too, like -Sonic 3. If this is enabled, .srm files are generated when you exit -the emulator or load another ROM. Format is compatible with other popular -emulators (like Gens and Fusion). - - -5. Frameskip: - -"Auto" option tries to run the game in it's original speed by skipping next - frame if the previous was rendered too slow. -"0" displays every frame, thus game runs very slow. -"1" skips every other frame. Use this for a game which is smoother, but a bit - too slow (actually depends on display mode you use). -"2" also makes the game smoother, but it will be too fast in most areas. -"4","8" is way too fast and is useful for skiping intros, etc. - - - -Credits -------- - -This emulator uses code from these people/projects: - -Dave -Cyclone 68000 core, Pico emulation library -Homepage: http://www.finalburn.com/ -E-mail: david(atsymbol)finalburn.com - -notaz -UIQ port, Cyclone 68000 hacks, some additional coding (see changelog). -Homepage: http://notaz.atspace.com/ -E-mail: notasas(atsymbol)gmail.com - -Reesy & FluBBa -DrZ80, the Z80 emulator written in ARM assembly. -Homepage: http://reesy.gp32x.de/ -E-mail: drsms_reesy(atsymbol)yahoo.co.uk - -Tatsuyuki Satoh, Jarek Burczynski, MultiArcadeMachineEmulator development -software implementation of Yamaha FM sound generator - -MultiArcadeMachineEmulator (MAME) development -Texas Instruments SN76489 / SN76496 programmable tone /noise generator -Homepage: http://www.mame.net/ - - -Additional thanks ------------------ - -* Peter van Sebille for ECompXL and his various open-source Symbian projects - to learn from. -* Steve Fischer for his open-source Motorola projects. -* Charles MacDonald (http://cgfm2.emuviews.com/) for old but still very useful - info about genesis hardware. -* Stéphane Dallongeville for creating Gens and making it open-source. -* Steve Snake for all that he has done for Genesis emulation scene. -* Bart Trzynadlowski for his SSFII and 68000 docs. -* Haze for his research (http://haze.mameworld.info). -* The development team behind "Symbian GCC Improvement Project" - (http://www.inf.u-szeged.hu/symbian-gcc/) for their updated compile tools. -* Mark and Jean-loup for zlib library. -* Reesy for also finding some Cyclone bugs. -* Inder for the icons. - - -Changelog ---------- -0.94 - * Improved interrupt timing, Mazin Saga and Burning Force now works. - * Rewritten renderer code to better suit gp2x, should be faster on other - ports too. - + Added support for banking used by 12-in-1 and 4-in-1 ROMs (thanks Haze). - + Added some protection device faking, used by some unlicensed games like - Super Bubble Bobble, King of Fighters, Elf Wor, ... - + Added primitive Virtua Racing SVP faking, so menus can be seen now. - -0.93 - * Fixed a problem with P900/P910 key configuration in FC mode. - * Improved shadow/hilight mode emulation. Still not perfect, but should be - enough for most games. - + Save state slots added. - + Region selector added. - -0.92 - VDP changes: - * VDP emulation is now more accurate (fixes flickering in Chase HQ II, - Super Hang-On and some other problems in other games). - * HV counter emulation is now much more accurate. Fixes the Asterix games, - line in Road Rash 3, etc. - * Minnor sprite and layer scroll masking bugs fixed. - + Added partial interlace mode renderer (Sonic 2 vs mode) - * Fixed a crash in both renderers when certain size window layers were used. - + Added emulation of shadow/hilight operator sprites. Other shadow/hilight - effects are still unemulated. - + Sprite emulation is more accurate, sprite limit is emulated. - + Added "accurate sprites" option, which always draws sprites in correct - order and emulates sprite collision bit, but is significantly slower. - - Emulation changes: - * Improved interrupt handling, added deferred interrupt emulation - (Lemmings, etc). - + Added serial EEPROM SRAM support (Wonder Boy in Monster World, - Megaman - The Wily Wars and many EA sports games like NBA Jam). - + Implemented ROM banking for Super Street Fighter II - The New Challengers - * Updated to the latest version of DrZ80 core, integrated memory handlers - in it for better performance. A noticeable performance increase, but save - states may not work from the previous version (you can only use them with - sound disabled in that case). - + SRAM word read handler was using incorrect byte order, fixed. - - Changes in Cyclone 0.0086: - + Added missing CHK opcode handler (used by SeaQuest DSV). - + Added missing TAS opcode handler (Gargoyles,Bubba N Stix,...). As in real genesis, - memory write-back phase is ignored (but can be enabled in config.h if needed). - + Added missing NBCD and TRAPV opcode handlers. - + Added missing addressing mode for CMP/EOR. - + Added some minor optimizations. - - Removed 216 handlers for 2927 opcodes which were generated for invalid addressing modes. - + Fixed flags for ASL, NEG, NEGX, DIVU, ADDX, SUBX, ROXR. - + Bugs fixed in MOVEP, LINK, ADDQ, DIVS handlers. - * Undocumented flags for CHK, ABCD, SBCD and NBCD are now emulated the same way as in Musashi. - + Added Uninitialized Interrupt emulation. - + Altered timing for about half of opcodes to match Musashi's. - -0.80 - * Nearly all VDP code was rewritten in ARM asm. Gives ~10-25% performance - increase (depends on game). - * Optimized 32-column renderer not to render tiles offscreen, games which - use 32-column display (like Shining Force) run ~50% faster. - + Added new "Alternative renderer", which gives another ~30-45% performance - increase (in addition to mentioned above), but works only with some games, - because it is missing some features (it uses tile-based renderering - instead of default line-based and disables H-ints). - + Added "fit2" display mode for all FC gamers. It always uses 208x146 for - P800 and 208x208 for all other phones. - + Added volume control for Motorolas (experimental). - - VDP changes: - + Added support for vertical window (used by Vapor Trail, Mercs, GRIND - Stormer and others). - + Added sprite masking (hiding), adds some speed. - + Added preliminary H counter emulation. Comix Zone and Sonic 3D Blast - special stage are now playable. - + Added column based vertical scrolling (Gunstar Heroes battleship level, - Sonic and Knuckles lava boss, etc). - - Emulation changes: - + Re-added and improved Z80 faking when Z80 is disabled. Many games now can - be played without enabling Z80 (Lost Vikings, Syndicate, etc), but some - still need it (International Superstar Soccer Deluxe). - * Improved ym2612 timers, Outrun music plays at correct speed, voices in - Earthworm Jim play better, more games play sound. - * I/O registers now remember their values (needed for Pirates! Gold) - + Added support for 6 button pad. - - Changes in Cyclone 0.0083wip: - + Added missing CHK opcode (used by SeaQuest DSV). - + Added missing TAS opcode (Gargoyles). As in real genesis, write-back phase - is ignored (but is enabled for other systems). - - Backported stuff from Snes9x: - * Fixed Pxxx jog up/down which were not working in game. - + Added an option to gzip save states to save space. - + The emulator now pauses whenever it is loosing focus, so it will now pause - when alarm/ponecall/battery low/... windows come up. - - Removed 'pause on phonecall' feature, as it is no longer needed. - + Video fix for asian A1000s. - -0.70 - * Started using tools from "Symbian GCC Improvement Project", which give - considerable speed increase (~4fps in "center 90" mode). - * Rewrote some drawing routines in ARM assembly (gives ~6 more fps in - "center 90" mode). - * Minor improvement to 0 and 180 "fit" modes. Now they look slightly better - and are faster. - * Minor stability improvements (emulator is less likely to crash). - + Added some background for OSD text for better readability. - + Added Pal/NTSC detection. This is needed for proper sound speed. - + Implemented Reesy's DrZ80 Z80 emu. Made some changes to it with hope to make - it faster. - + Implemented ym2612 emu from the MAME project. Runs well but sometimes sounds - a bit weird. Could be a little faster, so made some changes too. - + Implemented SN76489 emu from the MAME project. - + Added two separate sound output methods (mediaserver and cmaudiofb) with - autodetection (needs testing). - * Fixed VDP DMA fill emulation (as described in Charles MacDonald's docs), - fixes Contra and some other games. - -0.301 - Launcher: - * Launcher now starts emulation process from current directory, - not from hardcoded paths. - * Improved 'pause on call' feature, should hopefully work with Motorola phones. - -0.30 - Initial release. - - -Disclaimer ----------- - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. diff --git a/platform/uiq2/audio.h b/platform/uiq2/audio.h deleted file mode 100644 index 0b1ae38f..00000000 --- a/platform/uiq2/audio.h +++ /dev/null @@ -1,24 +0,0 @@ -// audio interface, used in picodriveN - -#ifndef __AUDIO_H -#define __AUDIO_H - -#include - - -class IGameAudio : public CBase -{ -public: - virtual TInt16 *NextFrameL() = 0; - virtual TInt16 *DupeFrameL(TInt &aUnderflowed) = 0; - virtual TInt16 *ResumeL() = 0; - virtual void Pause() = 0; - virtual void ChangeVolume(TInt aUp) = 0; // for Motorolas (experimental) -}; - - -// our audio object maker type -typedef IGameAudio *(*_gameAudioNew)(TInt aRate, TBool aStereo, TInt aPcmFrames, TInt aBufferedFrames); - - -#endif /* __AUDIO_H */ diff --git a/platform/uiq2/audio/AUDIO_MEDIASERVER.DLL b/platform/uiq2/audio/AUDIO_MEDIASERVER.DLL deleted file mode 100644 index 38172c48c99c2c0193ed9cd4110a82d2858cb1f0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3904 zcmc&%Z)h837=JF8c4tlXrW?dDamfWeSO|Zqx#kJF-RiZ|SIwWd8RG5<4 zM2fCZ)^-%!=*gxO87i_5{h&}mWa!j_L#Fs4x$|7tiB$YoWDtMP^|EEJvje{vc>3P+ zywCf*zvu5=UnJ7MjFGwMvSsE`Y}RVE1tQzMx^{DQF?Hi9O4wB;V^>32 zyQ19C^3vcbJLXYguh&F&wMnv6^sB`;enc?G-Vg>eoz7dA&o7oc`f9<-SHXx_)uapS4*+*XHx zMJWJN5&FPZ1m1gLj}jTDnW%*_BfhO>U|40?RSg(Euhp<`SNV=4ba{;tolXVM;kglK zu_L%A0l#6F?>NGKiLw_F6CP2Ii%_+6(S&ym&PA}281>p_$Gpochz(-q%P8Z983*=M z_^LJR5Ac~4_JPq&XUk4l*>`dS?objXCrrKWU$xqIeD6wUIqs|Aa}?*0Q9q80iE}>X3+bQjjJG2#8yy4`I7X2k!q0(@3!J7PsGm%vW0fo}qz5H|a_pjgN+ zucqzteLCdrh?N$^Dzw>Fm0RsA1!V1zDPqXoh-cJw7ww(9XHxO-jfQV&7 zS-Z-yXhjaP;K!P&@+0sP{7VbOXZ6s@Rq)q?jQ9C@tXZir&oNUGvqi*=_c(8=82X@d z6YEgrcwnbrFMF+t<(l|9u+yl^HNrOMSRYvOiLz%=*%{C$yzBh@vk#dnVsgP;N1z|! zx(afjb6w%Sf-&yp^l`*#+{YH$v|E2g?4}%gVJBpWle3fi0(v3psiG~{F_u2mYZr}s zuK-UnILq~T3;aXwzKdXQrTXB$j!+3UX@Tt>hP@ol=mEY$fKSN+V`dp&*+3p(Ka{ao zGd6x^e_75xD6pgGk5^s?CXAJZJaiP%? zv!h-feaW>RT0M4h?lj6?9$2}C@_vu?xOt=8 zbk>#vThPs+@8QdW{ijNaR+XX`sM82y%K63%1T$~k`vE@tHTI90cage7zeiBd^*XEf z0o(ivHWlnAu%85Rjd1PfjdA#1azennVg{7ruD z_MXk%AnxWo>Bv8E{*4hYLI>s}w0oXs=;)kE8ge0|o?Mf$-Dq~oO9cLEsJTypf$_bJ zmFKbjszS~1VK$HtVr|6DKK)Uvt!tEpsp8H+uU`B7p5=UmMG?8b-_^wETGY}NnkcR% zVXIi1SV!LbHyP);AGy->qLZN!=S|$j>%m}s3oF03uRx8}=iySV))Gd%o0T5-cRb@> z;Nb6r5r=DiKc7LbG$95AJ?^c>d`@D&A2F=g8`lfh3V+84KkjU6<+@>;{0)=x@1li1 z{w8Ud;~Hk^O#ybiGh0~yYViC`Lq1l!dOdjG4pzL{{AbQF+d2;$aIJy8blKrG{5SRuV%CH)L2*9?3h($4L(&T)wkgKq;_l6>(}*aGbY?E>uq?FStOu^sdX ztp)uGx&uS`84$jU=nc>TPz)bAFMz%UMWK8Z$O1hGdI)q7bO@wjaP9)_0nLDTkp2vc zVYu7{+6HO6*fTls$fMEK6$M+#HFh0ilP4LWoYDZ6M z`@@@r5VyvjyzP;jlIb*UO(nZKI@8^$`+9?&&A0qxr(;L5ds|QM_Eg8#Kq+?nvJ#bG z_YM&M__-v8#U3##j%|v@ay(b$RDd~7ME#iQ}I_?CEAyf2=Q55|Y%lkw^JO#Ep4 zM0`HJ6xYnC*=BAryUac_Zw{Kn=A=1o&X`Bd6Xv|BTb7lul2(_MwlY@MDp&*7pfzmm Pu|}Huc&C5lg0CCqZ(QD{3S^SZV}8>Pw}C7O4*{GAcr$s?g3%Ms}SFj0#l{uD0Kq zolTq@l9x)XboR`-_n!ZsJM&{A@y9_DXMaax^ZW-dAMg(ilTGyc=kNUj;b+jxR9#nZ zeSf1#S*`_&C+p_5tsgwRkVE1H322cDjD9Qj3?WwKzvA z$PulVEfS{zRlqBNCBVket7{#7xs@kFf-a*1ozRzs?u)SJIp`$M54RB&$e&5%Z4)Z! zvQ=P86};VQVV`xV;2E4{{3y}YBk6N)WhUIJC(%(=!6NJ=IUQT_OiVN$nUFt5XW|n0 zEMOu(B01Ze73yBIG1t4Zsk-}Hk93PW?2)gciOO`CA7XpXt`;H7m(yX6=2joWv*AyL zCLNAGY_;BDUANP*4L+Fg@nP^FLrLte`*84~_xjRUy>HOfF`ABZ@Sz{Rn7}qL`?Dm^ z^kz?~Zs7c6RT)%Kkv}^fT52YoXiSG@V+Zbx#eG(WcAJg!ao#(r{B{ zzF4yB@q(x$-u1-4%)lw}ygWq<=z~S98FDgQ#Pd0v%g{L2rtuA;?PFArUxFW_9X_I6 zBY5sXjP4?O$HM;YYJz*yBJL+zXC96#$Ny(UyBEMGyta*%)JCJMf+fFg?knT-d0=hdRA+seAmkABU0xAJqm znBVoL;$;Bx8WgZLM)UDsFwfn#E$CZi3?w;ZyT>D3V+9LmZs!BX#FA5S7VZpUbU1gxGKoiB$GI(Br`d)`@r&9s>_%PqNSaM9)NqSG&jXMj-m> z0D50T&Ag3g#7+H%`5>z|Csa4`vAa{Noqp}{VQ2Y5>>{u1OBZSn^|!934Kn=0$^FOo z!XFYJ>haH$n6&E}_etSKjW@Fm#HS-aM^8n3cjBJ?({?<=rmQKedDxT{zT>mi;^uz|#@CT6X{^LOj)#rhi0;7n?#mD za}@PzifZW7OgIbQ8NZm~Ixyc2oTJW6zJ{3O&}-X_@#x=p<~lIZ7di0l!2N@{iJbXS z9&sj|<9ZWY?tvGue-t&*={xQj&bNWO;CCNNWVLezKW=$XV0n4yc|6fW>kD|_>C_kd zV`82^nA(jz7x?@Gp!=`OR>5aLCvt#4n?CdV0L!|`F4)uqdGJ4pLr31TphZVs+EciP z;5V(mzQvv#&BnjN`(LgBzZwfM=U{9HiLEr=9dDv-ZNE>WeU0`s+S2HMY4SCevL{R84Zu>KL>XXpwZCAJ z{ld-9SGLghT{reFgXb9L)MhGw6!A+G;BN%a$F`H00Mr0=z#`xh0KGxIfDZtVFw+U|dC9jMf4X%8_{ZO5?*f(qp8`O||J}w0bi##OY<&xBY!5@n<^zYv z4}9&L15(P*4Sx60=N=vz8>1(O4v&2K(9rM};!95?MBA^Yz|TMSu`G|t8$b|vR z5l)ZO=kz~o~E-*Ft*@thH7)F}@x4{i*KqFt0lujm)c#Y(YSoGq&2#bTql zQfwACic}IMyCh3q$uE^ll~T1dTT-QqrABF`)GTe3$Q7>bO4oCbyC>X=JK_GwJ?Z|$ et-I&kMfak6$!)lAx-0IV-OKK~ZqvQu5`7Gp0cnH) diff --git a/platform/uiq2/audio/mediaserver/AUDIO_MEDIASERVER.ARMI b/platform/uiq2/audio/mediaserver/AUDIO_MEDIASERVER.ARMI deleted file mode 100644 index ab9cb647..00000000 --- a/platform/uiq2/audio/mediaserver/AUDIO_MEDIASERVER.ARMI +++ /dev/null @@ -1,402 +0,0 @@ - -# CWD \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\ -# MMPFile \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER.MMP -# Target AUDIO_MEDIASERVER.DLL -# TargetType DLL -# BasicTargetType DLL -# MakefileType GNU - -ERASE = @erase 2>>nul - -# EPOC DEFINITIONS - -EPOCBLD = ..\..\..\..\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER\ARMI -EPOCTRG = ..\..\..\..\EPOC32\RELEASE\ARMI -EPOCLIB = ..\..\..\..\EPOC32\RELEASE\ARMI -EPOCLINK = ..\..\..\..\EPOC32\RELEASE\ARMI -EPOCSTATLINK = ..\..\..\..\EPOC32\RELEASE\ARMI -EPOCASSPLINK = ..\..\..\..\EPOC32\RELEASE\MARM -EPOCDATA = \DEV\UIQ21\EPOC32\DATA -EPOCINC = \DEV\UIQ21\EPOC32\INCLUDE -TRGDIR = -DATADIR = Z\SYSTEM\DATA - -EPOCBLDUREL = $(EPOCBLD)\UREL -EPOCTRGUREL = $(EPOCTRG)\UREL -EPOCLIBUREL = $(EPOCLIB)\UREL -EPOCLINKUREL = $(EPOCLINK)\UREL -EPOCSTATLINKUREL = $(EPOCSTATLINK)\UREL -EPOCASSPLINKUREL = $(EPOCASSPLINK)\UREL - -EPOCBLDUDEB = $(EPOCBLD)\UDEB -EPOCTRGUDEB = $(EPOCTRG)\UDEB -EPOCLIBUDEB = $(EPOCLIB)\UREL -EPOCLINKUDEB = $(EPOCLINK)\UREL -EPOCSTATLINKUDEB = $(EPOCSTATLINK)\UDEB -EPOCASSPLINKUDEB = $(EPOCASSPLINK)\UREL - -# EPOC PSEUDOTARGETS - -UREL : MAKEWORKUREL RESOURCEUREL - -UDEB : MAKEWORKUDEB RESOURCEUDEB - -ALL : UREL UDEB - -CLEAN CLEANALL : CLEANBUILD CLEANRELEASE CLEANLIBRARY - - - -WHAT WHATALL : WHATUREL WHATUDEB - -RESOURCE RESOURCEALL : RESOURCEUREL RESOURCEUDEB - -CLEANBUILD CLEANBUILDALL : CLEANBUILDUREL CLEANBUILDUDEB - -CLEANRELEASE CLEANRELEASEALL : CLEANRELEASEUREL CLEANRELEASEUDEB - -MAKEWORK MAKEWORKALL : MAKEWORKUREL MAKEWORKUDEB - -LISTING LISTINGALL : LISTINGUREL LISTINGUDEB - -MAKEWORK : MAKEWORKLIBRARY - -RESOURCEUREL RESOURCEUDEB : GENERIC_RESOURCE - - -# must set both PATH and Path to make it work correctly -Path:=X:\DEV\UIQ21\EPOC32\gcc\bin;$(Path) -PATH:=$(Path) - -INCDIR = -I "." -I "..\.." -I "..\..\..\..\EPOC32\INCLUDE" - -GCCFLAGS=-march=armv4t -mthumb-interwork \ - -pipe -c -nostdinc -Wall -Wno-ctor-dtor-privacy -Wno-unknown-pragmas - -GCCDEFS = -D__SYMBIAN32__ -D__GCC32__ -D__EPOC32__ -D__MARM__ -D__MARM_ARMI__ -D__DLL__ $(USERDEFS) - -GCCUREL = gcc -s -fomit-frame-pointer -O $(GCCFLAGS) -DNDEBUG -D_UNICODE $(GCCDEFS) -GCCUDEB = gcc -g -O $(GCCFLAGS) -D_DEBUG -D_UNICODE $(GCCDEFS) - - -UREL : \ - $(EPOCTRGUREL)\AUDIO_MEDIASERVER.DLL \ - LIBRARY - - -UDEB : \ - $(EPOCTRGUDEB)\AUDIO_MEDIASERVER.DLL \ - LIBRARY - - - -RESOURCEUREL : MAKEWORKUREL -RESOURCEUDEB : MAKEWORKUDEB - -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 - - -# REAL TARGET - LIBRARY - -$(EPOCLIB)\UREL\AUDIO_MEDIASERVER.LIB : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER.DEF - dlltool -m arm_interwork --output-lib "$(EPOCLIB)\UREL\AUDIO_MEDIASERVER.LIB" \ - --def ".\AUDIO_MEDIASERVER.DEF" \ - --dllname "AUDIO_MEDIASERVER[1000c196].DLL" - -\DEV\UIQ21\EPOC32\RELEASE\ARM4\UREL\AUDIO_MEDIASERVER.LIB : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER.DEF - dlltool -m arm --output-lib "..\..\..\..\EPOC32\RELEASE\ARM4\UREL\AUDIO_MEDIASERVER.LIB" \ - --def ".\AUDIO_MEDIASERVER.DEF" \ - --dllname "AUDIO_MEDIASERVER[1000c196].DLL" - -\DEV\UIQ21\EPOC32\RELEASE\THUMB\UREL\AUDIO_MEDIASERVER.LIB : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER.DEF - dlltool -m thumb --output-lib "..\..\..\..\EPOC32\RELEASE\THUMB\UREL\AUDIO_MEDIASERVER.LIB" \ - --def ".\AUDIO_MEDIASERVER.DEF" \ - --dllname "AUDIO_MEDIASERVER[1000c196].DLL" - - -FREEZE : - perl -S efreeze.pl "\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER.DEF" "$(EPOCBLD)\AUDIO_MEDIASERVER.def" - -CLEANLIBRARY : - -$(ERASE) "$(EPOCLIB)\UREL\AUDIO_MEDIASERVER.LIB" - -$(ERASE) "\DEV\UIQ21\EPOC32\RELEASE\ARM4\UREL\AUDIO_MEDIASERVER.LIB" - -$(ERASE) "\DEV\UIQ21\EPOC32\RELEASE\THUMB\UREL\AUDIO_MEDIASERVER.LIB" - - -GENERIC_RESOURCE : GENERIC_MAKEWORK - -# REAL TARGET - BUILD VARIANT UREL - -WHATUREL : WHATGENERIC - -CLEANUREL : CLEANBUILDUREL CLEANRELEASEUREL - -CLEANBUILDUREL : - @perl -S ermdir.pl "$(EPOCBLDUREL)" - -CLEANRELEASEUREL : CLEANGENERIC - - -UREL_RELEASEABLES1= \ - \DEV\UIQ21\EPOC32\RELEASE\ARM4\UREL\AUDIO_MEDIASERVER.LIB \ - \DEV\UIQ21\EPOC32\RELEASE\ARMI\UREL\AUDIO_MEDIASERVER.DLL \ - \DEV\UIQ21\EPOC32\RELEASE\ARMI\UREL\AUDIO_MEDIASERVER.DLL.MAP \ - \DEV\UIQ21\EPOC32\RELEASE\ARMI\UREL\AUDIO_MEDIASERVER.LIB \ - \DEV\UIQ21\EPOC32\RELEASE\THUMB\UREL\AUDIO_MEDIASERVER.LIB - -WHATUREL: - @echo $(UREL_RELEASEABLES1) - -CLEANRELEASEUREL: - -$(ERASE) $(UREL_RELEASEABLES1) - -LISTINGUREL : MAKEWORKUREL \ - LISTINGURELAUDIO_MEDIASERVER \ - LISTINGURELPOLLEDAS - -LIBSUREL= \ - $(EPOCSTATLINKUREL)\EDLLSTUB.LIB \ - $(EPOCSTATLINKUREL)\EGCC.LIB \ - $(EPOCLINKUREL)\EUSER.LIB \ - $(EPOCLINKUREL)\MEDIACLIENTAUDIOSTREAM.LIB \ - $(EPOCLINKUREL)\MEDIACLIENT.LIB - -$(EPOCTRGUREL)\AUDIO_MEDIASERVER.DLL : $(EPOCBLDUREL)\AUDIO_MEDIASERVER.in \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER.DEF $(EPOCSTATLINKUREL)\EDLL.LIB $(LIBSUREL) - dlltool -m arm_interwork --output-def "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.inf" "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.in" - perl -S makedef.pl -Deffile "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.inf" -Frzfile "\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER.DEF" "$(EPOCBLD)\AUDIO_MEDIASERVER.def" - -$(ERASE) "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.inf" - dlltool -m arm_interwork --def "$(EPOCBLD)\AUDIO_MEDIASERVER.def" \ - --output-exp "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.exp" \ - --dllname "AUDIO_MEDIASERVER[1000c196].DLL" - ld -s -e _E32Dll -u _E32Dll "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.exp" --dll \ - --base-file "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.bas" -o "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.DLL" \ - "$(EPOCSTATLINKUREL)\EDLL.LIB" --whole-archive "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.in" \ - --no-whole-archive $(LIBSUREL) $(USERLDFLAGS) - -$(ERASE) "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.exp" - -$(ERASE) "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.DLL" - dlltool -m arm_interwork \ - --def "$(EPOCBLD)\AUDIO_MEDIASERVER.def" \ - --dllname "AUDIO_MEDIASERVER[1000c196].DLL" \ - --base-file "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.bas" \ - --output-exp "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.exp" - -$(ERASE) "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.bas" - ld -s -e _E32Dll -u _E32Dll --dll \ - "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.exp" \ - -Map "$(EPOCTRGUREL)\AUDIO_MEDIASERVER.DLL.map" -o "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.DLL" \ - "$(EPOCSTATLINKUREL)\EDLL.LIB" --whole-archive "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.in" \ - --no-whole-archive $(LIBSUREL) $(USERLDFLAGS) - -$(ERASE) "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.exp" - petran "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.DLL" "$@" \ - -nocall -uid1 0x10000079 -uid2 0x100039ce -uid3 0x1000c196 - -$(ERASE) "$(EPOCBLDUREL)\AUDIO_MEDIASERVER.DLL" - -OBJECTSUREL= \ - $(EPOCBLDUREL)\AUDIO_MEDIASERVER.o \ - $(EPOCBLDUREL)\POLLEDAS.o - -$(EPOCBLDUREL)\AUDIO_MEDIASERVER.in : $(OBJECTSUREL) - if exist "$@" del "$@" - ar cr $@ $^ - - -# REAL TARGET - BUILD VARIANT UDEB - -WHATUDEB : WHATGENERIC - -CLEANUDEB : CLEANBUILDUDEB CLEANRELEASEUDEB - -CLEANBUILDUDEB : - @perl -S ermdir.pl "$(EPOCBLDUDEB)" - -CLEANRELEASEUDEB : CLEANGENERIC - - -UDEB_RELEASEABLES1= \ - \DEV\UIQ21\EPOC32\RELEASE\ARM4\UREL\AUDIO_MEDIASERVER.LIB \ - \DEV\UIQ21\EPOC32\RELEASE\ARMI\UDEB\AUDIO_MEDIASERVER.DLL \ - \DEV\UIQ21\EPOC32\RELEASE\ARMI\UDEB\AUDIO_MEDIASERVER.DLL.MAP \ - \DEV\UIQ21\EPOC32\RELEASE\ARMI\UREL\AUDIO_MEDIASERVER.LIB \ - \DEV\UIQ21\EPOC32\RELEASE\THUMB\UREL\AUDIO_MEDIASERVER.LIB - -WHATUDEB: - @echo $(UDEB_RELEASEABLES1) - -CLEANRELEASEUDEB: - -$(ERASE) $(UDEB_RELEASEABLES1) - -LISTINGUDEB : MAKEWORKUDEB \ - LISTINGUDEBAUDIO_MEDIASERVER \ - LISTINGUDEBPOLLEDAS - -LIBSUDEB= \ - $(EPOCSTATLINKUDEB)\EDLLSTUB.LIB \ - $(EPOCSTATLINKUDEB)\EGCC.LIB \ - $(EPOCLINKUDEB)\EUSER.LIB \ - $(EPOCLINKUDEB)\MEDIACLIENTAUDIOSTREAM.LIB \ - $(EPOCLINKUDEB)\MEDIACLIENT.LIB - -$(EPOCTRGUDEB)\AUDIO_MEDIASERVER.DLL : $(EPOCBLDUDEB)\AUDIO_MEDIASERVER.in \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER.DEF $(EPOCSTATLINKUDEB)\EDLL.LIB $(LIBSUDEB) - dlltool -m arm_interwork --output-def "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.inf" "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.in" - perl -S makedef.pl -Deffile "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.inf" -Frzfile "\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER.DEF" "$(EPOCBLD)\AUDIO_MEDIASERVER.def" - -$(ERASE) "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.inf" - dlltool -m arm_interwork --def "$(EPOCBLD)\AUDIO_MEDIASERVER.def" \ - --output-exp "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.exp" \ - --dllname "AUDIO_MEDIASERVER[1000c196].DLL" - ld -s -e _E32Dll -u _E32Dll "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.exp" --dll \ - --base-file "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.bas" -o "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.DLL" \ - "$(EPOCSTATLINKUDEB)\EDLL.LIB" --whole-archive "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.in" \ - --no-whole-archive $(LIBSUDEB) $(USERLDFLAGS) - -$(ERASE) "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.exp" - -$(ERASE) "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.DLL" - dlltool -m arm_interwork \ - --def "$(EPOCBLD)\AUDIO_MEDIASERVER.def" \ - --dllname "AUDIO_MEDIASERVER[1000c196].DLL" \ - --base-file "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.bas" \ - --output-exp "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.exp" - -$(ERASE) "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.bas" - ld -e _E32Dll -u _E32Dll --dll \ - "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.exp" \ - -Map "$(EPOCTRGUDEB)\AUDIO_MEDIASERVER.DLL.map" -o "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.DLL" \ - "$(EPOCSTATLINKUDEB)\EDLL.LIB" --whole-archive "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.in" \ - --no-whole-archive $(LIBSUDEB) $(USERLDFLAGS) - -$(ERASE) "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.exp" - objcopy -X "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.DLL" "$(EPOCTRGUDEB)\AUDIO_MEDIASERVER.sym" - petran "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.DLL" "$@" \ - -nocall -uid1 0x10000079 -uid2 0x100039ce -uid3 0x1000c196 - -$(ERASE) "$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.DLL" - -OBJECTSUDEB= \ - $(EPOCBLDUDEB)\AUDIO_MEDIASERVER.o \ - $(EPOCBLDUDEB)\POLLEDAS.o - -$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.in : $(OBJECTSUDEB) - if exist "$@" del "$@" - ar cr $@ $^ - - -# SOURCES - -# Source AUDIO_MEDIASERVER.CPP - -$(EPOCBLDUREL)\AUDIO_MEDIASERVER.lis $(EPOCBLDUREL)\AUDIO_MEDIASERVER.o \ -$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.lis $(EPOCBLDUDEB)\AUDIO_MEDIASERVER.o \ -: \ - \DEV\UIQ21\EPOC32\INCLUDE\E32BASE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32BASE.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\E32DEF.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32DES16.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32DES8.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32HAL.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32KEYS.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32PCCD.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32STD.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32STD.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\E32SVR.H \ - \DEV\UIQ21\EPOC32\INCLUDE\MDAAUDIOOUTPUTSTREAM.H \ - \DEV\UIQ21\EPOC32\INCLUDE\MDA\CLIENT\BASE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\MDA\CLIENT\BASE.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\MDA\CLIENT\CONTROLLER.H \ - \DEV\UIQ21\EPOC32\INCLUDE\MDA\CLIENT\PORT.H \ - \DEV\UIQ21\EPOC32\INCLUDE\MDA\CLIENT\UTILITY.H \ - \DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\AUDIO.H \ - \DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\AUDIO.HRH \ - \DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\AUDIOSTREAM.HRH \ - \DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\BASE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\BASE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\BASE.HRH \ - \DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\BASE.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\CONTROLLER.H \ - \DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\CONTROLLER.H \ - \DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\CONTROLLER.HRH \ - \DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\PORT.H \ - \DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\PORT.HRH \ - \DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\RESOURCE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\MDA\COMMON\RESOURCE.HRH \ - \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO.H \ - \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER.H \ - \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\POLLEDAS.H - -$(EPOCBLDUREL)\AUDIO_MEDIASERVER.o : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\Audio_mediaserver.cpp - $(GCCUREL) -I "." $(INCDIR) -o $@ ".\Audio_mediaserver.cpp" - -LISTINGURELAUDIO_MEDIASERVER : $(EPOCBLDUREL)\AUDIO_MEDIASERVER.lis - perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER.lst.ARMI - -$(EPOCBLDUREL)\AUDIO_MEDIASERVER.lis : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\Audio_mediaserver.cpp - $(GCCUREL) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Audio_mediaserver.cpp" > $@ - -$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.o : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\Audio_mediaserver.cpp - $(GCCUDEB) -I "." $(INCDIR) -o $@ ".\Audio_mediaserver.cpp" - -LISTINGUDEBAUDIO_MEDIASERVER : $(EPOCBLDUDEB)\AUDIO_MEDIASERVER.lis - perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER.lst.ARMI - -$(EPOCBLDUDEB)\AUDIO_MEDIASERVER.lis : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\Audio_mediaserver.cpp - $(GCCUDEB) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Audio_mediaserver.cpp" > $@ - - - -# Source POLLEDAS.CPP - -$(EPOCBLDUREL)\POLLEDAS.lis $(EPOCBLDUREL)\POLLEDAS.o \ -$(EPOCBLDUDEB)\POLLEDAS.lis $(EPOCBLDUDEB)\POLLEDAS.o \ -: \ - \DEV\UIQ21\EPOC32\INCLUDE\E32DEF.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32DES16.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32DES8.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32STD.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32STD.INL \ - \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\POLLEDAS.H - -$(EPOCBLDUREL)\POLLEDAS.o : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\Polledas.cpp - $(GCCUREL) -I "." $(INCDIR) -o $@ ".\Polledas.cpp" - -LISTINGURELPOLLEDAS : $(EPOCBLDUREL)\POLLEDAS.lis - perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\POLLEDAS.lst.ARMI - -$(EPOCBLDUREL)\POLLEDAS.lis : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\Polledas.cpp - $(GCCUREL) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Polledas.cpp" > $@ - -$(EPOCBLDUDEB)\POLLEDAS.o : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\Polledas.cpp - $(GCCUDEB) -I "." $(INCDIR) -o $@ ".\Polledas.cpp" - -LISTINGUDEBPOLLEDAS : $(EPOCBLDUDEB)\POLLEDAS.lis - perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\POLLEDAS.lst.ARMI - -$(EPOCBLDUDEB)\POLLEDAS.lis : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\Polledas.cpp - $(GCCUDEB) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Polledas.cpp" > $@ - - - -ROMFILE: - @echo file=\DEV\UIQ21\EPOC32\RELEASE\ARMI\##BUILD##\AUDIO_MEDIASERVER.DLL System\Libs\AUDIO_MEDIASERVER.DLL - - -WHATGENERIC CLEANGENERIC : - @rem none - -# Rules to create all necessary directories - -GENERIC_MAKEWORK : \ - \DEV\UIQ21\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER\ARMI -MAKEWORKLIBRARY : \ - \DEV\UIQ21\EPOC32\RELEASE\ARM4\UREL \ - \DEV\UIQ21\EPOC32\RELEASE\ARMI\UREL \ - \DEV\UIQ21\EPOC32\RELEASE\THUMB\UREL -MAKEWORKUDEB : \ - \DEV\UIQ21\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER\ARMI\UDEB \ - \DEV\UIQ21\EPOC32\RELEASE\ARMI\UDEB -MAKEWORKUREL : \ - \DEV\UIQ21\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER\ARMI\UREL \ - \DEV\UIQ21\EPOC32\RELEASE\ARMI\UREL - -\DEV\UIQ21\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER\ARMI \ -\DEV\UIQ21\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER\ARMI\UDEB \ -\DEV\UIQ21\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MEDIASERVER\AUDIO_MEDIASERVER\ARMI\UREL \ -\DEV\UIQ21\EPOC32\RELEASE\ARM4\UREL \ -\DEV\UIQ21\EPOC32\RELEASE\ARMI\UDEB \ -\DEV\UIQ21\EPOC32\RELEASE\ARMI\UREL \ -\DEV\UIQ21\EPOC32\RELEASE\THUMB\UREL \ -: - perl -S emkdir.pl $@ - diff --git a/platform/uiq2/audio/mediaserver/PolledAS.h b/platform/uiq2/audio/mediaserver/PolledAS.h deleted file mode 100644 index f360c897..00000000 --- a/platform/uiq2/audio/mediaserver/PolledAS.h +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************* - * - * File: PolledAS.h - * - * Author: Peter van Sebille (peter@yipton.net) - * - * (c) Copyright 2001, Peter van Sebille - * All Rights Reserved - * - *******************************************************************/ - -#ifndef __POLLED_AS_H -#define __POLLED_AS_H - -class CPrivatePolledActiveScheduler; - -class CPolledActiveScheduler : public CBase -{ -public: - ~CPolledActiveScheduler(); - static CPolledActiveScheduler* NewL(); - //static CPolledActiveScheduler* Instance(); - void Schedule(); -protected: - CPolledActiveScheduler(){}; - void ConstructL(); - CPrivatePolledActiveScheduler* iPrivatePolledActiveScheduler; -}; - - -#endif /* __POLLED_AS_H */ - diff --git a/platform/uiq2/audio/mediaserver/audio_mediaserver.cpp b/platform/uiq2/audio/mediaserver/audio_mediaserver.cpp deleted file mode 100644 index 6655205b..00000000 --- a/platform/uiq2/audio/mediaserver/audio_mediaserver.cpp +++ /dev/null @@ -1,321 +0,0 @@ -/******************************************************************* - * - * File: Audio_mediaserver.cpp - * - * Author: Peter van Sebille (peter@yipton.net) - * - * Modified/adapted for picodriveN by notaz, 2006 - * - * (c) Copyright 2006, notaz - * (c) Copyright 2001, Peter van Sebille - * All Rights Reserved - * - *******************************************************************/ - -#include "audio_mediaserver.h" - -//#define __DEBUG_PRINT_SND - -#ifdef __DEBUG_PRINT_SND - #include // RDebug - #define DEBUGPRINT(x...) RDebug::Print(x) -#else - #define DEBUGPRINT(x...) -#endif - - -GLDEF_C TInt E32Dll(TDllReason) -{ - return KErrNone; -} - - -/******************************************* - * - * CGameAudioMS - * - *******************************************/ - -CGameAudioMS::CGameAudioMS(TInt aRate, TBool aStereo, TInt aPcmFrames, TInt aBufferedFrames) -: iRate(aRate), iStereo(aStereo), iBufferedFrames(aBufferedFrames), iPcmFrames(aPcmFrames) -{ -} - - -CGameAudioMS* CGameAudioMS::NewL(TInt aRate, TBool aStereo, TInt aPcmFrames, TInt aBufferedFrames) -{ - DEBUGPRINT(_L("CGameAudioMS::NewL(%i, %i, %i, %i)"),aRate, aStereo, aPcmFrames, aBufferedFrames); - CGameAudioMS* self = new(ELeave) CGameAudioMS(aRate, aStereo, aPcmFrames, aBufferedFrames); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); // self - return self; -} - - -CGameAudioMS::~CGameAudioMS() -{ - DEBUGPRINT(_L("CGameAudioMS::~CGameAudioMS()")); - if(iMdaAudioOutputStream) { - iScheduler->Schedule(); // let it finish it's stuff - iMdaAudioOutputStream->Stop(); - delete iMdaAudioOutputStream; - } - if(iServer) delete iServer; - - for (TInt i=0 ; iDes().FillZ (bytesPerFrame * iBufferedFrames); - } - // because feeding 2 buffers after an underflow is a little too much, but feeding 1 may be not enough, - // prepare this ~50ms empty buffer to additionaly feed after every underflow. - // Another strange thing here: if we try to make and odd-length sound buffer here, - // system then outputs horrible noise! (this happened on 22050 mono and when there - // were no parenthesis around iBufferedFrames / 4. - iSoundBuffers[KSoundBuffers] = HBufC8::NewL(bytesPerFrame * (iBufferedFrames / 4)); - iSoundBuffers[KSoundBuffers]->Des().FillZ (bytesPerFrame * (iBufferedFrames / 4)); - - iCurrentBuffer = 0; - - // here we actually test if we can create and open CMdaAudioOutputStream at all, but really create and use it later. - iMdaAudioOutputStream = CMdaAudioOutputStream::NewL(iListener, iServer); - if(iMdaAudioOutputStream) { - delete iMdaAudioOutputStream; - iMdaAudioOutputStream = 0; - } -} - -/* currently unused -TInt CGameAudioMS::Write(TInt16* aBuffer, TInt aSize) -{ - TInt byteSize = iStereo ? aSize << 2 : aSize << 1; - Mem::Copy(iCurrentPosition, aBuffer, byteSize); - iCurrentPosition += aSize; - - if (++iFrameCount == iBufferedFrames) - { - WriteBlock(); - } - - CPolledActiveScheduler::Instance()->Schedule(); - if(iListener.iUnderflowed) Underflowed(); // oh no, CMdaAudioOutputStream underflowed! - - return aSize; -} -*/ - -// returns a pointer to buffer for next frame, -// to be used when iSoundBuffers are used directly -TInt16 *CGameAudioMS::NextFrameL() -{ - iCurrentPosition += iPcmFrames << (iStereo?1:0); - - if (++iFrameCount == iBufferedFrames) - { - WriteBlockL(); - } - - iScheduler->Schedule(); - - if(iListener.iUnderflowed) { - if(iListener.iUnderflowed > KMaxUnderflows) { - delete iMdaAudioOutputStream; - iMdaAudioOutputStream = 0; - return 0; - } - UnderflowedL(); // not again! - } - - return iCurrentPosition; -} - -TInt16 *CGameAudioMS::DupeFrameL(TInt &aUnderflowed) -{ - TInt shorts = iStereo ? (iPcmFrames << 1) : iPcmFrames; - if(iFrameCount) - Mem::Copy(iCurrentPosition, iCurrentPosition-shorts, shorts<<1); - else { - TInt lastBuffer = iCurrentBuffer; - if(--lastBuffer < 0) lastBuffer = KSoundBuffers - 1; - Mem::Copy(iCurrentPosition, ((TInt16*) (iSoundBuffers[lastBuffer]->Ptr()))+shorts*(iBufferedFrames-1), shorts<<1); - } - iCurrentPosition += shorts; - - if (++iFrameCount == iBufferedFrames) - { - WriteBlockL(); - } - - iScheduler->Schedule(); - - if((aUnderflowed = iListener.iUnderflowed)) { // not again! - if(iListener.iUnderflowed > KMaxUnderflows) { - delete iMdaAudioOutputStream; - iMdaAudioOutputStream = 0; - return 0; - } - UnderflowedL(); // not again! - } - - return iCurrentPosition; -} - -void CGameAudioMS::WriteBlockL() -{ - iScheduler->Schedule(); - // do not write until stream is open - if(!iListener.iIsOpen) WaitForOpenToCompleteL(); - //if(!iListener.iHasCopied) WaitForCopyToCompleteL(); // almost never happens anyway and sometimes even deadlocks? - //iListener.iHasCopied = EFalse; - - - if(!iListener.iUnderflowed) { - // don't write if sound is lagging too much - if(iTime - iMdaAudioOutputStream->Position().Int64() <= TInt64(0, KMaxLag)) { - //RDebug::Print(_L("delta: %i"), iTime.Low() - iMdaAudioOutputStream->Position().Int64().Low()); - iMdaAudioOutputStream->WriteL(*iSoundBuffers[iCurrentBuffer]); - iTime += KBlockTime; - } - } - - iFrameCount = 0; - if (++iCurrentBuffer == KSoundBuffers) - iCurrentBuffer = 0; - iCurrentPosition = (TInt16*) iSoundBuffers[iCurrentBuffer]->Ptr(); -} - -void CGameAudioMS::Pause() -{ - if(!iMdaAudioOutputStream) return; - - iScheduler->Schedule(); // let it finish it's stuff - iMdaAudioOutputStream->Stop(); - delete iMdaAudioOutputStream; - iMdaAudioOutputStream = 0; -} - -// call this before doing any playback! -TInt16 *CGameAudioMS::ResumeL() -{ - DEBUGPRINT(_L("CGameAudioMS::Resume()")); - iScheduler->Schedule(); - - // we act a bit strange here: simulate buffer underflow, which actually starts audio - iListener.iIsOpen = ETrue; - iListener.iUnderflowed = 1; - iFrameCount = 0; - iCurrentPosition = (TInt16*) iSoundBuffers[iCurrentBuffer]->Ptr(); - return iCurrentPosition; -} - -// handles underflow condition -void CGameAudioMS::UnderflowedL() -{ - // recreate the stream - //iMdaAudioOutputStream->Stop(); - if(iMdaAudioOutputStream) delete iMdaAudioOutputStream; - iMdaAudioOutputStream = CMdaAudioOutputStream::NewL(iListener, iServer); - iMdaAudioOutputStream->Open(&iMdaAudioDataSettings); - iListener.iIsOpen = EFalse; // wait for it to open - //iListener.iHasCopied = ETrue; // but don't wait for last copy to complete - // let it open and feed some stuff to make it happy - User::After(0); - TInt lastBuffer = iCurrentBuffer; - if(--lastBuffer < 0) lastBuffer = KSoundBuffers - 1; - iScheduler->Schedule(); - if(!iListener.iIsOpen) WaitForOpenToCompleteL(); - iMdaAudioOutputStream->WriteL(*iSoundBuffers[KSoundBuffers]); // special empty fill-up - iMdaAudioOutputStream->WriteL(*iSoundBuffers[lastBuffer]); - iTime = TInt64(0, KBlockTime/4 + KBlockTime); -} - -/* -void CGameAudioMS::WaitForCopyToCompleteL() -{ - DEBUGPRINT(_L("CGameAudioMS::WaitForCopyToCompleteL")); - while (!iListener.iHasCopied) { - //User::After(0); - iScheduler->Schedule(); - } -} -*/ - -void CGameAudioMS::WaitForOpenToCompleteL() -{ - DEBUGPRINT(_L("CGameAudioMS::WaitForOpenToCompleteL")); - TInt count = 20; // 2 seconds - TInt waitPeriod = 100 * 1000; - - if(!iListener.iIsOpen) { - // it is often enough to do this - User::After(0); - iScheduler->Schedule(); - } - while (!iListener.iIsOpen && --count) - { - User::After(waitPeriod); - iScheduler->Schedule(); - } - if (!iListener.iIsOpen) - User::LeaveIfError(KErrNotSupported); -} - -void CGameAudioMS::ChangeVolume(TInt aUp) -{ - // do nothing - DEBUGPRINT(_L("CGameAudioMS::ChangeVolume(%i)"), aUp); -} - -void TGameAudioEventListener::MaoscOpenComplete(TInt aError) -{ - DEBUGPRINT(_L("CGameAudioMS::MaoscOpenComplete, error=%d"), aError); - - iIsOpen = ETrue; - if(aError) iUnderflowed++; - else iUnderflowed = 0; -} - -void TGameAudioEventListener::MaoscBufferCopied(TInt aError, const TDesC8& aBuffer) -{ - DEBUGPRINT(_L("CGameAudioMS::MaoscBufferCopied, error=%d"), aError); - -// iHasCopied = ETrue; - - if(aError) // shit! - iUnderflowed++; -} - -void TGameAudioEventListener::MaoscPlayComplete(TInt aError) -{ - DEBUGPRINT(_L("CGameAudioMS::MaoscPlayComplete: %i"), aError); - if(aError) - iUnderflowed++; // never happened to me while testing, but just in case -} - diff --git a/platform/uiq2/audio/mediaserver/audio_mediaserver.def b/platform/uiq2/audio/mediaserver/audio_mediaserver.def deleted file mode 100644 index c55290bb..00000000 --- a/platform/uiq2/audio/mediaserver/audio_mediaserver.def +++ /dev/null @@ -1,3 +0,0 @@ -EXPORTS -; NEW: - NewL__12CGameAudioMSiiii @ 1 NONAME ; static CGameAudioMS* NewL(TInt aRate, TBool aStereo, TInt aPcmFrames, TInt aBufferedFrames); diff --git a/platform/uiq2/audio/mediaserver/audio_mediaserver.h b/platform/uiq2/audio/mediaserver/audio_mediaserver.h deleted file mode 100644 index 6937a484..00000000 --- a/platform/uiq2/audio/mediaserver/audio_mediaserver.h +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************* - * - * File: Audio_mediaserver.h - * - * Author: Peter van Sebille (peter@yipton.net) - * - * Modified/adapted for picodriveN by notaz, 2006 - * - * (c) Copyright 2006, notaz - * (c) Copyright 2001, Peter van Sebille - * All Rights Reserved - * - *******************************************************************/ - -#ifndef __AUDIO_MEDIASERVER_H -#define __AUDIO_MEDIASERVER_H - -#include -#include - -#include "audio.h" -#include "polledas.h" - -const TInt KSoundBuffers = 4; -const TInt KBlockTime = 1000000 / 5; // hardcoded: 5 updates/sec -const TInt KMaxLag = 260000; // max sound lag, lower values increase chanse of underflow -const TInt KMaxUnderflows = 50; // max underflows/API errors we are going allow in a row (to prevent lockups) - - -class TGameAudioEventListener : public MMdaAudioOutputStreamCallback -{ -public: // implements MMdaAudioOutputStreamCallback - void MaoscOpenComplete(TInt aError); - void MaoscBufferCopied(TInt aError, const TDesC8& ); - void MaoscPlayComplete(TInt aError); - - TBool iIsOpen; -// TBool iHasCopied; - TInt iUnderflowed; -}; - - -class CGameAudioMS : public IGameAudio // IGameAudio MUST be specified first! -{ -public: // implements IGameAudio - TInt16 *NextFrameL(); - TInt16 *DupeFrameL(TInt &aUnderflowed); - TInt16 *ResumeL(); - void Pause(); - void ChangeVolume(TInt aUp); - -public: - ~CGameAudioMS(); - CGameAudioMS(TInt aRate, TBool aStereo, TInt aPcmFrames, TInt aBufferedFrames); - void ConstructL(); - EXPORT_C static CGameAudioMS* NewL(TInt aRate, TBool aStereo, TInt aPcmFrames, TInt aBufferedFrames); - -protected: - void WriteBlockL(); - void UnderflowedL(); - -protected: - void WaitForOpenToCompleteL(); -// void WaitForCopyToCompleteL(); - - TInt iRate; - TBool iStereo; - - CMdaAudioOutputStream *iMdaAudioOutputStream; - TMdaAudioDataSettings iMdaAudioDataSettings; - - TGameAudioEventListener iListener; - - CPolledActiveScheduler *iScheduler; - - HBufC8* iSoundBuffers[KSoundBuffers+1]; - TInt iBufferedFrames; - TInt16* iCurrentPosition; - TInt iCurrentBuffer; - TInt iFrameCount; - TInt iPcmFrames; - CMdaServer* iServer; - - TInt64 iTime; -}; - -#endif /* __AUDIO_MEDIASERVER_H */ diff --git a/platform/uiq2/audio/mediaserver/audio_mediaserver.mmp b/platform/uiq2/audio/mediaserver/audio_mediaserver.mmp deleted file mode 100644 index 3c3a6dbb..00000000 --- a/platform/uiq2/audio/mediaserver/audio_mediaserver.mmp +++ /dev/null @@ -1,18 +0,0 @@ -TARGET audio_mediaserver.dll -TARGETTYPE dll -UID 0x100039CE 0x1000C196 - -USERINCLUDE . -USERINCLUDE ..\..\ - -SYSTEMINCLUDE \epoc32\include - -SOURCEPATH . -SOURCE audio_mediaserver.cpp -SOURCE polledas.cpp - -LIBRARY EUSER.LIB mediaclientaudiostream.lib mediaclient.lib - -deffile .\audio_mediaserver.def - -nostrictdef diff --git a/platform/uiq2/audio/mediaserver/polledas.cpp b/platform/uiq2/audio/mediaserver/polledas.cpp deleted file mode 100644 index 8650c335..00000000 --- a/platform/uiq2/audio/mediaserver/polledas.cpp +++ /dev/null @@ -1,213 +0,0 @@ -/******************************************************************* - * - * File: PolledAS.cpp - * - * Author: Peter van Sebille (peter@yipton.net) - * - * (c) Copyright 2002, Peter van Sebille - * All Rights Reserved - * - *******************************************************************/ - -/* - * Oh Lord, forgive me for I have sinned. - * In their infinite wisdom, Symbian Engineers have decided that - * the Active Scheduler's queue of Active Objects is private - * and no getters are provided... sigh. - * This mere mortal will have to excercise the power of C pre-processor - * once more to circumvent the will of the gods. - */ - - -#include - -// from e32base.h -class CBase - { -public: - IMPORT_C virtual ~CBase(); - inline TAny* operator new(TUint aSize,TAny *aBase) {Mem::FillZ(aBase,aSize);return(aBase);} - IMPORT_C TAny* operator new(TUint aSize); - inline TAny* operator new(TUint aSize, TLeave) {return newL(aSize);} - IMPORT_C TAny* operator new(TUint aSize,TUint anExtraSize); -protected: - IMPORT_C CBase(); -private: - CBase(const CBase&); - CBase& operator=(const CBase&); - IMPORT_C static TAny* newL(TUint aSize); - }; - -class CActive : public CBase - { -public: -enum TPriority - { - EPriorityIdle=-100, - EPriorityLow=-20, - EPriorityStandard=0, - EPriorityUserInput=10, - EPriorityHigh=20, - }; -public: - IMPORT_C ~CActive(); - IMPORT_C void Cancel(); - IMPORT_C void Deque(); - IMPORT_C void SetPriority(TInt aPriority); - inline TBool IsActive() const {return(iActive);} - inline TBool IsAdded() const {return(iLink.iNext!=NULL);} - inline TInt Priority() const {return iLink.iPriority;} -protected: - IMPORT_C CActive(TInt aPriority); - IMPORT_C void SetActive(); -// Pure virtual - virtual void DoCancel() =0; - virtual void RunL() =0; - IMPORT_C virtual TInt RunError(TInt aError); -public: - TRequestStatus iStatus; -private: - TBool iActive; - TPriQueLink iLink; - friend class CActiveScheduler; -// friend class CServer; - friend class CPrivatePolledActiveScheduler; // added - }; - -class CActiveScheduler : public CBase - { -public: - IMPORT_C CActiveScheduler(); - IMPORT_C ~CActiveScheduler(); - IMPORT_C static void Install(CActiveScheduler* aScheduler); - IMPORT_C static CActiveScheduler* Current(); - IMPORT_C static void Add(CActive* anActive); - IMPORT_C static void Start(); - IMPORT_C static void Stop(); - IMPORT_C static TBool RunIfReady(TInt& aError, TInt aMinimumPriority); - IMPORT_C static CActiveScheduler* Replace(CActiveScheduler* aNewActiveScheduler); - IMPORT_C virtual void WaitForAnyRequest(); - IMPORT_C virtual void Error(TInt anError) const; -private: - void DoStart(); - void OwnedStartLoop(TInt& aRunning); - IMPORT_C virtual void OnStarting(); - IMPORT_C virtual void OnStopping(); - IMPORT_C virtual void Reserved_1(); - IMPORT_C virtual void Reserved_2(); - friend class CPrivatePolledActiveScheduler; // added -private: - // private interface used through by CActiveSchedulerWait objects - friend class CActiveSchedulerWait; - static void OwnedStart(CActiveSchedulerWait& aOwner); -protected: - inline TInt Level() const {return(iLevel);} -private: - TInt iLevel; - TPriQue iActiveQ; - }; - -class TCleanupItem; -class CleanupStack - { -public: - IMPORT_C static void PushL(TAny* aPtr); - IMPORT_C static void PushL(CBase* aPtr); - IMPORT_C static void PushL(TCleanupItem anItem); - IMPORT_C static void Pop(); - IMPORT_C static void Pop(TInt aCount); - IMPORT_C static void PopAndDestroy(); - IMPORT_C static void PopAndDestroy(TInt aCount); - IMPORT_C static void Check(TAny* aExpectedItem); - inline static void Pop(TAny* aExpectedItem); - inline static void Pop(TInt aCount, TAny* aLastExpectedItem); - inline static void PopAndDestroy(TAny* aExpectedItem); - inline static void PopAndDestroy(TInt aCount, TAny* aLastExpectedItem); - }; - - -/* - * This will declare CPrivatePolledActiveScheduler as a friend - * of all classes that define a friend. CPrivatePolledActiveScheduler needs to - * be a friend of CActive - */ -//#define friend friend class CPrivatePolledActiveScheduler; friend - - -/* - * This will change the: - * void DoStart(); - * method in CActiveScheduler to: - * void DoStart(); friend class CPrivatePolledActiveScheduler; - * We need this to access the private datamembers in CActiveScheduler. - */ -//#define DoStart() DoStart(); friend class CPrivatePolledActiveScheduler; -//#include -#include "PolledAS.h" - - -class CPrivatePolledActiveScheduler : public CActiveScheduler -{ -public: - void Schedule(); -}; - - - -void CPrivatePolledActiveScheduler::Schedule() -{ - TDblQueIter q(iActiveQ); - q.SetToFirst(); - FOREVER - { - CActive *pR=q++; - if (pR) - { - if (pR->IsActive() && pR->iStatus!=KRequestPending) - { - pR->iActive=EFalse; - TRAPD(r,pR->RunL()); - break; - } - } - else - break; - } -} - - -CPolledActiveScheduler::~CPolledActiveScheduler() -{ - delete iPrivatePolledActiveScheduler; -} - -//static CPolledActiveScheduler* sPolledActiveScheduler = NULL; -CPolledActiveScheduler* CPolledActiveScheduler::NewL() -{ - //sPolledActiveScheduler = - CPolledActiveScheduler* self = new(ELeave)CPolledActiveScheduler; - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); - return self; -} - -void CPolledActiveScheduler::ConstructL() -{ - iPrivatePolledActiveScheduler = new(ELeave) CPrivatePolledActiveScheduler; - iPrivatePolledActiveScheduler->Install(iPrivatePolledActiveScheduler); -} - - -void CPolledActiveScheduler::Schedule() -{ - iPrivatePolledActiveScheduler->Schedule(); -} - -/* -CPolledActiveScheduler* CPolledActiveScheduler::Instance() -{ -// return (CPolledActiveScheduler*) CActiveScheduler::Current(); - return sPolledActiveScheduler; -} -*/ diff --git a/platform/uiq2/audio/mediaserver/retr.cmd b/platform/uiq2/audio/mediaserver/retr.cmd deleted file mode 100644 index f8e35742..00000000 --- a/platform/uiq2/audio/mediaserver/retr.cmd +++ /dev/null @@ -1,2 +0,0 @@ -copy %EPOCROOT%\epoc32\release\armi\urel\audio_mediaserver.dll ..\ -..\..\..\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 diff --git a/platform/uiq2/audio/mediaserver/retr2.cmd b/platform/uiq2/audio/mediaserver/retr2.cmd deleted file mode 100644 index 766733bf..00000000 --- a/platform/uiq2/audio/mediaserver/retr2.cmd +++ /dev/null @@ -1 +0,0 @@ -copy %EPOCROOT%\epoc32\release\armi\urel\audio_mediaserver.dll ..\ diff --git a/platform/uiq2/audio/motorola/AUDIO_MOTOROLA.ARMI b/platform/uiq2/audio/motorola/AUDIO_MOTOROLA.ARMI deleted file mode 100644 index 3180600f..00000000 --- a/platform/uiq2/audio/motorola/AUDIO_MOTOROLA.ARMI +++ /dev/null @@ -1,418 +0,0 @@ - -# CWD \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\ -# MMPFile \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA.MMP -# Target AUDIO_MOTOROLA.DLL -# TargetType DLL -# BasicTargetType DLL -# MakefileType GNU - -ERASE = @erase 2>>nul - -# EPOC DEFINITIONS - -EPOCBLD = ..\..\..\..\..\A925SDK\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA\ARMI -EPOCTRG = ..\..\..\..\..\A925SDK\EPOC32\RELEASE\ARMI -EPOCLIB = ..\..\..\..\..\A925SDK\EPOC32\RELEASE\ARMI -EPOCLINK = ..\..\..\..\..\A925SDK\EPOC32\RELEASE\ARMI -EPOCSTATLINK = ..\..\..\..\..\A925SDK\EPOC32\RELEASE\ARMI -EPOCASSPLINK = ..\..\..\..\..\A925SDK\EPOC32\RELEASE\MARM -EPOCDATA = \DEV\A925SDK\EPOC32\DATA -EPOCINC = \DEV\A925SDK\EPOC32\INCLUDE -TRGDIR = -DATADIR = Z\SYSTEM\DATA - -EPOCBLDUREL = $(EPOCBLD)\UREL -EPOCTRGUREL = $(EPOCTRG)\UREL -EPOCLIBUREL = $(EPOCLIB)\UREL -EPOCLINKUREL = $(EPOCLINK)\UREL -EPOCSTATLINKUREL = $(EPOCSTATLINK)\UREL -EPOCASSPLINKUREL = $(EPOCASSPLINK)\UREL - -EPOCBLDUDEB = $(EPOCBLD)\UDEB -EPOCTRGUDEB = $(EPOCTRG)\UDEB -EPOCLIBUDEB = $(EPOCLIB)\UREL -EPOCLINKUDEB = $(EPOCLINK)\UREL -EPOCSTATLINKUDEB = $(EPOCSTATLINK)\UDEB -EPOCASSPLINKUDEB = $(EPOCASSPLINK)\UREL - -# EPOC PSEUDOTARGETS - -UREL : MAKEWORKUREL RESOURCEUREL - -UDEB : MAKEWORKUDEB RESOURCEUDEB - -ALL : UREL UDEB - -CLEAN CLEANALL : CLEANBUILD CLEANRELEASE CLEANLIBRARY - - - -WHAT WHATALL : WHATUREL WHATUDEB - -RESOURCE RESOURCEALL : RESOURCEUREL RESOURCEUDEB - -CLEANBUILD CLEANBUILDALL : CLEANBUILDUREL CLEANBUILDUDEB - -CLEANRELEASE CLEANRELEASEALL : CLEANRELEASEUREL CLEANRELEASEUDEB - -MAKEWORK MAKEWORKALL : MAKEWORKUREL MAKEWORKUDEB - -LISTING LISTINGALL : LISTINGUREL LISTINGUDEB - -MAKEWORK : MAKEWORKLIBRARY - -RESOURCEUREL RESOURCEUDEB : GENERIC_RESOURCE - - -# must set both PATH and Path to make it work correctly -Path:=X:\DEV\A925SDK\EPOC32\gcc\bin;$(Path) -PATH:=$(Path) - -INCDIR = -I "." -I "..\.." -I "..\..\..\..\..\A925SDK\EPOC32\INCLUDE" - -GCCFLAGS=-march=armv4t -mthumb-interwork \ - -pipe -c -nostdinc -Wall -Wno-ctor-dtor-privacy -Wno-unknown-pragmas - -GCCDEFS = -D__SYMBIAN32__ -D__GCC32__ -D__EPOC32__ -D__MARM__ -D__MARM_ARMI__ -D__DLL__ $(USERDEFS) - -GCCUREL = gcc -s -fomit-frame-pointer -O $(GCCFLAGS) -DNDEBUG -D_UNICODE $(GCCDEFS) -GCCUDEB = gcc -g -O $(GCCFLAGS) -D_DEBUG -D_UNICODE $(GCCDEFS) - - -UREL : \ - $(EPOCTRGUREL)\AUDIO_MOTOROLA.DLL \ - LIBRARY - - -UDEB : \ - $(EPOCTRGUDEB)\AUDIO_MOTOROLA.DLL \ - LIBRARY - - - -RESOURCEUREL : MAKEWORKUREL -RESOURCEUDEB : MAKEWORKUDEB - -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 - - -# REAL TARGET - LIBRARY - -$(EPOCLIB)\UREL\AUDIO_MOTOROLA.LIB : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA.DEF - @echo AUDIO_MOTOROLA.LIB: dlltool - @dlltool -m arm_interwork --output-lib "$(EPOCLIB)\UREL\AUDIO_MOTOROLA.LIB" \ - --def ".\AUDIO_MOTOROLA.DEF" \ - --dllname "AUDIO_MOTOROLA[1000c197].DLL" - -\DEV\A925SDK\EPOC32\RELEASE\ARM4\UREL\AUDIO_MOTOROLA.LIB : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA.DEF - @echo AUDIO_MOTOROLA.LIB: dlltool - @dlltool -m arm --output-lib "..\..\..\..\..\A925SDK\EPOC32\RELEASE\ARM4\UREL\AUDIO_MOTOROLA.LIB" \ - --def ".\AUDIO_MOTOROLA.DEF" \ - --dllname "AUDIO_MOTOROLA[1000c197].DLL" - -\DEV\A925SDK\EPOC32\RELEASE\THUMB\UREL\AUDIO_MOTOROLA.LIB : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA.DEF - @echo AUDIO_MOTOROLA.LIB: dlltool - @dlltool -m thumb --output-lib "..\..\..\..\..\A925SDK\EPOC32\RELEASE\THUMB\UREL\AUDIO_MOTOROLA.LIB" \ - --def ".\AUDIO_MOTOROLA.DEF" \ - --dllname "AUDIO_MOTOROLA[1000c197].DLL" - - -FREEZE : - perl -S efreeze.pl "\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA.DEF" "$(EPOCBLD)\AUDIO_MOTOROLA.def" - -CLEANLIBRARY : - -$(ERASE) "$(EPOCLIB)\UREL\AUDIO_MOTOROLA.LIB" - -$(ERASE) "\DEV\A925SDK\EPOC32\RELEASE\ARM4\UREL\AUDIO_MOTOROLA.LIB" - -$(ERASE) "\DEV\A925SDK\EPOC32\RELEASE\THUMB\UREL\AUDIO_MOTOROLA.LIB" - - -GENERIC_RESOURCE : GENERIC_MAKEWORK - -# REAL TARGET - BUILD VARIANT UREL - -WHATUREL : WHATGENERIC - -CLEANUREL : CLEANBUILDUREL CLEANRELEASEUREL - -CLEANBUILDUREL : - @perl -S ermdir.pl "$(EPOCBLDUREL)" - -CLEANRELEASEUREL : CLEANGENERIC - - -UREL_RELEASEABLES1= \ - \DEV\A925SDK\EPOC32\RELEASE\ARM4\UREL\AUDIO_MOTOROLA.LIB \ - \DEV\A925SDK\EPOC32\RELEASE\ARMI\UREL\AUDIO_MOTOROLA.DLL \ - \DEV\A925SDK\EPOC32\RELEASE\ARMI\UREL\AUDIO_MOTOROLA.DLL.MAP \ - \DEV\A925SDK\EPOC32\RELEASE\ARMI\UREL\AUDIO_MOTOROLA.LIB \ - \DEV\A925SDK\EPOC32\RELEASE\THUMB\UREL\AUDIO_MOTOROLA.LIB - -WHATUREL: - @echo $(UREL_RELEASEABLES1) - -CLEANRELEASEUREL: - -$(ERASE) $(UREL_RELEASEABLES1) - -LISTINGUREL : MAKEWORKUREL \ - LISTINGURELAUDIO_MOTOROLA \ - LISTINGURELPOLLEDAS - -LIBSUREL= \ - $(EPOCSTATLINKUREL)\EDLLSTUB.LIB \ - $(EPOCSTATLINKUREL)\EGCC.LIB \ - $(EPOCLINKUREL)\EUSER.LIB \ - $(EPOCLINKUREL)\MAUDIOFB.LIB \ - $(EPOCLINKUREL)\MAUDIOAC.LIB - -$(EPOCTRGUREL)\AUDIO_MOTOROLA.DLL : $(EPOCBLDUREL)\AUDIO_MOTOROLA.in \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA.DEF $(EPOCSTATLINKUREL)\EDLL.LIB $(LIBSUREL) - @echo AUDIO_MOTOROLA.DLL: dlltool - @dlltool -m arm_interwork --output-def "$(EPOCBLDUREL)\AUDIO_MOTOROLA.inf" "$(EPOCBLDUREL)\AUDIO_MOTOROLA.in" - @echo AUDIO_MOTOROLA.DLL: perl -S makedef.pl - @perl -S makedef.pl -Deffile "$(EPOCBLDUREL)\AUDIO_MOTOROLA.inf" -Frzfile "\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA.DEF" "$(EPOCBLD)\AUDIO_MOTOROLA.def" - -$(ERASE) "$(EPOCBLDUREL)\AUDIO_MOTOROLA.inf" - @echo AUDIO_MOTOROLA.DLL: dlltool - @dlltool -m arm_interwork --def "$(EPOCBLD)\AUDIO_MOTOROLA.def" \ - --output-exp "$(EPOCBLDUREL)\AUDIO_MOTOROLA.exp" \ - --dllname "AUDIO_MOTOROLA[1000c197].DLL" - @echo AUDIO_MOTOROLA.DLL: ld - @ld -s -e _E32Dll -u _E32Dll "$(EPOCBLDUREL)\AUDIO_MOTOROLA.exp" --dll \ - --base-file "$(EPOCBLDUREL)\AUDIO_MOTOROLA.bas" -o "$(EPOCBLDUREL)\AUDIO_MOTOROLA.DLL" \ - "$(EPOCSTATLINKUREL)\EDLL.LIB" --whole-archive "$(EPOCBLDUREL)\AUDIO_MOTOROLA.in" \ - --no-whole-archive $(LIBSUREL) $(USERLDFLAGS) - -$(ERASE) "$(EPOCBLDUREL)\AUDIO_MOTOROLA.exp" - -$(ERASE) "$(EPOCBLDUREL)\AUDIO_MOTOROLA.DLL" - @echo AUDIO_MOTOROLA.DLL: dlltool - @dlltool -m arm_interwork \ - --def "$(EPOCBLD)\AUDIO_MOTOROLA.def" \ - --dllname "AUDIO_MOTOROLA[1000c197].DLL" \ - --base-file "$(EPOCBLDUREL)\AUDIO_MOTOROLA.bas" \ - --output-exp "$(EPOCBLDUREL)\AUDIO_MOTOROLA.exp" - -$(ERASE) "$(EPOCBLDUREL)\AUDIO_MOTOROLA.bas" - @echo AUDIO_MOTOROLA.DLL: ld - @ld -s -e _E32Dll -u _E32Dll --dll \ - "$(EPOCBLDUREL)\AUDIO_MOTOROLA.exp" \ - -Map "$(EPOCTRGUREL)\AUDIO_MOTOROLA.DLL.map" -o "$(EPOCBLDUREL)\AUDIO_MOTOROLA.DLL" \ - "$(EPOCSTATLINKUREL)\EDLL.LIB" --whole-archive "$(EPOCBLDUREL)\AUDIO_MOTOROLA.in" \ - --no-whole-archive $(LIBSUREL) $(USERLDFLAGS) - -$(ERASE) "$(EPOCBLDUREL)\AUDIO_MOTOROLA.exp" - @echo AUDIO_MOTOROLA.DLL: petran - @petran "$(EPOCBLDUREL)\AUDIO_MOTOROLA.DLL" "$@" \ - -nocall -uid1 0x10000079 -uid2 0x100039ce -uid3 0x1000c197 - -$(ERASE) "$(EPOCBLDUREL)\AUDIO_MOTOROLA.DLL" - -OBJECTSUREL= \ - $(EPOCBLDUREL)\AUDIO_MOTOROLA.o \ - $(EPOCBLDUREL)\POLLEDAS.o - -$(EPOCBLDUREL)\AUDIO_MOTOROLA.in : $(OBJECTSUREL) - @echo AUDIO_MOTOROLA.in: if exist (del?) - @if exist "$@" del "$@" - @echo AUDIO_MOTOROLA.in: ar - @ar cr $@ $^ - - -# REAL TARGET - BUILD VARIANT UDEB - -WHATUDEB : WHATGENERIC - -CLEANUDEB : CLEANBUILDUDEB CLEANRELEASEUDEB - -CLEANBUILDUDEB : - @perl -S ermdir.pl "$(EPOCBLDUDEB)" - -CLEANRELEASEUDEB : CLEANGENERIC - - -UDEB_RELEASEABLES1= \ - \DEV\A925SDK\EPOC32\RELEASE\ARM4\UREL\AUDIO_MOTOROLA.LIB \ - \DEV\A925SDK\EPOC32\RELEASE\ARMI\UDEB\AUDIO_MOTOROLA.DLL \ - \DEV\A925SDK\EPOC32\RELEASE\ARMI\UDEB\AUDIO_MOTOROLA.DLL.MAP \ - \DEV\A925SDK\EPOC32\RELEASE\ARMI\UREL\AUDIO_MOTOROLA.LIB \ - \DEV\A925SDK\EPOC32\RELEASE\THUMB\UREL\AUDIO_MOTOROLA.LIB - -WHATUDEB: - @echo $(UDEB_RELEASEABLES1) - -CLEANRELEASEUDEB: - -$(ERASE) $(UDEB_RELEASEABLES1) - -LISTINGUDEB : MAKEWORKUDEB \ - LISTINGUDEBAUDIO_MOTOROLA \ - LISTINGUDEBPOLLEDAS - -LIBSUDEB= \ - $(EPOCSTATLINKUDEB)\EDLLSTUB.LIB \ - $(EPOCSTATLINKUDEB)\EGCC.LIB \ - $(EPOCLINKUDEB)\EUSER.LIB \ - $(EPOCLINKUDEB)\MAUDIOFB.LIB \ - $(EPOCLINKUDEB)\MAUDIOAC.LIB - -$(EPOCTRGUDEB)\AUDIO_MOTOROLA.DLL : $(EPOCBLDUDEB)\AUDIO_MOTOROLA.in \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA.DEF $(EPOCSTATLINKUDEB)\EDLL.LIB $(LIBSUDEB) - @echo AUDIO_MOTOROLA.DLL: dlltool - @dlltool -m arm_interwork --output-def "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.inf" "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.in" - @echo AUDIO_MOTOROLA.DLL: perl -S makedef.pl - @perl -S makedef.pl -Deffile "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.inf" -Frzfile "\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA.DEF" "$(EPOCBLD)\AUDIO_MOTOROLA.def" - -$(ERASE) "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.inf" - @echo AUDIO_MOTOROLA.DLL: dlltool - @dlltool -m arm_interwork --def "$(EPOCBLD)\AUDIO_MOTOROLA.def" \ - --output-exp "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.exp" \ - --dllname "AUDIO_MOTOROLA[1000c197].DLL" - @echo AUDIO_MOTOROLA.DLL: ld - @ld -s -e _E32Dll -u _E32Dll "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.exp" --dll \ - --base-file "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.bas" -o "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.DLL" \ - "$(EPOCSTATLINKUDEB)\EDLL.LIB" --whole-archive "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.in" \ - --no-whole-archive $(LIBSUDEB) $(USERLDFLAGS) - -$(ERASE) "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.exp" - -$(ERASE) "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.DLL" - @echo AUDIO_MOTOROLA.DLL: dlltool - @dlltool -m arm_interwork \ - --def "$(EPOCBLD)\AUDIO_MOTOROLA.def" \ - --dllname "AUDIO_MOTOROLA[1000c197].DLL" \ - --base-file "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.bas" \ - --output-exp "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.exp" - -$(ERASE) "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.bas" - @echo AUDIO_MOTOROLA.DLL: ld - @ld -e _E32Dll -u _E32Dll --dll \ - "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.exp" \ - -Map "$(EPOCTRGUDEB)\AUDIO_MOTOROLA.DLL.map" -o "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.DLL" \ - "$(EPOCSTATLINKUDEB)\EDLL.LIB" --whole-archive "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.in" \ - --no-whole-archive $(LIBSUDEB) $(USERLDFLAGS) - -$(ERASE) "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.exp" - objcopy -X "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.DLL" "$(EPOCTRGUDEB)\AUDIO_MOTOROLA.sym" - @echo AUDIO_MOTOROLA.DLL: petran - @petran "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.DLL" "$@" \ - -nocall -uid1 0x10000079 -uid2 0x100039ce -uid3 0x1000c197 - -$(ERASE) "$(EPOCBLDUDEB)\AUDIO_MOTOROLA.DLL" - -OBJECTSUDEB= \ - $(EPOCBLDUDEB)\AUDIO_MOTOROLA.o \ - $(EPOCBLDUDEB)\POLLEDAS.o - -$(EPOCBLDUDEB)\AUDIO_MOTOROLA.in : $(OBJECTSUDEB) - @echo AUDIO_MOTOROLA.in: if exist (del?) - @if exist "$@" del "$@" - @echo AUDIO_MOTOROLA.in: ar - @ar cr $@ $^ - - -# SOURCES - -# Source AUDIO_MOTOROLA.CPP - -$(EPOCBLDUREL)\AUDIO_MOTOROLA.lis $(EPOCBLDUREL)\AUDIO_MOTOROLA.o \ -$(EPOCBLDUDEB)\AUDIO_MOTOROLA.lis $(EPOCBLDUDEB)\AUDIO_MOTOROLA.o \ -: \ - \DEV\A925SDK\EPOC32\INCLUDE\CMAUDIOAC.H \ - \DEV\A925SDK\EPOC32\INCLUDE\CMAUDIOFB.H \ - \DEV\A925SDK\EPOC32\INCLUDE\CMAUDIOFBFORMAT.H \ - \DEV\A925SDK\EPOC32\INCLUDE\E32BASE.H \ - \DEV\A925SDK\EPOC32\INCLUDE\E32BASE.INL \ - \DEV\A925SDK\EPOC32\INCLUDE\E32DEF.H \ - \DEV\A925SDK\EPOC32\INCLUDE\E32DES16.H \ - \DEV\A925SDK\EPOC32\INCLUDE\E32DES8.H \ - \DEV\A925SDK\EPOC32\INCLUDE\E32HAL.H \ - \DEV\A925SDK\EPOC32\INCLUDE\E32KEYS.H \ - \DEV\A925SDK\EPOC32\INCLUDE\E32PCCD.H \ - \DEV\A925SDK\EPOC32\INCLUDE\E32STD.H \ - \DEV\A925SDK\EPOC32\INCLUDE\E32STD.INL \ - \DEV\A925SDK\EPOC32\INCLUDE\E32SVR.H \ - \DEV\A925SDK\EPOC32\INCLUDE\F32FILE.H \ - \DEV\A925SDK\EPOC32\INCLUDE\F32FILE.INL \ - \DEV\A925SDK\EPOC32\INCLUDE\MAUDIOGLOBAL.H \ - \DEV\A925SDK\EPOC32\INCLUDE\RPFILE.H \ - \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO.H \ - \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA.H \ - \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\POLLEDAS.H - -$(EPOCBLDUREL)\AUDIO_MOTOROLA.o : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\Audio_motorola.cpp - @echo AUDIO_MOTOROLA.o: gcc - @$(GCCUREL) -I "." $(INCDIR) -o $@ ".\Audio_motorola.cpp" - -LISTINGURELAUDIO_MOTOROLA : $(EPOCBLDUREL)\AUDIO_MOTOROLA.lis - @echo ISTINGURELAUDIO_MOTOROLA: perl -S ecopyfile.pl - @perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA.lst.ARMI - -$(EPOCBLDUREL)\AUDIO_MOTOROLA.lis : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\Audio_motorola.cpp - $(GCCUREL) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Audio_motorola.cpp" > $@ - -$(EPOCBLDUDEB)\AUDIO_MOTOROLA.o : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\Audio_motorola.cpp - $(GCCUDEB) -I "." $(INCDIR) -o $@ ".\Audio_motorola.cpp" - -LISTINGUDEBAUDIO_MOTOROLA : $(EPOCBLDUDEB)\AUDIO_MOTOROLA.lis - @echo ISTINGUDEBAUDIO_MOTOROLA: perl -S ecopyfile.pl - @perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA.lst.ARMI - -$(EPOCBLDUDEB)\AUDIO_MOTOROLA.lis : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\Audio_motorola.cpp - $(GCCUDEB) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Audio_motorola.cpp" > $@ - - - -# Source POLLEDAS.CPP - -$(EPOCBLDUREL)\POLLEDAS.lis $(EPOCBLDUREL)\POLLEDAS.o \ -$(EPOCBLDUDEB)\POLLEDAS.lis $(EPOCBLDUDEB)\POLLEDAS.o \ -: \ - \DEV\A925SDK\EPOC32\INCLUDE\E32DEF.H \ - \DEV\A925SDK\EPOC32\INCLUDE\E32DES16.H \ - \DEV\A925SDK\EPOC32\INCLUDE\E32DES8.H \ - \DEV\A925SDK\EPOC32\INCLUDE\E32STD.H \ - \DEV\A925SDK\EPOC32\INCLUDE\E32STD.INL \ - \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\POLLEDAS.H - -$(EPOCBLDUREL)\POLLEDAS.o : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\Polledas.cpp - @echo POLLEDAS.o: gcc - @$(GCCUREL) -I "." $(INCDIR) -o $@ ".\Polledas.cpp" - -LISTINGURELPOLLEDAS : $(EPOCBLDUREL)\POLLEDAS.lis - @echo ISTINGURELPOLLEDAS: perl -S ecopyfile.pl - @perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\POLLEDAS.lst.ARMI - -$(EPOCBLDUREL)\POLLEDAS.lis : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\Polledas.cpp - $(GCCUREL) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Polledas.cpp" > $@ - -$(EPOCBLDUDEB)\POLLEDAS.o : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\Polledas.cpp - $(GCCUDEB) -I "." $(INCDIR) -o $@ ".\Polledas.cpp" - -LISTINGUDEBPOLLEDAS : $(EPOCBLDUDEB)\POLLEDAS.lis - @echo ISTINGUDEBPOLLEDAS: perl -S ecopyfile.pl - @perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\POLLEDAS.lst.ARMI - -$(EPOCBLDUDEB)\POLLEDAS.lis : \DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\Polledas.cpp - $(GCCUDEB) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Polledas.cpp" > $@ - - - -ROMFILE: - @echo file=\DEV\A925SDK\EPOC32\RELEASE\ARMI\##BUILD##\AUDIO_MOTOROLA.DLL System\Libs\AUDIO_MOTOROLA.DLL - - -WHATGENERIC CLEANGENERIC : - @rem none - -# Rules to create all necessary directories - -GENERIC_MAKEWORK : \ - \DEV\A925SDK\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA\ARMI -MAKEWORKLIBRARY : \ - \DEV\A925SDK\EPOC32\RELEASE\ARM4\UREL \ - \DEV\A925SDK\EPOC32\RELEASE\ARMI\UREL \ - \DEV\A925SDK\EPOC32\RELEASE\THUMB\UREL -MAKEWORKUDEB : \ - \DEV\A925SDK\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA\ARMI\UDEB \ - \DEV\A925SDK\EPOC32\RELEASE\ARMI\UDEB -MAKEWORKUREL : \ - \DEV\A925SDK\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA\ARMI\UREL \ - \DEV\A925SDK\EPOC32\RELEASE\ARMI\UREL - -\DEV\A925SDK\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA\ARMI \ -\DEV\A925SDK\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA\ARMI\UDEB \ -\DEV\A925SDK\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\AUDIO\MOTOROLA\AUDIO_MOTOROLA\ARMI\UREL \ -\DEV\A925SDK\EPOC32\RELEASE\ARM4\UREL \ -\DEV\A925SDK\EPOC32\RELEASE\ARMI\UDEB \ -\DEV\A925SDK\EPOC32\RELEASE\ARMI\UREL \ -\DEV\A925SDK\EPOC32\RELEASE\THUMB\UREL \ -: - @echo UREL: perl -S emkdir.pl - @perl -S emkdir.pl $@ - - diff --git a/platform/uiq2/audio/motorola/PolledAS.h b/platform/uiq2/audio/motorola/PolledAS.h deleted file mode 100644 index f360c897..00000000 --- a/platform/uiq2/audio/motorola/PolledAS.h +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************* - * - * File: PolledAS.h - * - * Author: Peter van Sebille (peter@yipton.net) - * - * (c) Copyright 2001, Peter van Sebille - * All Rights Reserved - * - *******************************************************************/ - -#ifndef __POLLED_AS_H -#define __POLLED_AS_H - -class CPrivatePolledActiveScheduler; - -class CPolledActiveScheduler : public CBase -{ -public: - ~CPolledActiveScheduler(); - static CPolledActiveScheduler* NewL(); - //static CPolledActiveScheduler* Instance(); - void Schedule(); -protected: - CPolledActiveScheduler(){}; - void ConstructL(); - CPrivatePolledActiveScheduler* iPrivatePolledActiveScheduler; -}; - - -#endif /* __POLLED_AS_H */ - diff --git a/platform/uiq2/audio/motorola/audio_motorola.cpp b/platform/uiq2/audio/motorola/audio_motorola.cpp deleted file mode 100644 index b4ed4013..00000000 --- a/platform/uiq2/audio/motorola/audio_motorola.cpp +++ /dev/null @@ -1,363 +0,0 @@ -/******************************************************************* - * - * File: Audio_motorola.cpp - * - * Author: Peter van Sebille (peter@yipton.net) - * - * Modified/adapted for picodriveN by notaz, 2006 - * - * (c) Copyright 2006, notaz - * (c) Copyright 2001, Peter van Sebille - * All Rights Reserved - * - *******************************************************************/ - -// if only I had Motorola to test this on.. - - -#include "audio_motorola.h" - -#ifdef __DEBUG_PRINT_SND - #include // RDebug - #define DEBUGPRINT(x...) RDebug::Print(x) -#else - #define DEBUGPRINT(x...) -#endif - - -GLDEF_C TInt E32Dll(TDllReason) -{ - return KErrNone; -} - - -/******************************************* - * - * CGameAudioMot - * - *******************************************/ - -CGameAudioMot::CGameAudioMot(TInt aRate, TBool aStereo, TInt aPcmFrames, TInt aBufferedFrames) -: iRate(aRate), iStereo(aStereo), iBufferedFrames(aBufferedFrames), iPcmFrames(aPcmFrames) -{ - DEBUGPRINT(_L("CGameAudioMot::CGameAudioMot")); -} - - -CGameAudioMot* CGameAudioMot::NewL(TInt aRate, TBool aStereo, TInt aPcmFrames, TInt aBufferedFrames) -{ - DEBUGPRINT(_L("CGameAudioMot::NewL(%i, %i, %i, %i)"),aRate, aStereo, aPcmFrames, aBufferedFrames); - CGameAudioMot* self = new(ELeave) CGameAudioMot(aRate, aStereo, aPcmFrames, aBufferedFrames); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); // self - return self; -} - - -CGameAudioMot::~CGameAudioMot() -{ - DEBUGPRINT(_L("CGameAudioMot::~CGameAudioMot()")); - if(iAudioOutputStream) { - iScheduler->Schedule(); // let it finish it's stuff - //iAudioOutputStream->Stop(); - delete iAudioOutputStream; - } - - if(iAudioControl) delete iAudioControl; - - for (TInt i=0 ; i < KSoundBuffers+1; i++) { - delete iSoundBufferPtrs[i]; - delete iSoundBuffers[i]; - } - - // Polled AS - if(iScheduler) delete iScheduler; -} - - -void CGameAudioMot::ConstructL() -{ - iScheduler = CPolledActiveScheduler::NewL(); - - iSettings.iPCMSettings.iSamplingFreq = (TMSampleRate) iRate; - iSettings.iPCMSettings.iStereo = iStereo; - - TInt bytesPerFrame = iStereo ? iPcmFrames << 2 : iPcmFrames << 1; - for (TInt i=0 ; iDes().FillZ (bytesPerFrame * iBufferedFrames); - iSoundBufferPtrs[i] = new TPtr8( iSoundBuffers[i]->Des() ); - } - // because feeding 2 buffers after an underflow is a little too much, but feeding 1 may be not enough, - // prepare this ~50ms empty buffer to additionaly feed after every underflow. - iSoundBuffers[KSoundBuffers] = HBufC8::NewL(bytesPerFrame * (iBufferedFrames / 4)); - iSoundBuffers[KSoundBuffers]->Des().FillZ (bytesPerFrame * (iBufferedFrames / 4)); - iSoundBufferPtrs[KSoundBuffers] = new TPtr8( iSoundBuffers[KSoundBuffers]->Des() ); - - iCurrentBuffer = 0; - iListener.iFatalError = iListener.iIsOpen = iListener.iIsCtrlOpen = EFalse; - - // here we actually test if we can create and open CMdaAudioOutputStream at all, but really create and use it later. - iAudioOutputStream = CMAudioFB::NewL(EMAudioFBRequestTypeDecode, EMAudioFBFormatPCM, iSettings, iListener); - if(iAudioOutputStream) { - delete iAudioOutputStream; - iAudioOutputStream = 0; - } - - // ceate audio control object - iAudioControl = CMAudioAC::NewL(iListener); -} - - -// returns a pointer to buffer for next frame, -// to be used when iSoundBuffers are used directly -TInt16 *CGameAudioMot::NextFrameL() -{ - iCurrentPosition += iPcmFrames << (iStereo?1:0); - - if (++iFrameCount == iBufferedFrames) - { - WriteBlockL(); - } - - iScheduler->Schedule(); - - if(iListener.iFatalError || iListener.iUnderflowed > KMaxUnderflows) { - if(iAudioOutputStream) delete iAudioOutputStream; - iAudioOutputStream = 0; - return 0; - } - else if(iListener.iUnderflowed) UnderflowedL(); - - return iCurrentPosition; -} - -TInt16 *CGameAudioMot::DupeFrameL(TInt &aUnderflowed) -{ - TInt shorts = iStereo ? (iPcmFrames << 1) : iPcmFrames; - if(iFrameCount) - Mem::Copy(iCurrentPosition, iCurrentPosition-shorts, shorts<<1); - else { - TInt lastBuffer = iCurrentBuffer; - if(--lastBuffer < 0) lastBuffer = KSoundBuffers - 1; - Mem::Copy(iCurrentPosition, ((TInt16*) (iSoundBuffers[lastBuffer]->Ptr()))+shorts*(iBufferedFrames-1), shorts<<1); - } - iCurrentPosition += shorts; - - if (++iFrameCount == iBufferedFrames) - { - WriteBlockL(); - } - - iScheduler->Schedule(); - - if(iListener.iFatalError || iListener.iUnderflowed > KMaxUnderflows) { - if(iAudioOutputStream) delete iAudioOutputStream; - iAudioOutputStream = 0; - return 0; - } - else if((aUnderflowed = iListener.iUnderflowed)) UnderflowedL(); // not again! - - return iCurrentPosition; -} - -void CGameAudioMot::WriteBlockL() -{ - iScheduler->Schedule(); - - // do not write until stream is open - if(!iListener.iIsOpen) WaitForOpenToCompleteL(); - //if(!iListener.iHasCopied) WaitForCopyToCompleteL(); // almost never happens anyway and sometimes even deadlocks? - //iListener.iHasCopied = EFalse; - - - if(!iListener.iUnderflowed) { - iAudioOutputStream->QueueBufferL(iSoundBufferPtrs[iCurrentBuffer]); - // it is certain we already Queued at least 2 buffers (one just after underflow, another above) - if(!iDecoding) { - iAudioOutputStream->DecodeL(); - iDecoding = ETrue; - } - } - - iFrameCount = 0; - if (++iCurrentBuffer == KSoundBuffers) - iCurrentBuffer = 0; - iCurrentPosition = (TInt16*) iSoundBuffers[iCurrentBuffer]->Ptr(); -} - -void CGameAudioMot::Pause() -{ - if(!iAudioOutputStream) return; - - iScheduler->Schedule(); - // iAudioOutputStream->Stop(); // may be this breaks everything in A925? - delete iAudioOutputStream; - iAudioOutputStream = 0; -} - -// call this before doing any playback! -TInt16 *CGameAudioMot::ResumeL() -{ - DEBUGPRINT(_L("CGameAudioMot::Resume()")); - iScheduler->Schedule(); - - // we act a bit strange here: simulate buffer underflow, which actually starts audio - iListener.iIsOpen = ETrue; - iListener.iUnderflowed = 1; - iListener.iFatalError = EFalse; - iFrameCount = 0; - iCurrentPosition = (TInt16*) iSoundBuffers[iCurrentBuffer]->Ptr(); - return iCurrentPosition; -} - -// handles underflow condition -void CGameAudioMot::UnderflowedL() -{ - // recreate the stream - if(iAudioOutputStream) delete iAudioOutputStream; - if(iListener.iUnderflowed > 4) { - // HACK: A925 user said sound works for the first time, but fails after pause/resume, etc. - // at the very beginning we create and delete CMAudioFB object, maybe we should do this every time? - iAudioOutputStream = CMAudioFB::NewL(EMAudioFBRequestTypeDecode, EMAudioFBFormatPCM, iSettings, iListener); - if(iAudioOutputStream) delete iAudioOutputStream; - } - - iAudioOutputStream = CMAudioFB::NewL(EMAudioFBRequestTypeDecode, EMAudioFBFormatPCM, iSettings, iListener); - iListener.iIsOpen = EFalse; // wait for it to open - iDecoding = EFalse; - //iListener.iHasCopied = ETrue; // but don't wait for last copy to complete - // let it open and feed some stuff to make it happy - User::After(0); - //TInt lastBuffer = iCurrentBuffer; - //if(--lastBuffer < 0) lastBuffer = KSoundBuffers - 1; - iScheduler->Schedule(); - if(!iListener.iIsOpen) WaitForOpenToCompleteL(); - if(iListener.iUnderflowed) { - // something went wrong again. May be it needs time? Trying to fix something without ability to test is hell. - if(iAudioOutputStream) delete iAudioOutputStream; - iAudioOutputStream = 0; - User::After(50*000); - iScheduler->Schedule(); - return; - } - - iAudioOutputStream->QueueBufferL(iSoundBufferPtrs[KSoundBuffers]); // try a short buffer with hope to reduce lag -} - - -void CGameAudioMot::ChangeVolume(TInt aUp) -{ - if(iAudioControl && iListener.iIsCtrlOpen) - { - TInt vol = iAudioControl->GetMasterVolume(); - TInt max = iAudioControl->GetMaxMasterVolume(); - - if(aUp) vol++; // adjust volume - else vol--; - - if(vol >= 0 && vol <= max) - { - iAudioControl->SetMasterVolume(vol); - } - } -} - - -void CGameAudioMot::WaitForOpenToCompleteL() -{ - DEBUGPRINT(_L("CGameAudioMot::WaitForOpenToCompleteL")); - TInt count = 20; // 2 seconds - TInt waitPeriod = 100 * 1000; - - if(!iListener.iIsOpen) { - // it is often enough to do this - User::After(0); - iScheduler->Schedule(); - } - while (!iListener.iIsOpen && --count) - { - User::After(waitPeriod); - iScheduler->Schedule(); - } - if (!iListener.iIsOpen) - User::LeaveIfError(KErrNotSupported); -} - - - -void TGameAudioEventListener::OnEvent(TMAudioFBCallbackState aState, TInt aError) -{ - switch ( aState ) - { - case EMAudioFBCallbackStateReady: - iIsOpen = ETrue; - iUnderflowed = 0; - break; - - case EMAudioFBCallbackStateDecodeCompleteStopped: - break; - - //case EMAudioFBCallbackStateDecodeFileSystemError: - case EMAudioFBCallbackStateDecodeError: - switch( aError ) - { - case EMAudioFBCallbackErrorBufferFull: - case EMAudioFBCallbackErrorForcedStop: - case EMAudioFBCallbackErrorForcedClose: - //case EMAudioFBCallbackErrorForcedPause: - case EMAudioFBCallbackErrorPriorityRejection: - case EMAudioFBCallbackErrorAlertModeRejection: - case EMAudioFBCallbackErrorResourceRejection: - case EMAudioFBCallbackErrorUnknown: - iUnderflowed++; - break; - - // these look like really bad errors - case EMAudioFBCallbackErrorInvalidParameter: - case EMAudioFBCallbackErrorWrongState: - case EMAudioFBCallbackErrorFormatNotSupported: - case EMAudioFBCallbackErrorFunctionNotSupported: - case EMAudioFBCallbackErrorNoBuffer: - case EMAudioFBCallbackErrorSampleOrBitRateNotSupported: - //case EMAudioFBCallbackErrorPriorityOrPreferenceNotSupported: - //case EMAudioFBCallbackErrorFileSystemFull: - //iFatalError = ETrue; - // who cares, just keep retrying - iUnderflowed++; - break; - - default: - iUnderflowed++; - break; - } - // in error condition we also set to open, so that the - // framework would not leave, catch the error and retry - iIsOpen = ETrue; - break; - - default: - break; - } -} - -void TGameAudioEventListener::OnEvent(TMAudioFBCallbackState aState, TInt aError, TDes8* aBuffer) -{ - switch( aState ) - { - case EMAudioFBCallbackStateDecodeBufferDecoded: - break; - - default: - OnEvent( aState, aError ); - break; - } -} - -void TGameAudioEventListener::OnEvent(TMAudioACCallbackState aState, TInt aError) -{ - if(aState == EMAudioACCallbackStateReady) iIsCtrlOpen = ETrue; -} - diff --git a/platform/uiq2/audio/motorola/audio_motorola.def b/platform/uiq2/audio/motorola/audio_motorola.def deleted file mode 100644 index 6098f2a6..00000000 --- a/platform/uiq2/audio/motorola/audio_motorola.def +++ /dev/null @@ -1,3 +0,0 @@ -EXPORTS -; NEW: - NewL__13CGameAudioMotiiii @ 1 NONAME ; static CGameAudioMot* NewL(TInt aRate, TBool aStereo, TInt aPcmFrames, TInt aBufferedFrames); diff --git a/platform/uiq2/audio/motorola/audio_motorola.h b/platform/uiq2/audio/motorola/audio_motorola.h deleted file mode 100644 index 26c41098..00000000 --- a/platform/uiq2/audio/motorola/audio_motorola.h +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************* - * - * File: Audio_motorola.h - * - * Author: Peter van Sebille (peter@yipton.net) - * - * Modified/adapted for picodriveN by notaz, 2006 - * - * (c) Copyright 2006, notaz - * (c) Copyright 2001, Peter van Sebille - * All Rights Reserved - * - *******************************************************************/ - -#ifndef __AUDIO_MEDIASERVER_H -#define __AUDIO_MEDIASERVER_H - -#include - -#include "audio.h" -#include "polledas.h" - -const TInt KSoundBuffers = 8; -const TInt KMaxUnderflows = 20; // max underflows/API errors we are going allow in a row (to prevent lockups) - - -class TGameAudioEventListener : public MMAudioFBObserver, public MMAudioACObserver -{ -public: - // Implementation of MMAudioFBObserver - void OnEvent(TMAudioFBCallbackState aState, TInt aError); - void OnEvent(TMAudioFBCallbackState aState, TInt aError, TDes8* aBuffer); - // Implementation of MMAudioACObserver - void OnEvent(TMAudioACCallbackState aState, TInt aError); - - TBool iIsOpen; - TBool iIsCtrlOpen; -// TBool iHasCopied; - TInt iUnderflowed; - TBool iFatalError; -}; - - -class CGameAudioMot : public IGameAudio // IGameAudio MUST be specified first! -{ -public: // implements IGameAudio - TInt16 *NextFrameL(); - TInt16 *DupeFrameL(TInt &aUnderflowed); - TInt16 *ResumeL(); - void Pause(); - void ChangeVolume(TInt aUp); - -public: - ~CGameAudioMot(); - CGameAudioMot(TInt aRate, TBool aStereo, TInt aPcmFrames, TInt aBufferedFrames); - void ConstructL(); - EXPORT_C static CGameAudioMot* NewL(TInt aRate, TBool aStereo, TInt aPcmFrames, TInt aBufferedFrames); - -protected: - void WriteBlockL(); - void UnderflowedL(); - -protected: - void WaitForOpenToCompleteL(); - - TInt iRate; - TBool iStereo; - - CMAudioFB *iAudioOutputStream; - CMAudioAC *iAudioControl; - TMAudioFBBufSettings iSettings; - - TGameAudioEventListener iListener; - - CPolledActiveScheduler *iScheduler; - - HBufC8* iSoundBuffers[KSoundBuffers+1]; - TPtr8* iSoundBufferPtrs[KSoundBuffers+1]; - - TInt iBufferedFrames; - TInt16* iCurrentPosition; - TInt iCurrentBuffer; - TInt iFrameCount; - TInt iPcmFrames; - - TBool iDecoding; - - //TInt64 iTime; // removed because can't test -}; - -#endif /* __AUDIO_MEDIASERVER_H */ diff --git a/platform/uiq2/audio/motorola/audio_motorola.mmp b/platform/uiq2/audio/motorola/audio_motorola.mmp deleted file mode 100644 index 473c4dd3..00000000 --- a/platform/uiq2/audio/motorola/audio_motorola.mmp +++ /dev/null @@ -1,20 +0,0 @@ -TARGET audio_motorola.dll -TARGETTYPE dll -UID 0x100039CE 0x1000C197 - -USERINCLUDE . -USERINCLUDE ..\..\ - -SYSTEMINCLUDE \epoc32\include - -SOURCEPATH . -SOURCE audio_motorola.cpp -SOURCE polledas.cpp - -LIBRARY EUSER.LIB -LIBRARY maudiofb.lib -LIBRARY maudioac.lib - -deffile .\audio_motorola.def - -nostrictdef diff --git a/platform/uiq2/audio/motorola/polledas.cpp b/platform/uiq2/audio/motorola/polledas.cpp deleted file mode 100644 index 60991ec5..00000000 --- a/platform/uiq2/audio/motorola/polledas.cpp +++ /dev/null @@ -1,209 +0,0 @@ -/******************************************************************* - * - * File: PolledAS.cpp - * - * Author: Peter van Sebille (peter@yipton.net) - * - * (c) Copyright 2002, Peter van Sebille - * All Rights Reserved - * - *******************************************************************/ - -/* - * Oh Lord, forgive me for I have sinned. - * In their infinite wisdom, Symbian Engineers have decided that - * the Active Scheduler's queue of Active Objects is private - * and no getters are provided... sigh. - * This mere mortal will have to excercise the power of C pre-processor - * once more to circumvent the will of the gods. - */ - - -#include - -// from e32base.h -class CBase - { -public: - IMPORT_C virtual ~CBase(); - inline TAny* operator new(TUint aSize,TAny *aBase) {Mem::FillZ(aBase,aSize);return(aBase);} - IMPORT_C TAny* operator new(TUint aSize); - inline TAny* operator new(TUint aSize, TLeave) {return newL(aSize);} - IMPORT_C TAny* operator new(TUint aSize,TUint anExtraSize); -protected: - IMPORT_C CBase(); -private: - CBase(const CBase&); - CBase& operator=(const CBase&); - IMPORT_C static TAny* newL(TUint aSize); - }; - -class CActive : public CBase - { -public: -enum TPriority - { - EPriorityIdle=-100, - EPriorityLow=-20, - EPriorityStandard=0, - EPriorityUserInput=10, - EPriorityHigh=20, - }; -public: - IMPORT_C ~CActive(); - IMPORT_C void Cancel(); - IMPORT_C void Deque(); - IMPORT_C void SetPriority(TInt aPriority); - inline TBool IsActive() const {return(iActive);} - inline TBool IsAdded() const {return(iLink.iNext!=NULL);} - inline TInt Priority() const {return iLink.iPriority;} -protected: - IMPORT_C CActive(TInt aPriority); - IMPORT_C void SetActive(); -// Pure virtual - virtual void DoCancel() =0; - virtual void RunL() =0; - IMPORT_C virtual TInt RunError(TInt aError); -public: - TRequestStatus iStatus; -private: - TBool iActive; - TPriQueLink iLink; - friend class CActiveScheduler; -// friend class CServer; - friend class CPrivatePolledActiveScheduler; // added - }; - -// -class CActiveScheduler : public CBase - { -public: - IMPORT_C CActiveScheduler(); - IMPORT_C ~CActiveScheduler(); - IMPORT_C static void Install(CActiveScheduler* aScheduler); - IMPORT_C static CActiveScheduler* Current(); - IMPORT_C static void Add(CActive* anActive); - IMPORT_C static void Start(); - IMPORT_C static void Stop(); - IMPORT_C static TBool RunIfReady(TInt& aError, TInt aMinimumPriority); - IMPORT_C static CActiveScheduler* Replace(CActiveScheduler* aNewActiveScheduler); - IMPORT_C virtual void WaitForAnyRequest(); - IMPORT_C virtual void Error(TInt anError) const; -private: - void DoStart(); - IMPORT_C virtual void OnStarting(); - IMPORT_C virtual void OnStopping(); - IMPORT_C virtual void Reserved_1(); - IMPORT_C virtual void Reserved_2(); - friend class CPrivatePolledActiveScheduler; // added -protected: - inline TInt Level() const; -private: - TInt iLevel; - TPriQue iActiveQ; - }; - -class TCleanupItem; -class CleanupStack - { -public: - IMPORT_C static void PushL(TAny* aPtr); - IMPORT_C static void PushL(CBase* aPtr); - IMPORT_C static void PushL(TCleanupItem anItem); - IMPORT_C static void Pop(); - IMPORT_C static void Pop(TInt aCount); - IMPORT_C static void PopAndDestroy(); - IMPORT_C static void PopAndDestroy(TInt aCount); - IMPORT_C static void Check(TAny* aExpectedItem); - inline static void Pop(TAny* aExpectedItem); - inline static void Pop(TInt aCount, TAny* aLastExpectedItem); - inline static void PopAndDestroy(TAny* aExpectedItem); - inline static void PopAndDestroy(TInt aCount, TAny* aLastExpectedItem); - }; - - -/* - * This will declare CPrivatePolledActiveScheduler as a friend - * of all classes that define a friend. CPrivatePolledActiveScheduler needs to - * be a friend of CActive - */ -//#define friend friend class CPrivatePolledActiveScheduler; friend - - -/* - * This will change the: - * void DoStart(); - * method in CActiveScheduler to: - * void DoStart(); friend class CPrivatePolledActiveScheduler; - * We need this to access the private datamembers in CActiveScheduler. - */ -//#define DoStart() DoStart(); friend class CPrivatePolledActiveScheduler; -//#include -#include "PolledAS.h" - - -class CPrivatePolledActiveScheduler : public CActiveScheduler -{ -public: - void Schedule(); -}; - - - -void CPrivatePolledActiveScheduler::Schedule() -{ - TDblQueIter q(iActiveQ); - q.SetToFirst(); - FOREVER - { - CActive *pR=q++; - if (pR) - { - if (pR->IsActive() && pR->iStatus!=KRequestPending) - { - pR->iActive=EFalse; - TRAPD(r,pR->RunL()); - break; - } - } - else - break; - } -} - - -CPolledActiveScheduler::~CPolledActiveScheduler() -{ - delete iPrivatePolledActiveScheduler; -} - -//static CPolledActiveScheduler* sPolledActiveScheduler = NULL; -CPolledActiveScheduler* CPolledActiveScheduler::NewL() -{ - //sPolledActiveScheduler = - CPolledActiveScheduler* self = new(ELeave)CPolledActiveScheduler; - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); - return self; -} - -void CPolledActiveScheduler::ConstructL() -{ - iPrivatePolledActiveScheduler = new(ELeave) CPrivatePolledActiveScheduler; - iPrivatePolledActiveScheduler->Install(iPrivatePolledActiveScheduler); -} - - -void CPolledActiveScheduler::Schedule() -{ - iPrivatePolledActiveScheduler->Schedule(); -} - -/* -CPolledActiveScheduler* CPolledActiveScheduler::Instance() -{ -// return (CPolledActiveScheduler*) CActiveScheduler::Current(); - return sPolledActiveScheduler; -} -*/ diff --git a/platform/uiq2/audio/motorola/retr.cmd b/platform/uiq2/audio/motorola/retr.cmd deleted file mode 100644 index d7b22bb2..00000000 --- a/platform/uiq2/audio/motorola/retr.cmd +++ /dev/null @@ -1,2 +0,0 @@ -copy %EPOCROOT%\epoc32\release\armi\urel\audio_motorola.dll ..\ -..\..\..\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 diff --git a/platform/uiq2/audio/motorola/retr2.cmd b/platform/uiq2/audio/motorola/retr2.cmd deleted file mode 100644 index 41bc59c2..00000000 --- a/platform/uiq2/audio/motorola/retr2.cmd +++ /dev/null @@ -1 +0,0 @@ -copy %EPOCROOT%\epoc32\release\armi\urel\audio_motorola.dll ..\ diff --git a/platform/uiq2/blit.h b/platform/uiq2/blit.h deleted file mode 100644 index 5556e342..00000000 --- a/platform/uiq2/blit.h +++ /dev/null @@ -1,11 +0,0 @@ -extern "C" { - void vidConvCpyRGB444(void *to, void *from, int pixels); - void vidConvCpyRGB565(void *to, void *from, int pixels); - void vidConvCpyRGB32 (void *to, void *from, int pixels); - - // warning: the functions below will reboot the phone if used incorrectly! - void vidConvCpyM2_16_90 (void *to, void *from, int width); // width is in blocks of 8 pixels - void vidConvCpyM2_16_270 (void *to, void *from, int width); - void vidConvCpyM2_RGB32_90 (void *to, void *from, int width); - void vidConvCpyM2_RGB32_270(void *to, void *from, int width); -} diff --git a/platform/uiq2/blit.s b/platform/uiq2/blit.s deleted file mode 100644 index 899f13e8..00000000 --- a/platform/uiq2/blit.s +++ /dev/null @@ -1,432 +0,0 @@ -@ assembly "optimized" blitter and copy functions -@ all pointers must be word-aligned - -@ (c) Copyright 2006, notaz -@ All Rights Reserved - - -@ Convert 0000bbb0 ggg0rrr0 -@ to 0000rrr0 ggg0bbb0 - -@ r2,r3 - scratch, lr = 0x000F000F -.macro convRGB444 reg - and r2, \reg, lr @ r2=red - and r3, \reg, lr, lsl #8 @ r3=blue - and \reg, \reg, lr, lsl #4 @ green stays in place - orr \reg, \reg, r2, lsl #8 @ add red back - orr \reg, \reg, r3, lsr #8 @ add blue back -.endm - -.global vidConvCpyRGB444 @ void *to, void *from, int pixels - -vidConvCpyRGB444: - stmfd sp!, {r4-r11,lr} - - mov r12, r2, lsr #4 @ repeats - mov lr, #0xF0000 - orr lr, lr, #0xF @ lr == pattern 0x000F000F - - -.loopRGB444: - subs r12, r12, #1 - - @ I first thought storing multiple registers would be faster, - @ but this doesn't seem to be the case, probably because of - @ slow video memory we are dealing with - ldmia r1!, {r4-r11} - convRGB444 r4 - str r4, [r0], #4 - convRGB444 r5 - str r5, [r0], #4 - convRGB444 r6 - str r6, [r0], #4 - convRGB444 r7 - str r7, [r0], #4 - convRGB444 r8 - str r8, [r0], #4 - convRGB444 r9 - str r9, [r0], #4 - convRGB444 r10 - str r10, [r0], #4 - convRGB444 r11 - str r11, [r0], #4 - - bgt .loopRGB444 - - - ldmfd sp!, {r4-r11,lr} - bx lr - - -@ Convert 0000bbb0 ggg0rrr0 -@ to rrr00ggg 000bbb00 - -@ r2,r3 - scratch, lr = 0x07800780 -.macro convRGB565 reg - and r2, \reg, lr, lsr #7 @ r2=red - and r3, \reg, lr, lsl #1 @ r3=blue - and \reg, lr, \reg,lsl #3 @ green stays, but needs shifting - orr \reg, \reg, r2, lsl #12 @ add red back - orr \reg, \reg, r3, lsr #7 @ add blue back -.endm - -.global vidConvCpyRGB565 @ void *to, void *from, int pixels - -vidConvCpyRGB565: - stmfd sp!, {r4-r11,lr} - - mov r12, r2, lsr #4 @ repeats - mov lr, #0x07800000 - orr lr, lr, #0x780 @ lr == pattern 0x07800780 - -.loopRGB565: - subs r12, r12, #1 - - ldmia r1!, {r4-r11} - convRGB565 r4 - str r4, [r0], #4 - convRGB565 r5 - str r5, [r0], #4 - convRGB565 r6 - str r6, [r0], #4 - convRGB565 r7 - str r7, [r0], #4 - convRGB565 r8 - str r8, [r0], #4 - convRGB565 r9 - str r9, [r0], #4 - convRGB565 r10 - str r10, [r0], #4 - convRGB565 r11 - str r11, [r0], #4 - - bgt .loopRGB565 - - ldmfd sp!, {r4-r11,lr} - bx lr - - -@ Convert 0000bbb0 ggg0rrr0 0000bbb0 ggg0rrr0 -@ to 00000000 rrr00000 ggg00000 bbb00000 ... - -@ r2,r3 - scratch, lr = 0x0000F000 -@ rin - src reg, rout - dest reg (can be same for both; rout can be r3) -.macro convRGB32_l rout rin - and r2, \rin, lr, lsr #12 @ r2=red - and r3, \rin, lr, lsr #4 @ r3=blue - orr r2, r3, r2, lsl #24 - and \rout, lr, \rin, lsl #8 @ green stays, but needs shifting - orr \rout, \rout, r2, lsr #4 @ add red+blue back -.endm - -@ r2,r3 - scratch, lr = 0x0000F000 -@ rin - src reg, rout - dest reg (can be same for both; rout can be r3) -.macro convRGB32_h rout rin - and r2, \rin, lr, lsl #4 @ r2=red - mov r3, \rin, lsr #24 @ r3=blue - orr r2, r3, r2 - and \rout, lr, \rin, lsr #8 @ green - orr \rout, \rout, r2, lsl #4 -.endm - -@ slightly faster conversion, saves 1 opcode, writes output -@ lr = 0x00F000F0, out: r3=lower_pix, r2=higher_pix; trashes rin -.macro convRGB32_2 rin rethigh=0 - and r2, lr, \rin, lsr #4 @ blue - and r3, \rin, lr - orr r2, r2, r3, lsl #8 @ g0b0g0b0 - - mov r3, r2, lsl #16 @ g0b00000 - and \rin,lr, \rin, ror #12 @ 00r000r0 (reversed) - orr r3, r3, \rin, lsr #16 @ g0b000r0 - mov r3, r3, ror #16 @ r3=low - - str r3, [r0], #4 - - mov r2, r2, lsr #16 -.if \rethigh - orr \rin,r2, \rin, lsl #16 -.else - orr r2, r2, \rin, lsl #16 - str r2, [r0], #4 -.endif -.endm - - -.global vidConvCpyRGB32 @ void *to, void *from, int pixels - -vidConvCpyRGB32: - stmfd sp!, {r4-r7,lr} - - mov r12, r2, lsr #3 @ repeats - mov lr, #0x00F00000 - orr lr, lr, #0x00F0 - -.loopRGB32: - subs r12, r12, #1 - - ldmia r1!, {r4-r7} - convRGB32_2 r4 - convRGB32_2 r5 - convRGB32_2 r6 - convRGB32_2 r7 - - bgt .loopRGB32 - - ldmfd sp!, {r4-r7,lr} - bx lr - - -@ -------- M2 stuff --------- - -.bss -tmpstore1d: .long - -.text -tmpstore1: .long tmpstore1d - - -@ r3 - scratch, ru - reg with 2 pixels from upper col, rl - ... lower col -.macro rot_str16_90 ru rl - mov r3, \rl,lsl #16 - mov r3, r3, lsr #16 - orr r3, r3, \ru, lsl #16 - str r3, [r0], #208*2 - mov r3, \ru,lsr #16 - mov r3, r3, lsl #16 - orr r3, r3, \rl, lsr #16 - str r3, [r0], #208*2 -.endm - - -.global vidConvCpyM2_16_90 @ void *to, void *from, int width - -vidConvCpyM2_16_90: - stmfd sp!, {r4-r11,lr} - - ldr r4, =tmpstore1 - str sp, [r4] @ save sp, we will need sp reg.. - mov sp, r0 @ .. to store our dst - - @ crashing beyond this point will be fatal (phone reboots), as Symbian OS expects sp to always point to stack - - sub r2, r2, #1 - mov r12, #0x00670000 - orr r12, r12, r2, lsl #24 - orr r12, r12, r2 @ r12 == ((208-2)/2 << 16) | ((width-1)<<24) | (width-1) - - add r0, r0, #206*2 - add r1, r1, #8*2 @ skip left border - add lr, r1, #328*2 - -.loopM2_16_90: - subs r12, r12, #1<<24 - - ldmia r1!, {r4-r7} - ldmia lr!, {r8-r11} - rot_str16_90 r4 r8 - rot_str16_90 r5 r9 - rot_str16_90 r6 r10 - rot_str16_90 r7 r11 - - bpl .loopM2_16_90 - - add r12, r12, #1<<24 - subs r12, r12, #0x00010000 - bmi .loopM2_16_90_end - - add r0, sp, r12, lsr #14 @ calculate new dst pointer - orr r12, r12, r12, lsl #24 @ restore the width counter - - @ skip remaining pixels on these 2 lines - mov r4, #328/8-1 @ width of mode2 in line_pixels/8 - sub r4, r4, r12, lsr #24 - add r1, lr, r4, lsl #4 @ skip src pixels - add lr, r1, #328*2 - b .loopM2_16_90 - -.loopM2_16_90_end: - @ restore sp - ldr r4, =tmpstore1 - ldr sp, [r4] - - ldmfd sp!, {r4-r11,lr} - bx lr - - - -@ r3 - scratch, ru - reg with 2 pixels from upper col, rl - ... lower col (for right-to-left copies) -.macro rot_str16_270 ru rl - mov r3, \rl,lsr #16 - mov r3, r3, lsl #16 - orr r3, r3, \ru, lsr #16 - str r3, [r0], #208*2 - mov r3, \ru,lsl #16 - mov r3, r3, lsr #16 - orr r3, r3, \rl, lsl #16 - str r3, [r0], #208*2 -.endm - - -.global vidConvCpyM2_16_270 @ void *to, void *from, int width - -vidConvCpyM2_16_270: - stmfd sp!, {r4-r11,lr} - - ldr r4, =tmpstore1 - str sp, [r4] @ save sp, we will need sp reg to store our dst - - sub r2, r2, #1 - mov r12, #0x00670000 - orr r12, r12, r2, lsl #24 - orr r12, r12, r2 @ r12 == ((208-2)/2 << 16) | ((width-1)<<24) | (width-1) - - add r1, r1, #328*2 @ skip left border+1line - add lr, r1, #328*2 - add sp, r0, #206*2 @ adjust for algo - -.loopM2_16_270: - subs r12, r12, #1<<24 - - ldmdb r1!, {r4-r7} - ldmdb lr!, {r8-r11} - rot_str16_270 r7 r11 @ update the screen in incrementing direction, reduces tearing slightly - rot_str16_270 r6 r10 - rot_str16_270 r5 r9 - rot_str16_270 r4 r8 - - bpl .loopM2_16_270 - - add r12, r12, #1<<24 - subs r12, r12, #0x00010000 - bmi .loopM2_16_90_end @ same end as in 90 - - sub r0, sp, r12, lsr #14 @ calculate new dst pointer - orr r12, r12, r12, lsl #24 @ restore the width counter - - @ skip remaining pixels on these 2 lines - mov r4, #328/8-1 @ width of mode2 in line_pixels/8 - sub r4, r4, r12, lsr #24 - sub r1, lr, r4, lsl #4 @ skip src pixels - add r1, r1, #328*2*2 - add lr, r1, #328*2 - b .loopM2_16_270 - - - -.global vidConvCpyM2_RGB32_90 @ void *to, void *from, int width - -vidConvCpyM2_RGB32_90: - stmfd sp!, {r4-r10,lr} - - mov lr, #0x00F00000 - orr lr, lr, #0x00F0 - - mov r12, #208/4 @ row counter - mov r10, r2, lsl #2 @ we do 2 pixel wide copies - - add r8, r0, #208*4 @ parallel line - add r1, r1, #0x21000 - add r1, r1, #0x00280 @ r1+=328*207*2+8*2 - mov r9, r1 - -.loopM2RGB32_90: - subs r12, r12, #1 - - @ at first this loop was written differently: src pixels were fetched with ldm's and - @ dest was not sequential. It ran nearly 2 times slower. It seems it is very important - @ to do sequential memory access on those items, which we have more (to offload addressing bus?). - - ldr r4, [r1], #-328*2 - ldr r5, [r1], #-328*2 - ldr r6, [r1], #-328*2 - ldr r7, [r1], #-328*2 - - convRGB32_2 r4, 1 - convRGB32_2 r5, 1 - convRGB32_2 r6, 1 - convRGB32_2 r7, 1 - - str r4, [r8], #4 - str r5, [r8], #4 - str r6, [r8], #4 - str r7, [r8], #4 - - bne .loopM2RGB32_90 - - subs r10, r10, #1 - ldmeqfd sp!, {r4-r10,pc} @ return - - mov r12, #208/4 @ restore row counter - mov r0, r8 @ set new dst pointer - add r8, r0, #208*4 - add r9, r9, #2*2 @ fix src pointer - mov r1, r9 - b .loopM2RGB32_90 - - - -@ converter for vidConvCpyM2_RGB32_270 -@ lr = 0x00F000F0, out: r3=lower_pix, r2=higher_pix; trashes rin -.macro convRGB32_3 rin - and r2, lr, \rin, lsr #4 @ blue - and r3, \rin, lr - orr r2, r2, r3, lsl #8 @ g0b0g0b0 - - mov r3, r2, lsl #16 @ g0b00000 - and \rin,lr, \rin, ror #12 @ 00r000r0 (reversed) - orr r3, r3, \rin, lsr #16 @ g0b000r0 - - mov r2, r2, lsr #16 - orr r2, r2, \rin, lsl #16 - str r2, [r0], #4 - - mov \rin,r3, ror #16 @ r3=low -.endm - - -.global vidConvCpyM2_RGB32_270 @ void *to, void *from, int width - -vidConvCpyM2_RGB32_270: - stmfd sp!, {r4-r10,lr} - - mov lr, #0x00F00000 - orr lr, lr, #0x00F0 - - mov r12, #208/4 @ row counter - mov r10, r2, lsl #2 @ we do 2 pixel wide copies (right to left) - - add r8, r0, #208*4 @ parallel line - add r1, r1, #326*2 - mov r9, r1 - -.loopM2RGB32_270: - subs r12, r12, #1 - - ldr r4, [r1], #328*2 - ldr r5, [r1], #328*2 - ldr r6, [r1], #328*2 - ldr r7, [r1], #328*2 - - convRGB32_3 r4 - convRGB32_3 r5 - convRGB32_3 r6 - convRGB32_3 r7 - - str r4, [r8], #4 - str r5, [r8], #4 - str r6, [r8], #4 - str r7, [r8], #4 - - bne .loopM2RGB32_270 - - subs r10, r10, #1 - ldmeqfd sp!, {r4-r10,pc} @ return - - mov r12, #208/4 @ restore row counter - mov r0, r8 @ set new dst pointer - add r8, r0, #208*4 - sub r9, r9, #2*2 @ fix src pointer - mov r1, r9 - b .loopM2RGB32_270 - diff --git a/platform/uiq2/debug.cpp b/platform/uiq2/debug.cpp deleted file mode 100644 index efa60950..00000000 --- a/platform/uiq2/debug.cpp +++ /dev/null @@ -1,241 +0,0 @@ - -#include // RDebug -#include "debug.h" - -#ifdef __WINS__ - -void ExceptionHandler(TExcType exc) {} - -#else - -static const wchar_t * const exception_names[] = { - L"General", - L"IntegerDivideByZero", - L"SingleStep", - L"BreakPoint", - L"IntegerOverflow", - L"BoundsCheck", - L"InvalidOpCode", - L"DoubleFault", - L"StackFault", - L"AccessViolation", - L"PrivInstruction", - L"Alignment", - L"PageFault", - L"FloatDenormal", - L"FloatDivideByZero", - L"FloatInexactResult", - L"FloatInvalidOperation", - L"FloatOverflow", - L"FloatStackCheck", - L"FloatUnderflow", - L"Abort", - L"Kill", - L"DataAbort", - L"CodeAbort", - L"MaxNumber", - L"InvalidVector", - L"UserInterrupt", - L"Unknown" -}; - - -static void getASpace(TUint *code_start, TUint *code_end, TUint *stack_start, TUint *stack_end) -{ - TUint pc, sp; - RChunk chunk; - TFullName chunkname; - TFindChunk findChunk(_L("*")); - - asm volatile ("str pc, %0" : "=m" (pc) ); - asm volatile ("str sp, %0" : "=m" (sp) ); - - while( findChunk.Next(chunkname) != KErrNotFound ) { - chunk.Open(findChunk); - if((TUint)chunk.Base()+chunk.Bottom() < pc && pc < (TUint)chunk.Base()+chunk.Top()) { - if(code_start) *code_start = (TUint)chunk.Base()+chunk.Bottom(); - if(code_end) *code_end = (TUint)chunk.Base()+chunk.Top(); - } else - if((TUint)chunk.Base()+chunk.Bottom() < sp && sp < (TUint)chunk.Base()+chunk.Top()) { - if(stack_start) *stack_start = (TUint)chunk.Base()+chunk.Bottom(); - if(stack_end) *stack_end = (TUint)chunk.Base()+chunk.Top(); - } - chunk.Close(); - } -} - -// tmp -#if defined(__DEBUG_PRINT) -extern "C" char *debugString(); -#endif - -// our very own exception handler -void ExceptionHandler(TExcType exc) -{ - TUint lr, sp, i; - TUint stack_end = 0; // ending address of our stack chunk - TUint code_start = 0, code_end = 0; // starting and ending addresses of our code chunk - TUint guessed_address = 0; - - asm volatile ("str lr, %0" : "=m" (lr) ); - asm volatile ("str sp, %0" : "=m" (sp) ); - - // first get some info about the chunks we live in - getASpace(&code_start, &code_end, 0, &stack_end); - - // now we begin some black magic tricks - // we go up our stack until we pass our caller address - for(; sp < stack_end; sp += 4) - if(*(TUint *)sp == lr) break; - - // there might be mirored caller address - for(i = sp + 4; i < sp + 0x300 && i < stack_end; i += 4) - if(*(TUint *)i == lr) { sp = i; break; } - - // aah, it is always 0x9c bytes away from the caller address in my firmware, - // don't know how to detect it in any other way - sp += 0x9c; - guessed_address = *(TUint *)sp; - - // output the info - TUint exec_show = exc; - if(exec_show > 27) exec_show = 27; - TPtrC ptrExc((TUint16 *) exception_names[exec_show]); - - RDebug::Print(_L("!!!Exception %i (%S) @ 0x%08x (guessed; relative=0x%08x)"), exc, &ptrExc, guessed_address, guessed_address - code_start); -#ifdef __DEBUG_PRINT_FILE - DEBUGPRINT( _L("!!!Exception %i (%S) @ 0x%08x (guessed; relative=0x%08x)"), exc, &ptrExc, guessed_address, guessed_address - code_start); -#endif - - TBuf<148> buff1; - TBuf<10> buff2; - buff1.Copy(_L(" guessed stack: ")); - - for(sp += 4, i = 0; i < 5 && sp < stack_end; sp += 4) { - if((*(TUint *)sp >> 28) == 5) { - if(i++) buff1.Append(_L(", ")); - buff2.Format(_L("0x%08x"), *(TUint *)sp); - buff1.Append(buff2); - } - else if(code_start < *(TUint *)sp && *(TUint *)sp < code_end) { - if(i++) buff1.Append(_L(", ")); - buff2.Format(_L("0x%08x"), *(TUint *)sp); - buff1.Append(buff2); - buff1.Append(_L(" (")); - buff2.Format(_L("0x%08x"), *(TUint *)sp - code_start); - buff1.Append(buff2); - buff1.Append(_L(")")); - } - } - RDebug::Print(_L("%S"), &buff1); -#ifdef __DEBUG_PRINT_FILE - DEBUGPRINT(_L("%S"), &buff1); -#endif - - // tmp -#if defined(__DEBUG_PRINT) - char *ps, *cstr = debugString(); - for(ps = cstr; *ps; ps++) { - if(*ps == '\n') { - *ps = 0; - dprintf(cstr); - cstr = ps+1; - } - } -#endif - -// RDebug::Print(_L("Stack dump:")); -// asm volatile ("str sp, %0" : "=m" (sp) ); -// for(TUint i = sp+0x400; i >= sp-16; i-=4) -// RDebug::Print(_L("%08x: %08x"), i, *(int *)i); - - // more descriptive replacement of "KERN-EXEC 3" panic - buff1.Format(_L("K-EX3: %S"), &ptrExc); - User::Panic(buff1, exc); -} - -#endif // ifdef __WINS__ - - -#if defined(__DEBUG_PRINT) || defined(__WINS__) - -#ifndef __DLL__ - // c string dumper for RDebug::Print() - static TBuf<1024> sTextBuffer; - TDesC* DO_CONV(const char* s) - { - TPtrC8 text8((TUint8*) (s)); - sTextBuffer.Copy(text8); - return &sTextBuffer; - } -#endif - -#ifdef __DEBUG_PRINT_C - #include // va_* - #include // vsprintf - - // debug print from c code - extern "C" void dprintf(char *format, ...) - { - va_list args; - char buffer[512]; - - va_start(args,format); - vsprintf(buffer,format,args); - va_end(args); - - DEBUGPRINT(_L("%S"), DO_CONV(buffer)); - } -#endif - -#ifdef __DEBUG_PRINT_FILE - #include - - // note: uses tls, leaks some mem - void debugPrintFileInit() - { - RFs *fs = new(ELeave) RFs; - fs->Connect(); - RFile *file = new(ELeave) RFile; - // try to open - TInt res = file->Open(*fs, _L("C:\\documents\\Media files\\other\\snes9x.log"), EFileWrite|EFileShareAny); - if(res) res = file->Open(*fs, _L("C:\\snes9x.log"), EFileWrite|EFileShareAny); - if(!res) { TInt size; file->Size(size); file->Seek(ESeekStart, size); } - // try to create - if(res) res = file->Create(*fs, _L("C:\\documents\\Media files\\other\\snes9x.log"), EFileWrite|EFileShareAny); - if(res) res = file->Create(*fs, _L("C:\\snes9x.log"), EFileWrite|EFileShareAny); - Dll::SetTls(res ? 0 : file); - } - - // debug print to file - void debugPrintFile(TRefByValue aFmt, ...) - { - // get RFile - RFile *file = (RFile *) Dll::Tls(); - if(!file) return; // shit! - - TTime now; now.UniversalTime(); - TBuf<512> tmpBuff; - TBuf8<512> tmpBuff8; - TInt size; - - file->Size(size); file->Seek(ESeekStart, size); // something else could have written to the file - - now.FormatL(tmpBuff, _L("%H:%T:%S.%C: ")); - tmpBuff8.Copy(tmpBuff); - file->Write(tmpBuff8); - - VA_LIST args; - VA_START(args, aFmt); - tmpBuff.FormatList(aFmt, args); - VA_END(args); - tmpBuff8.Copy(tmpBuff); - file->Write(tmpBuff8); - - file->Write(TPtrC8((TUint8 const *) "\r\n")); - file->Flush(); - } -#endif - -#endif - diff --git a/platform/uiq2/debug.h b/platform/uiq2/debug.h deleted file mode 100644 index b91ce268..00000000 --- a/platform/uiq2/debug.h +++ /dev/null @@ -1,27 +0,0 @@ -#include - -#define __DEBUG_PRINT_C - -#if defined(__DEBUG_PRINT) || defined(__WINS__) - #include // RDebug - #ifdef __DEBUG_PRINT_FILE - void debugPrintFileInit(); - void debugPrintFile(TRefByValue aFmt, ...); - #define DEBUG_PRINT_FILE_INIT debugPrintFileInit - #define DEBUGPRINT debugPrintFile - #else - #define DEBUG_PRINT_FILE_INIT() - #define DEBUGPRINT RDebug::Print - #endif - TDesC* DO_CONV(const char* s); - #ifdef __DEBUG_PRINT_C - #ifdef __cplusplus - extern "C" - #endif - void dprintf(char *format, ...); - #endif -#else - #define DEBUGPRINT(x...) -#endif - -void ExceptionHandler(TExcType exc); diff --git a/platform/uiq2/launcher/App.cpp b/platform/uiq2/launcher/App.cpp deleted file mode 100644 index 78367640..00000000 --- a/platform/uiq2/launcher/App.cpp +++ /dev/null @@ -1,644 +0,0 @@ -/******************************************************************* - * - * File: App.cpp - * - * Author: Peter van Sebille (peter@yipton.net) - * - * Modified/adapted for picodriveN by notaz, 2006 - * - * (c) Copyright 2006, notaz - * (c) Copyright 2002, Peter van Sebille - * All Rights Reserved - * - *******************************************************************/ - -#include "app.h" -// #include "picodriven.mbg" // bitmap identifiers -#include "picodriven.rsg" -#include -#include -//#include -//#include -#include // CEikMenuBar -#include // TApaSystemEvent - -#include "Dialogs.h" - - -CApaDocument* CPicolApplication::CreateDocumentL() -{ - return new (ELeave) CPicolDocument(*this); -} - - -CPicolDocument::CPicolDocument(CEikApplication& aApp) - : CEikDocument(aApp) -{ -} - -CPicolDocument::~CPicolDocument() -{ -} - -CEikAppUi* CPicolDocument::CreateAppUiL() -{ - return new(ELeave) CPicolAppUi; -} - - -//////////////////////////////////////////////////////////////// -// -// class CPicolAppUi -// -//////////////////////////////////////////////////////////////// - -CPicolAppUi::CPicolAppUi() -: iCurrentLConfig(iCurrentConfig) -{ - // set default config - Mem::FillZ(&iCurrentConfig, sizeof(iCurrentConfig)); - iCurrentConfig.iFlags = 1; // use_sram - iCurrentConfig.iFrameskip = TPicoConfig::PFSkipAuto; - iCurrentConfig.iScreenRotation = TPicoConfig::PRot90; -} - -CPicolAppUi::~CPicolAppUi() -{ - delete iAppView; - DeregisterView(*iFOView); - delete iFOView; - DeregisterView(*iFCView); - delete iFCView; -} - -void CPicolAppUi::ConstructL() -{ - BaseConstructL(); - - // load config - iCurrentLConfig.Load(); - - iAppView=new(ELeave) CEPicolAppView; - iAppView->ConstructL(ClientRect()); - - iFOView=new(ELeave) CPicolFOView(*iAppView); - RegisterViewL(*iFOView); - iFCView=new(ELeave) CPicolFCView(*iAppView); - RegisterViewL(*iFCView); -} - - -void CPicolAppUi::HandleCommandL(TInt aCommand) -{ - TInt oldFrameskip = iCurrentConfig.iFrameskip; - TInt res; - - // give time for config dialog destruction - if(iAfterConfigDialog) { - iAfterConfigDialog = EFalse; - TTime now; now.UniversalTime(); - if(now.MicroSecondsFrom(iConfigDialogClosed).Int64().Low() < 2500*1000) - User::After(2500*1000-now.MicroSecondsFrom(iConfigDialogClosed).Int64().Low()); - } - - switch (aCommand) - { - case EEikCmdPicoLoadState: - if(iGameRunner) { - CEikonEnv::Static()->BusyMsgL(_L("Loading State")); - res = ss.SendReceive(PicoMsgLoadState, 0); - CEikonEnv::Static()->BusyMsgCancel(); - // emu doesn't start to run if load fails, so we can display this - if(res) CEikonEnv::Static()->InfoMsg(_L("Load Failed")); - } - break; - - case EEikCmdPicoSaveState: - if(iGameRunner) { - CEikonEnv::Static()->BusyMsgL(_L("Saving State")); - res = ss.SendReceive(PicoMsgSaveState, 0); - CEikonEnv::Static()->BusyMsgCancel(); - if(res) CEikonEnv::Static()->InfoMsg(_L("Save Failed")); - } - break; - - case EEikCmdPicoLoadROM: - DisplayOpenROMDialogL(); - break; - - case EEikCmdPicoResume: - ss.Send(PicoMsgResume, 0); - iEmuRunning = ETrue; - break; - - case EEikCmdPicoReset: - ss.Send(PicoMsgReset, 0); - iEmuRunning = ETrue; - break; - - case EEikCmdPicoKeys: - if(!iGameRunner) RunGameL(); - ss.Send(PicoMsgKeys, 0); - iEmuRunning = ETrue; - break; - - case EEikCmdPicoSettings: - DisplayConfigDialogL(); - break; - - case EEikCmdHelpAbout: // EEikCmdPicoAbout: - DisplayAboutDialogL(); - break; - - // standard identifier must be used here, TApaTask::EndTask() and probably others send it - case EEikCmdExit: // EEikCmdPicoExit: - if(iGameRunner) { - iQuitting = ETrue; - iExitForcer = CExitForcer::NewL(*this, 2000); - ss.Send(PicoMsgQuit, 0); - } else { - iCurrentLConfig.Save(); - DEBUGPRINT(_L("[app] Exit (menu)")); - Exit(); - } - break; - - // frameskips - case EEikCmdPicoFrameskipAuto: - iCurrentConfig.iFrameskip = TPicoConfig::PFSkipAuto; - break; - - case EEikCmdPicoFrameskip0: - iCurrentConfig.iFrameskip = TPicoConfig::PFSkip0; - break; - - case EEikCmdPicoFrameskip1: - iCurrentConfig.iFrameskip = 1; - break; - - case EEikCmdPicoFrameskip2: - iCurrentConfig.iFrameskip = 2; - break; - - case EEikCmdPicoFrameskip4: - iCurrentConfig.iFrameskip = 4; - break; - - case EEikCmdPicoFrameskip8: - iCurrentConfig.iFrameskip = 8; - break; - - case EEikCmdPicoDebugKillEmu: - if(iGameRunner) { - iExitForcer = CExitForcer::NewL(*this, 4000); - ss.Send(PicoMsgQuit, 0); - } - break; - - case EEikCmdPicoDebugInfo: - if(iGameRunner) - DisplayDebugDialogL(); - break; - } - - // send config update if needed - if(iCurrentConfig.iFrameskip != oldFrameskip) - SendConfig(); -} - - -void CPicolAppUi::HandleSystemEventL(const TWsEvent& aEvent) -{ - TApaSystemEvent event; - event = *(TApaSystemEvent*)aEvent.EventData(); - - if(event == EApaSystemEventBroughtToForeground) // application brought to foreground - { - DEBUGPRINT(_L("[app] EApaSystemEventBroughtToForeground, iEmuRunning=%i"), iEmuRunning); - // we might have missed flip open event (when moved to background), - // so make sure we have correct view active - if(iCoeEnv->ScreenDevice()->CurrentScreenMode() == EScreenModeFlipOpen) { - ActivateViewL(TVwsViewId(KUidPicolApp, KUidPicolFOView)); - return; - } - } - if(event == EApaSystemEventShutdown) - { - DEBUGPRINT(_L("[app] EApaSystemEventShutdown")); - } - - CEikAppUi::HandleSystemEventL(aEvent); -} - - -// called just before the menu is shown -void CPicolAppUi::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) -{ - if(aResourceId == R_APP_EMU_MENU) { - TBool dimmed = !iGameRunner || !iROMLoaded; - aMenuPane->SetItemDimmed(EEikCmdPicoLoadState, dimmed); - aMenuPane->SetItemDimmed(EEikCmdPicoSaveState, dimmed); - aMenuPane->SetItemDimmed(EEikCmdPicoResume, dimmed); - aMenuPane->SetItemDimmed(EEikCmdPicoReset, dimmed); - } else if(aResourceId == R_APP_FRAMESKIP_MENU) { - TInt itemToCheck = EEikCmdPicoFrameskipAuto; - switch(iCurrentConfig.iFrameskip) { - case 0: itemToCheck = EEikCmdPicoFrameskip0; break; - case 1: itemToCheck = EEikCmdPicoFrameskip1; break; - case 2: itemToCheck = EEikCmdPicoFrameskip2; break; - case 4: itemToCheck = EEikCmdPicoFrameskip4; break; - case 8: itemToCheck = EEikCmdPicoFrameskip8; break; - } - aMenuPane->SetItemButtonState(itemToCheck, EEikMenuItemSymbolOn); - } -} - - -void CPicolAppUi::DisplayAboutDialogL() -{ - CEikDialog* dialog = new(ELeave) CAboutDialog; - TInt iButtonRes = dialog->ExecuteLD(R_DIALOG_ABOUT); - if(iButtonRes == EEikBidYes) { - CCreditsDialog *creditsDialog = new (ELeave) CCreditsDialog(); - creditsDialog->iMessageResourceID = R_TBUF_CREDITS; - creditsDialog->ExecuteLD(R_DIALOG_CREDITS); - } -} - - -void CPicolAppUi::DisplayOpenROMDialogL() -{ - - TFileName file(iCurrentLConfig.iLastROMFile); - CEikDialog* dialog = new(ELeave) CEikFileOpenDialog(&file); - //((CEikFileOpenDialog *)dialog)->SetRequiredExtension(&ext); - - if(dialog->ExecuteLD(R_EIK_DIALOG_FILE_OPEN) == EEikBidOk) { - CEikonEnv::Static()->BusyMsgL(_L("Loading ROM")); - - // start emu process if it is not running - if(!iGameRunner) RunGameL(); - iROMLoaded = EFalse; - - TBuf8 file8; - file8.Copy(file); - TAny *p[KMaxMessageArguments]; - p[0]= (TAny*)(&file8); - TInt res = ss.SendReceive(PicoMsgLoadROM, &p[0]); - - CEikonEnv::Static()->BusyMsgCancel(); - - if(res == 1) - CEikonEnv::Static()->InfoWinL(_L("Error"), _L("Failed to open file.")); - else if(res == 2) - CEikonEnv::Static()->InfoWinL(_L("Error"), _L("Failed to allocate memory.")); - else if(res == 3) - CEikonEnv::Static()->InfoWinL(_L("Error"), _L("The file you selected is not a game ROM.")); - else if(res == 4) - CEikonEnv::Static()->InfoWinL(_L("Error"), _L("No game ROMs found in zipfile.")); - else if(res == 5) - CEikonEnv::Static()->InfoWinL(_L("Error"), _L("Failed while unzipping ROM.")); - else if(res < 0) - CEikonEnv::Static()->InfoWinL(_L("Error"), _L("Failed to send request to emu process.")); - else { - iROMLoaded = ETrue; - iEmuRunning = ETrue; - } - - // sound errors which leave ROM loaded - if(res == 6) - CEikonEnv::Static()->InfoWinL(_L("Error"), _L("Failed to allocate sound buffer, disabled sound.")); - else if(res == 7) - CEikonEnv::Static()->InfoWinL(_L("Error"), _L("Failed to start soundsystem, disabled sound.")); - if(res == 6 || res == 7) iCurrentConfig.iFlags &= ~4; - - iCurrentLConfig.iLastROMFile.Copy(file); - } -} - - -void CPicolAppUi::DisplayConfigDialogL() -{ - CPicoConfigDialog* configDialog = new(ELeave)CPicoConfigDialog(iCurrentConfig, iCurrentLConfig); - configDialog->ExecuteLD(R_PICO_CONFIG); - - if(iGameRunner) - SendConfig(); - - iCurrentLConfig.Save(); - - // configDialog seems to be actually destroyed later after returning, - // and this usually happens just after resuming game and causes emu slowdowns :/ - iAfterConfigDialog = ETrue; - iConfigDialogClosed.UniversalTime(); -} - - -void CPicolAppUi::DisplayDebugDialogL() -{ - // first get our debug info - char dtxt[1024]; - - TAny *p[KMaxMessageArguments]; - TPtr8 descr((TUint8*) dtxt, sizeof(dtxt)); - p[0]= (TAny*)(&descr); - ss.SendReceive(PicoMsgRetrieveDebugStr, &p[0]); - - CEikDialog* dialog = new(ELeave) CDebugDialog(dtxt); - dialog->ExecuteLD(R_DIALOG_DEBUG); -} - - -void CPicolAppUi::SendConfig() -{ - // send config - if(iGameRunner) { - TAny *p[KMaxMessageArguments]; - TPtrC8 descr((TUint8*) &iCurrentConfig, sizeof(iCurrentConfig)); - p[0]= (TAny*)(&descr); - ss.Send(PicoMsgConfigChange, &p[0]); - } -} - - -// get config from emu proc -void CPicolAppUi::RetrieveConfig() -{ - // ask to configure keys and receive new config - TAny *p[KMaxMessageArguments]; - TPtr8 descr((TUint8*) &iCurrentConfig, sizeof(iCurrentConfig)); - p[0]= (TAny*)(&descr); - ss.SendReceive(PicoMsgRetrieveConfig, &p[0]); - - iCurrentLConfig.Save(); -} - - -void CPicolAppUi::NotifyEmuDeath() -{ - StopGame(); - if(iQuitting) { - DEBUGPRINT(_L("[app] Exit (NotifyEmuDeath)")); - iCurrentLConfig.Save(); - RProcess me; - me.Terminate(0); - } -} - - -void CPicolAppUi::NotifyForcedExit() -{ - DEBUGPRINT(_L("[app] Exit (NotifyForcedExit)")); - StopGame(); - RProcess me; - me.Terminate(0); -} - - -TBool CPicolAppUi::EmuRunning() const -{ - return iEmuRunning; -} - - -void CPicolAppUi::StopGame() -{ - // in case we have busyMsg and process crashes - CEikonEnv::Static()->BusyMsgCancel(); - - ss.Close(); - if(iGameRunner) delete iGameRunner; - iGameRunner = NULL; - if(iExitForcer) delete iExitForcer; - iExitForcer = NULL; - if(iThreadWatcher1) delete iThreadWatcher1; - iThreadWatcher1 = NULL; - iROMLoaded = EFalse; - iEmuRunning = EFalse; -} - - -void CPicolAppUi::RunGameL() -{ - TInt res = KErrNone; - - // do one connection attemt to emu and ask it to quit if we succeed - res = ss.Connect(); - if(res == KErrNone) { - ss.Send(PicoMsgQuit, 0); - ss.Close(); - } - - iGameRunner = CGameRunner::NewL(*this); - - // Connect to the server - // we don't want to do complex asynchronous stuff here, so we just - // wait and do several connection attempts - User::After(200000); - for(TInt attempt=0; attempt < 10; attempt++) { - res = ss.Connect(); - if(res == KErrNone) break; - User::After(200000); - } - - if(res != KErrNone) { - CEikonEnv::Static()->BusyMsgCancel(); - CEikonEnv::Static()->InfoWinL(_L("Error"), _L("Failed to communicate with the emulation process.")); - StopGame(); - RProcess me; - me.Terminate(2); - } - - // now we are successfully connected, that means emu process' helper-communication thread is running. - // we have to keep an eye on it too, because if it crashes, symbian OS leaves it's process - // alive, but it becomes useless without it's communication thread so we have to detect it's death. - iThreadWatcher1 = CThreadWatcher::NewL(*this, KServerName); - - // send initial config - SendConfig(); -} - - -/* -void CPicolAppUi::HandleScreenDeviceChangedL() -{ - // does not receive when emu is in foreground - if(iCoeEnv->ScreenDevice()->CurrentScreenMode() == 0) { // flip open - // regain focus - //iCoeEnv->BringOwnerToFront(); - - } -// ss.Send(PicoMsgFlipChange, 0); -} -*/ - -void CPicolAppUi::HandleApplicationSpecificEventL(TInt aType, const TWsEvent& aEvent) -{ - DEBUGPRINT(_L("[app] event from server: %i"), aEvent.Type()); - - switch (aEvent.Type()) - { - case EEventKeyCfgDone: - RetrieveConfig(); - break; - - case EEventGamePaused: - iEmuRunning = EFalse; - break; - } -} - -//////////////////////////////////////////////////////////////// -// -// class CEPicolAppView -// -//////////////////////////////////////////////////////////////// - -void CEPicolAppView::ConstructL(const TRect& aRect) -{ - CreateWindowL(); - SetRect(aRect); - ActivateL(); - - /* - * Load background image - */ -/* - TBuf<1> name = _L("*"); - TRAPD(err, iBgImage = CEikonEnv::Static()->CreateBitmapL(name, EMbmEdoomDoom)); - if (iBgImage) - { - iImagePosition.iX = (aRect.Size().iWidth - iBgImage->SizeInPixels().iWidth) / 2; - iImagePosition.iY = (aRect.Size().iHeight - iBgImage->SizeInPixels().iHeight) / 2; - } -*/ -} - -CEPicolAppView::~CEPicolAppView() -{ - //if (iBgImage) delete iBgImage; -} - - -void CEPicolAppView::Draw(const TRect& aRect) const -{ - CWindowGc& gc = SystemGc(); - - //if (iBgImage) - //{ - // gc.DrawBitmap(iImagePosition, iBgImage); - // DrawUtils::ClearBetweenRects(gc, Rect(), TRect(iImagePosition, iBgImage->SizeInPixels())); - //} - //else - gc.Clear();//aRect); -} - - -//////////////////////////////////////////////////////////////// -// -// class CPicolViewBase -// -//////////////////////////////////////////////////////////////// - -void CPicolViewBase::ViewActivatedL(const TVwsViewId& /*aPrevViewId*/, TUid /*aCustomMessageId*/, const TDesC8& /*aCustomMessage*/) -{ - TPixelsAndRotation sizeAndRotation; - CEikonEnv::Static()->ScreenDevice()->GetDefaultScreenSizeAndRotation(sizeAndRotation); - CEikonEnv::Static()->ScreenDevice()->SetScreenSizeAndRotation(sizeAndRotation); - //iAppViewCtl.MakeVisible(ETrue); -} - -void CPicolViewBase::ViewDeactivated() -{ - //iAppViewCtl.MakeVisible(EFalse); -} - - -//////////////////////////////////////////////////////////////// -// -// class CPicolFOView -// -//////////////////////////////////////////////////////////////// - -TVwsViewId CPicolFOView::ViewId() const -{ - return TVwsViewId(KUidPicolApp, KUidPicolFOView); -} - -TVwsViewIdAndMessage CPicolFOView::ViewScreenDeviceChangedL() -{ - // only handle change to FC mode when emu process is running - if(static_cast(CEikonEnv::Static()->AppUi())->EmuRunning()) - return TVwsViewIdAndMessage(TVwsViewId(KUidPicolApp, KUidPicolFCView)); - else return MCoeView::ViewScreenDeviceChangedL(); -} - -TBool CPicolFOView::ViewScreenModeCompatible(TInt aScreenMode) -{ - return (aScreenMode == EScreenModeFlipOpen); -} - -void CPicolFOView::ViewActivatedL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage) -{ - DEBUGPRINT(_L("[app] FO")); - CPicolViewBase::ViewActivatedL(aPrevViewId, aCustomMessageId, aCustomMessage); - CEikonEnv::Static()->AppUiFactory()->MenuBar()->MakeVisible(ETrue); - - iAppViewCtl.SetRect(static_cast(CEikonEnv::Static()->AppUi())->ClientRect()); -} - - -//////////////////////////////////////////////////////////////// -// -// class CPicolFCView -// -//////////////////////////////////////////////////////////////// - -TVwsViewId CPicolFCView::ViewId() const -{ - return TVwsViewId(KUidPicolApp, KUidPicolFCView); -} - -TVwsViewIdAndMessage CPicolFCView::ViewScreenDeviceChangedL() -{ - return TVwsViewIdAndMessage(TVwsViewId(KUidPicolApp, KUidPicolFOView)); -} - -TBool CPicolFCView::ViewScreenModeCompatible(TInt aScreenMode) -{ - return (aScreenMode == EScreenModeFlipClosed); -} - -void CPicolFCView::ViewActivatedL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage) -{ - DEBUGPRINT(_L("[app] FC")); - CPicolViewBase::ViewActivatedL(aPrevViewId, aCustomMessageId, aCustomMessage); - CEikonEnv::Static()->AppUiFactory()->MenuBar()->MakeVisible(EFalse); - //iAppViewCtl.ChangeLayout(ETrue); - iAppViewCtl.SetRect(CEikonEnv::Static()->ScreenDevice()->SizeInPixels()); -} - - -//////////////////////////////////////////////////////////////// -// -// framework -// -//////////////////////////////////////////////////////////////// - -GLDEF_C TInt E32Dll(TDllReason) -{ - return KErrNone; -} - - -EXPORT_C CApaApplication* NewApplication() -{ - return new CPicolApplication; -} - - -TUid CPicolApplication::AppDllUid() const -{ - return KUidPicolApp; -} - diff --git a/platform/uiq2/launcher/App.h b/platform/uiq2/launcher/App.h deleted file mode 100644 index 1ac65265..00000000 --- a/platform/uiq2/launcher/App.h +++ /dev/null @@ -1,178 +0,0 @@ -/******************************************************************* - * - * File: App.h - * - * Author: Peter van Sebille (peter@yipton.net) - * - * Modified/adapted for picodriveN by notaz, 2006 - * - * (c) Copyright 2006, notaz - * (c) Copyright 2001, Peter van Sebille - * All Rights Reserved - * - *******************************************************************/ - -#ifndef __APP_H -#define __APP_H - -#include -#include -#include - -#include -#include -#include - -#include "Engine.h" -#include "../ClientServer.h" -#include "SimpleClient.h" -#include "picodriven.hrh" - -const TUid KUidPicolApp = { 0x1000C193 }; -const TUid KUidPicolFOView = { 0x1000C194 }; -const TUid KUidPicolFCView = { 0x1000C195 }; - -enum -{ - EScreenModeFlipOpen = 0, - EScreenModeFlipClosed -}; - - -//class CWsBitmap; - - -class CPicolDocument : public CEikDocument -{ -public: - ~CPicolDocument(); - CPicolDocument(CEikApplication& aApp); - void ConstructL(); - -private: // from CEikDocument - CEikAppUi* CreateAppUiL(); -}; - - -class CEPicolAppView : public CCoeControl // , public MCoeControlBrushContext -{ -public: - ~CEPicolAppView(); - void ConstructL(const TRect& aRect); - -private: - void Draw(const TRect& aRect) const; - - //CWsBitmap* iBgImage; - //TPoint iImagePosition; -}; - - -class CPicolViewBase : public CBase, public MCoeView -{ - public: - - CPicolViewBase(CEPicolAppView& aAppViewCtl) : iAppViewCtl(aAppViewCtl) {} - //~CPicolViewBase(); - - protected: - - // implements MCoeView: - virtual void ViewActivatedL(const TVwsViewId& /*aPrevViewId*/, TUid /*aCustomMessageId*/, const TDesC8& /*aCustomMessage*/); - virtual void ViewDeactivated(); - //virtual void ViewConstructL(); - - CEPicolAppView& iAppViewCtl; -}; - - -class CPicolFOView : public CPicolViewBase -{ - public: - - CPicolFOView(CEPicolAppView& aAppViewCtl) : CPicolViewBase(aAppViewCtl) {} - //~CPicolFOView(); - virtual TVwsViewId ViewId() const; - virtual TVwsViewIdAndMessage ViewScreenDeviceChangedL(); - virtual TBool ViewScreenModeCompatible(TInt aScreenMode); - virtual void ViewActivatedL(const TVwsViewId& /*aPrevViewId*/, TUid /*aCustomMessageId*/, const TDesC8& /*aCustomMessage*/); -}; - - -class CPicolFCView : public CPicolViewBase -{ - public: - - CPicolFCView(CEPicolAppView& aAppViewCtl) : CPicolViewBase(aAppViewCtl) {} - //~CPicolFCView(); - virtual TVwsViewId ViewId() const; - virtual TVwsViewIdAndMessage ViewScreenDeviceChangedL(); - virtual TBool ViewScreenModeCompatible(TInt aScreenMode); - virtual void ViewActivatedL(const TVwsViewId& /*aPrevViewId*/, TUid /*aCustomMessageId*/, const TDesC8& /*aCustomMessage*/); -}; - - - -class CPicolAppUi : public CEikAppUi, public MGameWatcher -{ -public: - CPicolAppUi(); - void ConstructL(); - ~CPicolAppUi(); - -public: // implements MGameWatcher - void NotifyEmuDeath(); - void NotifyForcedExit(); - - TBool EmuRunning() const; - -protected: // from CEikAppUi - void HandleCommandL(TInt aCommand); - void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane); - void HandleSystemEventL(const TWsEvent& aEvent); - -protected: // new stuf - void DisplayAboutDialogL(); - void DisplayOpenROMDialogL(); - void DisplayConfigDialogL(); - void DisplayDebugDialogL(); - - void StopGame(); - void RunGameL(); - void SendConfig(); - void RetrieveConfig(); - - CGameRunner* iGameRunner; - CExitForcer* iExitForcer; // makes sure emu process exits - CThreadWatcher* iThreadWatcher1; // emu process helper thread watcher - RServSession ss; - -private: - //void HandleScreenDeviceChangedL(); - //void HandleWsEventL(const TWsEvent& aEvent, CCoeControl* aDestination); - virtual void HandleApplicationSpecificEventL(TInt aType, const TWsEvent& aEvent); - -private: - TBool iQuitting; - TBool iROMLoaded; - TBool iEmuRunning; - TBool iAfterConfigDialog; - TTime iConfigDialogClosed; - TPicoConfig iCurrentConfig; - TPLauncherConfig iCurrentLConfig; - - CEPicolAppView* iAppView; - CPicolFOView* iFOView; - CPicolFCView* iFCView; -}; - - - -class CPicolApplication : public CEikApplication -{ -private: // from CApaApplication - CApaDocument* CreateDocumentL(); - TUid AppDllUid() const; -}; - -#endif diff --git a/platform/uiq2/launcher/CSimpleTextParser.cpp b/platform/uiq2/launcher/CSimpleTextParser.cpp deleted file mode 100644 index 865e35ee..00000000 --- a/platform/uiq2/launcher/CSimpleTextParser.cpp +++ /dev/null @@ -1,477 +0,0 @@ -/******************************************************************* - * - * File: CSimpleTextParser.cpp - * - * Author: Peter van Sebille (peter@yipton.net) - * - * (c) Copyright 2002, Peter van Sebille - * All Rights Reserved - * - *******************************************************************/ - -#include "CSimpleTextParser.h" - -enum -{ - EBadTag, - EBadZeroLengthTag, - EBadIntegerParam, - EBadAlignmentParam, - EBadRgbColorParam -}; - -void Panic(TInt aPanic) -{ - User::Panic(_L("STP"), aPanic); -} - -CSimpleTextFormatParser* CSimpleTextFormatParser::NewLC() -{ - CSimpleTextFormatParser* self = new(ELeave)CSimpleTextFormatParser; - CleanupStack::PushL(self); - self->ConstructL(); - return self; -} - -CSimpleTextFormatParser::~CSimpleTextFormatParser() -{ - delete iParaFormat; -} - -void CSimpleTextFormatParser::ConstructL() -{ - iParaFormat = CParaFormat::NewL(); -} - - -void CSimpleTextFormatParser::SetBold(TBool aEnable) -{ - iCharFormat.iFontSpec.iFontStyle.SetStrokeWeight(aEnable ? EStrokeWeightBold : EStrokeWeightNormal); - iCharMask.ClearAll(); - iCharMask.SetAttrib(EAttFontStrokeWeight); - iRichText->ApplyCharFormatL(iCharFormat, iCharMask, TextPos(), 0); -} - -void CSimpleTextFormatParser::SetItalic(TBool aEnable) -{ - iCharFormat.iFontSpec.iFontStyle.SetPosture(aEnable ? EPostureItalic : EPostureUpright); - iCharMask.ClearAll(); - iCharMask.SetAttrib(EAttFontPosture); - iRichText->ApplyCharFormatL(iCharFormat, iCharMask, TextPos(), 0); -} - -void CSimpleTextFormatParser::SetUnderLine(TBool aEnable) -{ - iCharFormat.iFontPresentation.iUnderline = aEnable ? EUnderlineOn : EUnderlineOff; - iCharMask.ClearAll(); - iCharMask.SetAttrib(EAttFontUnderline); - iRichText->ApplyCharFormatL(iCharFormat, iCharMask, TextPos(), 0); -} - -void CSimpleTextFormatParser::SetHiddenText(TBool aEnable) -{ - iCharFormat.iFontPresentation.iHiddenText = aEnable; - iCharMask.ClearAll(); - iCharMask.SetAttrib(EAttFontHiddenText); - iRichText->ApplyCharFormatL(iCharFormat, iCharMask, TextPos(), 0); -} - -TRgb CSimpleTextFormatParser::ForegroundColor() -{ - iCharMask.ClearAll(); - iCharMask.SetAttrib(EAttColor); - iRichText->GetCharFormat(iCharFormat, iCharMask, TextPos(), 0); - return iCharFormat.iFontPresentation.iTextColor; -} - -void CSimpleTextFormatParser::SetForegroundColor(const TRgb& aColor) -{ - iCharFormat.iFontPresentation.iTextColor = aColor; - iCharMask.ClearAll(); - iCharMask.SetAttrib(EAttColor); - iRichText->ApplyCharFormatL(iCharFormat, iCharMask, TextPos(), 0); -} - -void CSimpleTextFormatParser::SetBackgroundColor(const TRgb& aColor) -{ - iParaFormat->iFillColor = aColor; - iParaMask.ClearAll(); - iParaMask.SetAttrib(EAttFillColor); - iRichText->ApplyParaFormatL(iParaFormat, iParaMask, ParaPos(), 0); -} - -void CSimpleTextFormatParser::NewParagraph() -{ - iCurrentPara++; - iRichText->AppendParagraphL(); - AppendTextL(_L("")); -} - - -void CSimpleTextFormatParser::SetAlignment(CParaFormat::TAlignment aAlignment) -{ - iParaFormat->iHorizontalAlignment = aAlignment; - iParaMask.ClearAll(); - iParaMask.SetAttrib(EAttAlignment); - iRichText->ApplyParaFormatL(iParaFormat, iParaMask, ParaPos(), 0); -} - - -void CSimpleTextFormatParser::SetFontHeight(TInt aHeight) -{ - iCharFormat.iFontSpec.iHeight = (aHeight * KTwipsPerInch)/KPointsPerInch; - iCharMask.ClearAll(); - iCharMask.SetAttrib(EAttFontHeight); - iRichText->ApplyCharFormatL(iCharFormat, iCharMask, TextPos(), 0); -} - -void CSimpleTextFormatParser::SetFontName(const TDesC& aName) -{ - iCharFormat.iFontSpec.iTypeface.iName = aName; - iCharFormat.iFontSpec.iTypeface.SetAttributes(0); - iCharFormat.iFontSpec.iTypeface.SetIsProportional(ETrue); - iCharMask.ClearAll(); - iCharMask.SetAttrib(EAttFontTypeface); - iRichText->ApplyCharFormatL(iCharFormat, iCharMask, TextPos(), 0); -} - - -/* - * Character formatting: - * Bold on - * Bold of - * Italic on - * Italic off - * Underline on - * Underline off - * Hidden text on **doesn't work** - * Hidden text off **doesn't work** - * Fontname: name (type: string) - * Fontsize: size (type: integer) - * Foreground color: color (type: color) - * Restore foreground color - * - * Paragraph formatting: - *

New paragraph - will reset both character & paragraph formatting to defaults - * Alignment: aling (type: alignement) - * Background color: color (type: color) **doesn't work** - * - * Special characters: - * The character: < - * - * Types: - * - string: - * - integer: Either decimal or hexidecimal value - * - color: Either integer specifing rgb value, or (r,g,b) in which r, g and b are of type integer - * - align: element of enumeration {center, left, right} - * - * Comments: - * The syntax/parser is fairly simplistic. The parser is not trying to match a tag like - * as XML/HTML do. Basically, when it encounters a tag (e.g., ) it will - * simply instruct the the editor to apply the formatting from the current position as - * specified by the tag (e.g., enable bold). For example, HelloWorld results - * in Hello displayed in a Bold font and World in a normal font. - * - * The only case where state is maintained is when using and . The current - * fg color is stored when parsing and restored when doing . Again, and - * don't have the XML/HTML behavior. For example: - * Peterwashere - * results in "Peter" displayed in red, "was" displayed in blue and "here" displayed in red. - * It literally goes like this: - * 1) --> apply editor text color red, previous color = whatever the editor's text color is now - * 2) --> apply editor text color blue, previous color = whatever the editor's text color - * is now --> red - * 3) --> apply editor text to previous color --> red - * 4) --> apply editor text to previous color --> red - * - * What you probably wanted was: - * Peterwashere - * Now "Peter" is displayed in red, "was" in blue and "here" in the default editor's color - */ - -static TUint32 ParseInteger(const TDesC& aString) -{ - TUint32 val = 0; - TBool parsed = EFalse; - if (aString.Length() > 2) - { - if ((aString[0] == '0') && ((aString[0] == 'x') || (aString[0] == 'X'))) - { - TLex lex(aString.Right(aString.Length()-2)); - if (lex.Val(val, EHex) != KErrNone) - { - __ASSERT_DEBUG(ETrue, Panic(EBadIntegerParam)); - } - parsed = ETrue; - } - } - if (!parsed) - { - TLex lex(aString); - if (lex.Val(val, EDecimal) != KErrNone) - { - __ASSERT_DEBUG(ETrue, Panic(EBadIntegerParam)); - } - } - return val; -} - -static TRgb ParseColor(const TDesC& aString) -{ - if (aString.Length() > 0) - { - if (aString[0] == 'R') - { - if (aString.Compare(_L("RgbBlack")) == 0) - return KRgbBlack; - else if (aString.Compare(_L("RgbDarkGray")) == 0) - return KRgbDarkGray; - else if (aString.Compare(_L("RgbDarkRed")) == 0) - return KRgbDarkRed; - else if (aString.Compare(_L("RgbDarkGreen")) == 0) - return KRgbDarkGreen; - else if (aString.Compare(_L("RgbDarkYellow")) == 0) - return KRgbDarkYellow; - else if (aString.Compare(_L("RgbDarkBlue")) == 0) - return KRgbDarkBlue; - else if (aString.Compare(_L("RgbDarkMagenta")) == 0) - return KRgbDarkMagenta; - else if (aString.Compare(_L("RgbDarkCyan")) == 0) - return KRgbDarkCyan; - else if (aString.Compare(_L("RgbRed")) == 0) - return KRgbRed; - else if (aString.Compare(_L("RgbGreen")) == 0) - return KRgbGreen; - else if (aString.Compare(_L("RgbYellow")) == 0) - return KRgbYellow; - else if (aString.Compare(_L("RgbBlue")) == 0) - return KRgbBlue; - else if (aString.Compare(_L("RgbMagenta")) == 0) - return KRgbMagenta; - else if (aString.Compare(_L("RgbCyan")) == 0) - return KRgbCyan; - else if (aString.Compare(_L("RgbGray")) == 0) - return KRgbGray; - else if (aString.Compare(_L("RgbWhite")) == 0) - return KRgbWhite; - else - { - __ASSERT_DEBUG(ETrue, Panic(EBadRgbColorParam)); - } - } - return ParseInteger(aString); - } - __ASSERT_DEBUG(ETrue, Panic(EBadRgbColorParam)); - - return KRgbBlack; -} - - - -static CParaFormat::TAlignment ParseAlignment(const TDesC& aString) -{ - if (aString.Compare(_L("center")) == 0) - { - return CParaFormat::ECenterAlign; - } - else if (aString.Compare(_L("left")) == 0) - { - return CParaFormat::ELeftAlign; - } - else if (aString.Compare(_L("right")) == 0) - { - return CParaFormat::ERightAlign; - } - __ASSERT_DEBUG(ETrue, Panic(EBadAlignmentParam)); - - return CParaFormat::ECenterAlign; -} - -void CSimpleTextFormatParser::ParseTagL(const TDesC& aTag) -{ - TInt tagLength = aTag.Length(); - if (tagLength == 0) - { - __ASSERT_DEBUG(ETrue, Panic(EBadZeroLengthTag)); - return; - } - - TPtrC param(_L("")); - TInt pos = aTag.Find(_L("=")); - if (pos>0) - { - param.Set(aTag.Right(aTag.Length()-pos-1)); - tagLength = pos; - } - TPtrC tag = aTag.Left(tagLength); - -// RDebug::Print(_L("tag=%S, param=%S"), &tag, ¶m); - - switch (tagLength) - { - case 1: - { - if (tag.Compare(_L("a")) == 0) - SetAlignment(ParseAlignment(param)); - else if (tag.Compare(_L("b")) == 0) - SetBold(); - else if (tag.Compare(_L("f")) == 0) - SetFontName(param); - else if (tag.Compare(_L("h")) == 0) - SetHiddenText(); - else if (tag.Compare(_L("i")) == 0) - SetItalic(); - else if (tag.Compare(_L("p")) == 0) - NewParagraph(); - else if (tag.Compare(_L("s")) == 0) - SetFontHeight(ParseInteger(param)); - else if (tag.Compare(_L("u")) == 0) - SetUnderLine(); - else - { - __ASSERT_DEBUG(ETrue, Panic(EBadTag)); - } - break; - } - - case 2: - { - if (tag.Compare(_L("/b")) == 0) - SetBold(EFalse); - if (tag.Compare(_L("bg")) == 0) - SetBackgroundColor(ParseColor(param)); - if (tag.Compare(_L("fg")) == 0) - { - iPrevFgColor = ForegroundColor(); - SetForegroundColor(ParseColor(param)); - } - else if (tag.Compare(_L("/h")) == 0) - SetHiddenText(EFalse); - else if (tag.Compare(_L("/i")) == 0) - SetItalic(EFalse); - else if (tag.Compare(_L("/u")) == 0) - SetUnderLine(EFalse); - else if (tag.Compare(_L("/<")) == 0) - AppendTextL(_L("<")); - break; - } - case 3: - { - if (tag.Compare(_L("/fg")) == 0) - SetForegroundColor(iPrevFgColor); - break; - } - default: - ; - } -} - -void CSimpleTextFormatParser::ParseL(const TDesC& aSimpleText, CRichText& aRichText) -{ - iRichText = &aRichText; - iCurrentPara = 0; - - TBool done = EFalse; - TPtrC simpleText(aSimpleText); - do - { - TInt pos = simpleText.Locate('<'); - if (pos > 0) - { - AppendTextL(simpleText.Left(pos)); - simpleText.Set(simpleText.Right(simpleText.Length() - pos)); - } - else if (pos == 0) - { - pos = simpleText.Locate('>'); - if (pos<=0) - User::Leave(KErrArgument); - ParseTagL(simpleText.Mid(1, pos-1)); - simpleText.Set(simpleText.Right(simpleText.Length() - pos - 1)); - } - else - { - AppendTextL(simpleText); - done = ETrue; - } - } while (!done); -} - - -TInt CSimpleTextFormatParser::TextPos() -{ - return iRichText->DocumentLength(); -#if 0 - TInt pos, length; - pos = iRichText->CharPosOfParagraph(length, iCurrentPara); - return pos+length-1; -#endif -} - -TInt CSimpleTextFormatParser::ParaPos() -{ - return TextPos(); -#if 0 - TInt pos, length; - pos = iRichText->CharPosOfParagraph(length, iCurrentPara); - return pos+length-1; -#endif -} - - -void CSimpleTextFormatParser::AppendTextL(const TDesC& aText) -{ -// RDebug::Print(_L("text=%S"), &aText); - iRichText->InsertL(TextPos(), aText); -} - - -#if 0 -void CTestDialog::ShowTextL(CRichText& aRichText) -{ - aRichText.Reset(); - - TCharFormat charFormat; - TCharFormatMask charMask; - aRichText.GetCharFormat(charFormat, charMask, 0, 0); - - TInt para = 0; - AppendTextL(_L("http://www.yipton.net"), aRichText); - - para++; - aRichText.AppendParagraphL(); - - CParaFormat* paraFormat = CParaFormat::NewLC(); - TParaFormatMask paraMask; - aRichText.GetParaFormatL(paraFormat, paraMask, ParaPos(aRichText, para), 0); - paraFormat->iHorizontalAlignment = CParaFormat::ECenterAlign; - paraMask.ClearAll(); - paraMask.SetAttrib(EAttAlignment); - aRichText.ApplyParaFormatL(paraFormat, paraMask, ParaPos(aRichText, para), 0); - - charFormat.iFontPresentation.iUnderline = EUnderlineOn; - charFormat.iFontSpec.iFontStyle.SetPosture(EPostureItalic); - charMask.ClearAll(); - charMask.SetAttrib(EAttFontPosture); - charMask.SetAttrib(EAttFontUnderline); - aRichText.ApplyCharFormatL(charFormat, charMask, TextPos(aRichText, para)); - AppendTextL(_L("mailto:Peter is here"), aRichText, para); - - para++; - aRichText.AppendParagraphL(); - - TFontSpec fontSpec(_L("edmunds"), 20 * KPointsPerInch); -// CFont* font = NULL; -// iCoeEnv->ScreenDevice()->GetNearestFontInTwips(font, fontSpec); - - charFormat.iFontSpec = fontSpec; - charMask.ClearAll(); - charMask.SetAttrib(EAttFontHeight); - charMask.SetAttrib(EAttFontTypeface); - aRichText.ApplyCharFormatL(charFormat, charMask, TextPos(aRichText, para)); - AppendTextL(_L("mailto:Peter is here"), aRichText, para); - - CleanupStack::PopAndDestroy(); -} - -#endif diff --git a/platform/uiq2/launcher/CSimpleTextParser.h b/platform/uiq2/launcher/CSimpleTextParser.h deleted file mode 100644 index 6f6b76cf..00000000 --- a/platform/uiq2/launcher/CSimpleTextParser.h +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************* - * - * File: CSimpleTextParser.h - * - * Author: Peter van Sebille (peter@yipton.net) - * - * Modified/adapted for picodriveN by notaz, 2006 - * - * (c) Copyright 2006, notaz - * (c) Copyright 2002, Peter van Sebille - * All Rights Reserved - * - *******************************************************************/ - -#ifndef __CSIMPLE_TEXT_PARSER_H -#define __CSIMPLE_TEXT_PARSER_H - -#include -#include // CRichText -#include // CEikRichTextEditor - -class CSimpleTextFormatParser : public CBase -{ -public: - static CSimpleTextFormatParser* NewLC(); - void ParseL(const TDesC& aPSTText, CRichText& aRichText); - -protected: - CSimpleTextFormatParser(){} - ~CSimpleTextFormatParser(); - void ConstructL(); - - void ParseTagL(const TDesC& aTag); - - TRgb ForegroundColor(); - void SetBold(TBool aEnable=ETrue); - void SetItalic(TBool aEnable=ETrue); - void SetUnderLine(TBool aEnable=ETrue); - void SetFontHeight(TInt aHeight); - void SetFontName(const TDesC& aName); - void SetHiddenText(TBool aEnable=ETrue); - void SetForegroundColor(const TRgb& aColor); - - void NewParagraph(); - void SetAlignment(CParaFormat::TAlignment aAlignment); - void SetBackgroundColor(const TRgb& aColor); - - void AppendTextL(const TDesC& aText); - TInt TextPos(); - TInt ParaPos(); - - - CRichText* iRichText; - TCharFormat iCharFormat; - TCharFormatMask iCharMask; - CParaFormat* iParaFormat; - TParaFormatMask iParaMask; - TInt iCurrentPara; - TRgb iPrevFgColor; -}; - -#endif /* __CSIMPLE_TEXT_PARSER_H */ diff --git a/platform/uiq2/launcher/Dialogs.cpp b/platform/uiq2/launcher/Dialogs.cpp deleted file mode 100644 index 847d7b01..00000000 --- a/platform/uiq2/launcher/Dialogs.cpp +++ /dev/null @@ -1,473 +0,0 @@ -/******************************************************************* - * - * File: Dialogs.cpp - * - * Author: Peter van Sebille (peter@yipton.net) - * - * Modified/adapted for picodriveN by notaz, 2006 - * - * (c) Copyright 2006, notaz - * (c) Copyright 2002, Peter van Sebille - * All Rights Reserved - * - *******************************************************************/ - -#include "Dialogs.h" -#include "Engine.h" -#include "picodriven.hrh" -#include "picodriven.rsg" - -#include "../version.h" -#include "CSimpleTextParser.h" -#include // CRichText -#include // CEikRichTextEditor -#include // CEikHorOptionButtonList -#include // CEikOptionButton -#include // EQuartzKeyTwoWayDown - - -/************************************************ - * - * config Dialog - * - ************************************************/ - -CPicoConfigDialog::CPicoConfigDialog(TPicoConfig &cfg, TPLauncherConfig &cfgl) : config(cfg), config_l(cfgl) -{ -} - -void CPicoConfigDialog::PostLayoutDynInitL() -{ - CEikHorOptionButtonList *buttons_rot = (CEikHorOptionButtonList*) Control( ECtlOptRotation ); - CEikHorOptionButtonList *buttons_disp = (CEikHorOptionButtonList*) Control( ECtlOptScreenMode ); - CEikCheckBox *chkbox_altrend= (CEikCheckBox*) Control( ECtlOptUseAltRend ); - CEikCheckBox *chkbox_acctmng= (CEikCheckBox*) Control( ECtlOptUseAccTiming ); - CEikCheckBox *chkbox_sram = (CEikCheckBox*) Control( ECtlOptUseSRAM ); - CEikCheckBox *chkbox_fps = (CEikCheckBox*) Control( ECtlOptShowFPS ); - CEikCheckBox *chkbox_sound = (CEikCheckBox*) Control( ECtlOptEnableSound ); - CEikCheckBox *chkbox_z80 = (CEikCheckBox*) Control( ECtlOptEmulateZ80 ); - CEikCheckBox *chkbox_ym2612 = (CEikCheckBox*) Control( ECtlOptEmulateYM2612 ); - CEikCheckBox *chkbox_sn76496= (CEikCheckBox*) Control( ECtlOptEmulateSN76496 ); - CEikChoiceListBase *combo_sndq = (CEikChoiceListBase*) Control( ECtlOptSndQuality ); - CEikCheckBox *chkbox_6bpad = (CEikCheckBox*) Control( ECtlOpt6ButtonPad ); - CEikCheckBox *chkbox_gzipst = (CEikCheckBox*) Control( ECtlOptGzipStates ); - CEikCheckBox *chkbox_motvol = (CEikCheckBox*) Control( ECtlOptMotDontUseVol ); - CEikCheckBox *chkbox_accsprt= (CEikCheckBox*) Control( ECtlOptUseAccSprites ); - CEikChoiceListBase *combo_region = (CEikChoiceListBase*) Control( ECtlOptRegion ); - CEikOptionButton *opt_fit2 = (CEikOptionButton*) buttons_disp->ComponentControl( TPicoConfig::PMFit2 ); - - buttons_rot ->SetButtonById(ECtlOptRotation0 + config.iScreenRotation); - buttons_disp->SetButtonById(ECtlOptScreenModeCenter + config.iScreenMode); - chkbox_sram ->SetState(config.iFlags & 1 ? CEikButtonBase::ESet : CEikButtonBase::EClear); - chkbox_fps ->SetState(config.iFlags & 2 ? CEikButtonBase::ESet : CEikButtonBase::EClear); - chkbox_sound ->SetState(config.iFlags & 4 ? CEikButtonBase::ESet : CEikButtonBase::EClear); - chkbox_motvol ->SetState(config.iFlags & 0x40 ? CEikButtonBase::ESet : CEikButtonBase::EClear); - chkbox_gzipst ->SetState(config.iFlags & 0x80 ? CEikButtonBase::ESet : CEikButtonBase::EClear); - chkbox_z80 ->SetState(config.iPicoOpt & 4 ? CEikButtonBase::ESet : CEikButtonBase::EClear); - chkbox_ym2612 ->SetState(config.iPicoOpt & 1 ? CEikButtonBase::ESet : CEikButtonBase::EClear); - chkbox_sn76496->SetState(config.iPicoOpt & 2 ? CEikButtonBase::ESet : CEikButtonBase::EClear); - chkbox_altrend->SetState(config.iPicoOpt & 0x10? CEikButtonBase::ESet : CEikButtonBase::EClear); - chkbox_6bpad ->SetState(config.iPicoOpt & 0x20? CEikButtonBase::ESet : CEikButtonBase::EClear); - chkbox_acctmng->SetState(config.iPicoOpt & 0x40? CEikButtonBase::ESet : CEikButtonBase::EClear); - chkbox_accsprt->SetState(config.iPicoOpt & 0x80? CEikButtonBase::ESet : CEikButtonBase::EClear); - - // hide "fit2" if we are not in 0 or 180 mode - if(config.iScreenRotation != TPicoConfig::PRot0 && config.iScreenRotation != TPicoConfig::PRot180) opt_fit2->MakeVisible(EFalse); - // dim some stuff for alternative renderer - if(config.iPicoOpt & 0x10) { - buttons_disp->SetDimmed(ETrue); - ((CEikOptionButton*)(buttons_rot->ComponentControl(TPicoConfig::PRot0)))->SetDimmed(ETrue); - ((CEikOptionButton*)(buttons_rot->ComponentControl(TPicoConfig::PRot180)))->SetDimmed(ETrue); - } - // dim accurate sprites - if(config.iPicoOpt & 0x10) { - chkbox_accsprt->SetState(CEikButtonBase::EClear); - chkbox_accsprt->SetDimmed(ETrue); - } - - TInt sel = (config.iPicoOpt&8) ? 4 : 0; - sel+= (config.iFlags>>3)&3; - combo_sndq->SetCurrentItem(sel); - switch(config.PicoRegion) { - case 1: sel = 4; break; - case 2: sel = 3; break; - case 4: sel = 2; break; - case 8: sel = 1; break; - default:sel = 0; // auto - } - combo_region->SetCurrentItem(sel); -} - -TBool CPicoConfigDialog::OkToExitL(TInt aButtonId) -{ - if(aButtonId != EEikBidOk) return ETrue; - - CEikHorOptionButtonList *buttons_rot = (CEikHorOptionButtonList*) Control( ECtlOptRotation ); - CEikHorOptionButtonList *buttons_disp = (CEikHorOptionButtonList*) Control( ECtlOptScreenMode ); - CEikCheckBox *chkbox_altrend= (CEikCheckBox*) Control( ECtlOptUseAltRend ); - CEikCheckBox *chkbox_acctmng= (CEikCheckBox*) Control( ECtlOptUseAccTiming ); - CEikCheckBox *chkbox_sram = (CEikCheckBox*) Control( ECtlOptUseSRAM ); - CEikCheckBox *chkbox_fps = (CEikCheckBox*) Control( ECtlOptShowFPS ); - CEikCheckBox *chkbox_sound = (CEikCheckBox*) Control( ECtlOptEnableSound ); - CEikCheckBox *chkbox_z80 = (CEikCheckBox*) Control( ECtlOptEmulateZ80 ); - CEikCheckBox *chkbox_ym2612 = (CEikCheckBox*) Control( ECtlOptEmulateYM2612 ); - CEikCheckBox *chkbox_sn76496= (CEikCheckBox*) Control( ECtlOptEmulateSN76496 ); - CEikChoiceListBase *combo_sndq = (CEikChoiceListBase*) Control( ECtlOptSndQuality ); - CEikCheckBox *chkbox_6bpad = (CEikCheckBox*) Control( ECtlOpt6ButtonPad ); - CEikCheckBox *chkbox_gzipst = (CEikCheckBox*) Control( ECtlOptGzipStates ); - CEikCheckBox *chkbox_motvol = (CEikCheckBox*) Control( ECtlOptMotDontUseVol ); - CEikCheckBox *chkbox_accsprt= (CEikCheckBox*) Control( ECtlOptUseAccSprites ); - CEikChoiceListBase *combo_region = (CEikChoiceListBase*) Control( ECtlOptRegion ); - - config.iScreenRotation = (TPicoConfig::TPicoScreenRotation) (buttons_rot->LabeledButtonId() - ECtlOptRotation0); - config.iScreenMode = (TPicoConfig::TPicoScreenMode) (buttons_disp->LabeledButtonId() - ECtlOptScreenModeCenter); - - if(chkbox_sram ->State() == CEikButtonBase::ESet) config.iFlags |= 1; else config.iFlags &= ~1; - if(chkbox_fps ->State() == CEikButtonBase::ESet) config.iFlags |= 2; else config.iFlags &= ~2; - if(chkbox_sound ->State() == CEikButtonBase::ESet) config.iFlags |= 4; else config.iFlags &= ~4; - if(chkbox_motvol ->State() == CEikButtonBase::ESet) config.iFlags |= 0x40; else config.iFlags &= ~0x40; - if(chkbox_gzipst ->State() == CEikButtonBase::ESet) config.iFlags |= 0x80; else config.iFlags &= ~0x80; - if(chkbox_z80 ->State() == CEikButtonBase::ESet) config.iPicoOpt |= 4; else config.iPicoOpt &= ~4; - if(chkbox_ym2612 ->State() == CEikButtonBase::ESet) config.iPicoOpt |= 1; else config.iPicoOpt &= ~1; - if(chkbox_sn76496->State() == CEikButtonBase::ESet) config.iPicoOpt |= 2; else config.iPicoOpt &= ~2; - if(chkbox_altrend->State() == CEikButtonBase::ESet) config.iPicoOpt |= 0x10;else config.iPicoOpt &= ~0x10; - if(chkbox_6bpad ->State() == CEikButtonBase::ESet) config.iPicoOpt |= 0x20;else config.iPicoOpt &= ~0x20; - if(chkbox_acctmng->State() == CEikButtonBase::ESet) config.iPicoOpt |= 0x40;else config.iPicoOpt &= ~0x40; - if(chkbox_accsprt->State() == CEikButtonBase::ESet) config.iPicoOpt |= 0x80;else config.iPicoOpt &= ~0x80; - - TInt sel = combo_sndq->CurrentItem(); - if(sel > 3) { config.iPicoOpt |= 8; sel-=4; } else config.iPicoOpt &= ~8; - config.iFlags &= ~0x18; - config.iFlags |= (sel<<3)&0x18; - - switch(combo_region->CurrentItem()) { - case 4: config.PicoRegion = 1; break; - case 3: config.PicoRegion = 2; break; - case 2: config.PicoRegion = 4; break; - case 1: config.PicoRegion = 8; break; - default:config.PicoRegion = 0; // auto - } - - return ETrue; -} - -// simple GUI stuff needs lots of code -void CPicoConfigDialog::HandleControlStateChangeL(TInt aControlId) -{ - if(aControlId == ECtlOptEnableSound) { - CEikCheckBox *chkbox_sound = (CEikCheckBox*) Control( ECtlOptEnableSound ); - CEikCheckBox *chkbox_z80 = (CEikCheckBox*) Control( ECtlOptEmulateZ80 ); - CEikCheckBox *chkbox_ym2612 = (CEikCheckBox*) Control( ECtlOptEmulateYM2612 ); - CEikCheckBox *chkbox_sn76496= (CEikCheckBox*) Control( ECtlOptEmulateSN76496 ); - - if(chkbox_sound->State() == CEikButtonBase::ESet) { - // check all sound chips too, but only if they all are not set - if((chkbox_z80->State() | chkbox_ym2612->State() | chkbox_sn76496->State()) == CEikButtonBase::EClear) { // (==0) - chkbox_z80 ->SetState(CEikButtonBase::ESet); - chkbox_ym2612 ->SetState(CEikButtonBase::ESet); - chkbox_sn76496->SetState(CEikButtonBase::ESet); - chkbox_z80 ->DrawDeferred(); - chkbox_ym2612 ->DrawDeferred(); - chkbox_sn76496->DrawDeferred(); - } - } else { - // clear everything, but only if everything is set - if((chkbox_z80->State() & chkbox_ym2612->State() & chkbox_sn76496->State()) == CEikButtonBase::ESet) { // (==1) - chkbox_z80 ->SetState(CEikButtonBase::EClear); - chkbox_ym2612 ->SetState(CEikButtonBase::EClear); - chkbox_sn76496->SetState(CEikButtonBase::EClear); - chkbox_z80 ->DrawDeferred(); - chkbox_ym2612 ->DrawDeferred(); - chkbox_sn76496->DrawDeferred(); - } - } - } else if(aControlId == ECtlOptUseAltRend) { - CEikCheckBox *chkbox_altrend= (CEikCheckBox*) Control( ECtlOptUseAltRend ); - CEikCheckBox *chkbox_accsprt= (CEikCheckBox*) Control( ECtlOptUseAccSprites ); - CEikHorOptionButtonList *buttons_rot = (CEikHorOptionButtonList*) Control( ECtlOptRotation ); - CEikHorOptionButtonList *buttons_disp = (CEikHorOptionButtonList*) Control( ECtlOptScreenMode ); - - TBool dimmed = chkbox_altrend->State() == CEikButtonBase::ESet; - // show/hide more stuff for alternative renderer - buttons_disp->SetDimmed(dimmed); - chkbox_accsprt->SetDimmed(dimmed); - ((CEikOptionButton*)(buttons_rot->ComponentControl(TPicoConfig::PRot0)))->SetDimmed(dimmed); - ((CEikOptionButton*)(buttons_rot->ComponentControl(TPicoConfig::PRot180)))->SetDimmed(dimmed); - if(dimmed && buttons_rot->LabeledButtonId() != ECtlOptRotation90 && buttons_rot->LabeledButtonId() != ECtlOptRotation270) { - buttons_rot->SetButtonById(ECtlOptRotation90); - aControlId = ECtlOptRotation; // cause rotation update - } - buttons_disp->SetButtonById(ECtlOptScreenModeCenter); - chkbox_accsprt->DrawDeferred(); - buttons_disp->DrawDeferred(); - buttons_rot->DrawDeferred(); - } - if(aControlId == ECtlOptRotation) { - CEikHorOptionButtonList *buttons_rot = (CEikHorOptionButtonList*) Control( ECtlOptRotation ); - CEikHorOptionButtonList *buttons_disp = (CEikHorOptionButtonList*) Control( ECtlOptScreenMode ); - CEikOptionButton *opt_fit2 = (CEikOptionButton*) buttons_disp->ComponentControl( TPicoConfig::PMFit2 ); - - if(buttons_rot->LabeledButtonId() == ECtlOptRotation0 || buttons_rot->LabeledButtonId() == ECtlOptRotation180) { - opt_fit2->MakeVisible(ETrue); - opt_fit2->DrawDeferred(); - } else { - if(opt_fit2->State() == CEikButtonBase::ESet) { - buttons_disp->SetButtonById(ECtlOptScreenModeFit); - buttons_disp->DrawDeferred(); - } - opt_fit2->MakeVisible(EFalse); - } - } -} - - -/************************************************************* -* -* Credits dialog -* -**************************************************************/ - -void CCreditsDialog::PreLayoutDynInitL() -{ - CDesCArrayFlat* desArray = CEikonEnv::Static()->ReadDesCArrayResourceL(iMessageResourceID); - CleanupStack::PushL(desArray); - - TInt iLength; - TInt count = desArray->Count(); - for (TInt i=0 ;i < count; i++) - { - iLength = static_cast(Control(ECtlCredits))->TextLength(); - static_cast(Control(ECtlCredits))->Text()->InsertL(iLength, desArray->operator[](i)); - iLength = static_cast(Control(ECtlCredits))->TextLength(); - static_cast(Control(ECtlCredits))->Text()->InsertL(iLength, CEditableText::ELineBreak); - } - CleanupStack::PopAndDestroy(desArray); -} - -void CCreditsDialog::PostLayoutDynInitL() -{ - static_cast(Control(ECtlCredits))->CreateScrollBarFrameL(); - static_cast(Control(ECtlCredits))->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto); -} - -TKeyResponse CCreditsDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) -{ - if (aType == EEventKey) - { - if (aKeyEvent.iCode == EQuartzKeyTwoWayDown) - { - static_cast(Control(ECtlCredits))->MoveDisplayL(TCursorPosition::EFLineDown); - static_cast(Control(ECtlCredits))->UpdateScrollBarsL(); - return EKeyWasConsumed; - } - else if (aKeyEvent.iCode == EQuartzKeyTwoWayUp) - { - static_cast(Control(ECtlCredits))->MoveDisplayL(TCursorPosition::EFLineUp); - static_cast(Control(ECtlCredits))->UpdateScrollBarsL(); - return EKeyWasConsumed; - } - } - return CEikDialog::OfferKeyEventL(aKeyEvent, aType); -} - - -/************************************************************* -* -* Debug dialog -* -**************************************************************/ - -CDebugDialog::CDebugDialog(char *t) -{ - Mem::Copy(iText, t, 1024); - iText[1023] = 0; -} - -void CDebugDialog::PreLayoutDynInitL() -{ - char *p = iText, *line = iText; - TBool end=0; - TBuf<128> tbuf; - CEikGlobalTextEditor *editor = static_cast(Control(ECtlDebugEdit)); - - while(!end) { - while(*p && *p != '\r' && *p != '\n') p++; - if(!*p) end=1; - *p = 0; - TPtrC8 ptr((TUint8*) line); - tbuf.Copy(ptr); - editor->Text()->InsertL(editor->TextLength(), tbuf); - editor->Text()->InsertL(editor->TextLength(), CEditableText::ELineBreak); - line = ++p; - } -} - -void CDebugDialog::PostLayoutDynInitL() -{ - static_cast(Control(ECtlDebugEdit))->CreateScrollBarFrameL(); - static_cast(Control(ECtlDebugEdit))->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto); -} - -TKeyResponse CDebugDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) -{ - if (aType == EEventKey) - { - if (aKeyEvent.iCode == EQuartzKeyTwoWayDown) - { - static_cast(Control(ECtlDebugEdit))->MoveDisplayL(TCursorPosition::EFLineDown); - static_cast(Control(ECtlDebugEdit))->UpdateScrollBarsL(); - return EKeyWasConsumed; - } - else if (aKeyEvent.iCode == EQuartzKeyTwoWayUp) - { - static_cast(Control(ECtlDebugEdit))->MoveDisplayL(TCursorPosition::EFLineUp); - static_cast(Control(ECtlDebugEdit))->UpdateScrollBarsL(); - return EKeyWasConsumed; - } - } - return CEikDialog::OfferKeyEventL(aKeyEvent, aType); -} - - -/************************************************ - * - * SimpleTextInfoDialog - * - ************************************************/ - - -CSimpleTextInfoDialog::CSimpleTextInfoDialog(TInt aTextIdOne, TInt aRichTextCtlIdOne, TInt aTextIdTwo, TInt aRichTextCtlIdTwo, TBool aSimpleTextResIdOneIsArray, TBool aSimpleTextResIdTwoIsArray) - : iSimpleTextResIdOne(aTextIdOne), - iSimpleTextResIdTwo(aTextIdTwo), - iRichTextCtlIdOne(aRichTextCtlIdOne), - iRichTextCtlIdTwo(aRichTextCtlIdTwo), - iSimpleTextResIdOneIsArray(aSimpleTextResIdOneIsArray), - iSimpleTextResIdTwoIsArray(aSimpleTextResIdTwoIsArray), - iSetDialogBackground(ETrue) -{ -} - -void CSimpleTextInfoDialog::PreLayoutDynInitL() -{ - CEikRichTextEditor* richTextEditor; - - if (iRichTextCtlIdOne != -1) - { - richTextEditor=STATIC_CAST(CEikRichTextEditor*, Control(iRichTextCtlIdOne)); - PreLayoutDynInitRichTextL(*richTextEditor, iRichTextCtlIdOne, iSimpleTextResIdOne); - } - - if (iRichTextCtlIdTwo != -1) - { - richTextEditor=STATIC_CAST(CEikRichTextEditor*, Control(iRichTextCtlIdTwo)); - richTextEditor->Border().SetType(ENone); - PreLayoutDynInitRichTextL(*richTextEditor, iRichTextCtlIdTwo, iSimpleTextResIdTwo); - } -} - - -void CSimpleTextInfoDialog::PreLayoutDynInitRichTextL(CEikRichTextEditor& aRichTextEditor, TInt aRichTextCtlId, TInt aSimpleTextResId) -{ - iEikonEnv->BusyMsgL(_L("Opening")); - aRichTextEditor.SetEdwinSizeObserver(this); - if (iSetDialogBackground) - aRichTextEditor.SetBackgroundColorL(iEikonEnv->Color(EColorDialogBackground)); - aRichTextEditor.SetSize(aRichTextEditor.Size()); // Set the size of the edwin - - // no scrollbars for us - aRichTextEditor.CreateScrollBarFrameL(); // Create the scrollbars - aRichTextEditor.ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, iWantVertScrollbar ? CEikScrollBarFrame::EAuto: CEikScrollBarFrame::EOff); - - ShowTextL(*aRichTextEditor.RichText(), aRichTextCtlId, aSimpleTextResId); - - aRichTextEditor.UpdateAllFieldsL(); // Updates all the fields in the document - - aRichTextEditor.UpdateScrollBarsL(); -} - - -void CSimpleTextInfoDialog::PostLayoutDynInitL() -{ - Layout(); - iEikonEnv->BusyMsgCancel(); -} - -TBool CSimpleTextInfoDialog::HandleEdwinSizeEventL(CEikEdwin* aEdwin, TEdwinSizeEvent aEventType, TSize aDesirableEdwinSize) -{ - if ((aEventType == EEventSizeChanging)) - aEdwin->SetSize(aDesirableEdwinSize); - return EFalse; -} - -void CSimpleTextInfoDialog::ShowTextL(CRichText& aRichText, TInt /*aRichTextCtlId*/, TInt aResId) -{ - if (aResId != -1) - { - if ( ((aResId == iSimpleTextResIdOne) && (iSimpleTextResIdOneIsArray)) || - ((aResId == iSimpleTextResIdTwo) && (iSimpleTextResIdTwoIsArray)) - ) - { - CDesCArrayFlat* desArray = CEikonEnv::Static()->ReadDesCArrayResourceL(aResId); - CleanupStack::PushL(desArray); - - CSimpleTextFormatParser* parser = CSimpleTextFormatParser::NewLC(); - - TInt count = desArray->Count(); - for (TInt i=0 ;iParseL(desArray->operator[](i), aRichText); - - CleanupStack::PopAndDestroy(parser); - CleanupStack::PopAndDestroy(desArray); - } - else - { - HBufC* text = CEikonEnv::Static()->AllocReadResourceLC(aResId); - ShowSimpleTextL(*text, aRichText); - CleanupStack::PopAndDestroy(text); - } - } -} - -void CSimpleTextInfoDialog::ShowSimpleTextL(const TDesC& aSimpleText, CRichText& aRichText) -{ - CSimpleTextFormatParser* parser = CSimpleTextFormatParser::NewLC(); - parser->ParseL(aSimpleText, aRichText); - - CleanupStack::PopAndDestroy(parser); -} - - - -/************************************************ - * - * About Dialog - * - ************************************************/ - -CAboutDialog::CAboutDialog() : CSimpleTextInfoDialog(-1, ECtlAboutVersion, R_SIMPLE_TEXT_ABOUT_LINKS, ECtlAboutLinks) -{ -} - -void CAboutDialog::ShowTextL(CRichText& aRichText, TInt aRichTextCtlId, TInt aResId) -{ - if (aRichTextCtlId == ECtlAboutLinks) - CSimpleTextInfoDialog::ShowTextL(aRichText, aRichTextCtlId, aResId); - else - { - TBuf<16> versionText; - TBuf<512> text; - - #if (KPicoBuildNumber != 0) - versionText.Format(_L("%d.%d%d"), KPicoMajorVersionNumber, KPicoMinorVersionNumber, KPicoBuildNumber); - #else - versionText.Format(_L("%d.%d"), KPicoMajorVersionNumber, KPicoMinorVersionNumber); - #endif - - HBufC* aboutFormat = CEikonEnv::Static()->AllocReadResourceLC(R_SIMPLE_TEXT_ABOUT); - text.Format(*aboutFormat, &versionText); - - ShowSimpleTextL(text, aRichText); - - CleanupStack::PopAndDestroy(aboutFormat); - } -} diff --git a/platform/uiq2/launcher/Dialogs.h b/platform/uiq2/launcher/Dialogs.h deleted file mode 100644 index c8076e6f..00000000 --- a/platform/uiq2/launcher/Dialogs.h +++ /dev/null @@ -1,145 +0,0 @@ -/******************************************************************* - * - * File: Dialogs.h - * - * Author: Peter van Sebille (peter@yipton.net) - * - * Modified/adapted for picodriveN by notaz, 2006 - * - * (c) Copyright 2006, notaz - * (c) Copyright 2002, Peter van Sebille - * All Rights Reserved - * - *******************************************************************/ - -#ifndef __DIALOGS_H -#define __DIALOGS_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "../ClientServer.h" - -class CRichText; -class CEikRichTextEditor; -class TPLauncherConfig; - -/************************************************ - * - * CSimpleTextInfo Dialog - * - ************************************************/ - -class CSimpleTextInfoDialog : public CEikDialog, public MEikEdwinSizeObserver -{ -public: - CSimpleTextInfoDialog(TInt aTextIdOne = -1, TInt aRichTextCtlIdOne = -1, - TInt aTextIdTwo = -1, TInt aRichTextCtlIdTwo = -1, - TBool aSimpleTextResIdOneIsArray = EFalse, TBool aSimpleTextResIdTwoIsArray = EFalse - ); - void SetDialogBackground(TBool aEnable){iSetDialogBackground=aEnable;} - void WantVertScrollbar(TBool aEnable){iWantVertScrollbar=aEnable;} -public: // implements MEikEdwinSizeObserver - virtual TBool HandleEdwinSizeEventL(CEikEdwin* aEdwin, TEdwinSizeEvent aEventType, TSize aDesirableEdwinSize); - -protected: // framework - void PreLayoutDynInitL(); - void PostLayoutDynInitL(); - -protected: // new stuff - virtual void ShowTextL(CRichText& aRichText, TInt aRichTextCtlId, TInt aResId); - virtual void PreLayoutDynInitRichTextL(CEikRichTextEditor& aRichTextEditor, TInt aRichTextCtlId, TInt aResId); - - void ShowSimpleTextL(const TDesC& aSimpleText, CRichText& aRichText); - - TInt iSimpleTextResIdOne; - TInt iSimpleTextResIdTwo; - TInt iRichTextCtlIdOne; - TInt iRichTextCtlIdTwo; - TBool iSimpleTextResIdOneIsArray; - TBool iSimpleTextResIdTwoIsArray; - TBool iSetDialogBackground; - TBool iWantVertScrollbar; -}; - - -/************************************************ - * - * config Dialog - * - ************************************************/ - -class CPicoConfigDialog : public CEikDialog -{ -public: - CPicoConfigDialog(TPicoConfig &cfg, TPLauncherConfig &cfgl); - -protected: // framework - void PostLayoutDynInitL(); - void HandleControlStateChangeL(TInt aControlId); - TBool OkToExitL(TInt aButtonId); - - TPicoConfig &config; - TPLauncherConfig &config_l; -}; - - -/************************************************ - * - * About Dialog - * - ************************************************/ - -class CAboutDialog : public CSimpleTextInfoDialog -{ -public: - CAboutDialog(); -protected: // from CSimpleTextInfoDialog - virtual void ShowTextL(CRichText& aRichText, TInt aRichTextCtlId, TInt aResId); -}; - -/************************************************************* -* -* Credits dialog -* -**************************************************************/ - -class CCreditsDialog : public CEikDialog -{ -public: - TInt iMessageResourceID; - -protected: - void PreLayoutDynInitL(); - void PostLayoutDynInitL(); - TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); -}; - -/************************************************************* -* -* Debug dialog -* -**************************************************************/ - -class CDebugDialog : public CEikDialog -{ -public: - CDebugDialog(char *t); - -protected: - char iText[1024]; - void PreLayoutDynInitL(); - void PostLayoutDynInitL(); - TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); -}; - - - -#endif // __DIALOGS_H diff --git a/platform/uiq2/launcher/Engine.cpp b/platform/uiq2/launcher/Engine.cpp deleted file mode 100644 index 489cd4fa..00000000 --- a/platform/uiq2/launcher/Engine.cpp +++ /dev/null @@ -1,256 +0,0 @@ -/******************************************************************* - * - * File: Engine.cpp - * - * Author: Peter van Sebille (peter@yipton.net) - * - * Modified/adapted for picodriveN by notaz, 2006 - * - * (c) Copyright 2006, notaz - * (c) Copyright 2002, Peter van Sebille - * All Rights Reserved - * - *******************************************************************/ - -#include "Engine.h" -#include -#include -//#include - -#include "../version.h" - - -CGameRunner::~CGameRunner() -{ - Cancel(); - - RProcess process; - if(process.Open(iProcessId) == KErrNone) { - process.Terminate(1); - process.Close(); - } -} - -CGameRunner::CGameRunner(MGameWatcher& aGameWatcher) -: CActive(CActive::EPriorityStandard), iGameWatcher(aGameWatcher) -{ -} - - -CGameRunner* CGameRunner::NewL(MGameWatcher& aGameWatcher) -{ - CGameRunner* self = new(ELeave) CGameRunner(aGameWatcher); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); // self - return self; -} - -void CGameRunner::ConstructL() -{ - RProcess newProcess, thisProcess; - - // make path to picosmall - TBuf exePath; - TBuf tmpbuff; // hopefully large enough - thisProcess.CommandLine(tmpbuff); - TInt pos = tmpbuff.Find(_L(" ")); - if(pos == KErrNotFound) pos = tmpbuff.Length(); - for(pos--; pos > 2; pos--) - if(tmpbuff[pos] == '\\') break; - if(pos > 2) { - exePath.Copy(tmpbuff.Ptr(), pos+1); - exePath.Append(_L("PICOSMALL.EXE")); - } - - DEBUGPRINT(_L("[app] starting EXE: %S"), &exePath); - if(newProcess.Create(exePath, _L(""))) { - CEikonEnv::Static()->InfoWinL(_L("Error"), _L("Failed to start emulation process.")); - thisProcess.Terminate(1); - } - - iProcessId = newProcess.Id(); - DEBUGPRINT(_L("[app] newProcess.Id(): %d"), iProcessId); - - CActiveScheduler::Add(this); - newProcess.SetOwner(thisProcess); // Warning: phone strangely reboots when attempting to get owner after thisProcess exits - newProcess.Logon(iStatus); - - SetActive(); - - newProcess.Resume(); // start execution - newProcess.Close(); -} - -void CGameRunner::RunL() -{ - iGameWatcher.NotifyEmuDeath(); -} - -void CGameRunner::DoCancel() -{ - RProcess process; - if(process.Open(iProcessId) == KErrNone) { - process.LogonCancel(iStatus); - process.Close(); - } -} - - -// CExitForcer -CExitForcer::~CExitForcer() -{ - Cancel(); -} - -CExitForcer::CExitForcer(MGameWatcher& aGameWatcher) : CActive(CActive::EPriorityStandard), iGameWatcher(aGameWatcher) -{ -} - - -CExitForcer* CExitForcer::NewL(MGameWatcher& aGameWatcher, TInt ms) -{ - CExitForcer* self = new(ELeave) CExitForcer(aGameWatcher); - CleanupStack::PushL(self); - self->ConstructL(ms); - CleanupStack::Pop(); // self - return self; -} - -void CExitForcer::ConstructL(TInt ms) -{ - CActiveScheduler::Add(this); - iTimer.CreateLocal(); - iTimer.After(iStatus, ms*1000); - SetActive(); -} - -void CExitForcer::RunL() -{ - iGameWatcher.NotifyForcedExit(); -} - -void CExitForcer::DoCancel() -{ - if(iTimer.Handle()) { - iTimer.Cancel(); - iTimer.Close(); - } -} - - -// CThreadWatcher -CThreadWatcher::~CThreadWatcher() -{ - Cancel(); -} - -CThreadWatcher::CThreadWatcher(MGameWatcher& aGameWatcher, const TDesC& aName) -: CActive(CActive::EPriorityStandard), iGameWatcher(aGameWatcher), iName(aName) -{ -} - - -CThreadWatcher* CThreadWatcher::NewL(MGameWatcher& aGameWatcher, const TDesC& aName) -{ - CThreadWatcher* self = new(ELeave) CThreadWatcher(aGameWatcher, aName); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); // self - return self; -} - -void CThreadWatcher::ConstructL() -{ - CActiveScheduler::Add(this); - RThread thread; - if(thread.Open(iName) == KErrNone) { - thread.Logon(iStatus); - thread.Close(); - SetActive(); - } -} - -void CThreadWatcher::RunL() -{ - iGameWatcher.NotifyEmuDeath(); -} - -void CThreadWatcher::DoCancel() -{ - RThread thread; - if(thread.Open(iName) == KErrNone) { - thread.LogonCancel(iStatus); - thread.Close(); - } -} - - -// config -TPLauncherConfig::TPLauncherConfig(TPicoConfig &cfg) -: iEmuConfig(cfg) -{ - iLastROMFile.Copy(_L("C:\\")); - - // ini - TBuf tmpbuff; // hopefully large enough - RProcess me; - me.CommandLine(tmpbuff); - TInt pos = tmpbuff.Find(_L(" ")); - if(pos == KErrNotFound) pos = tmpbuff.Length(); - if(pos > 3) { - iIniFileName.Copy(tmpbuff.Ptr(), pos-3); - iIniFileName.Append(_L("ini")); - } - //DEBUGPRINT(_L("[app] made ini: %S"), &iIniFileName); -} - - -void TPLauncherConfig::Load() -{ - RFile file; - - if(!file.Open(CEikonEnv::Static()->FsSession(), iIniFileName, 0)) - { - TInt version; - TPckg pkg_version(version); - TPckg pkg_Pad(iPad); - TBuf8 pad0; // reserved for future use (6 words) - TPtr8 picoCfg((TUint8*) &iEmuConfig, sizeof(iEmuConfig)); - - file.Read(pkg_version); - file.Read(pkg_Pad); - file.Read(pad0, 24); - file.Read(pad0, KMaxFileName); - file.Read(picoCfg); - - TBuf8 file8(pad0.Ptr()); // take as zero terminated string - iLastROMFile.Copy(file8); - //DEBUGPRINT(_L("[app] iLastROMFile (%i): %S"), iLastROMFile.Length(), &iLastROMFile); - - file.Close(); - } -} - -void TPLauncherConfig::Save() -{ - RFile file; - - if(!file.Replace(CEikonEnv::Static()->FsSession(), iIniFileName, EFileWrite)) { - TInt version = (KPicoMajorVersionNumber<<24)+(KPicoMinorVersionNumber<<16); - TPckgC pkg_version(version); - TPckgC pkg_Pad(iPad); - TBuf8 pad0; pad0.FillZ(KMaxFileName); - TBuf8 file8; file8.Copy(iLastROMFile); - TPtrC8 picoCfg((TUint8*) &iEmuConfig, sizeof(iEmuConfig)); - - file.Write(pkg_version); - file.Write(pkg_Pad); // 0x0004 - file.Write(pad0, 24); // 0x0008, reserved for future use (6 words) - file.Write(file8); // 0x0020 - file.Write(pad0, KMaxFileName-file8.Length()); - file.Write(picoCfg); // 0x0120 - - file.Close(); - } -} diff --git a/platform/uiq2/launcher/Engine.h b/platform/uiq2/launcher/Engine.h deleted file mode 100644 index 052edc88..00000000 --- a/platform/uiq2/launcher/Engine.h +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************* - * - * File: Engine.h - * - * Author: Peter van Sebille (peter@yipton.net) - * - * Modified/adapted for picodriveN by notaz, 2006 - * - * (c) Copyright 2006, notaz - * (c) Copyright 2002, Peter van Sebille - * All Rights Reserved - * - *******************************************************************/ - -#ifndef __ENGINE_H -#define __ENGINE_H - -#include -#include - -#include "../ClientServer.h" - -class RFs; - -#ifdef __DEBUG_PRINT - #define DEBUGPRINT(x...) RDebug::Print(x) -#else - #define DEBUGPRINT(x...) -#endif - - -class MGameWatcher -{ -public: - virtual void NotifyEmuDeath() = 0; - virtual void NotifyForcedExit() = 0; -}; - - -class CGameRunner : public CActive -{ -public: - static CGameRunner* NewL(MGameWatcher& aGameWatcher); - ~CGameRunner(); - - void KillAfter(TInt ms); - -protected: - CGameRunner(MGameWatcher& aGameWatcher); - void ConstructL(); - - virtual void RunL(); - virtual void DoCancel(); - - MGameWatcher& iGameWatcher; - TProcessId iProcessId; -}; - - -class CExitForcer : public CActive -{ -public: - static CExitForcer* NewL(MGameWatcher& aGameWatcher, TInt ms); - ~CExitForcer(); - -protected: - CExitForcer(MGameWatcher& aGameWatcher); - void ConstructL(TInt ms); - - virtual void RunL(); - virtual void DoCancel(); - - MGameWatcher& iGameWatcher; - RTimer iTimer; -}; - - -class CThreadWatcher : public CActive -{ -public: - static CThreadWatcher* NewL(MGameWatcher& aGameWatcher, const TDesC& aName); - ~CThreadWatcher(); - -protected: - CThreadWatcher(MGameWatcher& aGameWatcher, const TDesC& aName); - void ConstructL(); - - virtual void RunL(); - virtual void DoCancel(); - - MGameWatcher& iGameWatcher; - const TDesC& iName; // thread name -}; - - -// configuration emu process doesn't care about -class TPLauncherConfig { -public: - TPLauncherConfig(TPicoConfig &cfg); - void Load(); - void Save(); - - TBool iPad; // was iPauseOnCall - TFileName iLastROMFile; - TPicoConfig &iEmuConfig; - -private: - TFileName iIniFileName; -}; - - -#endif diff --git a/platform/uiq2/launcher/PICODRIVEN.ARMI b/platform/uiq2/launcher/PICODRIVEN.ARMI deleted file mode 100644 index 11a10317..00000000 --- a/platform/uiq2/launcher/PICODRIVEN.ARMI +++ /dev/null @@ -1,1070 +0,0 @@ - -# CWD \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\ -# MMPFile \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICODRIVEN.MMP -# Target PICODRIVEN.APP -# TargetType APP -# BasicTargetType DLL -# MakefileType GNU - -ERASE = @erase 2>>nul - -# EPOC DEFINITIONS - -EPOCBLD = ..\..\..\..\..\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICODRIVEN\ARMI -EPOCTRG = ..\..\..\..\..\EPOC32\RELEASE\ARMI -EPOCLIB = ..\..\..\..\..\EPOC32\RELEASE\ARMI -EPOCLINK = ..\..\..\..\..\EPOC32\RELEASE\ARMI -EPOCSTATLINK = ..\..\..\..\..\EPOC32\RELEASE\ARMI -EPOCASSPLINK = ..\..\..\..\..\EPOC32\RELEASE\MARM -EPOCDATA = \DEV\UIQ21\EPOC32\DATA -EPOCINC = \DEV\UIQ21\EPOC32\INCLUDE -TRGDIR = Z\SYSTEM\APPS\PICODRIVEN -DATADIR = Z\SYSTEM\DATA - -EPOCBLDUREL = $(EPOCBLD)\UREL -EPOCTRGUREL = $(EPOCTRG)\UREL -EPOCLIBUREL = $(EPOCLIB)\UREL -EPOCLINKUREL = $(EPOCLINK)\UREL -EPOCSTATLINKUREL = $(EPOCSTATLINK)\UREL -EPOCASSPLINKUREL = $(EPOCASSPLINK)\UREL - -EPOCBLDUDEB = $(EPOCBLD)\UDEB -EPOCTRGUDEB = $(EPOCTRG)\UDEB -EPOCLIBUDEB = $(EPOCLIB)\UREL -EPOCLINKUDEB = $(EPOCLINK)\UREL -EPOCSTATLINKUDEB = $(EPOCSTATLINK)\UDEB -EPOCASSPLINKUDEB = $(EPOCASSPLINK)\UREL - -# EPOC PSEUDOTARGETS - -UREL : MAKEWORKUREL RESOURCEUREL - -UDEB : MAKEWORKUDEB RESOURCEUDEB - -ALL : UREL UDEB - -CLEAN CLEANALL : CLEANBUILD CLEANRELEASE CLEANLIBRARY - - - -WHAT WHATALL : WHATUREL WHATUDEB - -RESOURCE RESOURCEALL : RESOURCEUREL RESOURCEUDEB - -CLEANBUILD CLEANBUILDALL : CLEANBUILDUREL CLEANBUILDUDEB - -CLEANRELEASE CLEANRELEASEALL : CLEANRELEASEUREL CLEANRELEASEUDEB - -MAKEWORK MAKEWORKALL : MAKEWORKUREL MAKEWORKUDEB - -LISTING LISTINGALL : LISTINGUREL LISTINGUDEB - -MAKEWORK : MAKEWORKLIBRARY - -RESOURCEUREL RESOURCEUDEB : GENERIC_RESOURCE - - -# must set both PATH and Path to make it work correctly -Path:=X:\DEV\UIQ21\EPOC32\gcc\bin;$(Path) -PATH:=$(Path) - -INCDIR = -I "." -I "..\..\..\..\..\EPOC32\INCLUDE" - -GCCFLAGS=-march=armv4t -mthumb-interwork \ - -pipe -c -nostdinc -Wall -Wno-ctor-dtor-privacy -Wno-unknown-pragmas - -GCCDEFS = -D__SYMBIAN32__ -D__GCC32__ -D__EPOC32__ -D__MARM__ -D__MARM_ARMI__ -D__DLL__ $(USERDEFS) -D__DEBUG_PRINT - -GCCUREL = gcc -s -fomit-frame-pointer -O $(GCCFLAGS) -DNDEBUG -D_UNICODE $(GCCDEFS) -GCCUDEB = gcc -g -O $(GCCFLAGS) -D_DEBUG -D_UNICODE $(GCCDEFS) - - -UREL : \ - $(EPOCTRGUREL)\PICODRIVEN.APP - -UDEB : \ - $(EPOCTRGUDEB)\PICODRIVEN.APP - - -RESOURCEUREL : MAKEWORKUREL -RESOURCEUDEB : MAKEWORKUDEB - -LIBRARY : MAKEWORKLIBRARY - -FREEZE : - -CLEANLIBRARY : - - -GENERIC_RESOURCE : GENERIC_MAKEWORK - -# REAL TARGET - BUILD VARIANT UREL - -WHATUREL : WHATGENERIC - -CLEANUREL : CLEANBUILDUREL CLEANRELEASEUREL - -CLEANBUILDUREL : - @perl -S ermdir.pl "$(EPOCBLDUREL)" - -CLEANRELEASEUREL : CLEANGENERIC - - -UREL_RELEASEABLES1= \ - \DEV\UIQ21\EPOC32\RELEASE\ARMI\UREL\PICODRIVEN.APP \ - \DEV\UIQ21\EPOC32\RELEASE\ARMI\UREL\PICODRIVEN.APP.MAP - -WHATUREL: - @echo $(UREL_RELEASEABLES1) - -CLEANRELEASEUREL: - -$(ERASE) $(UREL_RELEASEABLES1) - -LISTINGUREL : MAKEWORKUREL \ - LISTINGURELAPP \ - LISTINGURELCSIMPLETEXTPARSER \ - LISTINGURELDIALOGS \ - LISTINGURELENGINE \ - LISTINGURELSIMPLECLIENT - -LIBSUREL= \ - $(EPOCSTATLINKUREL)\EDLLSTUB.LIB \ - $(EPOCSTATLINKUREL)\EGCC.LIB \ - $(EPOCLINKUREL)\EUSER.LIB \ - $(EPOCLINKUREL)\WS32.LIB \ - $(EPOCLINKUREL)\EFSRV.LIB \ - $(EPOCLINKUREL)\APPARC.LIB \ - $(EPOCLINKUREL)\CONE.LIB \ - $(EPOCLINKUREL)\EIKCOCTL.LIB \ - $(EPOCLINKUREL)\EIKCORE.LIB \ - $(EPOCLINKUREL)\EIKDLG.LIB \ - $(EPOCLINKUREL)\EIKCTL.LIB \ - $(EPOCLINKUREL)\EIKFILE.LIB \ - $(EPOCLINKUREL)\EGUL.LIB \ - $(EPOCLINKUREL)\ETEXT.LIB \ - $(EPOCLINKUREL)\GDI.LIB - -$(EPOCTRGUREL)\PICODRIVEN.APP : $(EPOCBLDUREL)\PICODRIVEN.in $(EPOCSTATLINKUREL)\EDLL.LIB $(LIBSUREL) - dlltool -m arm_interwork --output-def "$(EPOCBLDUREL)\PICODRIVEN.inf" "$(EPOCBLDUREL)\PICODRIVEN.in" - perl -S makedef.pl -Deffile "$(EPOCBLDUREL)\PICODRIVEN.inf" -1 NewApplication__Fv "$(EPOCBLD)\PICODRIVEN.def" - -$(ERASE) "$(EPOCBLDUREL)\PICODRIVEN.inf" - dlltool -m arm_interwork --def "$(EPOCBLD)\PICODRIVEN.def" \ - --output-exp "$(EPOCBLDUREL)\PICODRIVEN.exp" \ - --dllname "PICODRIVEN[1000c193].APP" - ld -s -e _E32Dll -u _E32Dll "$(EPOCBLDUREL)\PICODRIVEN.exp" --dll \ - --base-file "$(EPOCBLDUREL)\PICODRIVEN.bas" -o "$(EPOCBLDUREL)\PICODRIVEN.APP" \ - "$(EPOCSTATLINKUREL)\EDLL.LIB" --whole-archive "$(EPOCBLDUREL)\PICODRIVEN.in" \ - --no-whole-archive $(LIBSUREL) $(USERLDFLAGS) - -$(ERASE) "$(EPOCBLDUREL)\PICODRIVEN.exp" - -$(ERASE) "$(EPOCBLDUREL)\PICODRIVEN.APP" - dlltool -m arm_interwork \ - --def "$(EPOCBLD)\PICODRIVEN.def" \ - --dllname "PICODRIVEN[1000c193].APP" \ - --base-file "$(EPOCBLDUREL)\PICODRIVEN.bas" \ - --output-exp "$(EPOCBLDUREL)\PICODRIVEN.exp" - -$(ERASE) "$(EPOCBLDUREL)\PICODRIVEN.bas" - ld -s -e _E32Dll -u _E32Dll --dll \ - "$(EPOCBLDUREL)\PICODRIVEN.exp" \ - -Map "$(EPOCTRGUREL)\PICODRIVEN.APP.map" -o "$(EPOCBLDUREL)\PICODRIVEN.APP" \ - "$(EPOCSTATLINKUREL)\EDLL.LIB" --whole-archive "$(EPOCBLDUREL)\PICODRIVEN.in" \ - --no-whole-archive $(LIBSUREL) $(USERLDFLAGS) - -$(ERASE) "$(EPOCBLDUREL)\PICODRIVEN.exp" - petran "$(EPOCBLDUREL)\PICODRIVEN.APP" "$@" \ - -nocall -uid1 0x10000079 -uid2 0x100039ce -uid3 0x1000c193 - -$(ERASE) "$(EPOCBLDUREL)\PICODRIVEN.APP" - -OBJECTSUREL= \ - $(EPOCBLDUREL)\APP.o \ - $(EPOCBLDUREL)\CSIMPLETEXTPARSER.o \ - $(EPOCBLDUREL)\DIALOGS.o \ - $(EPOCBLDUREL)\ENGINE.o \ - $(EPOCBLDUREL)\SIMPLECLIENT.o - -$(EPOCBLDUREL)\PICODRIVEN.in : $(OBJECTSUREL) - if exist "$@" del "$@" - ar cr $@ $^ - - -# REAL TARGET - BUILD VARIANT UDEB - -WHATUDEB : WHATGENERIC - -CLEANUDEB : CLEANBUILDUDEB CLEANRELEASEUDEB - -CLEANBUILDUDEB : - @perl -S ermdir.pl "$(EPOCBLDUDEB)" - -CLEANRELEASEUDEB : CLEANGENERIC - - -UDEB_RELEASEABLES1= \ - \DEV\UIQ21\EPOC32\RELEASE\ARMI\UDEB\PICODRIVEN.APP \ - \DEV\UIQ21\EPOC32\RELEASE\ARMI\UDEB\PICODRIVEN.APP.MAP - -WHATUDEB: - @echo $(UDEB_RELEASEABLES1) - -CLEANRELEASEUDEB: - -$(ERASE) $(UDEB_RELEASEABLES1) - -LISTINGUDEB : MAKEWORKUDEB \ - LISTINGUDEBAPP \ - LISTINGUDEBCSIMPLETEXTPARSER \ - LISTINGUDEBDIALOGS \ - LISTINGUDEBENGINE \ - LISTINGUDEBSIMPLECLIENT - -LIBSUDEB= \ - $(EPOCSTATLINKUDEB)\EDLLSTUB.LIB \ - $(EPOCSTATLINKUDEB)\EGCC.LIB \ - $(EPOCLINKUDEB)\EUSER.LIB \ - $(EPOCLINKUDEB)\WS32.LIB \ - $(EPOCLINKUDEB)\EFSRV.LIB \ - $(EPOCLINKUDEB)\APPARC.LIB \ - $(EPOCLINKUDEB)\CONE.LIB \ - $(EPOCLINKUDEB)\EIKCOCTL.LIB \ - $(EPOCLINKUDEB)\EIKCORE.LIB \ - $(EPOCLINKUDEB)\EIKDLG.LIB \ - $(EPOCLINKUDEB)\EIKCTL.LIB \ - $(EPOCLINKUDEB)\EIKFILE.LIB \ - $(EPOCLINKUDEB)\EGUL.LIB \ - $(EPOCLINKUDEB)\ETEXT.LIB \ - $(EPOCLINKUDEB)\GDI.LIB - -$(EPOCTRGUDEB)\PICODRIVEN.APP : $(EPOCBLDUDEB)\PICODRIVEN.in $(EPOCSTATLINKUDEB)\EDLL.LIB $(LIBSUDEB) - dlltool -m arm_interwork --output-def "$(EPOCBLDUDEB)\PICODRIVEN.inf" "$(EPOCBLDUDEB)\PICODRIVEN.in" - perl -S makedef.pl -Deffile "$(EPOCBLDUDEB)\PICODRIVEN.inf" -1 NewApplication__Fv "$(EPOCBLD)\PICODRIVEN.def" - -$(ERASE) "$(EPOCBLDUDEB)\PICODRIVEN.inf" - dlltool -m arm_interwork --def "$(EPOCBLD)\PICODRIVEN.def" \ - --output-exp "$(EPOCBLDUDEB)\PICODRIVEN.exp" \ - --dllname "PICODRIVEN[1000c193].APP" - ld -s -e _E32Dll -u _E32Dll "$(EPOCBLDUDEB)\PICODRIVEN.exp" --dll \ - --base-file "$(EPOCBLDUDEB)\PICODRIVEN.bas" -o "$(EPOCBLDUDEB)\PICODRIVEN.APP" \ - "$(EPOCSTATLINKUDEB)\EDLL.LIB" --whole-archive "$(EPOCBLDUDEB)\PICODRIVEN.in" \ - --no-whole-archive $(LIBSUDEB) $(USERLDFLAGS) - -$(ERASE) "$(EPOCBLDUDEB)\PICODRIVEN.exp" - -$(ERASE) "$(EPOCBLDUDEB)\PICODRIVEN.APP" - dlltool -m arm_interwork \ - --def "$(EPOCBLD)\PICODRIVEN.def" \ - --dllname "PICODRIVEN[1000c193].APP" \ - --base-file "$(EPOCBLDUDEB)\PICODRIVEN.bas" \ - --output-exp "$(EPOCBLDUDEB)\PICODRIVEN.exp" - -$(ERASE) "$(EPOCBLDUDEB)\PICODRIVEN.bas" - ld -e _E32Dll -u _E32Dll --dll \ - "$(EPOCBLDUDEB)\PICODRIVEN.exp" \ - -Map "$(EPOCTRGUDEB)\PICODRIVEN.APP.map" -o "$(EPOCBLDUDEB)\PICODRIVEN.APP" \ - "$(EPOCSTATLINKUDEB)\EDLL.LIB" --whole-archive "$(EPOCBLDUDEB)\PICODRIVEN.in" \ - --no-whole-archive $(LIBSUDEB) $(USERLDFLAGS) - -$(ERASE) "$(EPOCBLDUDEB)\PICODRIVEN.exp" - objcopy -X "$(EPOCBLDUDEB)\PICODRIVEN.APP" "$(EPOCTRGUDEB)\PICODRIVEN.sym" - petran "$(EPOCBLDUDEB)\PICODRIVEN.APP" "$@" \ - -nocall -uid1 0x10000079 -uid2 0x100039ce -uid3 0x1000c193 - -$(ERASE) "$(EPOCBLDUDEB)\PICODRIVEN.APP" - -OBJECTSUDEB= \ - $(EPOCBLDUDEB)\APP.o \ - $(EPOCBLDUDEB)\CSIMPLETEXTPARSER.o \ - $(EPOCBLDUDEB)\DIALOGS.o \ - $(EPOCBLDUDEB)\ENGINE.o \ - $(EPOCBLDUDEB)\SIMPLECLIENT.o - -$(EPOCBLDUDEB)\PICODRIVEN.in : $(OBJECTSUDEB) - if exist "$@" del "$@" - ar cr $@ $^ - - -# SOURCES - -# Resource Z\SYSTEM\APPS\PICODRIVEN\PICODRIVEN.RSC - -DEPEND= \ - \DEV\UIQ21\EPOC32\INCLUDE\BADEF.RH \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKCDLG.RSG \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKCOCTL.RSG \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKCOLOR.HRH \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKCORE.RSG \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKCTL.RSG \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKDLG.RSG \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKFILE.RSG \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKMISC.RSG \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKON.HRH \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKON.RH \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKON.RSG \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKPRINT.RSG \ - \DEV\UIQ21\EPOC32\INCLUDE\GULFTFLG.HRH \ - \DEV\UIQ21\EPOC32\INCLUDE\UIKON.HRH \ - \DEV\UIQ21\EPOC32\INCLUDE\UIKON.RH \ - \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICODRIVEN.HRH - -GENERIC_RESOURCE : $(EPOCDATA)\Z\SYSTEM\APPS\PICODRIVEN\PICODRIVEN.RSC - -$(EPOCDATA)\Z\SYSTEM\APPS\PICODRIVEN\PICODRIVEN.RSC : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICODRIVEN.RSS $(DEPEND) - 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" - 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" - -# Aif PICODRIVEN.AIF - -DEPEND= \ - \DEV\UIQ21\EPOC32\INCLUDE\AIFTOOL.RH - -GENERIC_RESOURCE : $(EPOCDATA)\Z\SYSTEM\APPS\PICODRIVEN\PICODRIVEN.AIF - -$(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 - perl -S epocaif.pl -o$@ "\DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICODRIVENAIF.RSS" \ - -t"\DEV\UIQ21\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICODRIVEN\ARMI" -l"$(TRGDIR):\DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER"\ - -b"\ - /c8\DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICON20X16.BMP\ - /c8\DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICON20X16M.BMP\ - /c8\DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICON32X32.BMP\ - /c8\DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICON32X32M.BMP" \ - -I "." -I- -I "..\..\..\..\..\EPOC32\INCLUDE" -I "..\..\..\..\..\EPOC32\INCLUDE" - -# Source APP.CPP - -$(EPOCBLDUREL)\APP.lis $(EPOCBLDUREL)\APP.o \ -$(EPOCBLDUDEB)\APP.lis $(EPOCBLDUDEB)\APP.o \ -: \ - \DEV\UIQ21\EPOC32\INCLUDE\APACMDLN.H \ - \DEV\UIQ21\EPOC32\INCLUDE\APADEF.H \ - \DEV\UIQ21\EPOC32\INCLUDE\APAFLREC.H \ - \DEV\UIQ21\EPOC32\INCLUDE\APAID.H \ - \DEV\UIQ21\EPOC32\INCLUDE\APGTASK.H \ - \DEV\UIQ21\EPOC32\INCLUDE\APPARC.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BADESCA.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BAERRHAN.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BAMDESCA.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BARSC.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BASCHED.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BITBASE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BITDEV.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BITDEV.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\BITMAP.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BITSTD.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BTDEFCOMMPORT.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BTDEVICE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BTDEVICE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BTDEVICE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BTMANCLIENT.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BTREGISTRY.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BTSDP.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BTSDP.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\BTTYPES.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BTTYPES.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\BTUIUTILOBSERVER.H \ - \DEV\UIQ21\EPOC32\INCLUDE\C32COMM.H \ - \DEV\UIQ21\EPOC32\INCLUDE\C32COMM.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\CDBCOLS.H \ - \DEV\UIQ21\EPOC32\INCLUDE\CDBLEN.H \ - \DEV\UIQ21\EPOC32\INCLUDE\CDBPREFTABLE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\COEAUI.H \ - \DEV\UIQ21\EPOC32\INCLUDE\COEAUIB.H \ - \DEV\UIQ21\EPOC32\INCLUDE\COECCNTX.H \ - \DEV\UIQ21\EPOC32\INCLUDE\COECNTRL.H \ - \DEV\UIQ21\EPOC32\INCLUDE\COECOBS.H \ - \DEV\UIQ21\EPOC32\INCLUDE\COEDEF.H \ - \DEV\UIQ21\EPOC32\INCLUDE\COEHELP.H \ - \DEV\UIQ21\EPOC32\INCLUDE\COEINPUT.H \ - \DEV\UIQ21\EPOC32\INCLUDE\COEMAIN.H \ - \DEV\UIQ21\EPOC32\INCLUDE\COEUTILS.H \ - \DEV\UIQ21\EPOC32\INCLUDE\COEVIEW.H \ - \DEV\UIQ21\EPOC32\INCLUDE\COMMDB.H \ - \DEV\UIQ21\EPOC32\INCLUDE\COMMDB.H \ - \DEV\UIQ21\EPOC32\INCLUDE\COMMDB.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\D32COMM.H \ - \DEV\UIQ21\EPOC32\INCLUDE\D32COMM.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\D32DBMS.H \ - \DEV\UIQ21\EPOC32\INCLUDE\D32DBMS.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\DIAL.H \ - \DEV\UIQ21\EPOC32\INCLUDE\DIAL.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\E32BASE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32BASE.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\E32DEF.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32DES16.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32DES8.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32HAL.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32KEYS.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32PCCD.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32STD.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32STD.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32STD.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\E32SVR.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32UID.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32VER.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKALIGN.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKAMNT.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKAPP.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKAPPUI.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKAUFTY.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKBCTRL.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKBGFTY.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKBTGPC.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKBTGRP.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKBUTB.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKCDLG.RSG \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKCFDLG.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKCHKBX.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKCHLST.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKCLB.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKCMOBS.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKCOCTL.RSG \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKCOLOR.HRH \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKCORE.RSG \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKCTGRP.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKCTL.RSG \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKDEF.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKDGFTY.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKDIALG.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKDLG.RSG \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKDLGTB.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKDOC.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKDPOBS.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKEDWOB.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKENV.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKENV.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKFCTRY.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKFILE.RSG \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKLABEL.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKLBED.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKLBI.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKLBM.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKLBO.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKLBV.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKLBVO.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKLBX.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKLIBRY.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKMENUB.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKMENUP.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKMISC.RSG \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKMOBS.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKON.HRH \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKON.RSG \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKPRINT.RSG \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKSBFRM.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKSBOBS.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKSCBUT.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKSCRLB.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKTXLBM.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKTXLBX.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKVCURS.H \ - \DEV\UIQ21\EPOC32\INCLUDE\ETEL.H \ - \DEV\UIQ21\EPOC32\INCLUDE\ETEL.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\F32FILE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\F32FILE.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\FAXDEFN.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FBS.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FLDBASE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FLDBLTIN.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FLDINFO.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FLDSET.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FNTSTORE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FRMLAYDT.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FRMPARAM.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FRMTLAY.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FRMVIS.H \ - \DEV\UIQ21\EPOC32\INCLUDE\GDI.H \ - \DEV\UIQ21\EPOC32\INCLUDE\GDI.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\GRAPHICSACCELERATOR.H \ - \DEV\UIQ21\EPOC32\INCLUDE\GULALIGN.H \ - \DEV\UIQ21\EPOC32\INCLUDE\GULBORDR.H \ - \DEV\UIQ21\EPOC32\INCLUDE\GULCOLOR.H \ - \DEV\UIQ21\EPOC32\INCLUDE\GULDEF.H \ - \DEV\UIQ21\EPOC32\INCLUDE\GULFTFLG.HRH \ - \DEV\UIQ21\EPOC32\INCLUDE\GULUTIL.H \ - \DEV\UIQ21\EPOC32\INCLUDE\LAFMAIN.H \ - \DEV\UIQ21\EPOC32\INCLUDE\LAFPUBLC.H \ - \DEV\UIQ21\EPOC32\INCLUDE\OPENFONT.H \ - \DEV\UIQ21\EPOC32\INCLUDE\PICODRIVEN.RSG \ - \DEV\UIQ21\EPOC32\INCLUDE\QBTSELECTDLG.H \ - \DEV\UIQ21\EPOC32\INCLUDE\QIKSHUTTER.H \ - \DEV\UIQ21\EPOC32\INCLUDE\S32BUF.H \ - \DEV\UIQ21\EPOC32\INCLUDE\S32BUF.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\S32MEM.H \ - \DEV\UIQ21\EPOC32\INCLUDE\S32MEM.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\S32PAGE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\S32PAGE.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\S32SHARE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\S32SHARE.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\S32STD.H \ - \DEV\UIQ21\EPOC32\INCLUDE\S32STD.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\S32STOR.H \ - \DEV\UIQ21\EPOC32\INCLUDE\S32STOR.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\S32STRM.H \ - \DEV\UIQ21\EPOC32\INCLUDE\S32STRM.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\SACLIENT.H \ - \DEV\UIQ21\EPOC32\INCLUDE\SACLS.H \ - \DEV\UIQ21\EPOC32\INCLUDE\SAVARSET.H \ - \DEV\UIQ21\EPOC32\INCLUDE\SAVENOTF.H \ - \DEV\UIQ21\EPOC32\INCLUDE\T32WLD.H \ - \DEV\UIQ21\EPOC32\INCLUDE\TAGMA.H \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTETEXT.H \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTETEXT.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTFMLYR.H \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTFMLYR.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTFMSTM.H \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTFRMAT.H \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTFRMAT.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTLAYDC.H \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTSTYLE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTSTYLE.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\UIKON.HRH \ - \DEV\UIQ21\EPOC32\INCLUDE\VWSDEF.H \ - \DEV\UIQ21\EPOC32\INCLUDE\W32STD.H \ - \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\CLIENTSERVER.H \ - \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\APP.H \ - \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\DIALOGS.H \ - \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\ENGINE.H \ - \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICODRIVEN.HRH \ - \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\SIMPLECLIENT.H - -$(EPOCBLDUREL)\APP.o : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\App.cpp - $(GCCUREL) -I "." $(INCDIR) -o $@ ".\App.cpp" - -LISTINGURELAPP : $(EPOCBLDUREL)\APP.lis - perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\APP.lst.ARMI - -$(EPOCBLDUREL)\APP.lis : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\App.cpp - $(GCCUREL) -Wa,-adln -I "." $(INCDIR) -o nul: ".\App.cpp" > $@ - -$(EPOCBLDUDEB)\APP.o : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\App.cpp - $(GCCUDEB) -I "." $(INCDIR) -o $@ ".\App.cpp" - -LISTINGUDEBAPP : $(EPOCBLDUDEB)\APP.lis - perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\APP.lst.ARMI - -$(EPOCBLDUDEB)\APP.lis : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\App.cpp - $(GCCUDEB) -Wa,-adln -I "." $(INCDIR) -o nul: ".\App.cpp" > $@ - - - -# Source CSIMPLETEXTPARSER.CPP - -$(EPOCBLDUREL)\CSIMPLETEXTPARSER.lis $(EPOCBLDUREL)\CSIMPLETEXTPARSER.o \ -$(EPOCBLDUDEB)\CSIMPLETEXTPARSER.lis $(EPOCBLDUDEB)\CSIMPLETEXTPARSER.o \ -: \ - \DEV\UIQ21\EPOC32\INCLUDE\APADEF.H \ - \DEV\UIQ21\EPOC32\INCLUDE\APAID.H \ - \DEV\UIQ21\EPOC32\INCLUDE\APPARC.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BADESCA.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BAMDESCA.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BARSC.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BASCHED.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BITBASE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BITDEV.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BITDEV.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\BITMAP.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BITSTD.H \ - \DEV\UIQ21\EPOC32\INCLUDE\COECNTRL.H \ - \DEV\UIQ21\EPOC32\INCLUDE\COECOBS.H \ - \DEV\UIQ21\EPOC32\INCLUDE\COEDEF.H \ - \DEV\UIQ21\EPOC32\INCLUDE\COEHELP.H \ - \DEV\UIQ21\EPOC32\INCLUDE\COEINPUT.H \ - \DEV\UIQ21\EPOC32\INCLUDE\COEMAIN.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32BASE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32BASE.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\E32DEF.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32DES16.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32DES8.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32HAL.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32KEYS.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32PCCD.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32STD.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32STD.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\E32SVR.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKBCTRL.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKBUTB.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKCOLOR.HRH \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKEDWIN.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKEDWOB.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKGTED.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKON.HRH \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKRTED.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKSBFRM.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKSBOBS.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKSCBUT.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKSCRLB.H \ - \DEV\UIQ21\EPOC32\INCLUDE\F32FILE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\F32FILE.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\FBS.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FEPBASE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FLDBASE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FLDBLTIN.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FLDINFO.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FLDSET.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FNTSTORE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FRMFRAME.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FRMLAYDT.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FRMPARAM.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FRMTLAY.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FRMTVIEW.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FRMVIS.H \ - \DEV\UIQ21\EPOC32\INCLUDE\GDI.H \ - \DEV\UIQ21\EPOC32\INCLUDE\GDI.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\GRAPHICSACCELERATOR.H \ - \DEV\UIQ21\EPOC32\INCLUDE\GULALIGN.H \ - \DEV\UIQ21\EPOC32\INCLUDE\GULBORDR.H \ - \DEV\UIQ21\EPOC32\INCLUDE\GULDEF.H \ - \DEV\UIQ21\EPOC32\INCLUDE\GULFTFLG.HRH \ - \DEV\UIQ21\EPOC32\INCLUDE\GULUTIL.H \ - \DEV\UIQ21\EPOC32\INCLUDE\LAFPUBLC.H \ - \DEV\UIQ21\EPOC32\INCLUDE\MEDOBSRV.H \ - \DEV\UIQ21\EPOC32\INCLUDE\MPARSER.H \ - \DEV\UIQ21\EPOC32\INCLUDE\OPENFONT.H \ - \DEV\UIQ21\EPOC32\INCLUDE\S32BUF.H \ - \DEV\UIQ21\EPOC32\INCLUDE\S32BUF.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\S32PAGE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\S32PAGE.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\S32SHARE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\S32SHARE.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\S32STD.H \ - \DEV\UIQ21\EPOC32\INCLUDE\S32STD.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\S32STOR.H \ - \DEV\UIQ21\EPOC32\INCLUDE\S32STOR.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\S32STRM.H \ - \DEV\UIQ21\EPOC32\INCLUDE\S32STRM.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\TAGMA.H \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTETEXT.H \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTETEXT.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTFMLYR.H \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTFMLYR.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTFMSTM.H \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTFRMAT.H \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTFRMAT.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTGLOBL.H \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTGLOBL.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTLAYDC.H \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTMFMTX.H \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTMRTSR.H \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTRICH.H \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTRICH.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTSTYLE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTSTYLE.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\UIKON.HRH \ - \DEV\UIQ21\EPOC32\INCLUDE\W32STD.H \ - \DEV\UIQ21\EPOC32\INCLUDE\W32STD.H \ - \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\CSIMPLETEXTPARSER.H - -$(EPOCBLDUREL)\CSIMPLETEXTPARSER.o : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\Csimpletextparser.cpp - $(GCCUREL) -I "." $(INCDIR) -o $@ ".\Csimpletextparser.cpp" - -LISTINGURELCSIMPLETEXTPARSER : $(EPOCBLDUREL)\CSIMPLETEXTPARSER.lis - perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\CSIMPLETEXTPARSER.lst.ARMI - -$(EPOCBLDUREL)\CSIMPLETEXTPARSER.lis : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\Csimpletextparser.cpp - $(GCCUREL) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Csimpletextparser.cpp" > $@ - -$(EPOCBLDUDEB)\CSIMPLETEXTPARSER.o : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\Csimpletextparser.cpp - $(GCCUDEB) -I "." $(INCDIR) -o $@ ".\Csimpletextparser.cpp" - -LISTINGUDEBCSIMPLETEXTPARSER : $(EPOCBLDUDEB)\CSIMPLETEXTPARSER.lis - perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\CSIMPLETEXTPARSER.lst.ARMI - -$(EPOCBLDUDEB)\CSIMPLETEXTPARSER.lis : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\Csimpletextparser.cpp - $(GCCUDEB) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Csimpletextparser.cpp" > $@ - - - -# Source DIALOGS.CPP - -$(EPOCBLDUREL)\DIALOGS.lis $(EPOCBLDUREL)\DIALOGS.o \ -$(EPOCBLDUDEB)\DIALOGS.lis $(EPOCBLDUDEB)\DIALOGS.o \ -: \ - \DEV\UIQ21\EPOC32\INCLUDE\APACMDLN.H \ - \DEV\UIQ21\EPOC32\INCLUDE\APADEF.H \ - \DEV\UIQ21\EPOC32\INCLUDE\APAFLREC.H \ - \DEV\UIQ21\EPOC32\INCLUDE\APAID.H \ - \DEV\UIQ21\EPOC32\INCLUDE\APPARC.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BADESCA.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BAERRHAN.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BAMDESCA.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BARSC.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BASCHED.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BITBASE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BITDEV.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BITDEV.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\BITMAP.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BITSTD.H \ - \DEV\UIQ21\EPOC32\INCLUDE\C32COMM.H \ - \DEV\UIQ21\EPOC32\INCLUDE\C32COMM.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\COECCNTX.H \ - \DEV\UIQ21\EPOC32\INCLUDE\COECNTRL.H \ - \DEV\UIQ21\EPOC32\INCLUDE\COECOBS.H \ - \DEV\UIQ21\EPOC32\INCLUDE\COEDEF.H \ - \DEV\UIQ21\EPOC32\INCLUDE\COEHELP.H \ - \DEV\UIQ21\EPOC32\INCLUDE\COEINPUT.H \ - \DEV\UIQ21\EPOC32\INCLUDE\COEMAIN.H \ - \DEV\UIQ21\EPOC32\INCLUDE\D32COMM.H \ - \DEV\UIQ21\EPOC32\INCLUDE\D32COMM.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\E32BASE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32BASE.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\E32DEF.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32DES16.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32DES8.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32HAL.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32KEYS.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32PCCD.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32STD.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32STD.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32STD.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\E32SVR.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32VER.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKALIGN.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKAMNT.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKAUFTY.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKBCTRL.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKBGFTY.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKBTGPC.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKBTGRP.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKBUTB.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKCHKBX.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKCHLST.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKCMOBS.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKCOLOR.HRH \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKCTGRP.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKDEF.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKDGFTY.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKDIALG.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKDLGTB.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKDPOBS.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKEDWIN.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKEDWOB.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKENV.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKENV.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKFCTRY.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKGTED.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKHOPBT.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKLABEL.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKLBED.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKLBM.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKLBO.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKLBV.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKLBVO.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKLBX.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKLIBRY.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKON.HRH \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKOPBUT.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKRTED.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKSBFRM.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKSBOBS.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKSCBUT.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKSCRLB.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKTXLBM.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKTXLBX.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKVCURS.H \ - \DEV\UIQ21\EPOC32\INCLUDE\ETEL.H \ - \DEV\UIQ21\EPOC32\INCLUDE\ETEL.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\F32FILE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\F32FILE.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\FAXDEFN.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FBS.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FEPBASE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FLDBASE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FLDBLTIN.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FLDINFO.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FLDSET.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FNTSTORE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FRMFRAME.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FRMLAYDT.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FRMPARAM.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FRMTLAY.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FRMTVIEW.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FRMVIS.H \ - \DEV\UIQ21\EPOC32\INCLUDE\GDI.H \ - \DEV\UIQ21\EPOC32\INCLUDE\GDI.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\GRAPHICSACCELERATOR.H \ - \DEV\UIQ21\EPOC32\INCLUDE\GULALIGN.H \ - \DEV\UIQ21\EPOC32\INCLUDE\GULBORDR.H \ - \DEV\UIQ21\EPOC32\INCLUDE\GULCOLOR.H \ - \DEV\UIQ21\EPOC32\INCLUDE\GULDEF.H \ - \DEV\UIQ21\EPOC32\INCLUDE\GULFTFLG.HRH \ - \DEV\UIQ21\EPOC32\INCLUDE\GULUTIL.H \ - \DEV\UIQ21\EPOC32\INCLUDE\LAFMAIN.H \ - \DEV\UIQ21\EPOC32\INCLUDE\LAFPUBLC.H \ - \DEV\UIQ21\EPOC32\INCLUDE\MEDOBSRV.H \ - \DEV\UIQ21\EPOC32\INCLUDE\MPARSER.H \ - \DEV\UIQ21\EPOC32\INCLUDE\OPENFONT.H \ - \DEV\UIQ21\EPOC32\INCLUDE\PICODRIVEN.RSG \ - \DEV\UIQ21\EPOC32\INCLUDE\QIKSHUTTER.H \ - \DEV\UIQ21\EPOC32\INCLUDE\QIKVERTOPTIONBUTTONLIST.H \ - \DEV\UIQ21\EPOC32\INCLUDE\QUARTZKEYS.H \ - \DEV\UIQ21\EPOC32\INCLUDE\S32BUF.H \ - \DEV\UIQ21\EPOC32\INCLUDE\S32BUF.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\S32PAGE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\S32PAGE.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\S32SHARE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\S32SHARE.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\S32STD.H \ - \DEV\UIQ21\EPOC32\INCLUDE\S32STD.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\S32STOR.H \ - \DEV\UIQ21\EPOC32\INCLUDE\S32STOR.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\S32STRM.H \ - \DEV\UIQ21\EPOC32\INCLUDE\S32STRM.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\TAGMA.H \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTETEXT.H \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTETEXT.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTFMLYR.H \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTFMLYR.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTFMSTM.H \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTFRMAT.H \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTFRMAT.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTGLOBL.H \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTGLOBL.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTLAYDC.H \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTMFMTX.H \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTMRTSR.H \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTRICH.H \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTRICH.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTSTYLE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTSTYLE.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\UIKON.HRH \ - \DEV\UIQ21\EPOC32\INCLUDE\W32STD.H \ - \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\CLIENTSERVER.H \ - \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\CSIMPLETEXTPARSER.H \ - \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\DIALOGS.H \ - \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\ENGINE.H \ - \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICODRIVEN.HRH \ - \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\VERSION.H - -$(EPOCBLDUREL)\DIALOGS.o : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\Dialogs.cpp - $(GCCUREL) -I "." $(INCDIR) -o $@ ".\Dialogs.cpp" - -LISTINGURELDIALOGS : $(EPOCBLDUREL)\DIALOGS.lis - perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\DIALOGS.lst.ARMI - -$(EPOCBLDUREL)\DIALOGS.lis : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\Dialogs.cpp - $(GCCUREL) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Dialogs.cpp" > $@ - -$(EPOCBLDUDEB)\DIALOGS.o : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\Dialogs.cpp - $(GCCUDEB) -I "." $(INCDIR) -o $@ ".\Dialogs.cpp" - -LISTINGUDEBDIALOGS : $(EPOCBLDUDEB)\DIALOGS.lis - perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\DIALOGS.lst.ARMI - -$(EPOCBLDUDEB)\DIALOGS.lis : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\Dialogs.cpp - $(GCCUDEB) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Dialogs.cpp" > $@ - - - -# Source ENGINE.CPP - -$(EPOCBLDUREL)\ENGINE.lis $(EPOCBLDUREL)\ENGINE.o \ -$(EPOCBLDUDEB)\ENGINE.lis $(EPOCBLDUDEB)\ENGINE.o \ -: \ - \DEV\UIQ21\EPOC32\INCLUDE\APACMDLN.H \ - \DEV\UIQ21\EPOC32\INCLUDE\APADEF.H \ - \DEV\UIQ21\EPOC32\INCLUDE\APAFLREC.H \ - \DEV\UIQ21\EPOC32\INCLUDE\APAID.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BADESCA.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BAERRHAN.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BAMDESCA.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BARSC.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BASCHED.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BITBASE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BITDEV.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BITDEV.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\BITMAP.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BITSTD.H \ - \DEV\UIQ21\EPOC32\INCLUDE\C32COMM.H \ - \DEV\UIQ21\EPOC32\INCLUDE\C32COMM.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\COEDEF.H \ - \DEV\UIQ21\EPOC32\INCLUDE\COEMAIN.H \ - \DEV\UIQ21\EPOC32\INCLUDE\D32COMM.H \ - \DEV\UIQ21\EPOC32\INCLUDE\D32COMM.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\E32BASE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32BASE.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\E32DEF.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32DES16.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32DES8.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32HAL.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32KEYS.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32PCCD.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32STD.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32STD.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32STD.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\E32SVR.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32VER.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKAMNT.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKAUFTY.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKCOLOR.HRH \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKDEF.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKDGFTY.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKENV.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKFCTRY.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKLIBRY.H \ - \DEV\UIQ21\EPOC32\INCLUDE\EIKVCURS.H \ - \DEV\UIQ21\EPOC32\INCLUDE\ETEL.H \ - \DEV\UIQ21\EPOC32\INCLUDE\ETEL.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\F32FILE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\F32FILE.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\FAXDEFN.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FBS.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FLDBASE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FLDBLTIN.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FLDINFO.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FLDSET.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FNTSTORE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FRMLAYDT.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FRMPARAM.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FRMTLAY.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FRMVIS.H \ - \DEV\UIQ21\EPOC32\INCLUDE\GDI.H \ - \DEV\UIQ21\EPOC32\INCLUDE\GDI.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\GRAPHICSACCELERATOR.H \ - \DEV\UIQ21\EPOC32\INCLUDE\GULALIGN.H \ - \DEV\UIQ21\EPOC32\INCLUDE\GULBORDR.H \ - \DEV\UIQ21\EPOC32\INCLUDE\GULCOLOR.H \ - \DEV\UIQ21\EPOC32\INCLUDE\GULDEF.H \ - \DEV\UIQ21\EPOC32\INCLUDE\LAFMAIN.H \ - \DEV\UIQ21\EPOC32\INCLUDE\OPENFONT.H \ - \DEV\UIQ21\EPOC32\INCLUDE\S32BUF.H \ - \DEV\UIQ21\EPOC32\INCLUDE\S32BUF.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\S32PAGE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\S32PAGE.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\S32SHARE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\S32SHARE.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\S32STD.H \ - \DEV\UIQ21\EPOC32\INCLUDE\S32STD.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\S32STOR.H \ - \DEV\UIQ21\EPOC32\INCLUDE\S32STOR.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\S32STRM.H \ - \DEV\UIQ21\EPOC32\INCLUDE\S32STRM.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\TAGMA.H \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTETEXT.H \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTETEXT.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTFMLYR.H \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTFMLYR.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTFMSTM.H \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTFRMAT.H \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTFRMAT.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTLAYDC.H \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTSTYLE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\TXTSTYLE.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\UIKON.HRH \ - \DEV\UIQ21\EPOC32\INCLUDE\W32STD.H \ - \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\CLIENTSERVER.H \ - \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\ENGINE.H \ - \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\VERSION.H - -$(EPOCBLDUREL)\ENGINE.o : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\Engine.cpp - $(GCCUREL) -I "." $(INCDIR) -o $@ ".\Engine.cpp" - -LISTINGURELENGINE : $(EPOCBLDUREL)\ENGINE.lis - perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\ENGINE.lst.ARMI - -$(EPOCBLDUREL)\ENGINE.lis : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\Engine.cpp - $(GCCUREL) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Engine.cpp" > $@ - -$(EPOCBLDUDEB)\ENGINE.o : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\Engine.cpp - $(GCCUDEB) -I "." $(INCDIR) -o $@ ".\Engine.cpp" - -LISTINGUDEBENGINE : $(EPOCBLDUDEB)\ENGINE.lis - perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\ENGINE.lst.ARMI - -$(EPOCBLDUDEB)\ENGINE.lis : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\Engine.cpp - $(GCCUDEB) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Engine.cpp" > $@ - - - -# Source SIMPLECLIENT.CPP - -$(EPOCBLDUREL)\SIMPLECLIENT.lis $(EPOCBLDUREL)\SIMPLECLIENT.o \ -$(EPOCBLDUDEB)\SIMPLECLIENT.lis $(EPOCBLDUDEB)\SIMPLECLIENT.o \ -: \ - \DEV\UIQ21\EPOC32\INCLUDE\BITBASE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BITDEV.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BITDEV.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\BITMAP.H \ - \DEV\UIQ21\EPOC32\INCLUDE\BITSTD.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32BASE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32BASE.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\E32DEF.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32DES16.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32DES8.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32HAL.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32KEYS.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32PCCD.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32STD.H \ - \DEV\UIQ21\EPOC32\INCLUDE\E32STD.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\E32SVR.H \ - \DEV\UIQ21\EPOC32\INCLUDE\F32FILE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\F32FILE.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\FBS.H \ - \DEV\UIQ21\EPOC32\INCLUDE\FNTSTORE.H \ - \DEV\UIQ21\EPOC32\INCLUDE\GDI.H \ - \DEV\UIQ21\EPOC32\INCLUDE\GDI.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\GRAPHICSACCELERATOR.H \ - \DEV\UIQ21\EPOC32\INCLUDE\OPENFONT.H \ - \DEV\UIQ21\EPOC32\INCLUDE\S32STD.H \ - \DEV\UIQ21\EPOC32\INCLUDE\S32STD.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\S32STRM.H \ - \DEV\UIQ21\EPOC32\INCLUDE\S32STRM.INL \ - \DEV\UIQ21\EPOC32\INCLUDE\W32STD.H \ - \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\CLIENTSERVER.H \ - \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\SIMPLECLIENT.H \ - \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\VERSION.H - -$(EPOCBLDUREL)\SIMPLECLIENT.o : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\Simpleclient.cpp - $(GCCUREL) -I "." $(INCDIR) -o $@ ".\Simpleclient.cpp" - -LISTINGURELSIMPLECLIENT : $(EPOCBLDUREL)\SIMPLECLIENT.lis - perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\SIMPLECLIENT.lst.ARMI - -$(EPOCBLDUREL)\SIMPLECLIENT.lis : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\Simpleclient.cpp - $(GCCUREL) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Simpleclient.cpp" > $@ - -$(EPOCBLDUDEB)\SIMPLECLIENT.o : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\Simpleclient.cpp - $(GCCUDEB) -I "." $(INCDIR) -o $@ ".\Simpleclient.cpp" - -LISTINGUDEBSIMPLECLIENT : $(EPOCBLDUDEB)\SIMPLECLIENT.lis - perl -S ecopyfile.pl $? \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\SIMPLECLIENT.lst.ARMI - -$(EPOCBLDUDEB)\SIMPLECLIENT.lis : \DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\Simpleclient.cpp - $(GCCUDEB) -Wa,-adln -I "." $(INCDIR) -o nul: ".\Simpleclient.cpp" > $@ - - - -ROMFILE: - @echo file=\DEV\UIQ21\EPOC32\RELEASE\ARMI\##BUILD##\PICODRIVEN.APP SYSTEM\APPS\PICODRIVEN\PICODRIVEN.APP - -GENERIC_RELEASEABLES1= \ - $(EPOCDATA)\Z\SYSTEM\APPS\PICODRIVEN\PICODRIVEN.AIF \ - $(EPOCDATA)\Z\SYSTEM\APPS\PICODRIVEN\PICODRIVEN.RSC \ - $(EPOCINC)\PICODRIVEN.RSG \ - \DEV\UIQ21\EPOC32\LOCALISATION\AIF\DEV\PICODRIVEN\AIF\PICODRIVEN.RPP \ - \DEV\UIQ21\EPOC32\LOCALISATION\AIF\DEV\PICODRIVEN\AIF\PICON20X16.BMP \ - \DEV\UIQ21\EPOC32\LOCALISATION\AIF\DEV\PICODRIVEN\AIF\PICON20X16M.BMP \ - \DEV\UIQ21\EPOC32\LOCALISATION\AIF\DEV\PICODRIVEN\AIF\PICON32X32.BMP \ - \DEV\UIQ21\EPOC32\LOCALISATION\AIF\DEV\PICODRIVEN\AIF\PICON32X32M.BMP \ - \DEV\UIQ21\EPOC32\LOCALISATION\DEV\PICODRIVEN\RSC\PICODRIVEN.RPP \ - \DEV\UIQ21\EPOC32\LOCALISATION\GROUP\PICODRIVEN.INFO - -WHATGENERIC: - @echo $(GENERIC_RELEASEABLES1) - -CLEANGENERIC: - -$(ERASE) $(GENERIC_RELEASEABLES1) - -# Rules to create all necessary directories - -GENERIC_MAKEWORK : \ - \DEV\UIQ21\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICODRIVEN\ARMI \ - \DEV\UIQ21\EPOC32\DATA\Z\SYSTEM\APPS\PICODRIVEN \ - \DEV\UIQ21\EPOC32\INCLUDE -MAKEWORKLIBRARY : \ - \DEV\UIQ21\EPOC32\RELEASE\ARMI\UREL -MAKEWORKUDEB : \ - \DEV\UIQ21\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICODRIVEN\ARMI\UDEB \ - \DEV\UIQ21\EPOC32\RELEASE\ARMI\UDEB -MAKEWORKUREL : \ - \DEV\UIQ21\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICODRIVEN\ARMI\UREL \ - \DEV\UIQ21\EPOC32\RELEASE\ARMI\UREL - -\DEV\UIQ21\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICODRIVEN\ARMI \ -\DEV\UIQ21\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICODRIVEN\ARMI\UDEB \ -\DEV\UIQ21\EPOC32\BUILD\DEV\UIQ21\_SRC\PICODRIVEN\PLATFORM\UIQ2\LAUNCHER\PICODRIVEN\ARMI\UREL \ -\DEV\UIQ21\EPOC32\DATA\Z\SYSTEM\APPS\PICODRIVEN \ -\DEV\UIQ21\EPOC32\INCLUDE \ -\DEV\UIQ21\EPOC32\RELEASE\ARMI\UDEB \ -\DEV\UIQ21\EPOC32\RELEASE\ARMI\UREL \ -: - perl -S emkdir.pl $@ - diff --git a/platform/uiq2/launcher/PicoN20x16.bmp b/platform/uiq2/launcher/PicoN20x16.bmp deleted file mode 100644 index 859f6d065814ca9c1ac9cf89220d5a4681f5bf5b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1016 zcmZ?r{lUxt24+A~1BgX{SOAC_86KHO$eXY4*U5>4D1fVkFd%{ua`V}9O&{I?*`+NtAhNZu;pbbc?URtzU}ZxDU%Yw= zWc>R16G%QdbM5Q5A0Iw`#;P9f2CTBXcD!D+iA1%A6C zpa>9f>FTm;TLT&U4tzrPCfr^i0|I{k`IEeSmULg5aCH=KNFbMyr-+4!z*uU<&_#dH><)(W7uKkg@#KafM?G6b{Z(SL#g0)m%yb zyv|Npt5@~>|L^zlg8IB3#r#^4vL=zb4ud5Nq8=R%T;Jl9?zwZ<4xrw~#`Y`c&iAih zW&iM?!Na|}`)0}%Mkxk42CSQGdU=cF>WREfnOyERT>f6%C0UBwXW36`pR;T}P$Li& zNosj8usB9X)%vauVzoLVn&>zO&YtiE71La z{``UH-Qk~F${^C&+*)-!I&mmHqjvvc-{UGDVOWR#@13Qa0?bwQ} Hg@FM8GWHwJ diff --git a/platform/uiq2/launcher/PicoN20x16m.bmp b/platform/uiq2/launcher/PicoN20x16m.bmp deleted file mode 100644 index 578b643d1c8bcb1b5b9b12f53afa9f62b7539676..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1014 zcmb`DF%Ez*2t_fDE)EXPPM*L6xO-<$Y>-%T`PLCgc&(AzDNw zJ+jD(`Os*@22u!t`RpZ5*yvP2ie&=3?&k)wDs2DWvD3V^Kk(>;K|PkTn$u`JUP(1O y*6*})y3(2R)!#FhWkhW diff --git a/platform/uiq2/launcher/PicoN32x32.bmp b/platform/uiq2/launcher/PicoN32x32.bmp deleted file mode 100644 index 292e1c2a51f609fefb7a65412d6d567bc09e6db3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3128 zcmbuB3pCW*9>=Gg^6ErW=ce3@p%X&mF~(qqG0nrwcui)!$73pDpZs&iRYdO_jt-IIy|Ng)I+u!~9{r>yE*Z%*h zPQ(SMKN|sBeRygAbr~3_d)nfCsu%+I-oWcSa zw98NbJY)KfX41un4$33-_4N<~yLowe2rnfi1$KLSdS>9k@W==?+rrPF0~y2 zm6fMqkXtW-);T4Ge76cZ^9*zmC4z?a*q&bGkF4JB4Xi0xaRW6%=MQGpz}38 zECy*%10VV0z~JY=x9;+EPz1^UlaD+jwBLfx7(@8TvwWK`uOuia=;O!fjpxQMraRTq zT`L*Rb!_g{^o+jF&hZ)SX&1`)d_EHV8h_T5mX?or%4sDXhO)liJY(HChFS`%G!^t# zC>fKN=!p}=ulQKO}XyQ0t{iv#;36~3xzL_Z=zj`SG{SiPG0VZ6UYX$ACzko4;tS4l$$G`g$xh#>I zw%#ehi@k%-+QiT&8|!+rOobflo!)wZ&ht2&xel!PB%AoOza9Y!TuD z4{e)_AS0o(o)1gM$&M&+mC0lftCfCbYH24D>G58yUmVRn?1|p2!J+A8 zS-w4VnJcraYkFS|4Gr1EiGJGUt1RRzkjbj1xINbz;Lg4UzzF~%z##u^E3xsI!^I3r zcH|n@1Ot35jvS4rQ2mMzZ3TVnB!}5>>EhgN1@?Xs!twFx1IoF&$g(JFZ$<|6({c~4 zJh=y3xI;5JXhE>&Tq;$KWR=(`X$GJG01Q<#-vcuKF zyyw{3%^?srT&>>)z{aVUw0BJ_4x}ukyJ54o>)tNJ+%Ly=R$zP1EN?6(*X8* z=A;NMnHJqW-3Z@dbHanpPUw$}jFJkH_1nrYooBRKim_+XG&4mier~EvnzoOV|AXuP z;5lA;esS6k?CsL!=MSs-ultcqRCQn|2m5K9OxNzNA+(jc)Mq;Uy8d59#}GKQUi|f? z`^7oQsgIs?d)}yV>%VU|)MnRz%ce(yugf-$6W}*EGB+{k!8BrPiSEtvm5*!C+3_e6 zSWJ#5mkA8Q{a(-g?sE2u_?QXNw~vfW0Cj zQM0K~>+&J33t6m?&b3FSu0yRRdxWc8`G!mp%6{z+RH_D(J}@vaGsOjAbb*SY2({Eo zNhM%!QrI5@wPQo@edK`&@1Z;PXEW^%gmPkdbU!lrte7?+HFn91O#bVn{3BWx=_t+o%q;kSDD1qm@BPaf08+t}@B2&ykV^7%!Hw&~aUu@7uR;XTrbepKYx7yL8-V?4fyoi~hrNgsK$5uFaDATatEZ zs6--s^Aes`Ia8CB07LkKWTH_20e&tWKL7v# diff --git a/platform/uiq2/launcher/PicoN32x32m.bmp b/platform/uiq2/launcher/PicoN32x32m.bmp deleted file mode 100644 index 69f15e99e98de4588c296b840ba0b7bb80b2a86b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3126 zcmdUryAi@L5JW``1rRbsRNw;0>AwPq=mBn6*jY{|Axn0EW@PWJ_MSfH%d|_cG1>QI z^YEUVv^QnL){k3E7%4rz$H$)iHw=2fQ>{D9+MdhaE2RqVXx)cO97J^h(>QV`@R>wLOKJzV5=->a%d#X0 z3`MD{#SekG*@6l)IjZD@?RB$+3jGj;WMwHt{WJk&Y;nGkjkzkHaESa0E-+ZG#4o+l z;Az>8W24k7Ffb^TZzxv|!gHYU$C*lS2VRyBIGJuQJw~5)e1mYWKA?6Hz95r)h5sWT qPt9BKUhuW-)`aW(!0cwCQOPAevPFrR`?`y+s_(SMMzq7CECHWmI`iNF diff --git a/platform/uiq2/launcher/PicodriveN.hrh b/platform/uiq2/launcher/PicodriveN.hrh deleted file mode 100644 index c2a4aee6..00000000 --- a/platform/uiq2/launcher/PicodriveN.hrh +++ /dev/null @@ -1,70 +0,0 @@ - -enum TAppMenuCommands -{ - // Emu menu - EEikCmdPicoLoadState = 10000, - EEikCmdPicoSaveState, - EEikCmdPicoLoadROM, - EEikCmdPicoResume, - EEikCmdPicoReset, - EEikCmdPicoKeys, - EEikCmdPicoSettings, - - // Frameskip menu - EEikCmdPicoFrameskipAuto, - EEikCmdPicoFrameskip0, - EEikCmdPicoFrameskip1, - EEikCmdPicoFrameskip2, - EEikCmdPicoFrameskip4, - EEikCmdPicoFrameskip8, - - // Debug menu - EEikCmdPicoDebugKillEmu, - EEikCmdPicoDebugInfo, - - // config Dialog - // pages - ECtlOptPageMain, - ECtlOptPageSound, - ECtlOptPageMisc, - // main page - ECtlOptRotationLabel, - ECtlOptRotation, - ECtlOptRotation0, - ECtlOptRotation90, - ECtlOptRotation180, - ECtlOptRotation270, - ECtlOptScreenModeLabel, - ECtlOptScreenMode, - ECtlOptScreenModeCenter, - ECtlOptScreenModeFit, - ECtlOptScreenModeFit2, - ECtlOptUseAltRend, - ECtlOptUseAccTiming, - ECtlOptUseAccSprites, - ECtlOptShowFPS, - // sound page - ECtlOptEnableSound, - ECtlOptChipSelLabel, - ECtlOptEmulateZ80, - ECtlOptEmulateYM2612, - ECtlOptEmulateSN76496, - ECtlOptSndQLabel, - ECtlOptSndQuality, - // misc page - ECtlOpt6ButtonPad, - ECtlOptGzipStates, - ECtlOptUseSRAM, - ECtlOptMotDontUseVol, - ECtlOptRegionLabel, - ECtlOptRegion, - // credits - ECtlCredits, - // debug - ECtlDebugEdit -}; - - -#define ECtlAboutVersion 1 -#define ECtlAboutLinks 2 - diff --git a/platform/uiq2/launcher/PicodriveN.mmp b/platform/uiq2/launcher/PicodriveN.mmp deleted file mode 100644 index 63628608..00000000 --- a/platform/uiq2/launcher/PicodriveN.mmp +++ /dev/null @@ -1,34 +0,0 @@ -TARGET PicodriveN.app -TARGETTYPE app -TARGETPATH \system\Apps\PicodriveN -UID 0x100039CE 0x1000C193 - - -USERINCLUDE . - -SYSTEMINCLUDE \epoc32\include - -SOURCEPATH . -SOURCE App.cpp -SOURCE Engine.cpp -SOURCE Dialogs.cpp -SOURCE CSimpleTextParser.cpp -SOURCE SimpleClient.cpp - -LIBRARY EUSER.LIB WS32.LIB EFSRV.LIB -LIBRARY APPARC.LIB CONE.LIB -LIBRARY EIKCOCTL.LIB EIKCORE.LIB EIKDLG.LIB EIKCTL.LIB -LIBRARY EIKFILE.LIB // CEikFileOpenDialog -LIBRARY EGUL.LIB // CColorList -LIBRARY ETEXT.LIB // TCharFormat -LIBRARY GDI.LIB // TTypeface - -//LIBRARY ETEL.LIB -//LIBRARY APGRFX.LIB FBSCLI.LIB bafl.lib BITGDI.LIB - -SOURCEPATH . -RESOURCE PicodriveN.rss - -//MACRO __DEBUG_PRINT - -AIF PicodriveN.aif . PicodriveNAif.rss c8 PicoN20x16.bmp PicoN20x16m.bmp PicoN32x32.bmp PicoN32x32m.bmp diff --git a/platform/uiq2/launcher/PicodriveN.rss b/platform/uiq2/launcher/PicodriveN.rss deleted file mode 100644 index d4db38a7..00000000 --- a/platform/uiq2/launcher/PicodriveN.rss +++ /dev/null @@ -1,474 +0,0 @@ -NAME PDN - -#include -#include -#include "picodriven.hrh" - - -RESOURCE RSS_SIGNATURE { } - -RESOURCE TBUF { buf=""; } - -RESOURCE EIK_APP_INFO - { - menubar=r_app_menubar; - hotkeys=r_app_hotkeys; - } - -RESOURCE HOTKEYS r_app_hotkeys - { - control= - { - HOTKEY { command=EEikCmdExit; key='e'; } - }; - } - -RESOURCE MENU_BAR r_app_menubar - { - titles= - { - MENU_TITLE { menu_pane=r_app_emu_menu; txt="Emu"; }, - MENU_TITLE { menu_pane=r_app_frameskip_menu; txt="Frameskip"; } -#ifdef __DEBUG_PRINT - ,MENU_TITLE { menu_pane=r_app_debug_menu; txt="Debug"; } -#endif - }; - } - -RESOURCE MENU_PANE r_app_emu_menu - { - items= - { - MENU_ITEM { command=EEikCmdPicoLoadState; txt="Load state"; flags=EEikMenuItemDimmed; }, - MENU_ITEM { command=EEikCmdPicoSaveState; txt="Save state"; flags=EEikMenuItemDimmed; }, - MENU_ITEM { command=EEikCmdPicoLoadROM; txt="Load new ROM"; }, - MENU_ITEM { command=EEikCmdPicoResume; txt="Resume game"; flags=EEikMenuItemDimmed; }, - MENU_ITEM { command=EEikCmdPicoReset; txt="Reset game"; flags=EEikMenuItemDimmed; }, - MENU_ITEM { command=EEikCmdPicoKeys; txt="Configure keys"; }, - MENU_ITEM { command=EEikCmdPicoSettings; txt="Settings"; }, - MENU_ITEM { command=EEikCmdHelpAbout; txt="About"; flags=EEikMenuItemSeparatorAfter; }, - MENU_ITEM { command=EEikCmdExit; txt="Exit"; } - }; - } - -RESOURCE MENU_PANE r_app_frameskip_menu - { - items= - { - MENU_ITEM { command=EEikCmdPicoFrameskipAuto; txt="Auto"; flags=EEikMenuItemRadioStart | EEikMenuItemSeparatorAfter; }, - MENU_ITEM { command=EEikCmdPicoFrameskip0; txt="0"; flags=EEikMenuItemRadioMiddle; }, - MENU_ITEM { command=EEikCmdPicoFrameskip1; txt="1"; flags=EEikMenuItemRadioMiddle; }, - MENU_ITEM { command=EEikCmdPicoFrameskip2; txt="2"; flags=EEikMenuItemRadioMiddle; }, - MENU_ITEM { command=EEikCmdPicoFrameskip4; txt="4"; flags=EEikMenuItemRadioMiddle; }, - MENU_ITEM { command=EEikCmdPicoFrameskip8; txt="8"; flags=EEikMenuItemRadioEnd; } - }; - } - -RESOURCE MENU_PANE r_app_debug_menu - { - items= - { - MENU_ITEM { command=EEikCmdPicoDebugKillEmu; txt="Kill emu proc"; }, - MENU_ITEM { command=EEikCmdPicoDebugInfo; txt="info"; } - }; - } - - - -/************************************** - * - * about dialog - * - **************************************/ - -RESOURCE DIALOG r_dialog_about -{ - title = "About"; - buttons = r_buttons_continue_credits; - flags = EEikDialogFlagWait; - items = - { - DLG_LINE - { - itemflags = EQikDlgItemUseFullWidth | EQikDlgItemDenselyPacked; - type = EEikCtRichTextEditor; - id = ECtlAboutVersion; - control = RTXTED - { - flags = EEikEdwinResizable | EEikEdwinNoAutoSelection | EEikEdwinReadOnly | EEikEdwinWidthInPixels; - numlines = 4; - }; - }, - DLG_LINE - { - itemflags = EQikDlgItemUseFullWidth | EQikDlgItemDenselyPacked; - type = EEikCtRichTextEditor; - id = ECtlAboutLinks; - control = RTXTED - { - flags = EEikEdwinResizable | EEikEdwinNoAutoSelection | EEikEdwinReadOnly | EEikEdwinWidthInPixels | 0x00200000; - numlines = 4; - }; - } - }; -} - -RESOURCE DLG_BUTTONS r_buttons_continue_credits -{ - buttons = - { - DLG_BUTTON { id = EEikBidYes; button = CMBUT { txt = "Credits"; }; }, - DLG_BUTTON { id = EEikBidCancel; button = CMBUT { txt = "Continue"; }; flags=EEikLabeledButtonIsDefault; } - }; -} - - -RESOURCE TBUF r_simple_text_about_links -{ - buf= - "Email: notasas@gmail.com"\ - "

Web:

http://notaz.atspace.com"\ - "

Dave's Web:

http://www.finalburn.com"; -} - - -RESOURCE TBUF r_simple_text_about -{ - buf= - "PicodriveN"\ - "

for UIQ2"\ - "

Version %S, by notaz."\ - "

Port based on PicoDrive 0.030 for Pocket PC by Dave"; -} - - -RESOURCE DIALOG r_dialog_credits -{ - title = "Credits and thanks"; - buttons = R_EIK_BUTTONS_DONE; - flags = EEikDialogFlagWait; - items = - { - DLG_LINE - { - type = EEikCtGlobalTextEditor; - id = ECtlCredits; - control = GTXTED - { - width = 150; height = 200; numlines = 26; flags = EEikEdwinReadOnly | EEikEdwinNoAutoSelection | EEikEdwinDisplayOnly; - }; - } - }; -} - - -RESOURCE ARRAY r_tbuf_credits -{ - items= - { - LBUF{txt="This emulator uses code from these people / projects:";}, - LBUF{txt="";}, - LBUF{txt="Dave";}, - LBUF{txt="- Cyclone 68000 core, Pico emulation library";}, - LBUF{txt="Homepage: http://www.finalburn.com/";}, - LBUF{txt="E-mail: david(atsymbol)finalburn.com";}, - LBUF{txt="";}, - LBUF{txt="Reesy & FluBBa";}, - LBUF{txt="- DrZ80, the Z80 emulator written in ARM assembly.";}, - LBUF{txt="Homepage: http://reesy.gp32x.de/";}, - LBUF{txt="E-mail: drsms_reesy(atsymbol)yahoo.co.uk";}, - LBUF{txt="";}, - LBUF{txt="Tatsuyuki Satoh, Jarek Burczynski, MultiArcadeMachineEmulator (MAME) development";}, - LBUF{txt="- software implementation of Yamaha FM sound generator and";}, - LBUF{txt="Texas Instruments SN76489 / SN76496 programmable tone / noise generator";}, - LBUF{txt="Homepage: http://www.mame.net/";}, - LBUF{txt="";}, - LBUF{txt="Additional thanks:";}, - LBUF{txt="- Peter van Sebille for ECompXL and his various open-source Symbian projects to learn from.";}, - LBUF{txt="- Steve Fischer for his open-source Motorola projects.";}, - LBUF{txt="- Charles MacDonald (http://cgfm2.emuviews.com/) for old but still very useful info about genesis hardware.";}, - LBUF{txt="- Stéphane Dallongeville for creating Gens and making it open-source.";}, - LBUF{txt="- Steve Snake for all that he has done for Genesis emulation scene.";}, - LBUF{txt="- Bart Trzynadlowski for his SSFII and 68000 docs.";}, - LBUF{txt="- Haze for his research (http://haze.mameworld.info).";}, - LBUF{txt="- The development team behind \"Symbian GCC Improvement Project \" (http://www.inf.u-szeged.hu/symbian-gcc/) for their updated compile tools.";}, - LBUF{txt="- Mark and Jean-loup for zlib library.";}, - LBUF{txt="- Reesy for also finding some Cyclone bugs.";}, - LBUF{txt="- Inder for the icons.";} - }; -} - - -/************************************** - * - * debug dialog - * - **************************************/ - -RESOURCE DIALOG r_dialog_debug -{ - title = "debug"; - buttons = R_EIK_BUTTONS_DONE; - flags = EEikDialogFlagWait; - items = - { - DLG_LINE - { - type = EEikCtGlobalTextEditor; - id = ECtlDebugEdit; - control = GTXTED - { - width = 150; height = 200; numlines = 26; flags = EEikEdwinReadOnly | EEikEdwinNoAutoSelection | EEikEdwinDisplayOnly; - }; - } - }; -} - - -/************************************** - * - * config dialog - * - **************************************/ - -RESOURCE DIALOG r_pico_config -{ - title = "Settings"; - buttons = R_EIK_BUTTONS_CANCEL_OK; - flags = EEikDialogFlagWait; - pages = r_pico_config_pages; -} - -RESOURCE ARRAY r_pico_config_pages -{ - items = { - PAGE - { - id = ECtlOptPageMain; - text = "Main"; - lines = r_pico_config_page_main; - }, - PAGE - { - id = ECtlOptPageSound; - text = "Sound"; - lines = r_pico_config_page_sound; - }, - PAGE - { - id = ECtlOptPageMisc; - text = "Misc"; - lines = r_pico_config_page_misc; - } - }; -} - - -RESOURCE ARRAY r_pico_config_page_main -{ - items = { - DLG_LINE - { - id = ECtlOptRotationLabel; - type = EEikCtLabel; - prompt = "Screen Rotation"; - control = LABEL { horiz_align = EEikLabelAlignHLeft; }; - }, - DLG_LINE - { - id = ECtlOptRotation; - type = EEikCtHorOptionButList; - control = HOROPBUT - { - array_id = r_pico_config_rotation_buttons; - }; - }, - DLG_LINE - { - id = ECtlOptScreenModeLabel; - type = EEikCtLabel; - prompt = "Screen Mode"; - control = LABEL { horiz_align = EEikLabelAlignHLeft; }; - }, - DLG_LINE - { - id = ECtlOptScreenMode; - type = EEikCtHorOptionButList; - control = HOROPBUT - { - array_id = r_pico_config_screenmode_buttons; - }; - }, - DLG_LINE - { - id = ECtlOptUseAltRend; - type = EEikCtCheckBox; - prompt = "Fast renderer (inaccurate)"; - }, - DLG_LINE - { - id = ECtlOptUseAccTiming; - type = EEikCtCheckBox; - prompt = "Accurate timing (slower)"; - }, - DLG_LINE - { - id = ECtlOptUseAccSprites; - type = EEikCtCheckBox; - prompt = "Accurate sprites (slower)"; - }, - DLG_LINE - { - id = ECtlOptShowFPS; - type = EEikCtCheckBox; - prompt = "Show FPS"; - } - }; -} - - -RESOURCE ARRAY r_pico_config_page_sound -{ - items = { - DLG_LINE - { - id = ECtlOptEnableSound; - type = EEikCtCheckBox; - prompt = "Enable sound"; - }, - DLG_LINE - { - id = ECtlOptChipSelLabel; - type = EEikCtLabel; - prompt = "Emulate these sound chips:"; - control = LABEL { horiz_align = EEikLabelAlignHLeft; }; - }, - DLG_LINE - { - id = ECtlOptEmulateZ80; - type = EEikCtCheckBox; - prompt = "Z80"; - }, - DLG_LINE - { - id = ECtlOptEmulateYM2612; - type = EEikCtCheckBox; - prompt = "YM2612"; - }, - DLG_LINE - { - id = ECtlOptEmulateSN76496; - type = EEikCtCheckBox; - prompt = "SN76496 (PSG)"; - }, - DLG_LINE - { - id = ECtlOptSndQLabel; - type = EEikCtLabel; - prompt = "Quality (lowest is fastest)"; - control = LABEL { horiz_align = EEikLabelAlignHLeft; }; - }, - DLG_LINE - { - id = ECtlOptSndQuality; - type = EEikCtChoiceList; - prompt = ""; - control = CHOICELIST { array_id = r_pico_config_snd_quality; }; - itemflags = EEikDlgItemNonFocusing; - } - }; -} - - -RESOURCE ARRAY r_pico_config_page_misc -{ - items = { - DLG_LINE - { - id = ECtlOpt6ButtonPad; - type = EEikCtCheckBox; - prompt = "6 button pad"; - }, - DLG_LINE - { - id = ECtlOptGzipStates; - type = EEikCtCheckBox; - prompt = "gzip save states"; - }, - DLG_LINE - { - id = ECtlOptUseSRAM; - type = EEikCtCheckBox; - prompt = "Use SRAM saves (.srm)"; - }, - DLG_LINE - { - id = ECtlOptMotDontUseVol; - type = EEikCtCheckBox; - prompt = "Motorola: don't use volume keys for game controls"; - }, - DLG_LINE - { - id = ECtlOptRegionLabel; - type = EEikCtLabel; - prompt = "Region: "; - control = LABEL { horiz_align = EEikLabelAlignHLeft; }; - }, - DLG_LINE - { - id = ECtlOptRegion; - type = EEikCtChoiceList; - prompt = ""; - control = CHOICELIST { array_id = r_pico_config_region; }; - itemflags = EEikDlgItemNonFocusing; - } - }; -} - - -RESOURCE ARRAY r_pico_config_rotation_buttons -{ - items = { - OPBUT { id = ECtlOptRotation0; text = "0º"; }, - OPBUT { id = ECtlOptRotation90; text = "90º"; }, - OPBUT { id = ECtlOptRotation180; text = "180º"; }, - OPBUT { id = ECtlOptRotation270; text = "270º"; } - }; -} - - -RESOURCE ARRAY r_pico_config_screenmode_buttons -{ - items = { - OPBUT { id = ECtlOptScreenModeCenter; text = "Center"; }, - OPBUT { id = ECtlOptScreenModeFit; text = "Fit"; }, - OPBUT { id = ECtlOptScreenModeFit2; text = "Fit2"; } - }; -} - - -RESOURCE ARRAY r_pico_config_snd_quality -{ - items = { - LBUF { txt = "8000Hz mono"; }, - LBUF { txt = "11025Hz mono"; }, - LBUF { txt = "16000Hz mono"; }, - LBUF { txt = "22050Hz mono"; }, - LBUF { txt = "8000Hz stereo"; }, - LBUF { txt = "11025Hz stereo"; }, - LBUF { txt = "16000Hz stereo"; }, - LBUF { txt = "22050Hz stereo"; } - }; -} - - -RESOURCE ARRAY r_pico_config_region -{ - items = { - LBUF { txt = "Auto"; }, - LBUF { txt = "Europe"; }, - LBUF { txt = "USA"; }, - LBUF { txt = "Japan PAL"; }, - LBUF { txt = "Japan NTSC"; } - }; -} diff --git a/platform/uiq2/launcher/PicodriveNAif.rss b/platform/uiq2/launcher/PicodriveNAif.rss deleted file mode 100644 index d39cf281..00000000 --- a/platform/uiq2/launcher/PicodriveNAif.rss +++ /dev/null @@ -1,14 +0,0 @@ -#include - -RESOURCE AIF_DATA -{ - app_uid=0x1000C193; - caption_list= - { - CAPTION { code=ELangEnglish; caption="PicodriveN"; } - }; - num_icons=2; - embeddability=KAppNotEmbeddable; - newfile=KAppDoesNotSupportNewFile; -} - diff --git a/platform/uiq2/launcher/SimpleClient.cpp b/platform/uiq2/launcher/SimpleClient.cpp deleted file mode 100644 index e653721d..00000000 --- a/platform/uiq2/launcher/SimpleClient.cpp +++ /dev/null @@ -1,33 +0,0 @@ - -// needed for client interface -#include "../version.h" -#include "../ClientServer.h" -#include "SimpleClient.h" - - -// Connect to the server - default number of message slots = 4 -TInt RServSession::Connect() -{ - TInt r=CreateSession(KServerName,Version(),kDefaultMessageSlots); - return(r); -} - - -// Return the client side version number. -TVersion RServSession::Version(void) const -{ - return(TVersion(KPicoMajorVersionNumber,KPicoMinorVersionNumber,0)); -} - - -TInt RServSession::SendReceive(TInt aFunction, TAny* aPtr) const -{ - return RSessionBase::SendReceive(aFunction, aPtr); -} - - -TInt RServSession::Send(TInt aFunction, TAny* aPtr) const -{ - return RSessionBase::Send(aFunction, aPtr); -} - diff --git a/platform/uiq2/launcher/SimpleClient.h b/platform/uiq2/launcher/SimpleClient.h deleted file mode 100644 index 11cd7a01..00000000 --- a/platform/uiq2/launcher/SimpleClient.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef __SERVSESSION_H__ -#define __SERVSESSION_H__ - -#include - - -//********************************** -// RServSession -//********************************** - -class RServSession : public RSessionBase -{ -public: - RServSession() {} - TInt Connect(); - TVersion Version() const; - TInt SendReceive(TInt aFunction,TAny* aPtr) const; - TInt Send(TInt aFunction,TAny* aPtr) const; -}; - - -#endif - diff --git a/platform/uiq2/launcher/nicemake.c b/platform/uiq2/launcher/nicemake.c deleted file mode 100644 index bb48c05c..00000000 --- a/platform/uiq2/launcher/nicemake.c +++ /dev/null @@ -1,101 +0,0 @@ -#include -#include -#include - - -void targetname(char *dest, char *src) -{ - char *p, *p1; - - if(strlen(src) < 5 || src[0] == '\t') return; - - // goto string end - for(p=src; *p && *p != ' ' && *p != '\r'; p++); - // goto start - for(p1=p; p1 > src && *p1 != '\\'; p1--); p1++; - if(p-p1 > 0) { - strncpy(dest, p1, p-p1); - dest[p-p1] = 0; - } -} - - -int main(int argc, char *argv[]) -{ - FILE *f = 0, *fo = 0; - unsigned char buff[512], buff2[128], outname[512]; - buff2[0] = 0; - - if(argc != 2) { - printf("usage: %s \n\n", argv[0]); - return 1; - } - - f = fopen(argv[1], "r"); - if(!f) { - printf("%s: couldn't open %s\n", argv[0], argv[1]); - return 2; - } - - strcpy(outname, argv[1]); - strcat(outname, ".out"); - fo = fopen(outname, "w"); - if(!fo) { - fclose(f); - printf("%s: couldn't open %s for writing\n", argv[0], outname); - return 3; - } - - - while(!feof(f)) { - fgets(buff, 512, f); - if(!strncmp(buff, "\t$(GCCUREL)", 11) && !strchr(buff, '>')) { - fprintf(fo, "\t@echo %s: gcc\n\t@$(GCCUREL)", buff2); - fputs(buff+11, fo); - } else if(!strncmp(buff, "\tperl -S ecopyfile.pl", 21) && !strchr(buff, '>')) { - fprintf(fo, "\t@echo %s: perl -S ecopyfile.pl\n\t@perl", buff2); - fputs(buff+5, fo); - } else if(!strncmp(buff, "\tperl -S epocrc.pl", 18) && !strchr(buff, '>')) { - fprintf(fo, "\t@echo %s: perl -S epocrc.pl\n\t@perl", buff2); - fputs(buff+5, fo); - } else if(!strncmp(buff, "\tperl -S epocaif.pl", 19) && !strchr(buff, '>')) { - fprintf(fo, "\t@echo %s: perl -S epocaif.pl\n\t@perl", buff2); - fputs(buff+5, fo); - } else if(!strncmp(buff, "\tperl -S emkdir.pl", 18) && !strchr(buff, '>')) { - fprintf(fo, "\t@echo %s: perl -S emkdir.pl\n\t@perl", buff2); - fputs(buff+5, fo); - } else if(!strncmp(buff, "\tperl -S makedef.pl", 18) && !strchr(buff, '>')) { - fprintf(fo, "\t@echo %s: perl -S makedef.pl\n\t@perl", buff2); - fputs(buff+5, fo); - } else if(!strncmp(buff, "\tld ", 4) && !strchr(buff, '>')) { - fprintf(fo, "\t@echo %s: ld\n\t@ld ", buff2); - fputs(buff+4, fo); - } else if(!strncmp(buff, "\tar ", 4) && !strchr(buff, '>')) { - fprintf(fo, "\t@echo %s: ar\n\t@ar ", buff2); - fputs(buff+4, fo); - } else if(!strncmp(buff, "\tif exist ", 10) && !strchr(buff, '>')) { - fprintf(fo, "\t@echo %s: if exist (del?)\n\t@if exist ", buff2); - fputs(buff+10, fo); - } else if(!strncmp(buff, "\tdlltool ", 9) && !strchr(buff, '>')) { - fprintf(fo, "\t@echo %s: dlltool\n\t@dlltool ", buff2); - fputs(buff+9, fo); - } else if(!strncmp(buff, "\tpetran ", 8) && !strchr(buff, '>')) { - fprintf(fo, "\t@echo %s: petran\n\t@petran ", buff2); - fputs(buff+8, fo); - } else { - // try to get new targetname - targetname(buff2, buff); - fputs(buff, fo); - } - } - - - // done! - fclose(f); - fclose(fo); - - remove(argv[1]); - rename(outname, argv[1]); - - return 0; -} diff --git a/platform/uiq2/launcher/nicemake.exe b/platform/uiq2/launcher/nicemake.exe deleted file mode 100644 index 95c7317a45953e6eff26837c1bd548d9722ebb79..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 45056 zcmeIb4Ompi**AWcJ>UTrcU4eKFs>2PSd1k>jb!~;ghfomEFz1Jw=F^WfHPL@U+B7-jn1rZ-Rf*^Q-E$UP zt?AqA{kX3G`(7;0&YXMhx#ymHX6~7}=RRxUJ&$sBj^lU))8x2)i0R{H-~asU1hPj@ z{^MxwnfOb;^pG^^NZOhK=_%R6O8bSFvHkM$!HCDtCjl!M%QiJMZpd_X8U% zt7ax8C8S44f4+AAuK%(fIdeH2Jrl(9ZSmTf-y(kJhLdNWrsqlToOzKwzkOyW;=kY6 z!{E!;udAW5S99w3aokdyol6SlX0zv^FJ`GqH`FJ6anGv)$Ja9pT%t(xA=;P(Mj-m8OJR*S+35-Z!L;@oc z7?Hq;1V$t76*Bceidc$#y|0@uHRL@&!4$Nr(|Afpt|Vs>uv`IsLr^A|>pz z0k`)F(5)!|SS@j=i+I2Ow3Vwca`Fp|sFV&-s73tp2$`is=06ysV_yuBDFK-X1x?$6 z>WlPJ9I8=GO(l@E?-6XdUL1kd60DVAetqFkg~YY|0^?oEQZ=f%NPk)&Dtv@Mr2aap z|GG&1WQgefGbEsXkBX>^9CDAVwZqxEjbIj;8V+27#uvmy93$zdO{{s;VgpdWzK?ah zqqRdSs9k_I09d5|4R#W=0l+M+B)Gih2^3J7c>Q`4%X6q2aa^Q*PiDl^trEQ#z*cQa z&AzA_0@tdc`KlU@MAdNpRW&rR8V<0LAoM;?HH@tZN7Zo7DsW{RCSO&9qxo_ho{fyE zp*C1Gtc}z#hiVvClZgW8EGDIYyH*V^Sop(I%8RO@^qMtXLf1g9y>G;@Hq=Gcka?{d zR$Wy?Fsg>n8Li9xV71|iNDU2E4NpeZ@S4Tal~Ouy;SaZAUsMg>y=Dz}L~3wR4SY>c zR1J04s^QG&_Ek0TJ1+P1>x|ZADOoja ziqx=_YDlO_MS-E7-ea+JrIe0a_`_04kE-E;t7_Q6+K?Qn;Uf+;#Mdm1sv-YcH9UA# z4J)H+NW7|sW>&**A%7Z6ZB&C$vn8sA_pJh8*LQhNJBMq?WOKSDs)k=MT9>61WHtD$ z8jR@?*=U8qBK^>LXsd&Q`aPQd%ZH>kEy7GafI}+mV^$#_!PMW0JVGNE@J0Gzh#m^= zD&^VAph8v$>G)UFrRk2+*2CgMfnxP7RZLGF=mHT=-Inf>Ms@baNE?kQ?Q!{SqZTg_ zr?qs5)2)2TP~W25BKdE2G08$e?$_>;&Z>Fou2to0LId4INE}N=oh|K1TM+3Jt7siE z?vgI7Dn|ifO-Pv_ck@fc-~7?MbZNU9XFnqMnOO(a@p2dc3(jV17T;+(CeCQ-7jGCi z08=_AIwj3W9{7z|6TLp;7h?dJzN z8K=qZwj8v&IFm}cv;!G^LuWC6aQO)QK zX*rjMQ(p|H1|um`Ocz*4;p@E|Mv`Era7Y<3SshsT6aBh@VO%C3GDBG%Az<=mitr_v zol%%rw~GU%rX=W-v1pl+L+#TAG=@^)K&_2(NYm5viBkO`Hs9S@9iDfbk9DjmFIdHv zev85p&{g|1pUV$yD)?RKP{bgl=dgmQYWJFQ45Y|MTV$>ZX-}q;?6k^sE~}#*-CL}l z=Z=1RxhcNE(?c8h2QAQi10{Y@4>gcd3j>n{!mmtOhReCG<6;2I-k<}qjlOTPT zb<*eyV2TQ*^6RFW@7UuNV=*|4JNC%ptbktbzN*@&^NYwc)?1->y> z%}=vN)$dT5T%E?1soiq5gIiNR+<9nkDQ3Q4)JA$xWh1#XGC`cy1n~?_kbgcmrb58i zS#x9b<+-udG?KKfmkdGM`h{WFw$fy9MCea!ACrSgUfDKbaioe*j94~@Eu~-^QVL^+ z=iz(6p9Q7xm55RpYbgax!)|4QrC6%1MAzaNZcQliuqMdbf z<*R5c)S5MiFm-Fhxn8bv7flX-r813T`LqkORjJa=6c;eEjWnX@Yi%YKeERPnv<*Y^NV^_^A)HC`#~ z@fYcJV^B?5NCm@EkNzLXmgmn!sTeUi1^9Z6_?hqEucR}9UK9kRnYnUXTPv4x{9a{h#jAIny|NInC zcM~AgeExaB8pbxCe+jXLg)KR^DZxrZ5L}4OA(|l{O`@(Z6E`Hfgy$uXP?Cx#CjIN66S+E-lW)RY6}YnU5Jt13-wTXUe!T%00AXMiVeqI;4(D&0T&hn{ng&}<#V4rm zN~5wmdS69zRVmqOfhefp$d_!4>h>iQ>*_K`^Lqk@usB`K=b;;J^qf#HHpHl5T0G1- zddFmro4%d5Ex@SHc-Ph>82O&n$qo6~E+hu@PjE;=tEH`SQ!RsTnwc}yp z6WnpFC!MW+%stiT!fZMml9xH$IINu%8_ z>vr)LSr^2~1qI?*JULs-kS!Mu3cY?S!S^n<61Lt2NCXQ9gT1pYNKEexf?WKnG?kWM z{c}9gK=buDwXqfoKX3w%y*!>&fcL+w@j)#w=ZMj(l=Ss}j3t_i-@uCR9V*`E)Q;2Q z4gPyyLPFyeDv4r>udjC>E3`zM8N65{x`P+%#IeDPo1LvcCV1f&Lhrw`vV*SPZ(9j> zZ!2XjoFgR%AGXbsMlW6ryddP>OUD(Z zkaj&novb^Yt-a97)dRl4OhMwQ0jks|UoxfG{TNgaGs%#tf-qb{nR-Ym3_DvcVdS+Q zmg3c<?-Mg6*j`G?jkzH?Z_Z|nA*Ao9j^ zS-(fTP1fVZKNUDzbijHAG*CZ*ty)eWp z_kAIV6Pzz{M|HFjHAR})`+JgR)hTK@a(j2f@x*5hOF^ z6cEaY`qeI**2Xp8>?`eb(l}aHQKsAvl*4?Ox-v zjLzOiSg}4@Ur-tr7_Q$p7=-MhTRCxcyYG!I-$$8zQMd1XNRMmt8Ad?_gUW~=G$F>A z&HCkf^dR!wWnz4_T6nrz5sX;GiV*4b-l^0d7*-$;y$jqgf+D60l)}fzDKm1Yv^WLd zUN)2*`XPclU+nmSF-?D-rT@@joEb(C^q;eWJ^GI*&N@ap;`Ob^9-gobi$UXFYBK`=H3< zC`a_DzH>iV?k^1}z7D12px%I$!ITcFC*)A3DRp2wMeC@1F`MeyZnv*~1C~v*Fx-}E z{2l~hvNU~R)E|RUDo%v;GMJqyfm107NM1a5*)owOH=W>|t>+*kb@gC>$SdB|-)$4) z&=t2B$^9WKnPJ5DhhoG;K;7sbbRt3fssA11P(p4x#fdp`(>ZQCwOw5u*0z|{sy!EU4*7HS?_UqO zV=`{PO)ETI1i}oilh+qYtKD~_ZAXlh2rH&^&XmIXAFW(;7B5C~`Cz0}lfzp1u;#Un zgB<~TH@0ZTP4RN4CVRO7gj~0mdkA3%!XFUsL>?AU7-G#O{Fc$`n0BAg7Gv6+d$AuP z#`F)8!78oMnCDWgESRf9Cbv3-tq1G`jMME?u!Bhr&^8z$S%1pfEXxZ_aTG&%_-{C9 z6sz~9JJir!fzsBF?Kh!t8cMmG`{PRUQ7R28FH&qF6${;k!Sh$zL1XX3%N(zAP$`iI z0bA0Xuv#?qjLd4vWxG2%9m&p?gAmFdud|glg?nPe1czJ6cl7=mPYzr4FB~>JN$~-_ z7$dO^^NqG`=B8A0lR&$}#poW=zHDn$M;n;?)PSS^zz%7ay3AE7pEt#1^?aupE5A2c zo%h1p-*`D~-s?u}i*D$t_PhBt!S{9q&+m}pg0H!ifTMYPDp`uLLt5tO?-WEw|DSlM z&-_%j6&qcEdaUzcd1&Co^&K!Y%N?%xe1}}kb2#N$o4tT439bF&J-Z4}n;f=F;{*B> z;=Z*bAkOjYUP_l4cgW!w=_bubBWlne(APn=p()tnjiEKylm_*mTOh+3sKvHF59G|0 zRP1!h4~L3NSidHF=C6I)%Q@w5LSAaOI?x%8l|PuQrL|I1J3p|i_Wry~-X^Xu)%`P2 z0qx-C$)*jbQZq&xUmK%m16*rUbv+Y_GS8pN#I#a9ozhqa(oh>lc!Fj0P<8CLJ}%XF zW}q^AS+Fvb=UP7&<4g1p&O);rDcGAQ%hTv+5ZTwqgDnUK#)nl=oi0w=BZw2xh59R( zOtZSV+A(l33tOf*+LY(>0e;H8KY?XD!+^ayg*&6#I3;@e^sc~rekz)WjI}yX7y*C%rdiQ2Rppn_QG9T z&*FF>QcPkv-@}M) z`yDH&hD7Y0BPY`$oFLTMd!E997UzhplgjF_vU;$6)VvDux_J$va~^hnH$vGx3ujNx zaAX~pU$Ys)v+<<=UW=)<-P69av*mAK-*epAauTs~e}^1i@o0+(|SlMOFY!uKrPn4E@I<1Q`Qq{za1xe`~TD-d4jKcdyA2s zy*ez-?DmDJ(&i7$7frKwUIaX02>cr7#hz*!z$hw?$~x9N5$WKo!QL^5Yo0_|Q*trA zczQZU>mg`s&&y48dc02cC0nOPrQV^e=!^XJm- ztJO)YgDI6TGlhdJb$mZ7fu0$ws;wu61{Q7^8n{G)9P;MEDBtvUn=&4YKq0p7`ej@tIYhz zzloFjM_I?7y_qr(sAnv#q4G>?sC*wOQd+g`a=a;bx)(K{Zv*DGH_AhLco1Tq-$qkh zjP1REdPBQJ#*i3e9;rzV!hj;+OMeZ$SHsgIM~^S!5q%JW^&`cN2y=rBcK4oWSYv4=4|s1(8m8OD8y_>ZUrbBzYz#Z}jI+g!gt}6|skkKtN%>-|R|;|9bto*2O}~6zaJC*|xh||zYDzM`?MDNimzq+vSxYjGYO{X- zWAq`}9l9KMN&{GPXQu&YK4xZzJyEmCXIR!Ykq4o_DjpY4)9*BndAHHSt}PbYyy zSOG%CStqk6)u4+5rBbZkbPHrVo9t;>W_#QnA#v=y`J!!cK!5r}%nMD7vl+U^zrcfI zzy1bx>uO(_=d3cDtZlH=#p^Gh2A(>fD9oKKW|x%en^02K%Y4Cw^TiuW^dF&+Cxk_d zp+7Tn33{+3hZ`bMM>zax{_H_SCi;@==Rhj7Kf; zLHK68(sE3)7Z|kV;)B&D4#cS(4uH;<9<;38MYyqqM+ZU%r->EKyjqfM#&rA0$i`)z z49>k*;=Q@X0I@U!XAx-{mieYsF)6skcBAIENxXW%uq(J_z)B4JRI2l_14>EiQA0g` zSL-oxbS^Q{6?bpGX~RWZy9<2YDL18ZQUbBE5UhxIz$t?hX996zR1@PY`B<`XMhVak zshKu!?@Fv}td$U$Y3rRpkEUpsaRcE?#!i8D`$a{&o_LB@FZC8Lh79&8C$Wf`o{*Gf z{#otwoE4!R2!mQ{+-#=I1C|>0Ty(a41c;RvgH$i(I<|{8XKOPO7())LytCy1o~yHO zP`kv@UT<}Fs&w9p&SZ3{^XG!x(Qt9Gx476JC@xm=(r1}}QFV_Y-d3X5;rvZgCNJG3 zPAx7jA%lE6u*|<;tr?96m;M}?2$XwqU_l6&DYJ;ZkWoyV<)xmBq%wv$7U#{Ktaf7^ zo|`INq_6&rZm+7B=&`7VO=lR3`;EjBoLVE!Dy3#hCK2o+yCE&QWb{6rN1N#yl8F9N z94m^gr%-#n-mMcevuP{c9ZUOcH=3?}lQ2Dfjn@Tf*FW0q%8yOhML2R7Zt#$2{1vwi zxQt8jqpoVKSc@N^`#gKJT}V0L+96I3UxI?bJ|^7k<%ElS&-GvZW6GYjKpd%kL? zb$w2IA=lq&6KCRpBPD{%rQi~))Y~eY)#%bV=Ve~=2yweR)g76?C)mrW8lC{xfc}B?(5_i zwjeJ?8Y90@heT|HK&x~NI#O$W<6~?lAI0v~U$gc>I)1HWg`6!%KqBj;rV+y2|Dn~e+{?ncqkJyz3L&X5~G9J9*J+8XfTe> z)Fu@B^>5sSxlIOtxQ0RcVk#!OIF1$){c%tZHVwv=;dt9&$10H3QOjlHdbox*@y^FO z(6N1?IF z7PHK`;BANnTge?%8y)I51ZqKr=GY`}dxYmiU!X+0-({|NgkN0_3W*(J)|Pp|D%O8N z9Ri=Z`(1%z{T=oopcoGMd5;Ks1;)6_KceJ1P*y+zWT~?rF?O-H9*s2C5+j9(*P6xp z53Ta68F;8uO3*8UI$h04^Q$?jetl~M2`$`3_lz{0lF;Q}mFGXX18a>mrDhPV(o^xZ z>&IAqU<+Z#1=0nPGc^R#e45T}@OQ+y#S1xlTw)>=Th4s4MsNEppne96hUfc~QH4cv4apQOo~+KZ21cS%@?RvXUk{!)>`iclh!=L350E^P+(jH?iX>y(0BJ>?vz=e zQor^B716iZpUi&6EOn%yQ#`Z1nBbci2J}6c1+*y5!p$fq_$@Rc(Vv1=@0362Gwijl za?kAaUjliu+SRG!+&VSIB71|8gr(J9Yb%$#2sg^EB@)ZbZ0KQ2U4xw*L=MS4lRMAH zst%17*!H|mUheVI#uWAtc*elQQ|{Wc!`X5cZ6PC~L9tC7Pga{fF3ZlLE)&u(DWhT6 z0Y0mvGuzxg2`TI*@@dMg~vD0FxVU5(R`G<}2Z@xk*6(kRo{*Tp4y z+XSpi+V==ER0XNtW0Y(V|?YpK5z4dJ>A<9nH#jj z<8w8%XTjVJn6p&{3)xMAxTZFCWwuX{mRjBfI0bRL$s*YsM9Q*b;_}_-)(X#+!ajtX zFo$`$5|BQJ7D4|SKfjFp1g%Oj?_!=A^DT?2SA@>Sx#v1(%d1ccR$Vlsl=)PdF+RiB z_hq(FEUFPltVo3MT*}6Cp^LniI@P20F3+V+f+y_Uu?0O5@ySbuGoSodJFEi@)6f3Y zO#j}Yg-edvGB8DtVb<+`M_9AIXj1QQ2s^K z_Y}gD2u~n9hOiT%1z{V4n)mJZmApsZN30{(5uZkU8gU=uKE&q`pFNe%8nIE}!0LE9&go7bb%+UT^^@(2VxULg&LVhC3gZynUOWe-N=pMF{X zNnf1(=^*M|n}b@+fwv%K7m}bg)F0=q{>Y&Ir~xm)Amm54ApJN(2SR(ked^J+#r9<& zd^bsMZxmVLE0TY?k3NZ!KV{P28HM?16dt%o>mq&iiCzAbdeph&9_X{E5}=(7X3`MS z5oRFFLYRk;hfs9oQ&9o*oD}E*nwC;EFk6)^H=tZC7*iG+k()B z@C4Bw>X&>wS|8O9>=~_%>I1Y5I2P=Re#4|eNi5+ptKqox3Klx-;&3nPsBS)Qa+|Yj zZEeEJ)gi4=kgH&Q!kRzZjhP8^iKEu$uW`pf8_YgM>thNXTA^U#*s(mxn#(vekeP}( zO=7Wu`&eR!l!|>1B#`cc8_j3x38Wl|j~hAaAu>tQu9RR$dyk$x`q9x7iHD_g17~qP zTbZ5;j668*eqcY^FxmsW%|gQ{4{$fxmSr7NyUJG`aA9|7eToS+QXM16s>3Ra$_~Ig z#?PvAp*n~^UAU^cL#QtKJNR-%>T;m2(WpzsO>FBNh-l2HwUE^4lC$4tdI_ z9ki|rr5<+pa>{>#@=?2Rp@h`~Td&BqQsj7O?`rq+{Rgmu{19kzRhWZCL~e3%>g(ct z{Rd*CulFA)5GS>JW8o}0-Yj%s656%9Z4ncGS6*gpf~D`F=gC%2x_%4m3h53@_twUi zc{-((%bMKsJL_FQ6^0*ROBLB%{d(0~P|m$K5x;h|%En3p6b!r9aGxq9gyYDqSh zH5kNP-r(E>DNgpeVvO>xQAvwI#AvkI0$j~!VuVE&uSkO;H)t5Hi|Mji%(0e{0-W!B zCgd{#WYomPZF#rG8q+;Z4kSF^5Cwn{M;K*1wn8|g8Fq?`1$7l~FFdE* zLtg*%8W|GH1qJYVv%JK|%7$7u}6%`x*ByAOB?F%_$-{Uux&2n~1Ypjmg?wJuI7L zK4bAs`Hb@i!8u3?>JlFNT#Kx_L{OH&KZ}~PTA!Zk!fua>B1@SiayYe&XE)+g)tuQ!p;!a$a$HAdV%r~ukRwP0@-Y>AnNJ+0tezJ{v*P^R>U6%@SErbGBaBD6n#mj5? zOAI1!!9D)^V$6+thxsN0nf0#AQzaEluu-q3urbdEJ9}c(LkuzFkhXNp=_0KlxyY}7 zgp)H?J4}8viDro>mfEz5mmd(4*>qu33K+_KYTj^`j6}6r|AptqN%H%@Vu+6 z78)mFim0Bch2g1}5?_}Rw=7jQkA& z;|DNc8Xr@+n}*6Iu{?(V3Ghejb7}6LXvOunASM^{4)8{!tGEq<(>g&3tb7Sck-S)1*t+d-Ax(R1bF?p0fnJ$n+uJj ztUf*U-nKji;gVCDi!9jh97 zFDnVk(lLXiGsAEOwI9`%*$8yoAo@og-FjHtYEu?S*Lfz%mWR!4X;fsr0YnkB zMLe4b))Yvh)drU$CbkusTAt#^e1l&-O}^5h^(%-;>FE|LWNT?+3t6Nz;nf_>!5SuL ze9$VO&1yDNXwCC2gm z%w=~%JQr*E&JUgTtq!)b;|87^;srYp0W-Q67rvbK@ARuzo(r4jX^UNQLD-brPU8g? zQ)?SU)a@PYLj)1F4Sos_&H}zWr~^R2SX#2RfdVJJ8aOt^FR)iJ;5SfJI0$2N5`<*Qg)T`b?V!kYSq&Zwy!PCdt@@Lds%VR>> z&?n%!xYYbJEe5{_&F^hr0!^C`tivAZdj=kx3-Z8yb6iW0Yr5^zmYW>W&5_)4bs zEu1kq?c0xoj*_3O!Eb+=L)q?v4^!61&yvY8>zMq7%lV%N?woq`PM_j}WayUW3ug29 z8y1C9y?8v^(4p7uAy2sR`rsq9Q#G~4f-kw;DV#~#(P%3YCLB6CmnCjf`a&z2sT;D>jc_DEwWvd~!tlINkO!9t<37oVh%TCiw zdJ=~(nB?%xd%8E-mF*6wTeA>5&t`)fEq@9Jil*PnO@o~Jn!1S>XUJPqP3b1s$8y~F zkivH?B8gsL68+SQrBOvXhwX5ghcPK8(4o%x2)&!Y^Z*V_7<3R^Kz+%R8qoao_Tsv-;}BWTD>e+d3C#>eLEHM#p@JZvYy%*ws-b8><2vOVS#JBLv=#MdtTml zUG^G&Q%W&549}tk*ezhTOSC0g!^_@bqu~9c1()dQqLN{h6A&`&-l5PHr^_C0OfLq%29*b#%uY){fC{MJ$PMrSVmYE;h>p?t?9FL zHK5uc=-ahNNsg!?4Tfs+aYconVL{EXVZzwE;KqK@lvZFnw^;6SH=idP`L;h9x%;V9 zK!5cEX7m@cBA4x&!*UpAL=_vzCP&}7!<$a9ziH^5AI7ThS`MP5TmshpMQP)5SZT1W zX8ySI*!>0h<2vPex0=$N$UPPFWW(~KbE2z26bhtq#kJ=Qp}6*Q!(Lq5Z>F?B|Ei;u zw9KrIRbO_DXJ_nyW%4g=EQzxA&l`3F9>r|;Ht}|vKer8C%T3Pe$T%drmWaXL}S&fAUt}FX!Ih*>@i)<(#dU!T&tzQUmw9g!>Yd5$7Sc<6g6M z14ILB8l!VN5-7(RGZiUpOb1FVP_ILbt8o+JzPUE#a=f( z?@HsY=-|&BlfBUI&&ut@IKFgI2PVMmXC;ZJ(6jFTV3tf+x|p` zsqWr4LB{eMDKx#%EV!1WZW3_Ky#sZZ!IV~pCFEs?&6;*?zCyTg%Dn^~FnE4!nn5d2l!b0iRa0?gN z_QI$|)>r3m;46Bmr&N)I%~xKRW|@F*UOD_?0X&%nPb|BZo$1%dz~fg9m$jPGQe!fS z>AJ`*?AXXH?0>=s(Lz`lfP-d~xsG~pXL%#3N6Mbt2r$WP%(X$Psl)SlS_klUc#Mwfdk*t%Rv(AA~nosv*6g`Sj#GKgDfm!RtO9n5x;gl#h;m4R5!Lz^mr7|fU3yAZZ zpQ68mO`mYi7CL=vg`c*MX~8>$zs7@eZ;lCvJkJ5=x9HpyY-3J|UgML?B+vdzo3$KH z`JEr|ztn!{1xHvC)tAK??L{`rAri0ZT<~;nPR5R;{oif|g77Gj@nY}$c}`9+o0Hz4 z{Y?lawL!k26Mfqq>-c{yPd)!`YQ5e?jP0F;vM+MT`RPx~b`$SEHA+BWs|l4*fGG~g z8jC~0JD(gZ8a@l?I}uyRmx&s2$|R~FtAkPd)vtbKBxO%}3KfZ?^>3qq{#$&ZqwN^H z!<%P$8eu@Hmn2trETth@&Ybo*6ZIEY0v}_*LCLv`Zdxv*Gu?m7lh9(~jk3;*6J$L} zbQFkm>A#PM9t-Uo%f5Mm(qkxHTI($XtJHt!wFuKpF1x7}OcH3r8X7*h35S-$TUh~| z?n!h}Lt#7(nhv(+x3$Ec#?IU8>1sIF?mN@fN>6V5_{8mafxP6bb8iB6C!WsDlVFT{ zo}uRKbK}E)9Odk<)R*yo$=P2nTGYPC#8&9YnpL$N?yfJO4`x%pSXI+?HpmA2czxt< z2W?IP!0U}xZeTb&U=`9&#Yb?U(yqo~KV%ibdj@#&!F#hhG>xjPR>#1KEsnRk-qrqC zELGC>s2j2|(r_Omx~wcWWr4Qwx8RQ{lk?`}KmacqOCnN{!#NET3U<2N z+88BhmWqaPa`>Umqld^H3ii5<--cd|9Nicde3GI`$%{B!up|Uw`+YX=DP_5wCCnsSnm%$H$y|4^mJD(%> zkPAv|`wjWVk>JH!Pzv`mg~>5SZ17@+6bCp!SdVe?-?r5gXg~~})hb^mCJP?vTthNej|dO2&X5qWnZ}yp zvVVr10ZvX(GVQ6ol^9%VVKUA+xP%~AP!}%9;-GYJprjr!3i~_xeL#9xO2gfWv_O6@ zMvQNU)e!n`b39(WossPeZ~96<-v77uUpFELXFFJqjWM7cd@rW|t?LitS6Jv}Z4i&8 zgJ=x!WAG~nzA(KL&n~CnazQqL7-cS*F33584$`H?f%Y-<<|35m`t}EH`2CQ()dA!r zw~xx7dxZT&Od@{M2+0J@z0b>6t%2?!K%Zo2+s*ch82q-$&FyjUSeV-*9c<6BV_v7W zSL1~i0K|8V|H8R_)tdGLz4m9}pS9S;LrCqW@1ps1yw$)(LvnL3rEj6HRvUvip3XR= z9&EL#@8Ru6FYmYBJa`&P2Ii_oHIKtv3%{rV#Yb+{cpq{06G+$W1h~|E6BlEIDf(-+ zS%8`vig!OlI_k~c`w;D-Gz2oN0uWnF5KNoYp#XshWKwLMOai5ijn_V!^kZ{m69ayI8vVEkR&9EfgnqLFnuas(rdrw5 zO~ZElNopWFPhGhqkN4|uJ%{OTxUs>(3xZ!*8=NmYyWpj|7<~;Di1LYn0{WhuH#N&<}+CXdBXd5RM=W`LXUG@rPkFqwxOw{xA{R>8N4`!YqV& z2zdxg5mq4Fhk$+F@rN059zo0;L+Bp=n7G*bZLd=G zynKOgxMkoi>{vu0<0!lumPi-WL-@rndnZLML@&X+48vNCJNqkI41jYdaNsHe#R&aD z3p9I`Q$LCQ2K{PQAgkXqiL5A2nO<}I2ZzW0yhA+J+4CHhR~t@gn_v*b@rj+Yu#qH;i@g+K z;-L1)n?p6Bwe-ess__?@9qVH0Z8cJA*hS#&So-a?V)ip>Se3m^IHWSbE7U@L67D^) zGl9C>L+Y+?;GOIH2j0QeojK%`LPV@%DzijTX?S3N8>P`s+~XJ#cOufDSe7GKviPN` zr=j+*`Abu2IQJ-3Iy^Gx>rm%XekopvTvc4N2L&uc73}}dfE}y|f-;G4j2lZ!i))?) z0**{6PqRE{3%wBB9ZUISAjob?hPfV>P?Ae0f1NV?LQV26%B7>?BvVQ=B^cK!pFAST z&O(HG-yz27HK5~+2+Y-NE3f$6r8u4uy6Q`}UWOOEep7OrDNm8CaP#}V=Ur#Z6DUUa z%>4CuogjTs|8W?`;VNA{sQ6Cdw=zrv2kVveOI2C;jSvP=SHGX#bV{to8ySfNAf~}7L1>5JU zLvUNDRH!ShOY_LP%^E+);`uZV&cyR6WpxkZdF(LHStkjgqV{*iXYit)^!`<>f#D~> zPid*dmzElF7Bhij%m0j8HJ9;Ex4;k5maMCnUP8ePhDROE;DC0giFeQNize`#{cH)` zr_bV{T#C)08L1wiNl8Ck_GQC~j?v(K*J<=L4$UEH0U2Q6fgNBY3TNc!!2r1AalI1ymHXXlq1``tvU>Y(Jsvt=NALalW)YMus9%@yuT-ECkWKqPCuvo$`CJQ*}ICuVr zHRU1aBR`{r?(Y2|VyM36i*%N0x_M~B4p-@7y%l*;oBNe=4}KjQFARo^`_&ZM@Z+}= z!-8|~q5ix(ZTPi;U{wNsaz#=KI3p<_qu!KEO=^T?`sYedBQ-FVMc)?jT#C*QublczV&7PNQn=YkwJ4S~zX<(d>5eD7f+shQsG z_TtPqCU`hVqoXaMdK%YZ?$2nm}wE)^ji;WmVPgnJM+A?!r>8A1obn+TsE2%9or-WbZ;;zs;0i|fVp6?N+$s&dy< zRn#*w9O2zgc=X>fR&CfQ-B;sotgl#C<*r8EbsIOYk1ALpuHU%fa=AHQTCP#7{3qpR zQ@MJnp~}5!eS;`f)VZsr4eN+D{$I$tI#vPkHS0_1ui3bvYRh`@YZdq(4cCiqk(xNn z*R9!9?sB^~)>nb>#tn@dA&1JUP3zZ1;YMUswWYplomf@LBy(Ac9LeWaCLakkMsOaG z>csV8O+!^hB_y=&{;To7TrQD9^#3M;-K2zyuW#7c@Bjob^#5XtRSgfU-*BazGg*7C z**{eqAi<3r9;n(Nf*yFyWbL^oZbid=5+ODY$v5*hl2divMpU=qK6m}b^&3Ps3;?OD zsS1+qC2p@k-923Bg4HsGC-HE|9V43!&Vxz2^f?^U>}X!DG3RF>p%Ov z14EdbIddjAZ>W_UDlodG4fk)@xOu|@j$2$MF0E)3b1(!pRrxp8OZ5z9J(sTEP`Pn4 zS6J29SaDy~qK#W}IH|F!A?vo8m34Jg^W_iC^X>QHx8V>deOrx}n}a~H-BP_dzM z>G}=Ge}^D}s)k0)N{;&t=fgZhf38C}aE_P)=#Tt{sw(s=ms_{7v8n(C>#DdS`-;c_ zt{Ot-?qIZ~h6aqiA>h~TB^zp3kxJi|byf8=_rVuNKeoAqU%0VSs$-!3=(hSL8>%gZPx!YGr>BlKe!yu=!vVjH@R}ixl z`X-`EAQu-%GddvnFcp)Tg`h*_FjSW$0{3()aIKcg3a zOEp`$)Jwql{gn{l+~r%o%(wJfy5(9rVgxoKfe{IeNMJ+)BNF((T>{^nfjhs|-r;6u z+;TZR1e9opeusNnqkG;1757(FV+~(G=K?I@+_c6!a0Zj=DmQ#Zbh8uLv_@ocGdD`u zPi?+tK0AVL#wG?EJ;IGozj<+PZpm`r(&=2hw`yI@M$~nO`@VJS65_qldG%Edb?#em zTwb@aek-vtv!0F$QDv@$0U`tj-f(XH#&r$rSmA4x9m*XlctyF2_0?4HOUhZfLj{Sq z;W{6dWf9oI6yI>a44DBZ}s+t`hkKj;|og!xecI4ag&K z{Q7D)&fSe7FrwNw486Iss&3(QAP+-;htrz4abq13jVcp?0yjFpzDjJU*g&Y!xE2(s zL)lFjgErt$7>_{rc@*G2$6|7zN=1l8pj#~1ewfP!tU8JjjYJDW$uE47382_g{B&5?KqV#=2hD8B`P`1uY3%upO%(a`fQ1mf>W1gh`n z2n7EF0=4Ni1j_#l0_CSdC?p^6gI+EZA^5ZxPpBWU&Bl_}7YXL757CK6xhk90LpUR! z5efXO62N@!pm9l`Nl4Q?r_cAJ(i+kY_vjs7gUyGQ^%|bi|F^_mG;+_UCHxBVL zh)H*CLrjEMAifT98sh5_zmIuHI^lW5WX5_5F&W~XK>QHmornh!w;?tWZ$aEtaqV#C zTV9R=X`8G6ZiZFc`nx*kTF(V&(?9!bflj*m?@Ih;XtSX|8~3mMMN`50aFAKMW9yD7ktY4@T`RHcr&iqjqaJce;k?^}EZzhB&fRbCc3av1 z@Qt70W*=`P{{6p*pA*5~3;frA^8Qb* - -#include -#include -#include - -#include "debug.h" - -#include "pico/picoInt.h" -#include "vid.h" -#include "SimpleServer.h" -#include "ClientServer.h" -//#include "polledAS.h" -#include "audio.h" - -#include -#include "zlib/gzio_symb.h" - - -#define BENCHMARK -//#define TEST_FRAMEBUFF - -// keycodes we care about -enum TPxxxKeyCodes { - EKeyPxxxPower = EKeyDevice0, //0xF842 - EKeyPxxxBrowser = EKeyApplication0, - EKeyPxxxCamera = EKeyApplication1, - EKeyPxxxJogUp = EKeyDevice1, - EKeyPxxxJogDown = EKeyDevice2, - EKeyPxxxJogLeft = EKeyDevice3, - EKeyPxxxJogRight = EKeyDevice9, - EKeyPxxxJogInward= EKeyDevice8, - // FC keys - //EKeyPxxxFcOk = EKeyDevice8, // don't care about FC keycodes -}; -// EKeyScreenDimension1 ~ EStdKeyF24 is sent when flip is closed, -// EKeyScreenDimension0 ~ EStdKeyF23 when opened - -enum TMotAKeyCodes { - EKeyMotAUp = EKeyDevice4, //0xF846 - EKeyMotADown = EKeyDevice5, - EKeyMotALeft = EKeyDevice6, - EKeyMotARight = EKeyDevice7, - EKeyMotASelect = EKeyDevice8, - EKeyMotAButton1 = EKeyApplicationA, - EKeyMotAButton2 = EKeyApplicationB, - EKeyMotAHome = EKeyApplication0, - EKeyMotAShortcut = EKeyApplication1, - EKeyMotAVoice = EKeyDeviceA, - EKeyMotACamera = EKeyDeviceB, - EKeyMotAVolUp = EKeyIncVolume, - EKeyMotAVolDn = EKeyDecVolume, - EKeyMotASend = EKeyYes, - EKeyMotAEnd = EKeyNo, -}; - -// scancodes we care about -enum TPxxxScanCodes { - EScanPxxxPower = EStdKeyDevice0, // 0xa4 - EScanPxxxBrowser = EStdKeyApplication0, - EScanPxxxCamera = EStdKeyApplication1, - EScanPxxxJogUp = EStdKeyDevice1, - EScanPxxxJogDown = EStdKeyDevice2, - EScanPxxxJogLeft = EStdKeyDeviceE, // not consistent - EScanPxxxJogRight = EStdKeyDeviceD, - EScanPxxxJogInward= EStdKeyDevice8, - // FC keys - EScanPxxxFcOk = EStdKeyDeviceF, - EScanPxxxFcBack = EStdKeyDevice3, - EScanPxxxFcC = EStdKeyDeviceA, - EScanPxxxFcMenu = EStdKeyDevice9, - EScanPxxxFc0 = '0', - EScanPxxxFc1 = '1', - EScanPxxxFc2 = '2', - EScanPxxxFc3 = '3', - EScanPxxxFc4 = '4', - EScanPxxxFc5 = '5', - EScanPxxxFc6 = '6', - EScanPxxxFc7 = '7', - EScanPxxxFc8 = '8', - EScanPxxxFc9 = '9', - EScanPxxxFcHash = EStdKeyHash, - EScanPxxxFcAsterisk= EStdKeyNkpAsterisk, -}; - -enum TMotAScanCodes { - EScanMotAUp = EStdKeyDevice4, - EScanMotADown = EStdKeyDevice5, - EScanMotALeft = EStdKeyDevice6, - EScanMotARight = EStdKeyDevice7, - EScanMotASelect = EStdKeyDevice8, - EScanMotAButton1 = EStdKeyApplicationA, - EScanMotAButton2 = EStdKeyApplicationB, - EScanMotAHome = EStdKeyApplication0, - EScanMotAShortcut = EStdKeyApplication1, - EScanMotAVoice = EStdKeyDeviceA, - EScanMotACamera = EStdKeyDeviceB, - EScanMotAVolUp = EStdKeyIncVolume, - EScanMotAVolDn = EStdKeyDecVolume, - EScanMotASend = EStdKeyYes, - EScanMotAEnd = EStdKeyNo, - // some extra codes, don't know if these are actually used - EScanMotAExtra = EStdKeyApplicationC, - EScanMotAEsc = EStdKeyApplicationD, - EScanMotAStart = EStdKeyApplicationE, - EScanMotASelect2 = EStdKeyApplicationF, -}; - - -// list of key names and codes -TPicoKeyConfigEntry keyConfigPXXX[] = { - { EKeyPxxxPower, EScanPxxxPower, 0, -1, -1, "POWER" }, // 0 - { EKeyPxxxBrowser, EScanPxxxBrowser, 0, -1, -1, "BROWSER" }, - { EKeyPxxxCamera, EScanPxxxCamera, 0, -1, -1, "CAMERA" }, - { EKeyPxxxJogUp, EScanPxxxJogUp, 2, -1, -1, "JOG@UP" }, - { EKeyPxxxJogDown, EScanPxxxJogDown, 2, -1, -1, "JOG@DOWN" }, - { EKeyPxxxJogLeft, EScanPxxxJogLeft, 0, -1, -1, "JOG@LEFT" }, // 5 - { EKeyPxxxJogRight, EScanPxxxJogRight, 0, -1, -1, "JOG@RIGHT" }, - { 0, EScanPxxxJogInward, 0, -1, -1, "JOG@INWARD" }, - { 0, EScanPxxxFcOk, 0, -1, -1, "FC@OK" }, - { 0, EScanPxxxFcBack, 0, -1, -1, "FC@BACK" }, - { 0, EScanPxxxFcC, 0, -1, -1, "FC@C" }, // 10 - { 0, EScanPxxxFcMenu, 0, -1, -1, "FC@MENU" }, - { 0, EScanPxxxFc0, 0, -1, -1, "FC@0" }, - { 0, EScanPxxxFc1, 0, -1, -1, "FC@1" }, - { 0, EScanPxxxFc2, 0, -1, -1, "FC@2" }, - { 0, EScanPxxxFc3, 0, -1, -1, "FC@3" }, - { 0, EScanPxxxFc4, 0, -1, -1, "FC@4" }, - { 0, EScanPxxxFc5, 0, -1, -1, "FC@5" }, - { 0, EScanPxxxFc6, 0, -1, -1, "FC@6" }, - { 0, EScanPxxxFc7, 0, -1, -1, "FC@7" }, - { 0, EScanPxxxFc8, 0, -1, -1, "FC@8" }, - { 0, EScanPxxxFc9, 0, -1, -1, "FC@9" }, - { 0, EScanPxxxFcHash, 0, -1, -1, "FC@HASH" }, - { 0, EScanPxxxFcAsterisk,0, -1, -1, "FC@AST" }, - { 0, 0, 0, 0, 0, 0 } -}; - -// Motorola A92x & A1000 support -TPicoKeyConfigEntry keyConfigMotA[] = { - { EKeyMotAUp, EScanMotAUp, 0, -1, -1, "UP" }, // 0 - { EKeyMotADown, EScanMotADown, 0, -1, -1, "DOWN" }, - { EKeyMotALeft, EScanMotALeft, 0, -1, -1, "LEFT" }, - { EKeyMotARight, EScanMotARight, 0, -1, -1, "RIGHT" }, - { EKeyMotASelect, EScanMotASelect, 0, -1, -1, "SELECT" }, - { EKeyMotAButton1, EScanMotAButton1, 0, -1, -1, "BUTTON1" }, // 5 - { EKeyMotAButton2, EScanMotAButton2, 0, -1, -1, "BUTTON2" }, - { EKeyMotAHome, EScanMotAHome, 0, -1, -1, "HOME" }, - { EKeyMotAShortcut, EScanMotAShortcut, 0, -1, -1, "SHORTCUT" }, - { EKeyMotAVoice, EScanMotAVoice, 0, -1, -1, "VOICE" }, - { EKeyMotACamera, EScanMotACamera, 0, -1, -1, "CAMERA" }, // 10 - { EKeyMotAVolUp, EScanMotAVolUp, 0, -1, -1, "VOL@UP" }, - { EKeyMotAVolDn, EScanMotAVolDn, 0, -1, -1, "VOL@DOWN" }, - { EKeyMotASend, EScanMotASend, 0, -1, -1, "SEND" }, - { EKeyMotAEnd, EScanMotAEnd, 0, -1, -1, "END" }, - { 0, EScanMotAExtra, 0, -1, -1, "EXTRA" }, - { 0, EScanMotAEsc, 0, -1, -1, "ESC" }, - { 0, EScanMotAStart, 0, -1, -1, "START" }, - { 0, EScanMotASelect2, 0, -1, -1, "SELECT" }, - { 0, 0, 0, 0, 0, 0 } -}; - - -// list of areas -TPicoAreaConfigEntry areaConfig[] = { - { TRect( 0, 0, 0, 0) }, - // small corner bottons - { TRect( 0, 0, 15, 15) }, - { TRect(192, 0, 207, 15) }, - { TRect( 0, 304, 15, 319) }, - { TRect(192, 304, 207, 319) }, - // normal buttons - { TRect( 0, 0, 68, 63) }, - { TRect( 69, 0, 138, 63) }, - { TRect(139, 0, 207, 63) }, - { TRect( 0, 64, 68, 127) }, - { TRect( 69, 64, 138, 127) }, - { TRect(139, 64, 207, 127) }, - { TRect( 0, 128, 68, 191) }, - { TRect( 69, 128, 138, 191) }, - { TRect(139, 128, 207, 191) }, - { TRect( 0, 192, 68, 255) }, - { TRect( 69, 192, 138, 255) }, - { TRect(139, 192, 207, 255) }, - { TRect( 0, 256, 68, 319) }, - { TRect( 69, 256, 138, 319) }, - { TRect(139, 256, 207, 319) }, - { TRect( 0, 0, 0, 0) } -}; - -// PicoPad[] format: SACB RLDU -const char *actionNames[] = { - "UP", "DOWN", "LEFT", "RIGHT", "B", "C", "A", "START", - 0, 0, 0, 0, 0, 0, 0, 0, // Z, Y, X, MODE (enabled only when needed), ?, ?, ?, ? - 0, 0, 0, 0, 0, 0, "NEXT@SAVE@SLOT", "PREV@SAVE@SLOT", // ?, ?, ?, ?, mot_vol_up, mot_vol_down, next_slot, prev_slot - 0, 0, "PAUSE@EMU", "SAVE@STATE", "LOAD@STATE", "FRAMESKIP@8", "AUTO@FRAMESKIP", "DONE" // ?, switch_renderer -}; - - -// globals are allowed, so why not to (ab)use them? -TInt machineUid = 0; -int gamestate = PGS_Paused, gamestate_prev = PGS_Paused; -TPicoConfig currentConfig; -TPicoKeyConfigEntry *keyConfig = 0; // currently used keys -static char noticeMsg[64]; // notice msg to draw -static timeval noticeMsgTime = { 0, 0 }; // when started showing -static RLibrary gameAudioLib; // audio object library -static _gameAudioNew gameAudioNew; // audio object maker -static IGameAudio *gameAudio = 0; // the audio object itself -static TProcessId launcherProcessId; -static int reset_timing, state_slot = 0; -extern const char *RomFileName; -extern int pico_was_reset; -#ifdef TEST_FRAMEBUFF -static TUint8 *iFrameBuffer = 0; -#endif - -// some forward declarations -static void MainInit(); -static void MainExit(); -static void CheckForLauncher(); -static void DumpMemInfo(); - -// just for a nicer grouping of WS related stuff -class CGameWindow -{ -public: - static void ConstructResourcesL(); - static void FreeResources(); - static void DoKeys(timeval &time); - static void DoKeysConfig(TUint &which); - static void RunEvents(TUint32 which); - static void SendClientWsEvent(TInt type); - - static RWsSession iWsSession; - static RWindowGroup iWsWindowGroup; - static RWindow iWsWindow; - static CWsScreenDevice* iWsScreen; - static CWindowGc* iWindowGc; - static TRequestStatus iWsEventStatus; - static TThreadId iLauncherThreadId; - static RDirectScreenAccess* iDSA; - static TRequestStatus iDSAstatus; -}; - - -void SkipFrame(int do_sound) -{ - PicoSkipFrame=1; - PicoFrame(); - PicoSkipFrame=0; - - if(do_sound && PsndOut) { - PsndOut = gameAudio->NextFrameL(); - if(!PsndOut) { // sound output problems? - strcpy(noticeMsg, "SOUND@OUTPUT@ERROR;@SOUND@DISABLED"); - gettimeofday(¬iceMsgTime, 0); - } - } - -/* - int total=0; - - // V-Blanking period: - if (Pico.video.reg[1]&0x20) SekInterrupt(6); // Set IRQ - Pico.video.status|=0x88; // V-Int happened / go into vblank - total+=SekRun(18560); - - // Active Scan: - if (Pico.video.reg[1]&0x40) Pico.video.status&=~8; // Come out of vblank if display is enabled - SekInterrupt(0); // Clear IRQ - total+=SekRun(127969-total); -*/ -} - - -void TargetEpocGameL() -{ - char buff[24]; // fps count c string - struct timeval tval; // timing - int thissec = 0, frames_done = 0, frames_shown = 0; - int target_fps, target_frametime, too_fast, too_fast_time; - int i, underflow; - TRawEvent blevent; - - MainInit(); - buff[0] = 0; - - // just to keep the backlight on.. - blevent.Set(TRawEvent::EActive); - - // loop? - for(;;) { - if(gamestate == PGS_Running) { - // prepare window and stuff - CGameWindow::ConstructResourcesL(); - - // if the system has something to do, it should better do it now - User::After(50000); - //CPolledActiveScheduler::Instance()->Schedule(); - - // pal/ntsc might have changed, reset related stuff - if(Pico.m.pal) { - target_fps = 50; - if(!noticeMsgTime.tv_sec) strcpy(noticeMsg, "PAL@SYSTEM@/@50@FPS"); - } else { - target_fps = 60; - if(!noticeMsgTime.tv_sec) strcpy(noticeMsg, "NTSC@SYSTEM@/@60@FPS"); - } - target_frametime = 1000000/target_fps; - if(!noticeMsgTime.tv_sec && pico_was_reset) - gettimeofday(¬iceMsgTime, 0); - - pico_was_reset = too_fast = 0; - reset_timing = 1; - - while(gamestate == PGS_Running) { - gettimeofday(&tval, 0); - if(reset_timing) { - reset_timing = 0; - thissec = tval.tv_sec; - frames_done = tval.tv_usec/target_frametime; - } - - // show notice message? - char *notice = 0; - if(noticeMsgTime.tv_sec) { - if((tval.tv_sec*1000000+tval.tv_usec) - (noticeMsgTime.tv_sec*1000000+noticeMsgTime.tv_usec) > 2000000) // > 2.0 sec - noticeMsgTime.tv_sec = noticeMsgTime.tv_usec = 0; - else notice = noticeMsg; - } - - // second changed? - if(thissec != tval.tv_sec) { -#ifdef BENCHMARK - static int bench = 0, bench_fps = 0, bench_fps_s = 0, bfp = 0, bf[4]; - if(++bench == 10) { - bench = 0; - bench_fps_s = bench_fps; - bf[bfp++ & 3] = bench_fps; - bench_fps = 0; - } - bench_fps += frames_shown; - sprintf(buff, "%02i/%02i/%02i", frames_shown, bench_fps_s, (bf[0]+bf[1]+bf[2]+bf[3])>>2); -#else - if(currentConfig.iFlags & 2) - sprintf(buff, "%02i/%02i", frames_shown, frames_done); -#endif - thissec = tval.tv_sec; - if((thissec & 7) == 7) UserSvr::AddEvent(blevent); - // in is quite common for this implementation to leave 1 fame unfinished - // when second changes. This creates sound clicks, so it's probably better to - // skip that frame and render sound - if(PsndOut && frames_done < target_fps && frames_done > target_fps-5) { - SkipFrame(1); frames_done++; - } - // try to prevent sound buffer underflows by making sure we did _exactly_ - // target_fps sound updates and copying last samples over and over again - if(PsndOut && frames_done < target_fps) - for(; frames_done < target_fps; frames_done++) { - PsndOut = gameAudio->DupeFrameL(underflow); - if(!PsndOut) { // sound output problems? - strcpy(noticeMsg, "SOUND@OUTPUT@ERROR;@SOUND@DISABLED"); - gettimeofday(¬iceMsgTime, 0); - break; - } - if(underflow) break; - } - frames_done = frames_shown = 0; - } - - if(currentConfig.iFrameskip >= 0) { // frameskip enabled - for(i = 0; i < currentConfig.iFrameskip; i++) { - SkipFrame(frames_done < target_fps); frames_done++; - CGameWindow::DoKeys(tval); - } - } else if(tval.tv_usec > (frames_done+1)*target_frametime) { // auto frameskip - // no time left for this frame - skip - SkipFrame(1); frames_done++; - CGameWindow::DoKeys(tval); - too_fast = 0; - continue; - } else if(tval.tv_usec < (too_fast_time=frames_done*target_frametime)) { // we are too fast - if(++too_fast > 2) { User::After(too_fast_time-tval.tv_usec); too_fast = 0; }// sleep, but only if we are _really_ fast - } - - // draw - vidDrawFrame(notice, buff, frames_shown); - if(PsndOut && frames_done < target_fps) { - PsndOut = gameAudio->NextFrameL(); - if(!PsndOut) { // sound output problems? - strcpy(noticeMsg, "SOUND@OUTPUT@ERROR;@SOUND@DISABLED"); - gettimeofday(¬iceMsgTime, 0); - } - } - frames_done++; frames_shown++; - CGameWindow::DoKeys(tval); - } - - // save SRAM - if((currentConfig.iFlags & 1) && SRam.changed) { - saveLoadGame(0, 1); - SRam.changed = 0; - } - CGameWindow::SendClientWsEvent(EEventGamePaused); - CGameWindow::FreeResources(); - } else if(gamestate == PGS_Paused) { - for(i = 0; gamestate == PGS_Paused; i++) { - User::After(250000); - if(!(i & 0x7F)) CheckForLauncher(); // every 32 secs - } - } else if(gamestate == PGS_KeyConfig) { - // prepare window and stuff - CGameWindow::ConstructResourcesL(); - - TUint whichAction = 0; - while(gamestate == PGS_KeyConfig) { - vidKeyConfigFrame(whichAction, CGameWindow::iWsScreen->CurrentScreenMode()); - CGameWindow::DoKeysConfig(whichAction); - User::After(200000); - } - - CGameWindow::SendClientWsEvent(EEventKeyCfgDone); - CGameWindow::SendClientWsEvent(EEventGamePaused); - CGameWindow::FreeResources(); - } else if(gamestate == PGS_DebugHeap) { - #ifdef __DEBUG_PRINT - TInt cells = User::CountAllocCells(); - TInt mem; - User::AllocSize(mem); - DEBUGPRINT(_L("worker: cels=%d, size=%d KB"), cells, mem/1024); - gamestate = gamestate_prev; - #endif - } else if(gamestate == PGS_Quit) { - break; - } - } - - MainExit(); -} - - -// gameAudio default "maker", which simply leaves -IGameAudio *gameAudioNew_failer(TInt aRate, TBool aStereo, TInt aPcmFrames, TInt aBufferedFrames) -{ - User::Leave(1); - return 0; // shouldn't happen -} - - -// main initialization -static void MainInit() -{ - RProcess thisProcess, launcherProcess; - TInt err = KErrGeneral; - - DEBUGPRINT(_L("\r\n\r\nstarting..")); - - //CPolledActiveScheduler::NewL(); // create Polled AS for the sound engine - - // get launcher id - if(thisProcess.Owner(launcherProcess) == KErrNone) { - launcherProcessId = launcherProcess.Id(); - launcherProcess.Close(); // messing with launcherProcess too much strangely reboots my phone - } else { - DEBUGPRINT(_L("%i: couldn't find owner, terminating.."), thisProcess.Id()); - thisProcess.Terminate(1); - } - - // also get launcher thread id (for sending events, nasty way) - TFindThread findThread; - TFullName dummy1; - RThread tmpThread; - RProcess tmpProcess; - - while(findThread.Next(dummy1) == KErrNone) - { - tmpThread.Open(findThread); - tmpThread.Process(tmpProcess); - if(tmpProcess.Id() == launcherProcessId) { - CGameWindow::iLauncherThreadId = tmpThread.Id(); - break; - } - tmpThread.Close(); - tmpProcess.Close(); - } - - // start event listening thread, which waits for GUI commands - if(StartThread() < 0) { - // communication thread failed to start, we serve no purpose now, so suicide - DEBUGPRINT(_L("%i: StartThread() failed, terminating.."), thisProcess.Id()); - thisProcess.Terminate(1); - } - - HAL::Get(HALData::EMachineUid, machineUid); // find out the machine UID - - // get current dir - TFileName pfName = thisProcess.FileName(); - TParse parse; - parse.Set(pfName, 0, 0); - TPtrC currDir = parse.DriveAndPath(); - DEBUGPRINT(_L("current dir: %S"), &currDir); - - static TPtrC audio_dlls[] = { _L("audio_motorola.dll"), _L("audio_mediaserver.dll") }; - - // find our audio object maker - for(TInt i=0; i < 2; i++) { - DEBUGPRINT(_L("trying audio DLL: %S"), &audio_dlls[i]); - err = gameAudioLib.Load(audio_dlls[i], currDir); - if(err == KErrNone) { // great, we loaded a dll! - gameAudioNew = (_gameAudioNew) gameAudioLib.Lookup(1); - if(!gameAudioNew) { - gameAudioLib.Close(); - err = KErrGeneral; - DEBUGPRINT(_L(" loaded, but Lookup(1) failed.")); - } else - break; // done - } else - DEBUGPRINT(_L(" load failed! (%i)"), err);; - } - - if(err != KErrNone) - gameAudioNew = gameAudioNew_failer; - else DEBUGPRINT(_L(" audio dll loaded!"));; - - DumpMemInfo(); - - // try to start pico - DEBUGPRINT(_L("PicoInit();")); - PicoInit(); - -#ifdef TEST_FRAMEBUFF - iFrameBuffer = (TUint8 *) malloc(208*320*4); -#endif -} - - -// does not return -static void MainExit() -{ - RProcess thisProcess; - - DEBUGPRINT(_L("%i: cleaning up.."), thisProcess.Id()); - - // save SRAM - if((currentConfig.iFlags & 1) && SRam.changed) { - saveLoadGame(0, 1); - SRam.changed = 0; - } - - PicoExit(); - - if(gameAudio) delete gameAudio; - - if(gameAudioLib.Handle()) gameAudioLib.Close(); - - // Polled AS - //delete CPolledActiveScheduler::Instance(); - - DEBUGPRINT(_L("%i: terminating.."), thisProcess.Id()); - thisProcess.Terminate(0); -} - - -static void CheckForLauncher() -{ - RProcess launcherProcess; - - // check for launcher, we are useless without it - if(launcherProcess.Open(launcherProcessId) != KErrNone || launcherProcess.ExitCategory().Length() != 0) { - #ifdef __DEBUG_PRINT - RProcess thisProcess; - DEBUGPRINT(_L("%i: launcher process is gone, terminating.."), thisProcess.Id()); - if(launcherProcess.Handle()) { - TExitCategoryName ecn = launcherProcess.ExitCategory(); - DEBUGPRINT(_L("%i: launcher exit category: %S"), thisProcess.Id(), &ecn); - launcherProcess.Close(); - } - #endif - MainExit(); - } - launcherProcess.Close(); -} - - -void DumpMemInfo() -{ - TInt ramSize, ramSizeFree, romSize; - - HAL::Get(HALData::EMemoryRAM, ramSize); - HAL::Get(HALData::EMemoryRAMFree, ramSizeFree); - HAL::Get(HALData::EMemoryROM, romSize); - - DEBUGPRINT(_L("ram=%dKB, ram_free=%dKB, rom=%dKB"), ramSize/1024, ramSizeFree/1024, romSize/1024); -} - - - -TInt E32Main() -{ - // first thing's first - RThread().SetExceptionHandler(&ExceptionHandler, -1); - - //TInt pc, sp; - //asm volatile ("str pc, %0" : "=m" (pc) ); - //asm volatile ("str sp, %0" : "=m" (sp) ); - //RDebug::Print(_L("executing @ 0x%08x, sp=0x%08x"), pc, sp); - -/* - RDebug::Print(_L("Base Bottom Top Size RW Name")); - TBuf<4> l_r(_L("R")), l_w(_L("W")), l_d(_L("-")); - RChunk chunk; - TFullName chunkname; - TFindChunk findChunk(_L("*")); - while( findChunk.Next(chunkname) != KErrNotFound ) { - chunk.Open(findChunk); - 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); - chunk.Close(); - } -*/ - - CTrapCleanup* cleanup=CTrapCleanup::New(); - - TRAPD(error, TargetEpocGameL()); - - __ASSERT_ALWAYS(!error, User::Panic(_L("Picosmall"), error)); - delete cleanup; - - return 0; -} - - -void CGameWindow::ConstructResourcesL() -{ - - // connect to window server - // tried to create it globally and not re-connect everytime, - // but my window started to lose focus strangely - User::LeaveIfError(iWsSession.Connect()); - - // * Tell the Window Server not to mess about with our process priority - // * Also, because of the way legacy games are written, they never sleep - // * and thus never voluntarily yield the CPU. We set our process priority - // * to EPriorityForeground and hope that a Telephony application on - // * this device runs at EPriorityForeground as well. If not, tough! ;-) - - CGameWindow::iWsSession.ComputeMode(RWsSession::EPriorityControlDisabled); - RProcess me; - me.SetPriority(EPriorityForeground); - - iWsScreen=new(ELeave) CWsScreenDevice(iWsSession); - User::LeaveIfError(iWsScreen->Construct()); -// User::LeaveIfError(iWsScreen->CreateContext(iWindowGc)); - - iWsWindowGroup=RWindowGroup(iWsSession); - User::LeaveIfError(iWsWindowGroup.Construct((TUint32)&iWsWindowGroup)); - //iWsWindowGroup.SetOrdinalPosition(0); - //iWsWindowGroup.SetName(KServerWGName); - iWsWindowGroup.EnableScreenChangeEvents(); // flip events (EEventScreenDeviceChanged) - iWsWindowGroup.EnableFocusChangeEvents(); // EEventFocusGroupChanged - iWsWindowGroup.SetOrdinalPosition(0, 1); // TInt aPos, TInt aOrdinalPriority - - iWsWindow=RWindow(iWsSession); - User::LeaveIfError(iWsWindow.Construct(iWsWindowGroup, (TUint32)&iWsWindow)); - iWsWindow.SetSize(iWsScreen->SizeInPixels()); - iWsWindow.PointerFilter(EPointerFilterDrag, 0); - iWsWindow.SetPointerGrab(ETrue); - iWsWindow.SetVisible(ETrue); - iWsWindow.Activate(); - - // request access through RDirectScreenAccess api, but don't care about the result - RRegion *dsa_region = 0; - iDSA = new(ELeave) RDirectScreenAccess(iWsSession); - if(iDSA->Construct() == KErrNone) - iDSA->Request(dsa_region, iDSAstatus, iWsWindow); - DEBUGPRINT(_L("DSA: %i"), dsa_region ? dsa_region->Count() : -1); - - // now get the screenbuffer - TScreenInfoV01 screenInfo; - TPckg sI(screenInfo); - UserSvr::ScreenInfo(sI); - - if(!screenInfo.iScreenAddressValid) - User::Leave(KErrNotSupported); - -#ifndef TEST_FRAMEBUFF - TUint8 *iFrameBuffer = (TUint8*) screenInfo.iScreenAddress; -#endif - TInt p800 = 0; - - switch(machineUid) - { - case 0x101f6b26: // A9xx & A10xx - case 0x101f6b27: // Chinese A10xx - case 0x101fd279: // P3x - iFrameBuffer += 32; - keyConfig = keyConfigMotA; - break; - case 0x101f408b: // P800 - p800 = 1; - //case 0x101fb2ae: // P900 - //case 0x10200ac6: // P910 - default: - keyConfig = keyConfigPXXX; - break; - } - DEBUGPRINT(_L("framebuffer=0x%08x (%dx%d)"), iFrameBuffer, - screenInfo.iScreenSize.iWidth, screenInfo.iScreenSize.iHeight); - - // vidInit - User::LeaveIfError(vidInit(iWsScreen->DisplayMode(), iFrameBuffer, p800)); - - // register for keyevents - for(TPicoKeyConfigEntry *e = keyConfig; e->name; e++) { - // release all keys - e->flags &= ~1; - if(e->flags & 0x80) { - // key disabled - e->handle1 = e->handle2 = -1; - continue; - } - e->handle1 = iWsWindowGroup.CaptureKeyUpAndDowns(e->scanCode, 0, 0, 2); - // although we only use UpAndDown events, register simple events too, - // just to prevent fireing their default actions. - if(e->keyCode) e->handle2 = iWsWindowGroup.CaptureKey(e->keyCode, 0, 0, 2); // priority of 1 is not enough on my phone - } - - // try to start the audio engine - static int PsndRate_old = 0, PicoOpt_old = 0, pal_old = 0; - - if(gamestate == PGS_Running && (currentConfig.iFlags & 4)) { - TInt err = 0; - if(PsndRate != PsndRate_old || (PicoOpt&11) != (PicoOpt_old&11) || Pico.m.pal != pal_old) { - // if rate changed, reset all enabled chips, else reset only those chips, which were recently enabled - //sound_reset(PsndRate != PsndRate_old ? PicoOpt : (PicoOpt&(PicoOpt^PicoOpt_old))); - sound_rerate(); - } - if(!gameAudio || PsndRate != PsndRate_old || ((PicoOpt&8) ^ (PicoOpt_old&8)) || Pico.m.pal != pal_old) { // rate or stereo or pal/ntsc changed - if(gameAudio) delete gameAudio; gameAudio = 0; - DEBUGPRINT(_L("starting audio: %i len: %i stereo: %i, pal: %i"), PsndRate, PsndLen, PicoOpt&8, Pico.m.pal); - TRAP(err, gameAudio = gameAudioNew(PsndRate, (PicoOpt&8) ? 1 : 0, PsndLen, Pico.m.pal ? 10 : 12)); - } - if( gameAudio) - TRAP(err, PsndOut = gameAudio->ResumeL()); - if(err) { - if(gameAudio) delete gameAudio; - gameAudio = 0; - PsndOut = 0; - strcpy(noticeMsg, "SOUND@STARTUP@FAILED"); - gettimeofday(¬iceMsgTime, 0); - } - PsndRate_old = PsndRate; - PicoOpt_old = PicoOpt; - pal_old = Pico.m.pal; - } else { - if(gameAudio) delete gameAudio; - gameAudio = 0; - PsndOut = 0; - } - - // start key WS event polling - iWsSession.EventReady(&iWsEventStatus); - DEBUGPRINT(_L("CGameWindow::ConstructResourcesL() finished.")); -} - - -void CGameWindow::FreeResources() -{ - if(gameAudio) gameAudio->Pause(); - - // free RDirectScreenAccess stuff - iDSA->Cancel(); - iDSA->Close(); - delete iDSA; - iDSA = NULL; - - iWsSession.EventReadyCancel(); - - for(TPicoKeyConfigEntry *e = keyConfig; e->name; e++) { - if(e->handle2 >= 0) iWsWindowGroup.CancelCaptureKey(e->handle2); - if(e->handle1 >= 0) iWsWindowGroup.CancelCaptureKeyUpAndDowns(e->handle1); - } - - if(iWsWindow.WsHandle()) - iWsWindow.Close(); - - if(iWsWindowGroup.WsHandle()) - iWsWindowGroup.Close(); - - // these must be deleted before calling iWsSession.Close() -// delete iWindowGc; -// iWindowGc = NULL; - - delete iWsScreen; - iWsScreen = NULL; - - // emu might change renderer by itself, so we may need to sync config - if(PicoOpt != currentConfig.iPicoOpt) { - currentConfig.iFlags |= 0x80; - CGameWindow::SendClientWsEvent(EEventKeyCfgDone); - } - - if(iWsSession.WsHandle()) - iWsSession.Close(); - - vidFree(); - -#ifdef TEST_FRAMEBUFF - FILE *tmp = fopen("d:\\temp\\screen.raw", "wb"); - fwrite(iFrameBuffer, 1, 208*320*4, tmp); - fclose(tmp); -#endif -} - - -void CGameWindow::DoKeys(timeval &time) -{ - TWsEvent iWsEvent; - TInt iWsEventType; - unsigned long allActions = 0; - static unsigned long areaActions = 0, forceUpdate = 0; - int i, nEvents; - - // detect if user is holding power button - static timeval powerPushed = { 0, 0 }; - if(powerPushed.tv_sec) { - if((time.tv_sec*1000000+time.tv_usec) - (powerPushed.tv_sec*1000000+powerPushed.tv_usec) > 1000000) { // > 1 sec - gamestate = PGS_Paused; - powerPushed.tv_sec = powerPushed.tv_usec = 0; - } - } - - for(nEvents = 0; iWsEventStatus != KRequestPending; nEvents++) - { - iWsSession.GetEvent(iWsEvent); - iWsEventType = iWsEvent.Type(); - - // pointer events? - if(iWsEventType == EEventPointer) { - if(iWsEvent.Pointer()->iType == TPointerEvent::EButton1Up) { - areaActions = 0; // remove all directionals - } else { // if(iWsEvent.Pointer()->iType == TPointerEvent::EButton1Down) { - TPoint p = iWsEvent.Pointer()->iPosition; - const TPicoAreaConfigEntry *e = areaConfig + 1; - for(i = 0; !e->rect.IsEmpty(); e++, i++) - if(e->rect.Contains(p)) { - areaActions = currentConfig.iAreaBinds[i]; - break; - } - } - } - else if(iWsEventType == EEventKeyDown || iWsEventType == EEventKeyUp) { - TInt iScanCode = iWsEvent.Key()->iScanCode; - - for(TPicoKeyConfigEntry *e = keyConfig; e->name; e++) - if(iScanCode == e->scanCode) { - if(iWsEventType == EEventKeyDown) e->flags |= 1; - else if((e->flags & 2) == 0) e->flags &= ~1; - break; - } - - // power? - if(iScanCode == EScanPxxxPower || iScanCode == EScanMotAEnd) { - if(iWsEventType == EEventKeyDown) - powerPushed = time; - else powerPushed.tv_sec = powerPushed.tv_usec = 0; - } - } - else if(iWsEventType == EEventScreenDeviceChanged) { - // we have the priority, so the launcher will not be able to process this, but it has to - User::After(500000); - reset_timing = 1; - } - else if(iWsEventType == EEventFocusGroupChanged) { - TInt launcherGrpId = iWsSession.FindWindowGroupIdentifier(0, iLauncherThreadId); - TInt focusGrpId = iWsSession.GetFocusWindowGroup(); - DEBUGPRINT(_L("EEventFocusGroupChanged: %i, our: %i, launcher: %i"), - focusGrpId, iWsWindowGroup.Identifier(), launcherGrpId); - // if it is not us and not launcher that got focus, pause emu - if(focusGrpId != iWsWindowGroup.Identifier() && focusGrpId != launcherGrpId) - gamestate = PGS_Paused; - } - - iWsEventStatus = KRequestPending; - iWsSession.EventReady(&iWsEventStatus); - } - - if(nEvents || forceUpdate) { - allActions = areaActions; - forceUpdate = 0; - - // add all pushed button actions - i = 0; - for(TPicoKeyConfigEntry *e = keyConfig; e->name; e++, i++) { - if(e->flags & 1) allActions |= currentConfig.iKeyBinds[i]; - if((e->flags& 3) == 3) forceUpdate = 1; - if(e->flags & 2) e->flags &= ~1; - } - - PicoPad[0] = (unsigned short) allActions; - if(allActions & 0xFFFF0000) { - RunEvents(allActions >> 16); - areaActions = 0; - } - } -} - - -void CGameWindow::DoKeysConfig(TUint &which) -{ - TWsEvent iWsEvent; - int i; - - // to detect if user is holding power button - static int powerIters = 0; - - while(iWsEventStatus != KRequestPending) - { - TUint currentActCode = 1 << which; - - iWsSession.GetEvent(iWsEvent); - - // pointer events? - if(iWsEvent.Type() == EEventPointer) { - TPoint p = iWsEvent.Pointer()->iPosition; - TRect prev(190, 112, 208, 126); - TRect next(190, 194, 208, 208); - - if(iWsEvent.Pointer()->iType == TPointerEvent::EButton1Down) { - if(prev.Contains(p)) do { which = (which-1) & 0x1F; } while(!actionNames[which]); - else if(next.Contains(p)) do { which = (which+1) & 0x1F; } while(!actionNames[which]); - else if(which == 31) gamestate = PGS_Paused; // done - else { - const TPicoAreaConfigEntry *e = areaConfig + 1; - for(i = 0; e->rect != TRect(0,0,0,0); e++, i++) - if(e->rect.Contains(p)) { - currentConfig.iAreaBinds[i] ^= currentActCode; - break; - } - } - } - } - else if(iWsEvent.Type() == EEventKeyDown || iWsEvent.Type() == EEventKeyUp) - { - //if(iWsEvent.Type() == EEventKey) - // DEBUGPRINT(_L("iWsEvent.Key()->iCode=0x%08x"), iWsEvent.Key()->iCode); - - //if(iWsEvent.Type() == EEventKeyDown) - // DEBUGPRINT(_L("EEventKeyDown iScanCode=0x%08x"), iWsEvent.Key()->iScanCode); - - //if(iWsEvent.Type() == EEventKeyUp) - // DEBUGPRINT(_L("EEventKeyUp iScanCode=0x%08x"), iWsEvent.Key()->iScanCode); - - // key events? - if(iWsEvent.Type() == EEventKeyDown) { - if(iWsScreen->CurrentScreenMode() == 1 && iWsEvent.Key()->iScanCode == EScanPxxxJogUp) { - do { which = (which-1) & 0x1F; } while(!actionNames[which]); - } else if(iWsScreen->CurrentScreenMode() == 1 && iWsEvent.Key()->iScanCode == EScanPxxxJogDown) { - do { which = (which+1) & 0x1F; } while(!actionNames[which]); - } else if(which == 31) { - gamestate = PGS_Paused; - if(iWsScreen->CurrentScreenMode()) // flip closed - vidDrawFCconfigDone(); - } else { - i = 0; - for(TPicoKeyConfigEntry *e = keyConfig; e->name; e++, i++) - if(iWsEvent.Key()->iScanCode == e->scanCode) - if(!(e->flags&0x40)) currentConfig.iKeyBinds[i] ^= currentActCode; - } - } - - // power? - if(iWsEvent.Key()->iScanCode == EScanPxxxPower || iWsEvent.Key()->iScanCode == EScanMotAEnd) - { - if(iWsEvent.Type() == EEventKeyDown) powerIters = 1; - else if(iWsEvent.Type() == EEventKeyUp) powerIters = 0; - } - } - else if(iWsEvent.Type() == EEventScreenDeviceChanged) { - // trying to fix the P910 problem when something steals focus (and returns it after a while?) - User::After(300000); - } - else if(iWsEvent.Type() == EEventFocusGroupChanged) { - TInt launcherGrpId = iWsSession.FindWindowGroupIdentifier(0, iLauncherThreadId); - TInt focusGrpId = iWsSession.GetFocusWindowGroup(); - DEBUGPRINT(_L("EEventFocusGroupChanged: %i, our: %i, launcher: %i"), - focusGrpId, iWsWindowGroup.Identifier(), launcherGrpId); - // if it is not us and not launcher that got focus, exit config mode - if(focusGrpId != iWsWindowGroup.Identifier() && focusGrpId != launcherGrpId) { - // don't give up that easily. May be the focus will be given back. - for (int i = 0; i < 4; i++) { - User::After(200000); - focusGrpId = iWsSession.GetFocusWindowGroup(); - if(focusGrpId == iWsWindowGroup.Identifier() || focusGrpId == launcherGrpId) break; - } - if(focusGrpId != iWsWindowGroup.Identifier() && focusGrpId != launcherGrpId) - // we probably should give up now - gamestate = PGS_Paused; - } - } - - iWsEventStatus = KRequestPending; - iWsSession.EventReady(&iWsEventStatus); - } - - if(powerIters) { // iterations when power was down - powerIters++; - if(powerIters > 5) { - gamestate = PGS_Paused; - powerIters = 0; - } - } -} - - -void CGameWindow::RunEvents(TUint32 which) -{ - if(which & 0x4000) currentConfig.iFrameskip = -1; - if(which & 0x2000) currentConfig.iFrameskip = 8; - if(which & 0x1800) { // save or load (but not both) - if(PsndOut) gameAudio->Pause(); // this may take a while, so we pause sound output - - vidDrawNotice((which & 0x1000) ? "LOADING@GAME" : "SAVING@GAME"); - saveLoadGame(which & 0x1000); - - if(PsndOut) PsndOut = gameAudio->ResumeL(); - reset_timing = 1; - } - if(which & 0x0400) gamestate = PGS_Paused; - if(which & 0x0200) { // switch renderer - if(currentConfig.iScreenMode == TPicoConfig::PMCenter && !noticeMsgTime.tv_sec && - (currentConfig.iScreenRotation == TPicoConfig::PRot90 || currentConfig.iScreenRotation == TPicoConfig::PRot270)) { - - PicoOpt^=0x10; - vidInit(iWsScreen->DisplayMode(), 0, 0, 1); - - strcpy(noticeMsg, (PicoOpt&0x10) ? "ALT@RENDERER" : "DEFAULT@RENDERER"); - gettimeofday(¬iceMsgTime, 0); - } - } - if(which & 0x00c0) { - if(which&0x0080) { - state_slot -= 1; - if(state_slot < 0) state_slot = 9; - } else { - state_slot += 1; - if(state_slot > 9) state_slot = 0; - } - sprintf(noticeMsg, "SAVE@SLOT@%i@SELECTED", state_slot); - gettimeofday(¬iceMsgTime, 0); - } - if(which & 0x0020) if(gameAudio) gameAudio->ChangeVolume(0); // for Motorolas (broken?) - if(which & 0x0010) if(gameAudio) gameAudio->ChangeVolume(1); -} - - -// send event to launcher windowgroup (WS session MUST be alive) -void CGameWindow::SendClientWsEvent(TInt type) -{ - if(!iWsSession.Handle()) { - DEBUGPRINT(_L("SendClientWsEvent(%i) called on dead iWsSession."), type); - return; - } - - TWsEvent event; - event.SetType(type); - event.SetTimeNow(); - - TInt launcherGrpId = iWsSession.FindWindowGroupIdentifier(0, iLauncherThreadId); - if(launcherGrpId != KErrNotFound) - iWsSession.SendEventToWindowGroup(launcherGrpId, event); - else DEBUGPRINT(_L("failed to send event %i to launcher."), event.Type()); -} - - -size_t gzRead2(void *p, size_t _size, size_t _n, void *file) -{ - return gzread(file, p, _n); -} - - -size_t gzWrite2(void *p, size_t _size, size_t _n, void *file) -{ - return gzwrite(file, p, _n); -} - - -// this function is shared between both threads -int saveLoadGame(int load, int sram) -{ - int res = 0; - - if(!RomFileName) return -1; - - // make save filename - char saveFname[KMaxFileName]; - strcpy(saveFname, RomFileName); - saveFname[KMaxFileName-8] = 0; - if(saveFname[strlen(saveFname)-4] == '.') saveFname[strlen(saveFname)-4] = 0; - if(sram) strcat(saveFname, ".srm"); - else { - if(state_slot > 0 && state_slot < 10) sprintf(saveFname, "%s.%i", saveFname, state_slot); - strcat(saveFname, ".mds"); - } - - DEBUGPRINT(_L("saveLoad (%i, %i): %S"), load, sram, DO_CONV(saveFname)); - - if(sram) { - FILE *sramFile; - int sram_size = SRam.end-SRam.start+1; - if(SRam.reg_back & 4) sram_size=0x2000; - if(!SRam.data) return 0; // SRam forcefully disabled for this game - if(load) { - sramFile = fopen(saveFname, "rb"); - if(!sramFile) return -1; - fread(SRam.data, 1, sram_size, sramFile); - fclose(sramFile); - } else { - // sram save needs some special processing - // see if we have anything to save - for(; sram_size > 0; sram_size--) - if(SRam.data[sram_size-1]) break; - - if(sram_size) { - sramFile = fopen(saveFname, "wb"); - res = fwrite(SRam.data, 1, sram_size, sramFile); - res = (res != sram_size) ? -1 : 0; - fclose((FILE *) sramFile); - } - } - return res; - } else { - void *PmovFile = NULL; - // try gzip first - if(currentConfig.iFlags & 0x80) { - strcat(saveFname, ".gz"); - if( (PmovFile = gzopen(saveFname, load ? "rb" : "wb")) ) { - areaRead = gzRead2; - areaWrite = gzWrite2; - if(!load) gzsetparams(PmovFile, 9, Z_DEFAULT_STRATEGY); - } else - saveFname[strlen(saveFname)-3] = 0; - } - if(!PmovFile) { // gzip failed or was disabled - if( (PmovFile = fopen(saveFname, load ? "rb" : "wb")) ) { - areaRead = fread; - areaWrite = fwrite; - } - } - if(PmovFile) { - PmovState(load ? 6 : 5, PmovFile); - strcpy(noticeMsg, load ? "GAME@LOADED" : "GAME@SAVED"); - if(areaRead == gzRead2) - gzclose(PmovFile); - else fclose ((FILE *) PmovFile); - PmovFile = 0; - } else { - strcpy(noticeMsg, load ? "LOAD@FAILED" : "SAVE@FAILED"); - res = -1; - } - - gettimeofday(¬iceMsgTime, 0); - return res; - } -} - -// static class members -RWsSession CGameWindow::iWsSession; -RWindowGroup CGameWindow::iWsWindowGroup; -RWindow CGameWindow::iWsWindow; -CWsScreenDevice* CGameWindow::iWsScreen = NULL; -CWindowGc* CGameWindow::iWindowGc = NULL; -TRequestStatus CGameWindow::iWsEventStatus = KRequestPending; -TThreadId CGameWindow::iLauncherThreadId = 0; -RDirectScreenAccess* CGameWindow::iDSA; -TRequestStatus CGameWindow::iDSAstatus = KRequestPending; diff --git a/platform/uiq2/port_config.h b/platform/uiq2/port_config.h deleted file mode 100644 index 6ed28b17..00000000 --- a/platform/uiq2/port_config.h +++ /dev/null @@ -1,21 +0,0 @@ -// port specific settings - -#ifndef PORT_CONFIG_H -#define PORT_CONFIG_H - -// draw2.c -#define START_ROW 1 // which row of tiles to start rendering at? -#define END_ROW 27 // ..end - -// pico.c -#define CAN_HANDLE_240_LINES 0 - -// common debug -#if defined(__DEBUG_PRINT) -void dprintf(char *format, ...); -#else -#define dprintf(x...) -#endif - - -#endif //PORT_CONFIG_H diff --git a/platform/uiq2/port_config.s b/platform/uiq2/port_config.s deleted file mode 100644 index cb6592ae..00000000 --- a/platform/uiq2/port_config.s +++ /dev/null @@ -1,2 +0,0 @@ -.equiv START_ROW, 1 -.equiv END_ROW, 27 diff --git a/platform/uiq2/qconn.cmd b/platform/uiq2/qconn.cmd deleted file mode 100644 index 96220c2b..00000000 --- a/platform/uiq2/qconn.cmd +++ /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 index 7ef2241d..00000000 --- a/platform/uiq2/quploadpico.cmd +++ /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 diff --git a/platform/uiq2/quploadpicol.cmd b/platform/uiq2/quploadpicol.cmd deleted file mode 100644 index 1482b2f5..00000000 --- a/platform/uiq2/quploadpicol.cmd +++ /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 diff --git a/platform/uiq2/version.h b/platform/uiq2/version.h deleted file mode 100644 index ab1bd1ee..00000000 --- a/platform/uiq2/version.h +++ /dev/null @@ -1,10 +0,0 @@ -// version number - -#ifndef __VERSION_H -#define __VERSION_H - -#define KPicoMajorVersionNumber 0 -#define KPicoMinorVersionNumber 93 -#define KPicoBuildNumber 0 - -#endif /* __VERSION_H */ diff --git a/platform/uiq2/vid.cpp b/platform/uiq2/vid.cpp deleted file mode 100644 index 7b3b7aed..00000000 --- a/platform/uiq2/vid.cpp +++ /dev/null @@ -1,1017 +0,0 @@ -// EmuScan routines for Pico, also simple text and shape drawing routines. - -// (c) Copyright 2006, notaz -// All Rights Reserved - -#include "vid.h" -#include "ClientServer.h" -#include "SimpleServer.h" -#include "pico\picoInt.h" -#include "blit.h" -#include "debug.h" - -// global stuff -extern TPicoConfig currentConfig; -extern TPicoKeyConfigEntry *keyConfig; -extern TPicoAreaConfigEntry areaConfig[]; -extern const char * actionNames[]; - -// main framebuffer -static void *screenbuff = 0; // pointer to real device video memory -//static -unsigned short *framebuff = 0; // temporary buffer in sega native BGR format -const int framebuffsize = (8+320)*(8+208+8)*2; // actual framebuffer size (in bytes+to support new rendering mode) -static int framebuff_offs = 0; // where to start copying (in pixels) -static int framebuff_len = 0; // how much of the framebuffer actually needs to be copied (in pixels) -static int fc_lines, fc_inc; // lines, inc for "0 fit2" mode - -// drawer function pointers -void (*drawTextFps)(const char *text) = 0; -void (*drawTextNotice)(const char *text) = 0; - -// blitter -void (*vidBlit)(int full) = 0; -void (*vidBlitKeyCfg)(int full) = 0; - -// stuff for rendermode2 -static unsigned short cram_high[0x40]; -static unsigned short dt_dmask=0x0333; -unsigned short color_redM2 = 0x022F; - -// colors -const unsigned short color_red = 0x022F; -const unsigned short color_red_dim = 0x0004; -const unsigned short color_green = 0x01F1; -const unsigned short color_blue = 0x0F11; -const unsigned short color_grey = 0x0222; - -// other -int txtheight_fit = 138; - -// bitmasks -static const unsigned long mask_numbers[] = { - 0x12244800, // 47 2F / - 0x69999600, // 48 30 0 - 0x26222200, // 49 31 1 - 0x69168F00, // 50 32 2 - 0x69219600, // 51 33 3 - 0x266AF200, // 52 34 4 - 0xF8E11E00, // 53 35 5 - 0x68E99600, // 54 36 6 - 0x71222200, // 55 37 7 - 0x69699600, // 56 38 8 - 0x69719600, // 57 39 9 - 0x04004000, // 58 3A : - 0x04004400, // 59 3B ; - 0x01242100, // 60 3C < - 0x00707000, // 61 3D = - 0x04212400, // 62 3E > - 0x69240400, // 63 3F ? - 0x00000000, // 64 40 @ [used instead of space for now] - 0x22579900, // 65 41 A - 0xE9E99E00, // 66 42 B - 0x69889600, // 67 43 C - 0xE9999E00, // 68 44 D - 0xF8E88F00, // 69 45 E - 0xF8E88800, // 70 46 F - 0x698B9700, // 71 47 G - 0x99F99900, // 72 48 H - 0x44444400, // 73 49 I - 0x11119600, // 74 4A J - 0x9ACCA900, // 75 4B K - 0x88888F00, // 76 4C L - 0x9F999900, // 77 4D M - 0x9DDBB900, // 78 4E N - 0x69999600, // 79 4F O - 0xE99E8800, // 80 50 P - 0x6999A500, // 81 51 Q - 0xE99E9900, // 82 52 R - 0x69429600, // 83 53 S - 0x72222200, // 84 54 T - 0x99999600, // 85 55 U - 0x55552200, // 86 56 V - 0x9999F900, // 87 57 W - 0x55225500, // 88 58 X - 0x55222200, // 89 59 Y - 0xF1248F00, // 90 5A Z -}; - - -//////////////////////////////// -// Cram functions - -inline int EmuCramNull(int cram) -{ - User::Panic(_L("Cram called!!"), 0); - return cram; -} - - -//////////////////////////////// -// PicoScan functions in "center" mode - -int EmuScanCenter0(unsigned int num, unsigned short *sdata) -{ - //unsigned short *vidmem=framebuff; - - //unsigned short *sp, *sto; - //sp=sdata+56; sto=sdata+264; vidmem += num*208; - - //do { *vidmem++ = *sp++; } while(sp < sto); - memcpy(framebuff + num*208, sdata+56, 208*2); // memcpy gives ~1 fps (~2 with optimized memcpy) - - return 0; -} - - -int EmuScanCenter90(unsigned int num, unsigned short *sdata) -{ - // ignore top and bottom lines - if(num < 8) return 7-num; // skip first 8 lines - if(num > 215) return 223+8-num; // this should not happen, just in case - - num -= 8; - if(!num) { - if(Pico.video.reg[12]&1) { // copy less in 32-col mode - framebuff_offs= 0; - framebuff_len = 208*320; - } else { - framebuff_offs= 208*32; - framebuff_len = 208*256; - } - } - - unsigned short *vidmem=framebuff; - vidmem += 207-num; // adjust x - - // do less copy in 32-column mode - unsigned short *sp, *sto; - int pixels; - if(!(Pico.video.reg[12]&1)) - { sp=sdata+32; sto=sdata+288; pixels = 288; vidmem += 32*208; } - else { sp=sdata; sto=sdata+320; pixels = 320; } - - do { *vidmem = *sp++; vidmem+=208; } while(sp < sto); - - if(num == 207) return 16; // skip bottom of this frame and top of next - - return 0; -} - - -int EmuScanCenter180(unsigned int num, unsigned short *sdata) -{ - unsigned short *vidmem=framebuff; - - unsigned short *sp, *sto; - sp=sdata+56; sto=sdata+264; vidmem += (224-num)*208; - - do { *(--vidmem) = *sp++; } while(sp < sto); // reversed - - return 0; -} - - -int EmuScanCenter270(unsigned int num, unsigned short *sdata) -{ - // ignore top and bottom lines - if(num < 8) return 7-num; // skip first 8 lines - if(num > 215) return 223-num+8; - - num -= 8; - if(num > 207) return 0; - if(!num) { - if(Pico.video.reg[12]&1) { - framebuff_offs= 0; - framebuff_len = 208*320; - } else { - framebuff_offs= 208*32; - framebuff_len = 208*256; - } - } - - unsigned short *vidmem=framebuff+320*208; - vidmem -= 208-num; // adjust x - - // do less copy in 32-column mode - unsigned short *sp, *sto; - if(!(Pico.video.reg[12]&1)) - { sp=sdata+32; sto=sdata+288; vidmem -= 32*208; } - else { sp=sdata; sto=sdata+320; } - - do { *vidmem = *sp++; vidmem-=208; } while(sp < sto); - - if(num == 207) return 16; // skip bottom of this frame and top of next - - return 0; -} - - - -//////////////////////////////// -// PicoScan functions in "fit" mode - -static int EmuScanFit0(unsigned int num, unsigned short *sdata) -{ - // 0.65, 145 lines in normal mode; 0.8125, 182 lines in 32-column mode - - // draw this line? (ARM4s don't support division, so do some tricks here) - static int u = 0, num2 = 0; - if(!num) { - u = num2 = 0; - if(currentConfig.iScreenMode == TPicoConfig::PMFit) { - if(Pico.video.reg[12]&1) { // 32 col mode? This can change on any frame - fc_inc = 6500; - txtheight_fit = 138; - framebuff_len = 208*145; - memset(framebuff+208*145, 0, 208*37*2); - } else { - fc_inc = 8125; - txtheight_fit = 175; - framebuff_len = 208*182; - } - } - } - u += fc_inc; - if(u < 10000) return 0; - u -= 10000; - - unsigned short *vidmem=framebuff; - - int slen; - unsigned short *sp; - if(!(Pico.video.reg[12]&1)) - { sp=sdata+32; slen=256; } - else { sp=sdata; slen=320; } - - vidmem += num2*208; -/* - int i=0; - while(sp < sto) { - i += inc; - if(i >= 10000) { - *vidmem++ = *sp; - i -= 10000; - } - sp++; - } -*/ - PicuShrink(vidmem, 208, sp, slen); - - num2++; - - // calculate how many lines pico engine should skip, - // making sure this func will be called on scanline 0 - int skip = 0; - while(u+fc_inc < 10000 && num+skip != 223) { u+=fc_inc; skip++; } - - return skip; -} - -int EmuScanFit90(unsigned int num, unsigned short *sdata) -{ - // 0.9285 - - // draw this line? - static int u = 0, num2 = 0; - if(!num) { - u = num2 = 0; - if(Pico.video.reg[12]&1) { - framebuff_offs= 0; - framebuff_len = 208*320; - } else { - framebuff_offs= 208*32; - framebuff_len = 208*256; - } - } - u += 9285; - if(u < 10000) return 0; - u -= 10000; - - unsigned short *vidmem=framebuff; - vidmem += 207-num2; // adjust x - - // do less copy in 32-column mode - unsigned short *sp, *sto; - if(!(Pico.video.reg[12]&1)) - { sp=sdata+32; sto=sdata+288; vidmem += 32*208; } - else { sp=sdata; sto=sdata+320; } - - do { *vidmem = *sp++; vidmem+=208; } while(sp < sto); - - num2++; - - // skip next line? - if(u+9285 < 10000 && num != 223) { u+=9285; return 1; } - - return 0; -} - -int EmuScanFit180(unsigned int num, unsigned short *sdata) -{ - // 0.65, 145 lines in normal mode; 0.8125, 182 lines in 32-column mode - - // draw this line? (ARM4s don't support division) - static int u = 0, num2 = 0; - if(!num) { - u = num2 = 0; - if(currentConfig.iScreenMode == TPicoConfig::PMFit) { - if(Pico.video.reg[12]&1) { // 32 col mode? This can change on any frame - fc_lines = 145; - fc_inc = 6500; - txtheight_fit = 138; - framebuff_len = 208*145; - memset(framebuff+208*145, 0, 208*37*2); - } else { - fc_lines = 182; - fc_inc = 8125; - txtheight_fit = 175; - framebuff_len = 208*182; - } - } - } - u += fc_inc; - if(u < 10000) return 0; - u -= 10000; - - unsigned short *vidmem=framebuff; - - int slen; - unsigned short *sp; - if(!(Pico.video.reg[12]&1)) - { sp=sdata+32; slen=256; } - else { sp=sdata; slen=320; } - - vidmem += (fc_lines-num2)*208; - - PicuShrinkReverse(vidmem, 208, sp, slen); - - num2++; - - // skip some lines? - int skip = 0; - while(u+fc_inc < 10000 && num+skip != 223) { u+=fc_inc; skip++; } - - return skip; -} - -int EmuScanFit270(unsigned int num, unsigned short *sdata) -{ - // 0.9285 - - // draw this line? - static int u = 0, num2 = 0; - if(!num) { - u = num2 = 0; - if(Pico.video.reg[12]&1) { - framebuff_offs= 0; - framebuff_len = 208*320; - } else { - framebuff_offs= 208*32; - framebuff_len = 208*256; - } - } - u += 9285; - if(u < 10000) return 0; - u -= 10000; - - unsigned short *vidmem=framebuff+320*208; - vidmem -= 208-num2; // adjust x - - // do less copy in 32-column mode - unsigned short *sp, *sto; - if(!(Pico.video.reg[12]&1)) - { sp=sdata+32; sto=sdata+288; vidmem -= 32*208; } - else { sp=sdata; sto=sdata+320; } - - do { *vidmem = *sp++; vidmem-=208; } while(sp < sto); - - num2++; - - // skip next line? - if(u+9285 < 10000 && num != 223) { u+=9285; return 1; } - - return 0; -} - - -//////////////////////////////// -// text drawers -// warning: text must be at least 1px away from screen borders - -void drawTextM2(int x, int y, const char *text, long color) -{ - unsigned short *vidmem=framebuff; - int charmask, i, cx = x, cy; - unsigned short *l, *le; - - // darken the background (left border) - for(l=vidmem+(cx-1)+(y-1)*328, le=vidmem+(cx-1)+(y+7)*328; l < le; l+=328) - *l = (*l >> 2) & dt_dmask; - - for(const char *p=text; *p; p++) { - cy = y; - charmask = *(mask_numbers + (*p - 0x2F)); - - for(l = vidmem+cx+(y-1)*328, le = vidmem+cx+(y+7)*328; l < le; l+=328-4) { - *l = (*l >> 2) & dt_dmask; l++; *l = (*l >> 2) & dt_dmask; l++; - *l = (*l >> 2) & dt_dmask; l++; *l = (*l >> 2) & dt_dmask; l++; - *l = (*l >> 2) & dt_dmask; - } - - for(i=0; i < 24; i++) { - // draw dot. Is this fast? - if(charmask&0x80000000) *( vidmem + (cx+(i&3)) + (cy+(i>>2))*328 ) = color; - charmask <<= 1; - } - cx += 5; - } -} - -void drawText0(int x, int y, const char *text, long color) -{ - unsigned short *vidmem=framebuff; - int charmask, i, cx = x, cy; - unsigned short *l, *le, dmask=0x0333; - - // darken the background (left border) - for(l=vidmem+(cx-1)+(y-1)*208, le=vidmem+(cx-1)+(y+7)*208; l < le; l+=208) - *l = (*l >> 2) & dmask; - - for(const char *p=text; *p; p++) { - cy = y; - charmask = *(mask_numbers + (*p - 0x2F)); - - for(l = vidmem+cx+(y-1)*208, le = vidmem+cx+(y+7)*208; l < le; l+=208-4) { - *l = (*l >> 2) & dmask; l++; *l = (*l >> 2) & dmask; l++; - *l = (*l >> 2) & dmask; l++; *l = (*l >> 2) & dmask; l++; - *l = (*l >> 2) & dmask; - } - - for(i=0; i < 24; i++) { - // draw dot. Is this fast? - if(charmask&0x80000000) *( vidmem + (cx+(i&3)) + (cy+(i>>2))*208 ) = color; - charmask <<= 1; - } - cx += 5; - } -} - -void drawText90(int x, int y, const char *text, long color) -{ - unsigned short *vidmem=framebuff; - unsigned short *l, *le, dmask=0x0333; - int charmask, i, cx, cy = y; - - for(l=vidmem+(x+1)+(cy-1)*208, le=vidmem+(x-7)+(cy-1)*208; l > le; l--) - *l = (*l >> 2) & dmask; - - for(const char *p=text; *p; p++) { - cx = x; - charmask = *(mask_numbers + (*p - 0x2F)); - - for(l = vidmem+(x+1)+(cy)*208, le = vidmem+(x+1)+(cy+5)*208; l < le; l+=208+7) { - *l = (*l >> 2) & dmask; l--; *l = (*l >> 2) & dmask; l--; - *l = (*l >> 2) & dmask; l--; *l = (*l >> 2) & dmask; l--; - *l = (*l >> 2) & dmask; l--; *l = (*l >> 2) & dmask; l--; - *l = (*l >> 2) & dmask; l--; *l = (*l >> 2) & dmask; - } - - for(i=0; i < 24; i++) { - if(charmask&0x80000000) *( vidmem + (cy+(i&3))*208 + (cx-(i>>2)) ) = color; - charmask <<= 1; - } - cy += 5; - } -} - -void drawText180(int x, int y, const char *text, long color) -{ - unsigned short *vidmem=framebuff; - int charmask, i, cx = x, cy; - unsigned short *l, *le, dmask=0x0333; - - for(l=vidmem+(cx+1)+(y+1)*208, le=vidmem+(cx+1)+(y-7)*208; l > le; l-=208) - *l = (*l >> 2) & dmask; - - for(const char *p=text; *p; p++) { - cy = y; - charmask = *(mask_numbers + (*p - 0x2F)); - - for(l = vidmem+cx+(y+1)*208, le = vidmem+cx+(y-8)*208; l > le; l-=208-4) { - *l = (*l >> 2) & dmask; l--; *l = (*l >> 2) & dmask; l--; - *l = (*l >> 2) & dmask; l--; *l = (*l >> 2) & dmask; l--; - *l = (*l >> 2) & dmask; - } - - for(i=0; i < 24; i++) { - if(charmask&0x80000000) *( vidmem + (cx-(i&3)) + (cy-(i>>2))*208 ) = color; - charmask <<= 1; - } - cx -= 5; - } -} - -void drawText270(int x, int y, const char *text, long color) -{ - unsigned short *vidmem=framebuff; - int charmask, i, cx, cy = y; - unsigned short *l, *le, dmask=0x0333; - - for(l=vidmem+(x-1)+(cy+1)*208, le=vidmem+(x+7)+(cy+1)*208; l < le; l++) - *l = (*l >> 2) & dmask; - - for(const char *p=text; *p; p++) { - cx = x; - charmask = *(mask_numbers + (*p - 0x2F)); - - for(l = vidmem+(x-1)+(cy)*208, le = vidmem+(x-1)+(cy-5)*208; l > le; l-=208+7) { - *l = (*l >> 2) & dmask; l++; *l = (*l >> 2) & dmask; l++; - *l = (*l >> 2) & dmask; l++; *l = (*l >> 2) & dmask; l++; - *l = (*l >> 2) & dmask; l++; *l = (*l >> 2) & dmask; l++; - *l = (*l >> 2) & dmask; l++; *l = (*l >> 2) & dmask; - } - - for(i=0; i < 24; i++) { - if(charmask&0x80000000) *( vidmem + (cy-(i&3))*208 + (cx+(i>>2)) ) = color; - charmask <<= 1; - } - cy -= 5; - } -} - -void drawTextFpsM2(const char *text) -{ - if(!text) return; - drawTextM2((Pico.video.reg[12]&1) ? 256 : 224, 200, text, color_redM2); -} - -void drawTextFps0(const char *text) -{ - if(!text) return; - drawText0(176, 216, text, color_red); -} - -void drawTextFpsFit0(const char *text) -{ - if(!text) return; - drawText0(176, txtheight_fit, text, color_red); -} - -void drawTextFps90(const char *text) -{ - if(!text) return; - drawText90(10, 256, text, color_red); -} - -void drawTextFps180(const char *text) -{ - if(!text) return; - drawText180(32, 8, text, color_red); -} - -void drawTextFps270(const char *text) -{ - if(!text) return; - drawText270(200, 64, text, color_red); -} - -void drawTextNoticeM2(const char *text) -{ - if(!text) return; - drawTextM2(20, 200, text, color_redM2); -} - -void drawTextNotice0(const char *text) -{ - if(!text) return; - drawText0(2, 216, text, color_red); -} - -void drawTextNoticeFit0(const char *text) -{ - if(!text) return; - drawText0(2, txtheight_fit, text, color_red); -} - -void drawTextNotice90(const char *text) -{ - if(!text) return; - drawText90(10, 34, text, color_red); -} - -void drawTextNotice180(const char *text) -{ - if(!text) return; - drawText180(206, 8, text, color_red); -} - -void drawTextNotice270(const char *text) -{ - if(!text) return; - drawText270(200, 286, text, color_red); -} - - -//////////////////////////////// -// misc drawers - -// draws rect with width - 1 and height - 1 -void drawRect(const TRect &rc, unsigned short color) -{ - if(rc.iTl.iX - rc.iBr.iX && rc.iTl.iY - rc.iBr.iY) { - int stepX = rc.iTl.iX < rc.iBr.iX ? 1 : -1; - int stepY = rc.iTl.iY < rc.iBr.iY ? 1 : -1; - - for(int x = rc.iTl.iX;; x += stepX) { - *(framebuff + rc.iTl.iY*208 + x) = *(framebuff + (rc.iBr.iY - stepY)*208 + x) = color; - if(x == rc.iBr.iX - stepX) break; - } - - for(int y = rc.iTl.iY;; y += stepY) { - *(framebuff + y*208 + rc.iTl.iX) = *(framebuff + y*208 + rc.iBr.iX - stepX) = color; - if(y == rc.iBr.iY - stepY) break; - } - } -} - -// draws fullsize filled rect -void drawRectFilled(const TRect rc, unsigned short color) -{ - if(rc.iTl.iX - rc.iBr.iX && rc.iTl.iY - rc.iBr.iY) { - int stepX = rc.iTl.iX < rc.iBr.iX ? 1 : -1; - int stepY = rc.iTl.iY < rc.iBr.iY ? 1 : -1; - - for(int y = rc.iTl.iY;; y += stepY) { - for(int x = rc.iTl.iX;; x += stepX) { - *(framebuff + y*208 + x) = *(framebuff + y*208 + x) = color; - if(x == rc.iBr.iX) break; - } - if(y == rc.iBr.iY) break; - } - } -} - -// direction: -1 left, 1 right -void drawArrow0(TPoint p, int direction, unsigned short color) -{ - int width = 11; - int x = p.iX; - int y = p.iY; - - for(; width > 0; x+=direction, y++, width -=2) - for(int i=0; i < width; i++) - *(framebuff + x + y*208 + i*208) = color; -} - -void drawArrow90(TPoint p, int direction, unsigned short color) -{ - int width = 11; - int x = p.iX - width; - int y = p.iY; - - for(; width > 0; x++, y+=direction, width -=2) - for(int i=0; i < width; i++) - *(framebuff + x + y*208 + i) = color; -} - - -// copies temporary framebuff to real device framebuffer -void vidBlitRGB444(int full) -{ - unsigned short *ps; - unsigned short *pd; - int pixels; - if(full) { - ps = framebuff; - pd = (unsigned short *) screenbuff; - pixels = 208*320; - } else { - ps = framebuff + framebuff_offs; - pd = (unsigned short *) screenbuff + framebuff_offs; - pixels = framebuff_len; - } - - vidConvCpyRGB444(pd, ps, pixels); - //for(unsigned short *ps_end = ps + pixels; ps < ps_end; ps++) - // Convert 0000bbb0 ggg0rrr0 - // to 0000rrr0 ggg0bbb0 - // *pd++ = ((*ps&0x000F)<<8) | (*ps&0x00F0) | ((*ps&0x0F00)>>8); -} - -void vidBlitRGB565(int full) -{ - unsigned short *ps; - unsigned short *pd; - int pixels; - if(full) { - ps = framebuff; - pd = (unsigned short *) screenbuff; - pixels = 208*320; - } else { - ps = framebuff + framebuff_offs; - pd = (unsigned short *) screenbuff + framebuff_offs; - pixels = framebuff_len; - } - - vidConvCpyRGB565(pd, ps, pixels); - //for(; ps < ps_end; ps++) - // Convert 0000bbb0 ggg0rrr0 - // to rrr00ggg 000bbb00 - // *pd++ = ((*ps&0x000F)<<12) | ((*ps&0x00F0)<<3) | ((*ps&0x0F00)>>7); -} - -void vidBlitRGB32(int full) -{ - unsigned short *ps; - unsigned long *pd; - int pixels; - if(full) { - ps = framebuff; - pd = (unsigned long *) screenbuff; - pixels = 208*320; - } else { - ps = framebuff + framebuff_offs; - pd = (unsigned long *) screenbuff + framebuff_offs; - pixels = framebuff_len; - } - - vidConvCpyRGB32(pd, ps, pixels); - //for(; ps < ps_end; ps++) - // Convert 0000bbb0 ggg0rrr0 - // to ..0 rrr00000 ggg00000 bbb00000 - // *pd++ = ((*ps&0x000F)<<20) | ((*ps&0x00F0)<<8) | ((*ps&0x0F00)>>4); -} - -// -------- rendermode 2 --------- - -void vidBlit16M2(int full) -{ - unsigned short *ps = framebuff+328*8; - unsigned short *pd = (unsigned short *) screenbuff; - - if(currentConfig.iScreenRotation == TPicoConfig::PRot90) { - if(Pico.video.reg[12]&1) - vidConvCpyM2_16_90(pd, ps, 320/8); - else { - if(full) memset(pd, 0, 208*32*2); - pd += 208*32; - vidConvCpyM2_16_90(pd, ps, 256/8); - if(full) memset(pd + 208*256, 0, 208*32*2); - } - } else if(currentConfig.iScreenRotation == TPicoConfig::PRot270) { - if(Pico.video.reg[12]&1) - vidConvCpyM2_16_270(pd, ps, 320/8); - else { - if(full) memset(pd, 0, 208*32*2); - pd += 208*32; - ps -= 64; // the blitter starts copying from the right border, so we need to adjust - vidConvCpyM2_16_270(pd, ps, 256/8); - if(full) memset(pd + 208*256, 0, 208*32*2); - } - } -/* - for(int x=0; x < 320; x++) - for(int y=207; y>=0; y--) { - *pd++ = *(ps+8+x+y*328); - } -*/ -} - -void vidBlitRGB32M2(int full) -{ - unsigned short *ps = framebuff+328*8; - unsigned long *pd = (unsigned long *) screenbuff; - - if(currentConfig.iScreenRotation == TPicoConfig::PRot90) { - if(Pico.video.reg[12]&1) - vidConvCpyM2_RGB32_90(pd, ps, 320/8); - else { - if(full) memset(pd, 0, 208*32*4); - pd += 208*32; - vidConvCpyM2_RGB32_90(pd, ps, 256/8); - if(full) memset(pd + 208*256, 0, 208*32*4); - } - } else if(currentConfig.iScreenRotation == TPicoConfig::PRot270) { - if(Pico.video.reg[12]&1) - vidConvCpyM2_RGB32_270(pd, ps, 320/8); - else { - if(full) memset(pd, 0, 208*32*4); - pd += 208*32; - ps -= 64; // the blitter starts copying from the right border, so we need to adjust - vidConvCpyM2_RGB32_270(pd, ps, 256/8); - if(full) memset(pd + 208*256, 0, 208*32*4); - } - } -} - -void PrepareCramRGB444M2() -{ - vidConvCpyRGB444(cram_high, Pico.cram, 0x40); -} - -void PrepareCramRGB565M2() -{ - vidConvCpyRGB565(cram_high, Pico.cram, 0x40); -} - - -//////////////////////////////// -// main functions - -int vidInit(int displayMode, void *vidmem, int p800, int reinit) -{ - if(!reinit) { - // prepare framebuffer - screenbuff = (unsigned short *) vidmem; - framebuff = (unsigned short *) malloc(framebuffsize); - - if(!screenbuff) return KErrNotSupported; - if(!framebuff) return KErrNoMemory; - - // Cram function: go and hack Pico so it never gets called - PicoCram = EmuCramNull; - } - - // select suitable blitter - switch(displayMode) { - case EColor4K: vidBlit = vidBlitKeyCfg = vidBlitRGB444; break; - case EColor64K: vidBlit = vidBlitKeyCfg = vidBlitRGB565; break; - case EColor16M: vidBlit = vidBlitKeyCfg = vidBlitRGB32; break; - default: return KErrNotSupported; - } - - memset(framebuff, 0, framebuffsize); - - // rendermode 2? - if(PicoOpt&0x10) { - switch(displayMode) { - case EColor4K: - vidBlit = vidBlit16M2; - PicoPrepareCram = PrepareCramRGB444M2; - PicoCramHigh = cram_high; - color_redM2 = 0x0F22; - dt_dmask = 0x0333; - break; - case EColor64K: - vidBlit = vidBlit16M2; - PicoPrepareCram = PrepareCramRGB565M2; - PicoCramHigh = cram_high; - color_redM2 = 0xF882; - dt_dmask = 0x39e7; - break; - case EColor16M: - vidBlit = vidBlitRGB32M2; - break; - } - drawTextFps = drawTextFpsM2; - drawTextNotice = drawTextNoticeM2; - vidBlit(1); - return 0; - } - - framebuff_offs = 0; - framebuff_len = 208*320; - vidBlit(1); - - // setup all orientation related stuff - if(currentConfig.iScreenRotation == TPicoConfig::PRot0) { - if(currentConfig.iScreenMode == TPicoConfig::PMCenter) { - PicoScan = EmuScanCenter0; - framebuff_len = 208*224; - drawTextFps = drawTextFps0; - drawTextNotice = drawTextNotice0; - } else { - if(currentConfig.iScreenMode == TPicoConfig::PMFit2) { - if(p800) { - fc_inc = 6518; // 0.651786 (144+2) - txtheight_fit = 139; - framebuff_len = 208*146; - } else { - fc_inc = 9286; // 0.92857 - txtheight_fit = 201; - framebuff_len = 208*208; - } - } - PicoScan = EmuScanFit0; - drawTextFps = drawTextFpsFit0; - drawTextNotice = drawTextNoticeFit0; - } - } else if(currentConfig.iScreenRotation == TPicoConfig::PRot90) { - if(currentConfig.iScreenMode == TPicoConfig::PMFit) - PicoScan = EmuScanFit90; - else PicoScan = EmuScanCenter90; - drawTextFps = drawTextFps90; - drawTextNotice = drawTextNotice90; - } else if(currentConfig.iScreenRotation == TPicoConfig::PRot180) { - if(currentConfig.iScreenMode == TPicoConfig::PMCenter) { - PicoScan = EmuScanCenter180; - framebuff_len = 208*224; - } else { - if(currentConfig.iScreenMode == TPicoConfig::PMFit2) { - if(p800) { - fc_inc = 6518; // 0.651786 - fc_lines = 146; - framebuff_len = 208*146; - } else { - fc_inc = 9286; // 0.92857 - fc_lines = 208; - framebuff_len = 208*208; - } - } - PicoScan = EmuScanFit180; - } - drawTextFps = drawTextFps180; - drawTextNotice = drawTextNotice180; - } else if(currentConfig.iScreenRotation == TPicoConfig::PRot270) { - if(currentConfig.iScreenMode == TPicoConfig::PMFit) - PicoScan = EmuScanFit270; - else PicoScan = EmuScanCenter270; - drawTextFps = drawTextFps270; - drawTextNotice = drawTextNotice270; - } - - return 0; -} - -void vidFree() -{ - free(framebuff); - framebuff = 0; -} - -void vidDrawFrame(char *noticeStr, char *fpsStr, int num) -{ - PicoFrame(); - if(currentConfig.iFlags & 2) - drawTextFps(fpsStr); - drawTextNotice(noticeStr); - - vidBlit(!num); // copy full frame once a second -} - -void vidKeyConfigFrame(const TUint whichAction, TInt flipClosed) -{ - int i; - char buttonNames[128]; - buttonNames[0] = 0; - memset(framebuff, 0, framebuffsize); - - unsigned long currentActCode = 1 << whichAction; - - if(flipClosed) { - drawRectFilled(TRect(56, 2, 152, 16), color_grey); // 96x14 - drawArrow0(TPoint(64, 3), -1, color_green); - drawArrow0(TPoint(144, 3), 1, color_green); - drawText0(64, 20, "USE@JOG@TO@SELECT", color_red); - - drawText0(68, 6, actionNames[whichAction], color_red); - } else { - // draw all "buttons" in reverse order - const TPicoAreaConfigEntry *e = areaConfig + 1; i = 0; - while(e->rect != TRect(0,0,0,0)) { e++; i++; } - for(e--, i--; e->rect != TRect(0,0,0,0); e--, i--) - drawRect(e->rect, (currentConfig.iAreaBinds[i] & currentActCode) ? color_red : color_red_dim); - - // draw config controls - drawRectFilled(TRect(190, 112, 204, 208), color_grey); - drawArrow90(TPoint(203, 120), -1, color_green); - drawArrow90(TPoint(203, 200), 1, color_green); - - drawText90(200, 124, actionNames[whichAction], color_red); - } - - // draw active button names if there are any - i = 0; - for(TPicoKeyConfigEntry *e = keyConfig; e->name; e++, i++) - if(currentConfig.iKeyBinds[i] & currentActCode) { - if(buttonNames[0]) strcat(buttonNames, ";@"); - strcat(buttonNames, e->name); - } - if(buttonNames[0]) { - if(flipClosed) { - buttonNames[41] = 0; // only 61 chars fit - drawText0(2, 138, buttonNames, color_blue); - } else { - buttonNames[61] = 0; - drawText90(12, 10, buttonNames, color_blue); - } - } - - vidBlitKeyCfg(1); -} - -void vidDrawFCconfigDone() -{ - drawText0(64, 20, "USE@JOG@TO@SELECT", 0); // blank prev text - drawText0(54, 30, "OPEN@FLIP@TO@CONTINUE", color_red); - vidBlitKeyCfg(1); -} - -void vidDrawNotice(const char *txt) -{ - if(framebuff) { - drawTextNotice(txt); - vidBlit(1); - } -} diff --git a/platform/uiq2/vid.h b/platform/uiq2/vid.h deleted file mode 100644 index 0b28cb86..00000000 --- a/platform/uiq2/vid.h +++ /dev/null @@ -1,9 +0,0 @@ -#include - -// let's do it in more c-like way -int vidInit(int displayMode, void *vidmem, int p800, int reinit=0); -void vidFree(); -void vidDrawFrame(char *noticeStr, char *fpsStr, int num); -void vidKeyConfigFrame(const TUint whichAction, TInt flipClosed); -void vidDrawFCconfigDone(); -void vidDrawNotice(const char *txt); // safe to call anytime, draws text for 1 frame diff --git a/platform/uiq3/App.cpp b/platform/uiq3/App.cpp deleted file mode 100644 index d1be510d..00000000 --- a/platform/uiq3/App.cpp +++ /dev/null @@ -1,491 +0,0 @@ -/******************************************************************* - * - * File: App.cpp - * - * Author: Peter van Sebille (peter@yipton.net) - * - * Modified/adapted for picodriveN by notaz, 2006 - * - * (c) Copyright 2006, notaz - * (c) Copyright 2002, Peter van Sebille - * All Rights Reserved - * - *******************************************************************/ - -#include "App.h" -// #include "picodriven.mbg" // bitmap identifiers -#include "rsc/picodrive.rsg" // resource include -#include -#include -//#include -//#include -//#include // CEikMenuBar -#include // TApaSystemEvent -#include -#include -#include - -#include -#include -#include -#include - -#include "Dialogs.h" -#include "engine/debug.h" -#include "../common/emu.h" -#include "emu.h" - -extern "C" char menuErrorMsg[]; - -//////////////////////////////////////////////////////////////// -// -// class CPicolAppView -// -//////////////////////////////////////////////////////////////// - -// Creates and constructs the view. -CPicolAppView* CPicolAppView::NewLC(CQikAppUi& aAppUi, TPicoConfig& aCurrentConfig) -{ - CPicolAppView* self = new (ELeave) CPicolAppView(aAppUi, aCurrentConfig); - CleanupStack::PushL(self); - return self; -} - -/** -Constructor for the view. -Passes the application UI reference to the construction of the super class. - -KNullViewId should normally be passed as parent view for the applications -default view. The parent view is the logical view that is normally activated -when a go back command is issued. KNullViewId will activate the system -default view. - -@param aAppUi Reference to the application UI -*/ -CPicolAppView::CPicolAppView(CQikAppUi& aAppUi, TPicoConfig& aCurrentConfig) -: CQikViewBase(aAppUi, KNullViewId), iCurrentConfig(aCurrentConfig) -{ -} - -void CPicolAppView::ConstructL() -{ - BaseConstructL(); -} - -CPicolAppView::~CPicolAppView() -{ -} - - -/** -Inherited from CQikViewBase and called upon by the UI Framework. -It creates the view from resource. -*/ -void CPicolAppView::ViewConstructL() -{ - // Loads information about the UI configurations this view supports - // together with definition of each view. - ViewConstructFromResourceL(R_APP_UI_CONFIGURATIONS); - UpdateCommandList(); -} - -/** -Returns the view Id - -@return Returns the Uid of the view -*/ -TVwsViewId CPicolAppView::ViewId()const -{ - return TVwsViewId(KUidPicolApp, KUidPicolMainView); -} - -/** -Handles all commands in the view. -Called by the UI framework when a command has been issued. -The command Ids are defined in the .hrh file. - -@param aCommand The command to be executed -@see CQikViewBase::HandleCommandL -*/ -void CPicolAppView::HandleCommandL(CQikCommand& aCommand) -{ - TInt res; - - switch(aCommand.Id()) - { - case EEikCmdPicoLoadState: - if(iROMLoaded) { - CEikonEnv::Static()->BusyMsgL(_L("Loading State")); - res = CPicoGameSession::Do(PicoMsgLoadState); - CEikonEnv::Static()->BusyMsgCancel(); - // emu doesn't start to run if load fails, so we can display this - if(res) CEikonEnv::Static()->InfoMsg(_L("Load Failed")); - } - break; - - case EEikCmdPicoSaveState: - if(iROMLoaded) { - CEikonEnv::Static()->BusyMsgL(_L("Saving State")); - res = CPicoGameSession::Do(PicoMsgSaveState); - CEikonEnv::Static()->BusyMsgCancel(); - if(res) CEikonEnv::Static()->InfoMsg(_L("Save Failed")); - } - break; - - case EEikCmdPicoLoadROM: - DisplayOpenROMDialogL(); - DEBUGPRINT(_L("after DisplayOpenROMDialogL()")); - break; - - case EEikCmdPicoResume: - CPicoGameSession::Do(PicoMsgResume); - break; - - case EEikCmdPicoReset: - CPicoGameSession::Do(PicoMsgReset); - break; - - case EEikCmdPicoSettings: - DisplayConfigDialogL(); - break; - - case EEikCmdHelpAbout: - DisplayAboutDialogL(); - break; - - case EEikCmdPicoDebugInfo: - DisplayDebugDialogL(); - break; - - case EEikCmdPicoKeys: - CPicoGameSession::Do(PicoMsgConfigChange, &iCurrentConfig); - CPicoGameSession::Do(PicoMsgKeys); - break; - - case EEikCmdPicoFrameskipAuto: - currentConfig.Frameskip = -1; - emu_write_config(0); - break; - - case EEikCmdPicoFrameskip0: - currentConfig.Frameskip = 0; - emu_write_config(0); - break; - - case EEikCmdPicoFrameskip1: - currentConfig.Frameskip = 1; - emu_write_config(0); - break; - - case EEikCmdPicoFrameskip2: - currentConfig.Frameskip = 2; - emu_write_config(0); - break; - - case EEikCmdPicoFrameskip4: - currentConfig.Frameskip = 4; - emu_write_config(0); - break; - - case EEikCmdPicoFrameskip8: - currentConfig.Frameskip = 8; - emu_write_config(0); - break; - - case EEikCmdExit: - emu_Deinit(); - CPicoGameSession::freeResources(); - //break; // this is intentional - - default: - // Go back and exit command will be passed to the CQikViewBase to handle. - CQikViewBase::HandleCommandL(aCommand); - break; - } -} - -void CPicolAppView::DisplayOpenROMDialogL() -{ - // Array of mimetypes that the dialog shall filter on, if empty all - // mimetypes will be visible. - CDesCArray* mimeArray = new (ELeave) CDesCArrayFlat(1); - CleanupStack::PushL(mimeArray); - // Array that will be filled with the file paths that are choosen - // from the dialog. - CDesCArray* fileArray = new (ELeave) CDesCArraySeg(3); - CleanupStack::PushL(fileArray); - _LIT16(KDlgTitle, "Select a ROM file"); - - TPtrC8 text8((TUint8*) rom_fname_loaded); - iCurrentConfig.iLastROMFile.Copy(text8); - - if( CQikSelectFileDlg::RunDlgLD( *mimeArray, *fileArray, &KDlgTitle, &iCurrentConfig.iLastROMFile) ) - { - CEikonEnv::Static()->BusyMsgL(_L("Loading ROM")); - TPtrC16 file = (*fileArray)[0]; - //iCurrentConfig.iLastROMFile.Copy(file); - - // push the config first - CPicoGameSession::Do(PicoMsgSetAppView, this); - CPicoGameSession::Do(PicoMsgConfigChange, &iCurrentConfig); - - TInt res = CPicoGameSession::Do(PicoMsgLoadROM, &file); - - CEikonEnv::Static()->BusyMsgCancel(); - - iROMLoaded = EFalse; - switch (res) - { - case PicoErrRomOpenFailed: { - TBuf<64> mErrorBuff; - TPtrC8 buff8((TUint8*) menuErrorMsg); - mErrorBuff.Copy(buff8); - CEikonEnv::Static()->InfoWinL(_L("Error"), mErrorBuff); - break; - } - - case PicoErrOutOfMem: - CEikonEnv::Static()->InfoWinL(_L("Error"), _L("Failed to allocate memory.")); - break; - - case PicoErrEmuThread: - CEikonEnv::Static()->InfoWinL(_L("Error"), _L("Failed to create emulation thread. Try to restart this application.")); - break; - - default: - iROMLoaded = ETrue; - break; - } - - // errors which leave ROM loaded - switch (res) - { - case PicoErrOutOfMemSnd: - CEikonEnv::Static()->InfoWinL(_L("Error"), _L("Failed to allocate sound buffer, disabled sound.")); - break; - - case PicoErrGenSnd: - CEikonEnv::Static()->InfoWinL(_L("Error"), _L("Failed to start soundsystem, disabled sound.")); - break; - } - if(res == 6 || res == 7) currentConfig.EmuOpt &= ~EOPT_EN_SOUND; - - if(iROMLoaded) { - if(iTitleAdded) - ViewContext()->ChangeTextL(EEikCidTitleBarLabel, CPicoGameSession::iRomInternalName); - else ViewContext()->AddTextL (EEikCidTitleBarLabel, CPicoGameSession::iRomInternalName); - iTitleAdded = ETrue; - UpdateCommandList(); - } - } - CleanupStack::PopAndDestroy(2, mimeArray); -} - - -void CPicolAppView::DisplayConfigDialogL() -{ - CPicoConfigDialog* configDialog = new(ELeave)CPicoConfigDialog(currentConfig); - emu_pack_config(); - configDialog->ExecuteLD(R_PICO_CONFIG); - emu_unpack_config(); - emu_write_config(0); - - CPicoGameSession::Do(PicoMsgConfigChange, ¤tConfig); -} - - -void CPicolAppView::DisplayAboutDialogL() -{ - TInt iButtonRes; - CAboutDialog* dialog = new (ELeave) CAboutDialog; - - dialog->PrepareLC(R_PICO_ABOUT); - iButtonRes = dialog->RunLD(); - - if(iButtonRes == EEikCmdPicoAboutCreditsCmd) { - CCreditsDialog *creditsDialog = new (ELeave) CCreditsDialog(); - creditsDialog->PrepareLC(R_PICO_CREDITS); - creditsDialog->RunLD(); - } -} - -#ifdef __DEBUG_PRINT -extern "C" char *PDebugMain(); -#endif - -void CPicolAppView::DisplayDebugDialogL() -{ -#ifdef __DEBUG_PRINT - CDebugDialog* dialog = new (ELeave) CDebugDialog(PDebugMain()); - - dialog->PrepareLC(R_PICO_DEBUG); - dialog->RunLD(); -#endif -} - -void CPicolAppView::UpdateCommandList() -{ - CQikCommandManager& commandManager = CQikCommandManager::Static(*iCoeEnv); - CQikCommand *cmd_fs[10]; - Mem::FillZ(cmd_fs, sizeof(CQikCommand*)*10); - - CQikCommand* cmd_reset = commandManager.Command(*this, EEikCmdPicoReset); - CQikCommand* cmd_savest = commandManager.Command(*this, EEikCmdPicoSaveState); - CQikCommand* cmd_loadst = commandManager.Command(*this, EEikCmdPicoLoadState); - CQikCommand* cmd_resume = commandManager.Command(*this, EEikCmdPicoResume); - cmd_fs[0] = commandManager.Command(*this, EEikCmdPicoFrameskipAuto); - cmd_fs[1] = commandManager.Command(*this, EEikCmdPicoFrameskip0); - cmd_fs[2] = commandManager.Command(*this, EEikCmdPicoFrameskip1); - cmd_fs[3] = commandManager.Command(*this, EEikCmdPicoFrameskip2); - cmd_fs[5] = commandManager.Command(*this, EEikCmdPicoFrameskip4); - cmd_fs[9] = commandManager.Command(*this, EEikCmdPicoFrameskip8); - - TBool dimmed = !CPicoGameSession::iEmuRunning || !iROMLoaded; - cmd_reset ->SetDimmed(dimmed); - cmd_savest->SetDimmed(dimmed); - cmd_loadst->SetDimmed(dimmed); - cmd_resume->SetDimmed(dimmed); - - // frameskip - TInt fs_index = currentConfig.Frameskip + 1; - if (fs_index >= 0 && fs_index < 10 && cmd_fs[fs_index]) - { - cmd_fs[fs_index]->SetChecked(ETrue); - } -} - - -//////////////////////////////////////////////////////////////// -// -// class CPicolAppUi -// -//////////////////////////////////////////////////////////////// - - -void CPicolAppUi::ConstructL() -{ - BaseConstructL(); - - // Create the view and add it to the framework - iAppView = CPicolAppView::NewLC(*this, ((CPicolDocument *)Document())->iCurrentConfig); - AddViewL(*iAppView); - CleanupStack::Pop(iAppView); -} - - -//////////////////////////////////////////////////////////////// -// -// CPicolDocument -// -//////////////////////////////////////////////////////////////// - - -CPicolDocument::CPicolDocument(CQikApplication& aApp) -: CQikDocument(aApp) -{ -} - -CQikAppUi* CPicolDocument::CreateAppUiL() -{ - return new(ELeave) CPicolAppUi; -} - -/** -Called by the framework when ::SaveL has been called. -*/ -void CPicolDocument::StoreL(CStreamStore& aStore, CStreamDictionary& aStreamDic) const -{ -#if 0 - RStoreWriteStream stream; - - TStreamId preferenceId = stream.CreateLC(aStore); - aStreamDic.AssignL(KUidPicolStore, preferenceId); - - // Externalize preference - stream << iCurrentConfig; - - // Ensures that any buffered data is written to aStore - stream.CommitL(); - CleanupStack::PopAndDestroy(); // stream -#endif -/* - // tmp - TInt res; - RFile logFile; - res = logFile.Replace(CEikonEnv::Static()->FsSession(), _L("C:\\Shared\\pico.cfg"), EFileWrite|EFileShareAny); - if(!res) { - logFile.Write(TPtr8((TUint8 *)&iCurrentConfig, sizeof(iCurrentConfig), sizeof(iCurrentConfig))); - logFile.Close(); - } -*/ -} - -/** -Called by the framework on application start. -Loads the application data from disk, i.e. domain data and preferences. -*/ -void CPicolDocument::RestoreL(const CStreamStore& aStore, const CStreamDictionary& aStreamDic) -{ -#if 0 - // Find the stream ID of the model data from the stream dictionary: - TStreamId preferenceId(aStreamDic.At(KUidPicolStore)); - RStoreReadStream stream; - stream.OpenLC(aStore, preferenceId); - if(preferenceId != KNullStreamId) - { - // Interalize preference and model - stream >> iCurrentConfig; - } - - CleanupStack::PopAndDestroy(); // stream -#endif - - // tmp -/* TInt res; - RFile logFile; - res = logFile.Open(CEikonEnv::Static()->FsSession(), _L("C:\\Shared\\pico.cfg"), EFileRead|EFileShareAny); - if(!res) { - TPtr8 ptr((TUint8 *)&iCurrentConfig, sizeof(iCurrentConfig), sizeof(iCurrentConfig)); - logFile.Read(ptr); - logFile.Close(); - }*/ -} - -//////////////////////////////////////////////////////////////// -// -// framework -// -//////////////////////////////////////////////////////////////// - - -CApaDocument* CPicolApplication::CreateDocumentL() -{ - return new (ELeave) CPicolDocument(*this); -} - -EXPORT_C CApaApplication* NewApplication() -{ - return new CPicolApplication; -} - - -TUid CPicolApplication::AppDllUid() const -{ - return KUidPicolApp; -} - - -extern "C" TInt my_SetExceptionHandler(TInt, TExceptionHandler, TUint32); - -GLDEF_C TInt E32Main() -{ - // doesn't work :( - User::SetExceptionHandler(ExceptionHandler, (TUint32) -1); -// my_SetExceptionHandler(KCurrentThreadHandle, ExceptionHandler, 0xffffffff); - - emu_Init(); - - return EikStart::RunApplication(NewApplication); -} - - diff --git a/platform/uiq3/App.h b/platform/uiq3/App.h deleted file mode 100644 index 2c1543fd..00000000 --- a/platform/uiq3/App.h +++ /dev/null @@ -1,113 +0,0 @@ -/******************************************************************* - * - * File: App.h - * - * Author: Peter van Sebille (peter@yipton.net) - * - * Modified/adapted for picodriveN by notaz, 2006 - * - * (c) Copyright 2006, notaz - * (c) Copyright 2001, Peter van Sebille - * All Rights Reserved - * - *******************************************************************/ - -#ifndef __APP_H -#define __APP_H - -#include -#include -#include - -#include -#include -#include -//#include -#include - -#include "Engine.h" -#include "picodrive.hrh" - -const TUid KUidPicolApp = { 0xA00010F3 }; -const TUid KUidPicolMainView = { 0x00000001 }; -//const TUid KUidPicolFOView = { 0x1000C194 }; -//const TUid KUidPicolFCView = { 0x1000C195 }; -const TUid KUidPicolStore = { 0x00000011 }; // store stream UID - -//enum -//{ -// EScreenModeFlipOpen = 0, -// EScreenModeFlipClosed -//}; - - -extern "C" struct _currentConfig_t; - -class CPicolAppView : public CQikViewBase -{ -public: - static CPicolAppView* NewLC(CQikAppUi& aAppUi, TPicoConfig &aCurrentConfig); - ~CPicolAppView(); - - // from CQikViewBase - TVwsViewId ViewId()const; - void HandleCommandL(CQikCommand& aCommand); - void UpdateCommandList(); - -protected: - // from CQikViewBase - void ViewConstructL(); - -private: - CPicolAppView(CQikAppUi& aAppUi, TPicoConfig &aCurrentConfig); - void ConstructL(); - -protected: // new stuf - void DisplayAboutDialogL(); - void DisplayOpenROMDialogL(); - void DisplayConfigDialogL(); - void DisplayDebugDialogL(); - -/* void StopGame(); - void RunGameL();*/ - -private: - TPicoConfig &iCurrentConfig; - TBool iROMLoaded; - TBool iTitleAdded; -}; - - - -class CPicolAppUi : public CQikAppUi -{ -public: -// CPicolAppUi(); - void ConstructL(); - - CPicolAppView* iAppView; -}; - - -class CPicolDocument : public CQikDocument -{ -public: - CPicolDocument(CQikApplication& aApp); - void StoreL(CStreamStore& aStore, CStreamDictionary& aStreamDic) const; - void RestoreL(const CStreamStore& aStore, const CStreamDictionary& aStreamDic); - - TPicoConfig iCurrentConfig; - -private: // from CQikDocument - CQikAppUi* CreateAppUiL(); -}; - - -class CPicolApplication : public CQikApplication -{ -private: // from CApaApplication - CApaDocument* CreateDocumentL(); - TUid AppDllUid() const; -}; - -#endif diff --git a/platform/uiq3/CSimpleTextParser.cpp b/platform/uiq3/CSimpleTextParser.cpp deleted file mode 100644 index 865e35ee..00000000 --- a/platform/uiq3/CSimpleTextParser.cpp +++ /dev/null @@ -1,477 +0,0 @@ -/******************************************************************* - * - * File: CSimpleTextParser.cpp - * - * Author: Peter van Sebille (peter@yipton.net) - * - * (c) Copyright 2002, Peter van Sebille - * All Rights Reserved - * - *******************************************************************/ - -#include "CSimpleTextParser.h" - -enum -{ - EBadTag, - EBadZeroLengthTag, - EBadIntegerParam, - EBadAlignmentParam, - EBadRgbColorParam -}; - -void Panic(TInt aPanic) -{ - User::Panic(_L("STP"), aPanic); -} - -CSimpleTextFormatParser* CSimpleTextFormatParser::NewLC() -{ - CSimpleTextFormatParser* self = new(ELeave)CSimpleTextFormatParser; - CleanupStack::PushL(self); - self->ConstructL(); - return self; -} - -CSimpleTextFormatParser::~CSimpleTextFormatParser() -{ - delete iParaFormat; -} - -void CSimpleTextFormatParser::ConstructL() -{ - iParaFormat = CParaFormat::NewL(); -} - - -void CSimpleTextFormatParser::SetBold(TBool aEnable) -{ - iCharFormat.iFontSpec.iFontStyle.SetStrokeWeight(aEnable ? EStrokeWeightBold : EStrokeWeightNormal); - iCharMask.ClearAll(); - iCharMask.SetAttrib(EAttFontStrokeWeight); - iRichText->ApplyCharFormatL(iCharFormat, iCharMask, TextPos(), 0); -} - -void CSimpleTextFormatParser::SetItalic(TBool aEnable) -{ - iCharFormat.iFontSpec.iFontStyle.SetPosture(aEnable ? EPostureItalic : EPostureUpright); - iCharMask.ClearAll(); - iCharMask.SetAttrib(EAttFontPosture); - iRichText->ApplyCharFormatL(iCharFormat, iCharMask, TextPos(), 0); -} - -void CSimpleTextFormatParser::SetUnderLine(TBool aEnable) -{ - iCharFormat.iFontPresentation.iUnderline = aEnable ? EUnderlineOn : EUnderlineOff; - iCharMask.ClearAll(); - iCharMask.SetAttrib(EAttFontUnderline); - iRichText->ApplyCharFormatL(iCharFormat, iCharMask, TextPos(), 0); -} - -void CSimpleTextFormatParser::SetHiddenText(TBool aEnable) -{ - iCharFormat.iFontPresentation.iHiddenText = aEnable; - iCharMask.ClearAll(); - iCharMask.SetAttrib(EAttFontHiddenText); - iRichText->ApplyCharFormatL(iCharFormat, iCharMask, TextPos(), 0); -} - -TRgb CSimpleTextFormatParser::ForegroundColor() -{ - iCharMask.ClearAll(); - iCharMask.SetAttrib(EAttColor); - iRichText->GetCharFormat(iCharFormat, iCharMask, TextPos(), 0); - return iCharFormat.iFontPresentation.iTextColor; -} - -void CSimpleTextFormatParser::SetForegroundColor(const TRgb& aColor) -{ - iCharFormat.iFontPresentation.iTextColor = aColor; - iCharMask.ClearAll(); - iCharMask.SetAttrib(EAttColor); - iRichText->ApplyCharFormatL(iCharFormat, iCharMask, TextPos(), 0); -} - -void CSimpleTextFormatParser::SetBackgroundColor(const TRgb& aColor) -{ - iParaFormat->iFillColor = aColor; - iParaMask.ClearAll(); - iParaMask.SetAttrib(EAttFillColor); - iRichText->ApplyParaFormatL(iParaFormat, iParaMask, ParaPos(), 0); -} - -void CSimpleTextFormatParser::NewParagraph() -{ - iCurrentPara++; - iRichText->AppendParagraphL(); - AppendTextL(_L("")); -} - - -void CSimpleTextFormatParser::SetAlignment(CParaFormat::TAlignment aAlignment) -{ - iParaFormat->iHorizontalAlignment = aAlignment; - iParaMask.ClearAll(); - iParaMask.SetAttrib(EAttAlignment); - iRichText->ApplyParaFormatL(iParaFormat, iParaMask, ParaPos(), 0); -} - - -void CSimpleTextFormatParser::SetFontHeight(TInt aHeight) -{ - iCharFormat.iFontSpec.iHeight = (aHeight * KTwipsPerInch)/KPointsPerInch; - iCharMask.ClearAll(); - iCharMask.SetAttrib(EAttFontHeight); - iRichText->ApplyCharFormatL(iCharFormat, iCharMask, TextPos(), 0); -} - -void CSimpleTextFormatParser::SetFontName(const TDesC& aName) -{ - iCharFormat.iFontSpec.iTypeface.iName = aName; - iCharFormat.iFontSpec.iTypeface.SetAttributes(0); - iCharFormat.iFontSpec.iTypeface.SetIsProportional(ETrue); - iCharMask.ClearAll(); - iCharMask.SetAttrib(EAttFontTypeface); - iRichText->ApplyCharFormatL(iCharFormat, iCharMask, TextPos(), 0); -} - - -/* - * Character formatting: - * Bold on - * Bold of - * Italic on - * Italic off - * Underline on - * Underline off - * Hidden text on **doesn't work** - * Hidden text off **doesn't work** - * Fontname: name (type: string) - * Fontsize: size (type: integer) - * Foreground color: color (type: color) - * Restore foreground color - * - * Paragraph formatting: - *

New paragraph - will reset both character & paragraph formatting to defaults - * Alignment: aling (type: alignement) - * Background color: color (type: color) **doesn't work** - * - * Special characters: - * The character: < - * - * Types: - * - string: - * - integer: Either decimal or hexidecimal value - * - color: Either integer specifing rgb value, or (r,g,b) in which r, g and b are of type integer - * - align: element of enumeration {center, left, right} - * - * Comments: - * The syntax/parser is fairly simplistic. The parser is not trying to match a tag like - * as XML/HTML do. Basically, when it encounters a tag (e.g., ) it will - * simply instruct the the editor to apply the formatting from the current position as - * specified by the tag (e.g., enable bold). For example, HelloWorld results - * in Hello displayed in a Bold font and World in a normal font. - * - * The only case where state is maintained is when using and . The current - * fg color is stored when parsing and restored when doing . Again, and - * don't have the XML/HTML behavior. For example: - * Peterwashere - * results in "Peter" displayed in red, "was" displayed in blue and "here" displayed in red. - * It literally goes like this: - * 1) --> apply editor text color red, previous color = whatever the editor's text color is now - * 2) --> apply editor text color blue, previous color = whatever the editor's text color - * is now --> red - * 3) --> apply editor text to previous color --> red - * 4) --> apply editor text to previous color --> red - * - * What you probably wanted was: - * Peterwashere - * Now "Peter" is displayed in red, "was" in blue and "here" in the default editor's color - */ - -static TUint32 ParseInteger(const TDesC& aString) -{ - TUint32 val = 0; - TBool parsed = EFalse; - if (aString.Length() > 2) - { - if ((aString[0] == '0') && ((aString[0] == 'x') || (aString[0] == 'X'))) - { - TLex lex(aString.Right(aString.Length()-2)); - if (lex.Val(val, EHex) != KErrNone) - { - __ASSERT_DEBUG(ETrue, Panic(EBadIntegerParam)); - } - parsed = ETrue; - } - } - if (!parsed) - { - TLex lex(aString); - if (lex.Val(val, EDecimal) != KErrNone) - { - __ASSERT_DEBUG(ETrue, Panic(EBadIntegerParam)); - } - } - return val; -} - -static TRgb ParseColor(const TDesC& aString) -{ - if (aString.Length() > 0) - { - if (aString[0] == 'R') - { - if (aString.Compare(_L("RgbBlack")) == 0) - return KRgbBlack; - else if (aString.Compare(_L("RgbDarkGray")) == 0) - return KRgbDarkGray; - else if (aString.Compare(_L("RgbDarkRed")) == 0) - return KRgbDarkRed; - else if (aString.Compare(_L("RgbDarkGreen")) == 0) - return KRgbDarkGreen; - else if (aString.Compare(_L("RgbDarkYellow")) == 0) - return KRgbDarkYellow; - else if (aString.Compare(_L("RgbDarkBlue")) == 0) - return KRgbDarkBlue; - else if (aString.Compare(_L("RgbDarkMagenta")) == 0) - return KRgbDarkMagenta; - else if (aString.Compare(_L("RgbDarkCyan")) == 0) - return KRgbDarkCyan; - else if (aString.Compare(_L("RgbRed")) == 0) - return KRgbRed; - else if (aString.Compare(_L("RgbGreen")) == 0) - return KRgbGreen; - else if (aString.Compare(_L("RgbYellow")) == 0) - return KRgbYellow; - else if (aString.Compare(_L("RgbBlue")) == 0) - return KRgbBlue; - else if (aString.Compare(_L("RgbMagenta")) == 0) - return KRgbMagenta; - else if (aString.Compare(_L("RgbCyan")) == 0) - return KRgbCyan; - else if (aString.Compare(_L("RgbGray")) == 0) - return KRgbGray; - else if (aString.Compare(_L("RgbWhite")) == 0) - return KRgbWhite; - else - { - __ASSERT_DEBUG(ETrue, Panic(EBadRgbColorParam)); - } - } - return ParseInteger(aString); - } - __ASSERT_DEBUG(ETrue, Panic(EBadRgbColorParam)); - - return KRgbBlack; -} - - - -static CParaFormat::TAlignment ParseAlignment(const TDesC& aString) -{ - if (aString.Compare(_L("center")) == 0) - { - return CParaFormat::ECenterAlign; - } - else if (aString.Compare(_L("left")) == 0) - { - return CParaFormat::ELeftAlign; - } - else if (aString.Compare(_L("right")) == 0) - { - return CParaFormat::ERightAlign; - } - __ASSERT_DEBUG(ETrue, Panic(EBadAlignmentParam)); - - return CParaFormat::ECenterAlign; -} - -void CSimpleTextFormatParser::ParseTagL(const TDesC& aTag) -{ - TInt tagLength = aTag.Length(); - if (tagLength == 0) - { - __ASSERT_DEBUG(ETrue, Panic(EBadZeroLengthTag)); - return; - } - - TPtrC param(_L("")); - TInt pos = aTag.Find(_L("=")); - if (pos>0) - { - param.Set(aTag.Right(aTag.Length()-pos-1)); - tagLength = pos; - } - TPtrC tag = aTag.Left(tagLength); - -// RDebug::Print(_L("tag=%S, param=%S"), &tag, ¶m); - - switch (tagLength) - { - case 1: - { - if (tag.Compare(_L("a")) == 0) - SetAlignment(ParseAlignment(param)); - else if (tag.Compare(_L("b")) == 0) - SetBold(); - else if (tag.Compare(_L("f")) == 0) - SetFontName(param); - else if (tag.Compare(_L("h")) == 0) - SetHiddenText(); - else if (tag.Compare(_L("i")) == 0) - SetItalic(); - else if (tag.Compare(_L("p")) == 0) - NewParagraph(); - else if (tag.Compare(_L("s")) == 0) - SetFontHeight(ParseInteger(param)); - else if (tag.Compare(_L("u")) == 0) - SetUnderLine(); - else - { - __ASSERT_DEBUG(ETrue, Panic(EBadTag)); - } - break; - } - - case 2: - { - if (tag.Compare(_L("/b")) == 0) - SetBold(EFalse); - if (tag.Compare(_L("bg")) == 0) - SetBackgroundColor(ParseColor(param)); - if (tag.Compare(_L("fg")) == 0) - { - iPrevFgColor = ForegroundColor(); - SetForegroundColor(ParseColor(param)); - } - else if (tag.Compare(_L("/h")) == 0) - SetHiddenText(EFalse); - else if (tag.Compare(_L("/i")) == 0) - SetItalic(EFalse); - else if (tag.Compare(_L("/u")) == 0) - SetUnderLine(EFalse); - else if (tag.Compare(_L("/<")) == 0) - AppendTextL(_L("<")); - break; - } - case 3: - { - if (tag.Compare(_L("/fg")) == 0) - SetForegroundColor(iPrevFgColor); - break; - } - default: - ; - } -} - -void CSimpleTextFormatParser::ParseL(const TDesC& aSimpleText, CRichText& aRichText) -{ - iRichText = &aRichText; - iCurrentPara = 0; - - TBool done = EFalse; - TPtrC simpleText(aSimpleText); - do - { - TInt pos = simpleText.Locate('<'); - if (pos > 0) - { - AppendTextL(simpleText.Left(pos)); - simpleText.Set(simpleText.Right(simpleText.Length() - pos)); - } - else if (pos == 0) - { - pos = simpleText.Locate('>'); - if (pos<=0) - User::Leave(KErrArgument); - ParseTagL(simpleText.Mid(1, pos-1)); - simpleText.Set(simpleText.Right(simpleText.Length() - pos - 1)); - } - else - { - AppendTextL(simpleText); - done = ETrue; - } - } while (!done); -} - - -TInt CSimpleTextFormatParser::TextPos() -{ - return iRichText->DocumentLength(); -#if 0 - TInt pos, length; - pos = iRichText->CharPosOfParagraph(length, iCurrentPara); - return pos+length-1; -#endif -} - -TInt CSimpleTextFormatParser::ParaPos() -{ - return TextPos(); -#if 0 - TInt pos, length; - pos = iRichText->CharPosOfParagraph(length, iCurrentPara); - return pos+length-1; -#endif -} - - -void CSimpleTextFormatParser::AppendTextL(const TDesC& aText) -{ -// RDebug::Print(_L("text=%S"), &aText); - iRichText->InsertL(TextPos(), aText); -} - - -#if 0 -void CTestDialog::ShowTextL(CRichText& aRichText) -{ - aRichText.Reset(); - - TCharFormat charFormat; - TCharFormatMask charMask; - aRichText.GetCharFormat(charFormat, charMask, 0, 0); - - TInt para = 0; - AppendTextL(_L("http://www.yipton.net"), aRichText); - - para++; - aRichText.AppendParagraphL(); - - CParaFormat* paraFormat = CParaFormat::NewLC(); - TParaFormatMask paraMask; - aRichText.GetParaFormatL(paraFormat, paraMask, ParaPos(aRichText, para), 0); - paraFormat->iHorizontalAlignment = CParaFormat::ECenterAlign; - paraMask.ClearAll(); - paraMask.SetAttrib(EAttAlignment); - aRichText.ApplyParaFormatL(paraFormat, paraMask, ParaPos(aRichText, para), 0); - - charFormat.iFontPresentation.iUnderline = EUnderlineOn; - charFormat.iFontSpec.iFontStyle.SetPosture(EPostureItalic); - charMask.ClearAll(); - charMask.SetAttrib(EAttFontPosture); - charMask.SetAttrib(EAttFontUnderline); - aRichText.ApplyCharFormatL(charFormat, charMask, TextPos(aRichText, para)); - AppendTextL(_L("mailto:Peter is here"), aRichText, para); - - para++; - aRichText.AppendParagraphL(); - - TFontSpec fontSpec(_L("edmunds"), 20 * KPointsPerInch); -// CFont* font = NULL; -// iCoeEnv->ScreenDevice()->GetNearestFontInTwips(font, fontSpec); - - charFormat.iFontSpec = fontSpec; - charMask.ClearAll(); - charMask.SetAttrib(EAttFontHeight); - charMask.SetAttrib(EAttFontTypeface); - aRichText.ApplyCharFormatL(charFormat, charMask, TextPos(aRichText, para)); - AppendTextL(_L("mailto:Peter is here"), aRichText, para); - - CleanupStack::PopAndDestroy(); -} - -#endif diff --git a/platform/uiq3/CSimpleTextParser.h b/platform/uiq3/CSimpleTextParser.h deleted file mode 100644 index f5bdc7c3..00000000 --- a/platform/uiq3/CSimpleTextParser.h +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************* - * - * File: CSimpleTextParser.h - * - * Author: Peter van Sebille (peter@yipton.net) - * - * (c) Copyright 2002, Peter van Sebille - * All Rights Reserved - * - *******************************************************************/ - -#ifndef __CSIMPLE_TEXT_PARSER_H -#define __CSIMPLE_TEXT_PARSER_H - -#include -#include // CRichText -#include // CEikRichTextEditor - -class CSimpleTextFormatParser : public CBase -{ -public: - static CSimpleTextFormatParser* NewLC(); - void ParseL(const TDesC& aPSTText, CRichText& aRichText); - -protected: - CSimpleTextFormatParser(){} - ~CSimpleTextFormatParser(); - void ConstructL(); - - void ParseTagL(const TDesC& aTag); - - TRgb ForegroundColor(); - void SetBold(TBool aEnable=ETrue); - void SetItalic(TBool aEnable=ETrue); - void SetUnderLine(TBool aEnable=ETrue); - void SetFontHeight(TInt aHeight); - void SetFontName(const TDesC& aName); - void SetHiddenText(TBool aEnable=ETrue); - void SetForegroundColor(const TRgb& aColor); - - void NewParagraph(); - void SetAlignment(CParaFormat::TAlignment aAlignment); - void SetBackgroundColor(const TRgb& aColor); - - void AppendTextL(const TDesC& aText); - TInt TextPos(); - TInt ParaPos(); - - - CRichText* iRichText; - TCharFormat iCharFormat; - TCharFormatMask iCharMask; - CParaFormat* iParaFormat; - TParaFormatMask iParaMask; - TInt iCurrentPara; - TRgb iPrevFgColor; -}; - -#endif /* __CSIMPLE_TEXT_PARSER_H */ diff --git a/platform/uiq3/Dialogs.cpp b/platform/uiq3/Dialogs.cpp deleted file mode 100644 index 923a457f..00000000 --- a/platform/uiq3/Dialogs.cpp +++ /dev/null @@ -1,361 +0,0 @@ -/******************************************************************* - * - * File: Dialogs.cpp - * - * Author: Peter van Sebille (peter@yipton.net) - * - * Modified/adapted for picodriveN by notaz, 2006 - * - * (c) Copyright 2006, notaz - * (c) Copyright 2002, Peter van Sebille - * All Rights Reserved - * - *******************************************************************/ - -#include "Dialogs.h" -#include "Engine.h" -#include "picodrive.hrh" -#include "rsc/picodrive.rsg" - -#include "version.h" -#include "CSimpleTextParser.h" -#include // CRichText -#include // CEikRichTextEditor -#include // CEikHorOptionButtonList -#include // CEikOptionButton -#include // CEikEdwin -#include // EQuartzKeyTwoWayDown - -#include -#include "../common/emu.h" - - -/************************************************ - * - * config Dialog - * - ************************************************/ - -CPicoConfigDialog::CPicoConfigDialog(_currentConfig_t &cfg) : config(cfg) -{ -} - -void CPicoConfigDialog::PostLayoutDynInitL() -{ - CEikHorOptionButtonList *buttons_rot = (CEikHorOptionButtonList*) Control( ECtlOptRotation ); - CEikHorOptionButtonList *buttons_disp = (CEikHorOptionButtonList*) Control( ECtlOptScreenMode ); - CEikCheckBox *chkbox_altrend= (CEikCheckBox*) Control( ECtlOptUseAltRend ); -// CEikCheckBox *chkbox_acctmng= (CEikCheckBox*) Control( ECtlOptUseAccTiming ); - CEikCheckBox *chkbox_sram = (CEikCheckBox*) Control( ECtlOptUseSRAM ); - CEikCheckBox *chkbox_fps = (CEikCheckBox*) Control( ECtlOptShowFPS ); - CEikCheckBox *chkbox_sound = (CEikCheckBox*) Control( ECtlOptEnableSound ); - CEikCheckBox *chkbox_z80 = (CEikCheckBox*) Control( ECtlOptEmulateZ80 ); - CEikCheckBox *chkbox_ym2612 = (CEikCheckBox*) Control( ECtlOptEmulateYM2612 ); - CEikCheckBox *chkbox_sn76496= (CEikCheckBox*) Control( ECtlOptEmulateSN76496 ); - CEikChoiceListBase *combo_sndq = (CEikChoiceListBase*) Control( ECtlOptSndQuality ); - CEikCheckBox *chkbox_6bpad = (CEikCheckBox*) Control( ECtlOpt6ButtonPad ); - CEikCheckBox *chkbox_gzipst = (CEikCheckBox*) Control( ECtlOptGzipStates ); -// CEikCheckBox *chkbox_accsprt= (CEikCheckBox*) Control( ECtlOptUseAccSprites ); - CEikChoiceListBase *combo_region = (CEikChoiceListBase*) Control( ECtlOptRegion ); - CEikOptionButton *opt_fit2 = (CEikOptionButton*) buttons_disp->ComponentControl( TPicoConfig::PMFit2 ); - CEikCheckBox *chkbox_cdda = (CEikCheckBox*) Control( ECtlOptCDcdda ); - CEikCheckBox *chkbox_pcm = (CEikCheckBox*) Control( ECtlOptCDpcm ); - CEikCheckBox *chkbox_ramcart= (CEikCheckBox*) Control( ECtlOptCDramcart ); - CEikCheckBox *chkbox_sclrot = (CEikCheckBox*) Control( ECtlOptCDscalerot ); - CEikCheckBox *chkbox_bsync = (CEikCheckBox*) Control( ECtlOptCDbettersync ); - - buttons_rot ->SetButtonById(ECtlOptRotation0 + config.rotation); - buttons_disp->SetButtonById(ECtlOptScreenModeCenter + config.scaling); - chkbox_sram ->SetState(config.EmuOpt & 1 ? CEikButtonBase::ESet : CEikButtonBase::EClear); - chkbox_fps ->SetState(config.EmuOpt & 2 ? CEikButtonBase::ESet : CEikButtonBase::EClear); - chkbox_sound ->SetState(config.EmuOpt & 4 ? CEikButtonBase::ESet : CEikButtonBase::EClear); - chkbox_gzipst ->SetState(config.EmuOpt & 8 ? CEikButtonBase::ESet : CEikButtonBase::EClear); - chkbox_z80 ->SetState(config.s_PicoOpt& 4 ? CEikButtonBase::ESet : CEikButtonBase::EClear); - chkbox_ym2612 ->SetState(config.s_PicoOpt& 1 ? CEikButtonBase::ESet : CEikButtonBase::EClear); - chkbox_sn76496->SetState(config.s_PicoOpt& 2 ? CEikButtonBase::ESet : CEikButtonBase::EClear); - chkbox_altrend->SetState(config.s_PicoOpt& 0x10? CEikButtonBase::ESet : CEikButtonBase::EClear); - chkbox_6bpad ->SetState(config.s_PicoOpt& 0x20? CEikButtonBase::ESet : CEikButtonBase::EClear); -// chkbox_acctmng->SetState(config.s_PicoOpt& 0x40? CEikButtonBase::ESet : CEikButtonBase::EClear); -// chkbox_accsprt->SetState(config.s_PicoOpt& 0x80? CEikButtonBase::ESet : CEikButtonBase::EClear); - chkbox_cdda ->SetState(config.s_PicoOpt&0x0800?CEikButtonBase::ESet : CEikButtonBase::EClear); - chkbox_pcm ->SetState(config.s_PicoOpt&0x0400?CEikButtonBase::ESet : CEikButtonBase::EClear); - chkbox_ramcart->SetState(config.s_PicoOpt&0x8000?CEikButtonBase::ESet : CEikButtonBase::EClear); - chkbox_sclrot ->SetState(config.s_PicoOpt&0x1000?CEikButtonBase::ESet : CEikButtonBase::EClear); - chkbox_bsync ->SetState(config.s_PicoOpt&0x2000?CEikButtonBase::ESet : CEikButtonBase::EClear); - - // dim "fit2" if we are not in 0 or 180 mode - if (config.rotation != TPicoConfig::PRot0 && config.rotation != TPicoConfig::PRot180) - opt_fit2->SetDimmed(ETrue); - // dim some stuff for alternative renderer - if (config.s_PicoOpt & 0x10) { - // dim accurate sprites - //chkbox_accsprt->SetState(CEikButtonBase::EClear); - //chkbox_accsprt->SetDimmed(ETrue); - // dim fit - if(buttons_rot->LabeledButtonId() == ECtlOptRotation0 || buttons_rot->LabeledButtonId() == ECtlOptRotation180) - ((CEikOptionButton*)(buttons_disp->ComponentControl(TPicoConfig::PMFit)))->SetDimmed(ETrue); - } - - TInt sel = 0; - switch (config.s_PsndRate) { - case 11025: sel = 1; break; - case 16000: sel = 2; break; - case 22050: sel = 3; break; - case 44100: sel = 4; break; - } - sel += (config.s_PicoOpt&8) ? 5 : 0; - if (sel >= 10) sel = 0; - combo_sndq->SetCurrentItem(sel); - - switch(config.s_PicoRegion) { - case 1: sel = 4; break; - case 2: sel = 3; break; - case 4: sel = 2; break; - case 8: sel = 1; break; - default:sel = 0; // auto - } - combo_region->SetCurrentItem(sel); -} - -TBool CPicoConfigDialog::OkToExitL(TInt aButtonId) -{ - if(aButtonId != EEikBidOk) return ETrue; - - CEikHorOptionButtonList *buttons_rot = (CEikHorOptionButtonList*) Control( ECtlOptRotation ); - CEikHorOptionButtonList *buttons_disp = (CEikHorOptionButtonList*) Control( ECtlOptScreenMode ); - CEikCheckBox *chkbox_altrend= (CEikCheckBox*) Control( ECtlOptUseAltRend ); -// CEikCheckBox *chkbox_acctmng= (CEikCheckBox*) Control( ECtlOptUseAccTiming ); - CEikCheckBox *chkbox_sram = (CEikCheckBox*) Control( ECtlOptUseSRAM ); - CEikCheckBox *chkbox_fps = (CEikCheckBox*) Control( ECtlOptShowFPS ); - CEikCheckBox *chkbox_sound = (CEikCheckBox*) Control( ECtlOptEnableSound ); - CEikCheckBox *chkbox_z80 = (CEikCheckBox*) Control( ECtlOptEmulateZ80 ); - CEikCheckBox *chkbox_ym2612 = (CEikCheckBox*) Control( ECtlOptEmulateYM2612 ); - CEikCheckBox *chkbox_sn76496= (CEikCheckBox*) Control( ECtlOptEmulateSN76496 ); - CEikChoiceListBase *combo_sndq = (CEikChoiceListBase*) Control( ECtlOptSndQuality ); - CEikCheckBox *chkbox_6bpad = (CEikCheckBox*) Control( ECtlOpt6ButtonPad ); - CEikCheckBox *chkbox_gzipst = (CEikCheckBox*) Control( ECtlOptGzipStates ); -// CEikCheckBox *chkbox_accsprt= (CEikCheckBox*) Control( ECtlOptUseAccSprites ); - CEikChoiceListBase *combo_region = (CEikChoiceListBase*) Control( ECtlOptRegion ); - CEikCheckBox *chkbox_cdda = (CEikCheckBox*) Control( ECtlOptCDcdda ); - CEikCheckBox *chkbox_pcm = (CEikCheckBox*) Control( ECtlOptCDpcm ); - CEikCheckBox *chkbox_ramcart= (CEikCheckBox*) Control( ECtlOptCDramcart ); - CEikCheckBox *chkbox_sclrot = (CEikCheckBox*) Control( ECtlOptCDscalerot ); - CEikCheckBox *chkbox_bsync = (CEikCheckBox*) Control( ECtlOptCDbettersync ); - - config.rotation = (TPicoConfig::TPicoScreenRotation) (buttons_rot->LabeledButtonId() - ECtlOptRotation0); - config.scaling = (TPicoConfig::TPicoScreenMode) (buttons_disp->LabeledButtonId() - ECtlOptScreenModeCenter); - - if(chkbox_sram ->State() == CEikButtonBase::ESet) config.EmuOpt |= 1; else config.EmuOpt &= ~1; - if(chkbox_fps ->State() == CEikButtonBase::ESet) config.EmuOpt |= 2; else config.EmuOpt &= ~2; - if(chkbox_sound ->State() == CEikButtonBase::ESet) config.EmuOpt |= 4; else config.EmuOpt &= ~4; - if(chkbox_gzipst ->State() == CEikButtonBase::ESet) config.EmuOpt |= 8; else config.EmuOpt &= ~8; - if(chkbox_z80 ->State() == CEikButtonBase::ESet) config.s_PicoOpt|= 4; else config.s_PicoOpt&= ~4; - if(chkbox_ym2612 ->State() == CEikButtonBase::ESet) config.s_PicoOpt|= 1; else config.s_PicoOpt&= ~1; - if(chkbox_sn76496->State() == CEikButtonBase::ESet) config.s_PicoOpt|= 2; else config.s_PicoOpt&= ~2; - if(chkbox_altrend->State() == CEikButtonBase::ESet) config.s_PicoOpt|= 0x10;else config.s_PicoOpt&= ~0x10; - if(chkbox_6bpad ->State() == CEikButtonBase::ESet) config.s_PicoOpt|= 0x20;else config.s_PicoOpt&= ~0x20; -// if(chkbox_acctmng->State() == CEikButtonBase::ESet) config.s_PicoOpt|= 0x40;else config.s_PicoOpt&= ~0x40; -// if(chkbox_accsprt->State() == CEikButtonBase::ESet) config.s_PicoOpt|= 0x80;else config.s_PicoOpt&= ~0x80; - if(chkbox_cdda ->State() == CEikButtonBase::ESet) config.s_PicoOpt |= 0x0800; else config.s_PicoOpt&= ~0x0800; - if(chkbox_pcm ->State() == CEikButtonBase::ESet) config.s_PicoOpt |= 0x0400; else config.s_PicoOpt&= ~0x0400; - if(chkbox_ramcart->State() == CEikButtonBase::ESet) config.s_PicoOpt |= 0x8000; else config.s_PicoOpt&= ~0x8000; - if(chkbox_sclrot ->State() == CEikButtonBase::ESet) config.s_PicoOpt |= 0x1000; else config.s_PicoOpt&= ~0x1000; - if(chkbox_bsync ->State() == CEikButtonBase::ESet) config.s_PicoOpt |= 0x2000; else config.s_PicoOpt&= ~0x2000; - - TInt sel = combo_sndq->CurrentItem(); - if(sel >= 5) { config.s_PicoOpt |= 8; sel-=5; } else config.s_PicoOpt &= ~8; - switch (sel) { - default:config.s_PsndRate = 8000; break; - case 1: config.s_PsndRate = 11025; break; - case 2: config.s_PsndRate = 16000; break; - case 3: config.s_PsndRate = 22050; break; - case 4: config.s_PsndRate = 44100; break; - } - - switch (combo_region->CurrentItem()) { - case 4: config.s_PicoRegion = 1; break; - case 3: config.s_PicoRegion = 2; break; - case 2: config.s_PicoRegion = 4; break; - case 1: config.s_PicoRegion = 8; break; - default:config.s_PicoRegion = 0; // auto - } - - return ETrue; -} - -// simple GUI stuff needs lots of code -void CPicoConfigDialog::HandleControlStateChangeL(TInt aControlId) -{ - if (aControlId == ECtlOptEnableSound) - { - CEikCheckBox *chkbox_sound = (CEikCheckBox*) Control( ECtlOptEnableSound ); - CEikCheckBox *chkbox_z80 = (CEikCheckBox*) Control( ECtlOptEmulateZ80 ); - CEikCheckBox *chkbox_ym2612 = (CEikCheckBox*) Control( ECtlOptEmulateYM2612 ); - CEikCheckBox *chkbox_sn76496= (CEikCheckBox*) Control( ECtlOptEmulateSN76496 ); - - if(chkbox_sound->State() == CEikButtonBase::ESet) { - // check all sound chips too, but only if they all are not set - if((chkbox_z80->State() | chkbox_ym2612->State() | chkbox_sn76496->State()) == CEikButtonBase::EClear) { // (==0) - chkbox_z80 ->SetState(CEikButtonBase::ESet); - chkbox_ym2612 ->SetState(CEikButtonBase::ESet); - chkbox_sn76496->SetState(CEikButtonBase::ESet); - chkbox_z80 ->DrawDeferred(); - chkbox_ym2612 ->DrawDeferred(); - chkbox_sn76496->DrawDeferred(); - } - } else { - // clear everything, but only if everything is set - if((chkbox_z80->State() & chkbox_ym2612->State() & chkbox_sn76496->State()) == CEikButtonBase::ESet) { // (==1) - chkbox_z80 ->SetState(CEikButtonBase::EClear); - chkbox_ym2612 ->SetState(CEikButtonBase::EClear); - chkbox_sn76496->SetState(CEikButtonBase::EClear); - chkbox_z80 ->DrawDeferred(); - chkbox_ym2612 ->DrawDeferred(); - chkbox_sn76496->DrawDeferred(); - } - } - } - else if(aControlId == ECtlOptUseAltRend || aControlId == ECtlOptRotation) - { - CEikCheckBox *chkbox_altrend= (CEikCheckBox*) Control( ECtlOptUseAltRend ); -// CEikCheckBox *chkbox_accsprt= (CEikCheckBox*) Control( ECtlOptUseAccSprites ); - CEikHorOptionButtonList *buttons_rot = (CEikHorOptionButtonList*) Control( ECtlOptRotation ); - CEikHorOptionButtonList *buttons_disp = (CEikHorOptionButtonList*) Control( ECtlOptScreenMode ); - CEikOptionButton *opt_fit = (CEikOptionButton*) buttons_disp->ComponentControl( TPicoConfig::PMFit ); - CEikOptionButton *opt_fit2 = (CEikOptionButton*) buttons_disp->ComponentControl( TPicoConfig::PMFit2 ); - - TBool dimmed = chkbox_altrend->State() == CEikButtonBase::ESet; - // show/hide more stuff for alternative renderer -// chkbox_accsprt->SetDimmed(dimmed); - if(buttons_rot->LabeledButtonId() == ECtlOptRotation0 || buttons_rot->LabeledButtonId() == ECtlOptRotation180) { - opt_fit->SetDimmed(dimmed); - if(dimmed && buttons_disp->LabeledButtonId() == ECtlOptScreenModeFit) - buttons_disp->SetButtonById(ECtlOptScreenModeFit2); - } - else opt_fit->SetDimmed(EFalse); -// chkbox_accsprt->DrawDeferred(); - buttons_disp->DrawDeferred(); - - if(buttons_rot->LabeledButtonId() == ECtlOptRotation0 || buttons_rot->LabeledButtonId() == ECtlOptRotation180) { - opt_fit2->SetDimmed(EFalse); - } else { - if(opt_fit2->State() == CEikButtonBase::ESet) { - buttons_disp->SetButtonById(ECtlOptScreenModeFit); - buttons_disp->DrawDeferred(); - } - opt_fit2->SetDimmed(ETrue); - } - opt_fit2->DrawDeferred(); - } -} - - -/************************************************ - * - * About Dialog - * - ************************************************/ - -void CAboutDialog::PostLayoutDynInitL() -{ - TBuf<16> versionText; - TBuf<512> text; - - #if (KPicoBuildNumber != 0) - versionText.Format(_L("%d.%d%d"), KPicoMajorVersionNumber, KPicoMinorVersionNumber, KPicoBuildNumber); - #else - versionText.Format(_L("%d.%d"), KPicoMajorVersionNumber, KPicoMinorVersionNumber); - #endif - - CEikRichTextEditor* richTextEd = LocateControlByUniqueHandle(ECtlPicoAboutText); - User::LeaveIfNull(richTextEd); - - HBufC *aboutFormat = CEikonEnv::Static()->AllocReadResourceLC(R_PICO_TEXT_ABOUT); - CSimpleTextFormatParser *parser = CSimpleTextFormatParser::NewLC(); - - text.Format(*aboutFormat, &versionText); - parser->ParseL(text, *richTextEd->RichText()); - - richTextEd->UpdateAllFieldsL(); // Updates all the fields in the document - - CleanupStack::PopAndDestroy(parser); - CleanupStack::PopAndDestroy(aboutFormat); -} - -/************************************************************* -* -* Credits dialog -* -**************************************************************/ - -void CCreditsDialog::PreLayoutDynInitL() -{ - CEikEdwin *edwin = LocateControlByUniqueHandle(ECtlPicoCreditsText); - User::LeaveIfNull(edwin); - - CDesCArrayFlat* desArray = CEikonEnv::Static()->ReadDesCArrayResourceL(R_PICO_TBUF_CREDITS); - CleanupStack::PushL(desArray); - - edwin->SetTextLimit(2048); // to prevent stupid "too big" warning - TInt count = desArray->Count(); - for (TInt i = 0; i < count; i++) - { - edwin->Text()->InsertL(edwin->TextLength(), desArray->operator[](i)); - edwin->Text()->InsertL(edwin->TextLength(), CEditableText::ELineBreak); - } - CleanupStack::PopAndDestroy(desArray); -} - -TKeyResponse CCreditsDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) -{ - if (aType == EEventKey) - { - CEikEdwin *edwin = LocateControlByUniqueHandle(ECtlPicoCreditsText); - User::LeaveIfNull(edwin); - - if (aKeyEvent.iCode == EQuartzKeyTwoWayDown) - { - edwin->MoveDisplayL(TCursorPosition::EFLineDown); - edwin->UpdateScrollBarsL(); - return EKeyWasConsumed; - } - else if (aKeyEvent.iCode == EQuartzKeyTwoWayUp) - { - edwin->MoveDisplayL(TCursorPosition::EFLineUp); - edwin->UpdateScrollBarsL(); - return EKeyWasConsumed; - } - } - return CQikSimpleDialog::OfferKeyEventL(aKeyEvent, aType); -} - -/************************************************************* -* -* Debug dialog -* -**************************************************************/ - -CDebugDialog::CDebugDialog(char *t) -{ - Mem::Copy(iText, t, 1024); - iText[1023] = 0; -} - -void CDebugDialog::PreLayoutDynInitL() -{ - char *p = iText, *line = iText; - TBool end=0; - TBuf<128> tbuf; - CEikEdwin *editor = LocateControlByUniqueHandle(ECtlPicoCreditsText); - - while(!end) { - while(*p && *p != '\r' && *p != '\n') p++; - if(!*p) end=1; - *p = 0; - TPtrC8 ptr((TUint8*) line); - tbuf.Copy(ptr); - editor->Text()->InsertL(editor->TextLength(), tbuf); - editor->Text()->InsertL(editor->TextLength(), CEditableText::ELineBreak); - line = ++p; - } -} diff --git a/platform/uiq3/Dialogs.h b/platform/uiq3/Dialogs.h deleted file mode 100644 index cd865ec9..00000000 --- a/platform/uiq3/Dialogs.h +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************* - * - * File: Dialogs.h - * - * Author: Peter van Sebille (peter@yipton.net) - * - * Modified/adapted for picodriveN by notaz, 2006 - * - * (c) Copyright 2006, notaz - * (c) Copyright 2002, Peter van Sebille - * All Rights Reserved - * - *******************************************************************/ - -#ifndef __DIALOGS_H -#define __DIALOGS_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - - -/************************************************ - * - * config Dialog - * - ************************************************/ - -extern "C" struct _currentConfig_t; - -class CPicoConfigDialog : public CEikDialog -{ -public: - CPicoConfigDialog(_currentConfig_t &cfg); - -protected: // framework - void PostLayoutDynInitL(); - void HandleControlStateChangeL(TInt aControlId); - TBool OkToExitL(TInt aButtonId); - - _currentConfig_t &config; -}; - - -/************************************************ - * - * About Dialog - * - ************************************************/ - -class CAboutDialog : public CQikSimpleDialog -{ -protected: // from CQikSimpleDialog - void PostLayoutDynInitL(); -}; - -/************************************************************* -* -* Credits dialog -* -**************************************************************/ - -class CCreditsDialog : public CQikSimpleDialog -{ -protected: // from CQikSimpleDialog - void PreLayoutDynInitL(); - TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); -}; - -/************************************************************* -* -* Debug dialog -* -**************************************************************/ - -class CDebugDialog : public CCreditsDialog -{ -public: - CDebugDialog(char *t); - -protected: - char iText[1024]; - void PreLayoutDynInitL(); -}; - -#endif // __DIALOGS_H diff --git a/platform/uiq3/Engine.cpp b/platform/uiq3/Engine.cpp deleted file mode 100644 index adb32b45..00000000 --- a/platform/uiq3/Engine.cpp +++ /dev/null @@ -1,352 +0,0 @@ -/******************************************************************* - * - * File: Engine.cpp - * - * Author: Peter van Sebille (peter@yipton.net) - * - * Modified/adapted for picodriveN by notaz, 2006 - * - * (c) Copyright 2006, notaz - * (c) Copyright 2002, Peter van Sebille - * All Rights Reserved - * - *******************************************************************/ - - -#include "Engine.h" -#include -#include -#include -#include -#include - -#include - -#include "version.h" -#include -#include "../common/emu.h" -#include "engine/debug.h" -#include "App.h" - -// this is where we start to break a bunch of symbian rules -extern TInt machineUid; -extern int gamestate, gamestate_next; -extern char *loadrom_fname; -extern int loadrom_result; -extern const char *actionNames[]; -RSemaphore initSemaphore; -RSemaphore pauseSemaphore; -RSemaphore loadWaitSemaphore; -static CPicolAppView *appView = 0; - - -TInt CPicoGameSession::Do(const TPicoServRqst what, TAny *param) -{ - switch (what) - { - case PicoMsgLoadState: - if(!rom_loaded) return -1; // no ROM - return emu_save_load_game(1, 0); - - case PicoMsgSaveState: - if(!rom_loaded) return -1; - return emu_save_load_game(0, 0); - - case PicoMsgLoadROM: - return loadROM((TPtrC16 *)param); - - case PicoMsgResume: - DEBUGPRINT(_L("resume")); - if(rom_loaded) { - return ChangeRunState(PGS_Running); - } - return 1; - - case PicoMsgReset: - if(rom_loaded) { - return ChangeRunState(PGS_Reset); - } - return 1; - - case PicoMsgKeys: - return ChangeRunState(PGS_KeyConfig); - - case PicoMsgPause: - return ChangeRunState(PGS_Paused); - - case PicoMsgQuit: - DEBUGPRINT(_L("got quit msg.")); - return ChangeRunState(PGS_Quit); - - // config change - case PicoMsgConfigChange: - return changeConfig((TPicoConfig *)param); - - case PicoMsgSetAppView: - appView = (CPicolAppView *)param; - return 1; - - default: - return 1; - } -} - -TInt EmuThreadFunction(TAny* anArg); - -TInt CPicoGameSession::StartEmuThread() -{ - TInt res=KErrNone; - iEmuRunning = EFalse; - - if (initSemaphore.Handle() > 0) - initSemaphore.Close(); - initSemaphore.CreateLocal(0); - if (pauseSemaphore.Handle() <= 0) - pauseSemaphore.CreateLocal(0); - if (loadWaitSemaphore.Handle() <= 0) - loadWaitSemaphore.CreateLocal(0); - - RThread thread; - if(iThreadWatcher && (res = thread.Open(iThreadWatcher->iTid)) == KErrNone) { - // should be a dead thread in some strange state. - DEBUGPRINT(_L("found thread with the same id (id=%i, RequestCount=%i), killing.."), - (TInt32)thread.Id(), thread.RequestCount()); - // what can we do in this situation? Nothing seems to help, it just stays in this state. - delete iThreadWatcher; - iThreadWatcher = 0; - thread.Kill(1); - thread.Terminate(1); - thread.Close(); - } - - res=thread.Create(_L("PicoEmuThread"), // create new server thread - EmuThreadFunction, // thread's main function - KDefaultStackSize, - KMinHeapSize, - KPicoMaxHeapSize, - 0 // &semaphore // passed as TAny* argument to thread function - ); - - if(res == KErrNone) { // thread created ok - now start it going - thread.SetPriority(EPriorityMore); - iEmuRunning = ETrue; - if (iThreadWatcher) delete iThreadWatcher; - iThreadWatcher = CThreadWatcher::NewL(thread.Id()); - thread.Resume(); // start it going - DEBUGPRINT(_L("initSemaphore.Wait()")); - res = initSemaphore.Wait(3*1000*1000); // wait until it's initialized - DEBUGPRINT(_L("initSemaphore resume, ExitReason() == %i"), thread.ExitReason()); - res |= thread.ExitReason(); - thread.Close(); // we're no longer interested in the other thread - if(res != KErrNone) iEmuRunning = EFalse; - return res; - } - - return res; -} - -TInt CPicoGameSession::ChangeRunState(TPicoGameState newstate, TPicoGameState newstate_next) -{ - if (!iEmuRunning) { - gamestate = PGS_Paused; - TInt res = StartEmuThread(); - if(res != KErrNone) DEBUGPRINT(_L("StartEmuThread() returned %i"), res); - if (!iEmuRunning) return PicoErrEmuThread; - } - - int oldstate = gamestate; - gamestate = newstate; - gamestate_next = newstate_next ? newstate_next : PGS_Paused; - if (oldstate == PGS_Paused) pauseSemaphore.Signal(); - return 0; -} - - -TInt CPicoGameSession::loadROM(TPtrC16 *pptr) -{ - TInt ret; - char buff[150]; - - // make sure emu thread is ok - ret = ChangeRunState(PGS_Paused); - if(ret) return ret; - - // read the contents of the client pointer into a TPtr. - static TBuf8 writeBuf; - writeBuf.Copy(*pptr); - - // push the emu thead to a load state. This is done so that it owns all file handles. - // If successful, in will enter PGS_Running state by itself. - loadrom_fname = (char *)writeBuf.PtrZ(); - loadrom_result = 0; - loadWaitSemaphore.Wait(1); // make sure sem is not set - ret = ChangeRunState(PGS_ReloadRom); - if(ret) return ret; - - loadWaitSemaphore.Wait(60*1000*1000); - - if (loadrom_result == 0) - return PicoErrRomOpenFailed; - - emu_get_game_name(buff); - TPtrC8 buff8((TUint8*) buff); - iRomInternalName.Copy(buff8); - - DEBUGPRINT(_L("done waiting for ROM load")); - - // debug - #ifdef __DEBUG_PRINT - TInt mem, cells = User::CountAllocCells(); - User::AllocSize(mem); - DEBUGPRINT(_L("comm: cels=%d, size=%d KB"), cells, mem/1024); - #endif - - return 0; -} - - -TInt CPicoGameSession::changeConfig(TPicoConfig *aConfig) -{ - // 6 button pad, enable XYZM config if needed - if (PicoOpt & POPT_6BTN_PAD) - { - actionNames[8] = "Z"; - actionNames[9] = "Y"; - actionNames[10] = "X"; - actionNames[11] = "MODE"; - } else { - actionNames[8] = actionNames[9] = actionNames[10] = actionNames[11] = 0; - } - - // if we are in center 90||270 modes, we can bind renderer switcher - if (currentConfig.scaling == TPicoConfig::PMFit && - (currentConfig.rotation == TPicoConfig::PRot0 || currentConfig.rotation == TPicoConfig::PRot180)) - actionNames[25] = 0; - else actionNames[25] = "RENDERER"; - - return 0; -} - - -#ifdef __DEBUG_PRINT_FILE -extern RMutex logMutex; -#endif - -void CPicoGameSession::freeResources() -{ - RThread thread; - TInt i; - - DEBUGPRINT(_L("CPicoGameSession::freeResources()")); - - if(iThreadWatcher && thread.Open(iThreadWatcher->iTid) == KErrNone) - { - // try to stop our emu thread - gamestate = PGS_Quit; - if(pauseSemaphore.Handle() > 0) - pauseSemaphore.Signal(); - - if(thread.Handle() > 0) - { - // tried reopening thread handle here over time intervals to detect if thread is alive, - // but would run into handle panics. - - for(i = 0; i < 8; i++) { - User::After(100 * 1000); - if(thread.ExitReason() != 0) break; - } - - if(thread.ExitReason() == 0) { - // too late, time to die - DEBUGPRINT(_L("thread %i not responding, killing.."), (TInt32) thread.Id()); - thread.Terminate(1); - } - thread.Close(); - } - - } - - if (iThreadWatcher != NULL) - { - DEBUGPRINT(_L("delete iThreadWatcher")); - delete iThreadWatcher; - DEBUGPRINT(_L("after delete iThreadWatcher")); - iThreadWatcher = NULL; - } - - if (initSemaphore.Handle() > 0) - initSemaphore.Close(); - if (pauseSemaphore.Handle() > 0) - pauseSemaphore.Close(); - if (loadWaitSemaphore.Handle() > 0) - loadWaitSemaphore.Close(); - DEBUGPRINT(_L("freeResources() returning")); -#ifdef __DEBUG_PRINT_FILE - if (logMutex.Handle() > 0) - logMutex.Close(); -#endif -} - -TBool CPicoGameSession::iEmuRunning = EFalse; -CThreadWatcher *CPicoGameSession::iThreadWatcher = 0; -TBuf<150> CPicoGameSession::iRomInternalName; - - -// CThreadWatcher -CThreadWatcher::~CThreadWatcher() -{ - Cancel(); - DEBUGPRINT(_L("after CThreadWatcher::Cancel();")); -} - -CThreadWatcher::CThreadWatcher(const TThreadId& aTid) -: CActive(CActive::EPriorityStandard), iTid(aTid) -{ -} - - -CThreadWatcher* CThreadWatcher::NewL(const TThreadId& aTid) -{ - CThreadWatcher* self = new(ELeave) CThreadWatcher(aTid); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); // self - return self; -} - -void CThreadWatcher::ConstructL() -{ - CActiveScheduler::Add(this); - RThread thread; - if(thread.Open(iTid) == KErrNone) { - thread.Logon(iStatus); - thread.Close(); - SetActive(); - } -} - -void CThreadWatcher::RunL() -{ - DEBUGPRINT(_L("CThreadWatcher::RunL()")); - CPicoGameSession::iEmuRunning = EFalse; - if(appView) appView->UpdateCommandList(); - //initSemaphore.Signal(); // no point to do that here, AS can't get here if it is waiting -} - -void CThreadWatcher::DoCancel() -{ - RThread thread; - DEBUGPRINT(_L("CThreadWatcher::DoCancel()")); - if(thread.Open(iTid) == KErrNone) { - DEBUGPRINT(_L("thread.LogonCancel(iStatus);")); - thread.LogonCancel(iStatus); - thread.Close(); - } -} - -extern "C" void cache_flush_d_inval_i(const void *start_addr, const void *end_addr) -{ - // TODO - User::IMB_Range((TAny *)start_addr, (TAny *)end_addr); -} - diff --git a/platform/uiq3/Engine.h b/platform/uiq3/Engine.h deleted file mode 100644 index e0a3afe7..00000000 --- a/platform/uiq3/Engine.h +++ /dev/null @@ -1,143 +0,0 @@ -/******************************************************************* - * - * File: Engine.h - * - * Author: Peter van Sebille (peter@yipton.net) - * - * Modified/adapted for picodriveN by notaz, 2006 - * - * (c) Copyright 2006, notaz - * (c) Copyright 2002, Peter van Sebille - * All Rights Reserved - * - *******************************************************************/ - -#ifndef __ENGINE_H -#define __ENGINE_H - -#include - -class RReadStream; -class RWriteStream; - - -// engine states -enum TPicoGameState { - PGS_Running = 1, - PGS_Paused, - PGS_Quit, - PGS_KeyConfig, - PGS_ReloadRom, - PGS_Reset, -}; - -enum TPicoServRqst { - PicoMsgLoadState, - PicoMsgSaveState, - PicoMsgLoadROM, - PicoMsgResume, - PicoMsgReset, - PicoMsgKeys, - PicoMsgPause, - PicoMsgQuit, - PicoMsgConfigChange, - PicoMsgSetAppView, - kDefaultMessageSlots // this is how many messages we need :) -}; - -enum TPicoGenErrors { // generic errors - PicoErrNoErr = 0, // OK - PicoErrRomOpenFailed, - PicoErrOutOfMem, - PicoErrOutOfMemSnd, - PicoErrGenSnd, // generic sound system error - PicoErrEmuThread -}; - - -// needed for creating server thread. -const TUint KPicoMaxHeapSize=0x00800000; - -// key config entry (touchpad areas) -struct TPicoAreaConfigEntry { - TRect rect; - //unsigned long actions; -}; - -struct TPicoKeyConfigEntry -{ - unsigned short keyCode; - unsigned char scanCode; - unsigned char flags; // lsb->msb: key_down, pulse_only, ?, ?, ?, ?, not_configurable, disabled - TInt32 handle1; // for CancelCaptureKeyUpAndDowns() - TInt32 handle2; // for CancelCaptureKey() - char *name; -}; - - -// configuration data -class TPicoConfig -{ -public: -// void SetDefaults(); -// void InternalizeL(RReadStream &aStream); -// void ExternalizeL(RWriteStream &aStream) const; - - enum TPicoScreenRotation { - PRot0, - PRot90, - PRot180, - PRot270 - }; - enum TPicoScreenMode { - PMCenter, - PMFit, - PMFit2 - }; - enum TPicoFrameSkip { - PFSkipAuto = -1, - PFSkip0 - }; - -public: - TFileName iLastROMFile; // used as tmp only -}; - - -class CThreadWatcher : public CActive -{ -public: - static CThreadWatcher* NewL(const TThreadId& aTid); - ~CThreadWatcher(); - - TThreadId iTid; // thread id - -protected: - CThreadWatcher(const TThreadId& aTid); - void ConstructL(); - - virtual void RunL(); - virtual void DoCancel(); -}; - - -class CPicoGameSession -{ -public: - static TInt Do(const TPicoServRqst what, TAny *param=0); - static void freeResources(); - - static TBool iEmuRunning; - static TBuf<150> iRomInternalName; - -private: - // services available - static TInt StartEmuThread(); - static TInt ChangeRunState(TPicoGameState newstate, TPicoGameState newstate_next=(TPicoGameState)0); - static TInt loadROM(TPtrC16 *pptr); - static TInt changeConfig(TPicoConfig *aConfig); - - static CThreadWatcher *iThreadWatcher; -}; - -#endif diff --git a/platform/uiq3/Makefile b/platform/uiq3/Makefile deleted file mode 100644 index 0f89a494..00000000 --- a/platform/uiq3/Makefile +++ /dev/null @@ -1,133 +0,0 @@ -# makefile for uiq3_patcher_0_2.tar.gz setup, modified -export CROSS = arm-none-symbianelf- -APPNAME = PicoDrive -VER_MAJ = 1 -VER_MIN = 51 -VENDOR = notaz -UID3 = A00010F3 -EPOCROOT = /opt/uiq3/ -EPOCLIBS = qikdlg.lib etext.lib bafl.lib efsrv.lib eikctl.lib ws32.lib \ - eikdlg.lib gdi.lib estor.lib hal.lib mediaclient.lib mediaclientaudiostream.lib -STACK = 0x3000 -HEAP = 0x10,0x1000000 - - -# settings -asm_memory = 1 -asm_render = 1 -asm_ym2612 = 1 -asm_misc = 1 -asm_cdpico = 1 -asm_cdmemory = 1 -asm_blit = 1 -use_cyclone = 1 -#use_musashi = 1 - - -# objects - -# launcher -OBJS += App.o Engine.o Dialogs.o CSimpleTextParser.o emu.o -# engine -OBJS += engine/main.o engine/vid.o engine/polledas.o engine/audio_mediaserver.o engine/debug.o -ifeq "$(asm_blit)" "1" -OBJS += engine/blit_asm.o -else -OBJS += engine/blit.o -endif -# common -OBJS += ../common/emu.o ../common/config.o ../common/menu.o ../common/mp3_helix.o -# Pico -OBJS += pico/area.o pico/cart.o pico/memory.o pico/misc.o pico/pico.o pico/sek.o \ - pico/videoport.o pico/draw2.o pico/draw.o pico/patch.o pico/debug.o -# Pico - CD -OBJS += pico/cd/pico.o pico/cd/memory.o pico/cd/sek.o pico/cd/LC89510.o \ - pico/cd/cd_sys.o pico/cd/cd_file.o pico/cd/cue.o pico/cd/gfx_cd.o \ - pico/cd/area.o pico/cd/misc.o pico/cd/pcm.o pico/cd/buffering.o -# Pico - Pico -OBJS += pico/pico/pico.o pico/pico/memory.o pico/pico/xpcm.o -# Pico - carthw -OBJS += pico/carthw/carthw.o pico/carthw/svp/svp.o pico/carthw/svp/memory.o \ - pico/carthw/svp/ssp16.o pico/carthw/svp/compiler.o pico/carthw/svp/stub_arm.o - -# Pico - sound -OBJS += pico/sound/sound.o -OBJS += pico/sound/mix_arm.o -OBJS += pico/sound/sn76496.o pico/sound/ym2612.o -# zlib -OBJS += zlib/gzio.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o zlib/trees.o \ - zlib/deflate.o zlib/crc32.o zlib/adler32.o zlib/zutil.o zlib/compress.o -# unzip -OBJS += unzip/unzip.o unzip/unzip_stream.o -# CPU cores -ifeq "$(use_musashi)" "1" -CFLAGS += -DEMU_M68K -OBJS += cpu/musashi/m68kops.o cpu/musashi/m68kcpu.o -endif -ifeq "$(use_cyclone)" "1" -CFLAGS += -DEMU_C68K -OBJS += cpu/Cyclone/proj/Cyclone.o cpu/Cyclone/tools/idle.o -endif -# drz80 -CFLAGS += -D_USE_DRZ80 -OBJS += cpu/DrZ80/drz80.o -# helix -OBJS += ../common/helix/$(CROSS)helix-mp3.a - - -vpath %.c = ../.. -vpath %.s = ../.. -vpath %.S = ../.. -DIRS = platform platform/common pico pico/cd pico/pico pico/sound pico/carthw/svp \ - zlib unzip cpu cpu/musashi cpu/Cyclone/proj cpu/Cyclone/tools cpu/mz80 cpu/DrZ80 - -ICONS := $(shell echo rsc/*.bmp) -APPICON = $(NAME).mbm -RSCDIR = rsc -REGDIR = rsc -CFLAGS += -I./ -I../../ -CFLAGS += -DUIQ3 -DARM -DNO_SYNC -CFLAGS += -D__DEBUG_PRINT -CFLAGS += -mcpu=arm926ej-s -mtune=arm926ej-s -O3 -ftracer \ - -fstrength-reduce -fomit-frame-pointer -fstrict-aliasing -ffast-math -SFLAGS = -march=armv5t -msoft-float -nostdinc -ASFLAGS = -mcpu=arm926ej-s -mfloat-abi=soft -export CFLAGS -SRCRES := $(shell echo rsc/*.rss) -EPOCRCFLAGS += -I./ - -all: mkdirs sis - -include ../common/common_arm.mak -include uiq3.mak - - -$(NAME).mbg $(NAME).mbm : $(ICONS) - @echo "Creating multibitmap file..." - $(BMCONV) /h$(NAME).mbg $(NAME).mbm \ - /c24rsc/pico18x18.bmp /8rsc/pico18x18m.bmp \ - /c24rsc/pico40x40.bmp /8rsc/pico40x40m.bmp \ - /c24rsc/pico64x64.bmp /8rsc/pico64x64m.bmp - - -engine/blit_asm.o : engine/blit.s - @echo ">>>" $@ - $(AS) $(ASFLAGS) $< -o $@ - - -readme.txt: ../../tools/textfilter ../base_readme.txt - ../../tools/textfilter ../base_readme.txt $@ UIQ - -# ----------- release ----------- -ifneq ($(findstring rel,$(MAKECMDGOALS)),) -ifeq ($(VER),) -$(error need VER) -endif -endif - -rel: picodrive.sis readme.txt - zip -9 -j ../../PicoDrive_uiq3_$(VER).zip $^ - mkdir bin_to_cso_mp3 - cp ../../tools/bin_to_cso_mp3/* bin_to_cso_mp3/ - zip -9 -r ../../PicoDrive_uiq3_$(VER).zip bin_to_cso_mp3 - rm -rf bin_to_cso_mp3 diff --git a/platform/uiq3/Makefile.old b/platform/uiq3/Makefile.old deleted file mode 100644 index fa14569a..00000000 --- a/platform/uiq3/Makefile.old +++ /dev/null @@ -1,307 +0,0 @@ -# makefile for GCCE - -# settings -#dprint = 1 -asm_memory = 1 -asm_render = 1 -asm_blit = 1 -#use_musashi = 1 -#up = 1 -#sis = 1 - -# targets -all: $(EPOCROOT2)epoc32 MAKEDIRS RESOURCES PicoDrive.exe - -clean : - @perl -S ermdir.pl _build - @erase 2>>nul rsc\*.rsc - @erase 2>>nul rsc\*.rsg - @erase 2>>nul rsc\PicoDrive.mb? - - -# paths -$(EPOCROOT2)epoc32 : - @echo Please set EPOCROOT2 environmental variable to full path to your SDK - @echo with ending slash (something like C:\Uiq_21\) - @cd : 2> NUL # do something stupid to make it silently fail - -# resource compiler hates drive lettered paths -EPOCROOT2_NODRV = $(filter \\%,$(subst :, ,$(EPOCROOT2))) -EPOCLIB = $(EPOCROOT2)EPOC32\RELEASE\ARMV5 - -# C/C++ Compiler -CC=arm-none-symbianelf-gcc - -# Linker -LD=arm-none-symbianelf-ld - -# Assembler -ASM=arm-none-symbianelf-as - -# Archiver -AR=arm-none-symbianelf-ar - -# Strip -STRIP=arm-none-symbianelf-strip - -# gcc config -GCCDEFINES = -DNDEBUG -D_UNICODE -D__GCCE__ -D__SYMBIAN32__ -D__EPOC32__ -D__MARM__ \ - -D__EABI__ -D__MARM_ARMV5__ -D__EXE__ -D__SUPPORT_CPP_EXCEPTIONS__ \ - -D__MARM_ARMV5__ -D__PRODUCT_INCLUDE__=\"$(EPOCROOT2)epoc32/include/variant/UIQ_3.0.hrh\" - -GCCDEFINES += -D_UNZIP_SUPPORT -D__BROKEN_FWRITE - -# 'CSL Arm Toolchain' stuff must be specified after Symbian includes -GCCINCLUDES = -I "$(EPOCROOT2)epoc32\include\variant" -I "$(EPOCROOT2)EPOC32\INCLUDE" -I "$(EPOCROOT2)EPOC32\INCLUDE\LIBC" \ - -I "$(EPOCROOT2)\CSL Arm Toolchain\lib\gcc\arm-none-symbianelf\3.4.3\include" -I. - -# -funit-at-a-time is not compatible with SDK, it either has linker problems or does not start on device -GCCCOMMFLAGS = -Wall -Wno-unknown-pragmas -fexceptions -march=armv5t -mapcs -pipe -nostdinc -msoft-float \ - $(GCCINCLUDES) -include "$(EPOCROOT2)EPOC32/INCLUDE/GCCE/GCCE.h" -marm - -GCCCPPFLAGS = -x c++ -Wno-ctor-dtor-privacy -O3 -fno-unit-at-a-time -GCCCFLAGS = -x c -O3 -fno-unit-at-a-time - -GCCLDFLAGS = -L"$(EPOCROOT2)CSL Arm Toolchain\arm-none-symbianelf\lib" \ - -L"$(EPOCROOT2)CSL Arm Toolchain\lib\gcc\arm-none-symbianelf\3.4.3" \ - --target1-abs --no-undefined -nostdlib -shared -Ttext 0x8000 -Tdata 0x400000 --default-symver - -# libs -LIBS = \ - $(EPOCLIB)\LIB\ESTLIB.dso \ - $(EPOCLIB)\urel\qikalloc.lib \ - $(EPOCLIB)\LIB\euser.dso \ - $(EPOCLIB)\LIB\apparc.dso \ - $(EPOCLIB)\LIB\cone.dso \ - $(EPOCLIB)\LIB\eikcore.dso \ - $(EPOCLIB)\LIB\eikcoctl.dso \ - $(EPOCLIB)\LIB\qikcore.dso \ - $(EPOCLIB)\LIB\qikdlg.dso \ - $(EPOCLIB)\LIB\etext.dso \ - $(EPOCLIB)\LIB\bafl.dso \ - $(EPOCLIB)\LIB\efsrv.dso \ - $(EPOCLIB)\LIB\eikctl.dso \ - $(EPOCLIB)\LIB\WS32.dso \ - $(EPOCLIB)\LIB\EIKDLG.dso \ - $(EPOCLIB)\LIB\GDI.dso \ - $(EPOCLIB)\LIB\estor.dso \ - $(EPOCLIB)\LIB\EZLIB.dso \ - $(EPOCLIB)\LIB\HAL.dso \ - $(EPOCLIB)\LIB\mediaclient.dso \ - $(EPOCLIB)\LIB\mediaclientaudiostream.dso - -LIBS += \ - $(EPOCLIB)\LIB\qikallocdll.dso \ - $(EPOCLIB)\UREL\usrt2_2.lib \ - $(EPOCLIB)\LIB\dfpaeabi.dso \ - $(EPOCLIB)\LIB\dfprvct2_2.dso \ - $(EPOCLIB)\LIB\drtaeabi.dso \ - $(EPOCLIB)\LIB\scppnwdl.dso \ - $(EPOCLIB)\LIB\drtrvct2_2.dso - - -# objects - -# launcher -OBJECTS += _build\App.o _build\Engine.o _build\Dialogs.o _build\CSimpleTextParser.o -# engine -OBJECTS += _build\main.o _build\vid.o _build\polledas.o _build\audio_mediaserver.o _build\debug.o - -# Pico -OBJECTS += _build\Area.o _build\Cart.o _build\Utils.o _build\Memory.o _build\Misc.o \ - _build\Pico.o _build\Sek.o _build\VideoPort.o _build\Draw2.o _build\Draw.o -# asm stuff -ifeq "$(asm_render)" "1" -GCCDEFINES += -D_ASM_DRAW_C -OBJECTS += _build\draw_asm.o _build\draw2_asm.o -endif -ifeq "$(asm_memory)" "1" -GCCDEFINES += -D_ASM_MEMORY_C -OBJECTS += _build\memory_asm.o -endif -# Pico - sound -OBJECTS += _build\sound.o _build\sn76496.o _build\ym2612.o -# misc -OBJECTS += _build\unzip.o _build\gzio_symb.o -# CPU cores -ifeq "$(use_musashi)" "1" -GCCDEFINES += -DEMU_M68K -OBJECTS += _build\m68kcpu.o _build\m68kopac.o _build\m68kopdm.o _build\m68kopnz.o _build\m68kops.o -else -GCCDEFINES += -DEMU_C68K -OBJECTS += _build\Cyclone.o -endif -ifeq "$(asm_blit)" "1" -OBJECTS += _build\blit_asm.o -else -OBJECTS += _build\blit.o -endif -GCCDEFINES += -D_USE_DRZ80 -OBJECTS += _build\DrZ80.o -GCCDEFINES += -D_ASM_YM2612_C -OBJECTS += _build\ym2612_asm.o - - - -# dprint -ifeq "$(dprint)" "1" -GCCDEFINES += -D__DEBUG_PRINT -endif - - -define crule - @echo * $< - @$(CC) -c $(GCCCOMMFLAGS) $(GCCDEFINES) $(GCCCFLAGS) $< -o $@ -endef - -define cpprule - @echo * $< - @$(CC) -c $(GCCCOMMFLAGS) $(GCCDEFINES) $(GCCCPPFLAGS) $< -o $@ -endef - -define asmrule - @echo * $< - @$(ASM) -marmv4t -mthumb-interwork -o $@ $^ -endef - -# object making rules -_build\App.o : App.cpp - $(cpprule) -_build\Engine.o : Engine.cpp - $(cpprule) -_build\Dialogs.o : Dialogs.cpp - $(cpprule) -_build\CSimpleTextParser.o : CSimpleTextParser.cpp - $(cpprule) - -_build\main.o : engine\main.cpp - $(cpprule) -_build\vid.o : engine\vid.cpp - $(cpprule) -_build\polledas.o: engine\polledas.cpp - $(cpprule) -_build\audio_mediaserver.o : engine\audio_mediaserver.cpp - $(cpprule) -_build\debug.o : engine\debug.cpp - $(cpprule) -_build\blit.o : engine\blit.c - $(crule) - -_build\Area.o : ..\..\Pico\Area.c - $(crule) -_build\Cart.o : ..\..\Pico\Cart.c - $(crule) -_build\Draw.o : ..\..\Pico\Draw.c - $(crule) -_build\Draw2.o : ..\..\Pico\Draw2.c - $(crule) -_build\Memory.o : ..\..\Pico\Memory.c - $(crule) -_build\Misc.o : ..\..\Pico\Misc.c - $(crule) -_build\Pico.o : ..\..\Pico\Pico.c - $(crule) -_build\Sek.o : ..\..\Pico\Sek.c - $(crule) -_build\Utils.o : ..\..\Pico\Utils.c - $(crule) -_build\VideoPort.o : ..\..\Pico\VideoPort.c - $(crule) -_build\sound.o : ..\..\Pico\sound\sound.c - $(crule) -_build\sn76496.o : ..\..\Pico\sound\sn76496.c - $(crule) -_build\ym2612.o : ..\..\Pico\sound\ym2612.c - $(crule) - -_build\unzip.o : ..\..\unzip\unzip.c - $(crule) -_build\gzio_symb.o : ..\..\zlib\gzio_symb.c - $(crule) - -_build\m68kcpu.o : ..\..\musashi\m68kcpu.c - $(crule) -_build\m68kopac.o : ..\..\musashi\m68kopac.c - $(crule) -_build\m68kopdm.o : ..\..\musashi\m68kopdm.c - $(crule) -_build\m68kopnz.o : ..\..\musashi\m68kopnz.c - $(crule) -_build\m68kops.o : ..\..\musashi\m68kops.c - $(crule) - -_build\Cyclone.o : ..\..\cpu\Cyclone\proj\Cyclone.s - $(asmrule) -_build\DrZ80.o : ..\..\cpu\DrZ80\drz80.s - $(asmrule) -_build\draw_asm.o : ..\..\Pico\draw.s - $(asmrule) -_build\draw2_asm.o : ..\..\Pico\draw2.s - $(asmrule) -_build\memory_asm.o : ..\..\Pico\memory.s - $(asmrule) -_build\ym2612_asm.o : ..\..\Pico\sound\ym2612.s - $(asmrule) -_build\blit_asm.o : engine\blit.s - $(asmrule) - - -PicoDrive.exe : $(OBJECTS) - @echo * ld - @$(LD) $(GCCLDFLAGS) -soname PicoDrive{000a0000}[a00010f3].exe --entry _E32Startup -u _E32Startup \ - $(EPOCROOT2)EPOC32\RELEASE\ARMV5\UREL\EEXE.LIB -o "_build\PicoDrive_elf.exe" -Map "_build\PicoDrive.exe.map" $(OBJECTS) $(LIBS) -lsupc++ -lgcc -# @echo * strip -# @$(STRIP) _build\PicoDrive_elf.exe - @echo * elf2e32 - @elf2e32 --sid=0xa00010f3 --heap=0x00000100,0x00800000 --stack=0x00003000 \ - --uid1=0x1000007a --uid2=0x100039ce --uid3=0xa00010f3 \ - --capability=none --fpu=softvfp --targettype=EXE --output="$@" \ - --elfinput="_build\PicoDrive_elf.exe" --linkas=PicoDrive{000a0000}[a00010f3].exe --libpath="$(EPOCLIB)\LIB" -ifeq "$(sis)" "1" - @make -C _out -ifeq "$(up)" "1" - @qup.cmd -endif -endif - - -MAKEDIRS : _build - -_build : -# @echo * making build dir - @perl -S emkdir.pl $@ - - -# BitMap PicoDrive.mbm - -RESOURCES : rsc\PicoDrive.mbm rsc\PicoDrive.RSC rsc\PicoDrive_reg.RSC rsc\PicoDrive_loc.RSC rsc\PicoDrive.mbg - -rsc\PicoDrive.mbg : rsc\PicoDrive.mbm - -rsc\PicoDrive.mbm : rsc\pico18x18.bmp rsc\pico18x18m.bmp rsc\pico40x40.bmp rsc\pico40x40m.bmp rsc\pico64x64.bmp rsc\pico64x64m.bmp - @echo * $@ - @perl -S epocmbm.pl -h"rsc\PicoDrive.mbg" -o"rsc\PicoDrive.mbm" -l"\Z\Resource\Apps\:rsc" \ - -b"/c24rsc\pico18x18.bmp /8rsc\pico18x18m.bmp /c24rsc\pico40x40.bmp /8rsc\pico40x40m.bmp /c24rsc\pico64x64.bmp /8rsc\pico64x64m.bmp" -l"\Z\Resource\Apps\:rsc" - @perl -S ecopyfile.pl "rsc\PicoDrive.mbg" "$(EPOCROOT2)EPOC32\INCLUDE\PicoDrive.mbg" - -# Resource Z\Resource\Apps\PicoDrive.RSC - -rsc\PicoDrive.RSC : rsc\PicoDrive.rss picodrive.hrh - @echo * $@ - @perl -S epocrc.pl -m045,046,047 -I "." -I- -I "$(EPOCROOT2_NODRV)EPOC32\include" -DLANGUAGE_SC -u "rsc\PicoDrive.rss" -o$@ \ - -h"rsc\PicoDrive.rsg" -t"rsc" -l"Z\Resource\Apps:rsc" - @perl -S ecopyfile.pl "rsc\PicoDrive.rsg" "$(EPOCROOT2)EPOC32\INCLUDE\PicoDrive.RSG" - -# Resource Z\private\10003a3f\apps\PicoDrive_reg.RSC - -rsc\PicoDrive_reg.RSC : rsc\PicoDrive_reg.rss - @echo * $@ - @perl -S epocrc.pl -m045,046,047 -I "." -I- -I "$(EPOCROOT2)EPOC32\include" -DLANGUAGE_SC -u "rsc\PicoDrive_reg.rss" -o$@ \ - -t"rsc" -l"Z\private\10003a3f\apps:rsc" - -# Resource Z\Resource\Apps\PicoDrive_loc.RSC - -rsc\PicoDrive_loc.RSC : rsc\PicoDrive_loc.rss - @echo * $@ - @perl -S epocrc.pl -m045,046,047 -I "." -I- -I "$(EPOCROOT2)EPOC32\include" -DLANGUAGE_SC -u "rsc\PicoDrive_loc.rss" -o$@ \ - -t"rsc" -l"Z\Resource\Apps:rsc" diff --git a/platform/uiq3/PicoDrive.mmp b/platform/uiq3/PicoDrive.mmp deleted file mode 100644 index 01565267..00000000 --- a/platform/uiq3/PicoDrive.mmp +++ /dev/null @@ -1,140 +0,0 @@ -TARGET PicoDrive.exe -TARGETTYPE exe -//TARGETPATH ? -UID 0x100039CE 0xA00010F3 -EPOCSTACKSIZE 0x3000 // required by CQikSelectFileDlg -EPOCHEAPSIZE 0x100 0x00800000 // required by large ROMs :) - -// resource -SOURCEPATH Rsc -START RESOURCE PicoDrive.rss -HEADER -TARGETPATH \Resource\Apps -LANG SC -END - -START RESOURCE PicoDrive_reg.rss -TARGETPATH \private\10003a3f\apps -END - -START RESOURCE PicoDrive_loc.rss -TARGETPATH \Resource\Apps -LANG SC -END - -CAPABILITY none // SwEvent // forbidden - -USERINCLUDE ..\.. - -SYSTEMINCLUDE \epoc32\include -SYSTEMINCLUDE \epoc32\include\libc - -// launcher -SOURCEPATH . -SYSTEMINCLUDE . // for port_config.h -SOURCE App.cpp -SOURCE Engine.cpp -SOURCE Dialogs.cpp -SOURCE CSimpleTextParser.cpp - -// engine -SOURCEPATH engine -SOURCE main.cpp -SOURCE vid.cpp -SOURCE polledas.cpp -SOURCE debug.cpp -SOURCE audio_mediaserver.cpp -SOURCE blit.c - -// pico -MACRO _UNZIP_SUPPORT -SOURCEPATH ..\..\Pico -USERINCLUDE ..\..\Pico -SOURCE Area.c -SOURCE Cart.c -SOURCE Draw.c -SOURCE Draw2.c -SOURCE Memory.c -SOURCE Misc.c -SOURCE Pico.c -SOURCE Sek.c -SOURCE Utils.c -SOURCE VideoPort.c - -// pico - sound -SOURCEPATH ..\..\Pico\Sound -SOURCE sound.c -SOURCE sn76496.c -SOURCE ym2612.c - -// CPU cores -MACRO EMU_M68K -SOURCEPATH ..\..\cpu\Musashi -USERINCLUDE ..\..\cpu\Musashi -SOURCE m68kcpu.c -SOURCE m68kopac.c -SOURCE m68kopdm.c -SOURCE m68kopnz.c -SOURCE m68kops.c - -//MACRO _USE_MZ80 -//SOURCEPATH ..\win32\z80 -//SOURCE mz80_asm.obj - -// misc -SOURCEPATH ..\..\unzip -USERINCLUDE ..\..\unzip -SOURCE unzip.c -SOURCEPATH ..\..\zlib -USERINCLUDE ..\..\zlib -SOURCE gzio_symb.c - - -// TODO: get rid of unneeded stuff -LIBRARY ESTLIB.LIB -LIBRARY euser.lib -LIBRARY apparc.lib -LIBRARY cone.lib -LIBRARY eikcore.lib -LIBRARY eikcoctl.lib -LIBRARY qikcore.lib -LIBRARY qikdlg.lib // CQikSelectFileDlg -LIBRARY etext.lib // TCharFormat -LIBRARY bafl.lib // CDesCArrayFlat -LIBRARY efsrv.lib -LIBRARY eikctl.lib - -LIBRARY WS32.LIB -LIBRARY EIKDLG.LIB -//LIBRARY EGUL.LIB // CColorList -LIBRARY GDI.LIB // TTypeface -LIBRARY estor.lib // RWriteStream - -LIBRARY EZLIB.LIB -LIBRARY HAL.LIB - -LIBRARY mediaclient.LIB -LIBRARY mediaclientaudiostream.LIB - - - -STATICLIBRARY qikalloc.lib -LIBRARY qikallocdll.lib - - -MACRO __DEBUG_PRINT -MACRO __BROKEN_FWRITE - - -USERINCLUDE . -START BITMAP PicoDrive.mbm -HEADER -TARGETPATH \Resource\Apps -SOURCEPATH Rsc -SOURCE c24 Pico18x18.bmp -SOURCE 8 Pico18x18m.bmp -SOURCE c24 Pico40x40.bmp -SOURCE 8 Pico40x40m.bmp -SOURCE c24 Pico64x64.bmp -SOURCE 8 Pico64x64m.bmp -END diff --git a/platform/uiq3/config.txt b/platform/uiq3/config.txt deleted file mode 100644 index c3db1b11..00000000 --- a/platform/uiq3/config.txt +++ /dev/null @@ -1,110 +0,0 @@ -1. Keys: - -If it looks confusing to you, check this tutorial first: -http://notaz.atspace.com/pico_tut/ - -There are no default settings. -When you start key configuration mode, black screen with dark-red squares will -appear. Also there will be little 'control' on the top with the function -name in it, and arrows on the corners of it. You can tap on these corners to -select a function. You can also tap on these squares to bind that function to -them. This way you can associate touchpad areas with game-controls or functions. -I also made a small square in every corner of the screen to be used as a virtual -button for some function, like save state. You can bind it as you like. To -bind phone buttons, simply select the function you need, and press a button -you want. To unbind any key or touchpad area, simply push or tap it again. - -When finished, select 'done' and press any key. You can also press 'Power' -to exit. - -You need to bind 'pause emu' function to be able exit game when ROM is loaded. -It is bound to 'back' button by default. - -2. Main Settings: - -Here you can set the orientation of screen and the drawing mode. The "fit" -option will scale the image so it better fits in the screen, but some detail -will be lost. "center" displays the game at the center of the screen, but -non-fitting parts are not visible then. "fit2" is simmilar to "fit" but is -a bit more stretched (fit modes are only meaningful in 0 or 180 rotation -modes). - -"Fast renderer" enables faster rendering method, but it works only with some -games (some other have serious glitches or even hang). - -"Accurate timing" is needed for some games to run (like Red Zone). It should -be kept off for all other games, because it slows emulation down. Some games -also need this option for proper sound, so enable this if game has any -glitches. - -"Accurate sprites" fixes sprite priority problems, for example if game -character is in front of or behind some object it should not be, this option -should fix it. This option does not work in "Fast renderer" mode. - -"Show FPS" shows game frames per second in format XX/YY, where XX is the -number of frames shown per previous second, and YY is the number of frames -emulated, but not necessarily shown. By calculating YY-XX you get the number -of skipped frames per second. - -3. Sound settings: - -Sound emulation is very picky on CPU power (in most cases sound alone uses -more CPU power than everything else altogether), but it is still possible to -play some games. When using sound, the recommended display modes are "fit 0" -and "fit 180", because these are the fastest ones. Also try "Alternative -renderer", but it might cause graphical glitches. You must use auto frameskip -when using sound, or else you will get stuttering sound. Also, it is -recommended to exit all other non-vital apps (you can use SMan for this), -disable bluetooth and any other devices your phone may have. I also noticed -that simply connecting the phone battery charger strangely slows everything -down. - -"Enable sound" tries to enable sound output on your device, but that alone is -not enough to get sound. You need to enable the sound chips below: -"Z80" is secondary CPU in genesis and is mostly used to control the other 2 -sound chips. So if you disable Z80, sound will be lost in most games, with -some exceptions like Sonic1. It is possible to use Z80 for other things, -some games do that and Z80 must be enabled to run them at all. - -"YM2612" is a fairly complex Frequency Modulation (FM) sound synthesis chip. -It was the main sound output device in genesis and is horrible CPU hog when -is tried to be emulated in software. Disabling it gives large speed -improvement, but most of the sound is lost. - -"SN76496" is programmable sound generator (PSG) chip, used for various sound -effects and music elements. - -Note: if you change sound settings AFTER loading a ROM, you may need to reset -game to get sound. This is because most games initialize sound chips on -startup, and this data is lost when sound chips are being enabled/disabled. - -4. Misc: - -"6 button pad" will enable 6 button gamepad emulation and will add additional -X, Y, Z and MODE actions to key configuration. -Note: if you enable this, games may detect that and use different button -configuration, for example A ("high punch") will change to "low punch" in -Mortal Kombat and you will need to bind X for "high punch". - -"gzip save states" enables gzip (similar to ordinary zip, but a little -different) compression on your save states to save space. The compression -ratio is 50-90%, so it's worth to enable this. - -"Use SRAM saves" option enables emulation of batery-backed save RAM some game -cartridges had. RPG games used it alot, but there were some others too, like -Sonic 3. If this is enabled, .srm files are generated when you exit -the emulator or load another ROM. Format is compatible with other popular -emulators (like Gens and Fusion). - -"Region" lets you set the region of emulated genesis machine. - - -5. Frameskip: - -"Auto" option tries to run the game in it's original speed by skipping next - frame if the previous was rendered too slow. -"0" displays every frame, thus game runs very slow, sound skips. -"1" skips every other frame. Use this for a game which is smoother, but a bit - too slow (actually depends on display mode you use). -"2" also makes the game smoother, but it will be too fast in most areas. -"4","8" similar to above, but skips more frames and often becomes choppy. diff --git a/platform/uiq3/emu.c b/platform/uiq3/emu.c deleted file mode 100644 index 22b21431..00000000 --- a/platform/uiq3/emu.c +++ /dev/null @@ -1,157 +0,0 @@ -#include -#include -#include -#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, ¤tConfig.scaling, 0, 0, 2, 1, 1 }, - { "Rotation", MB_RANGE, MA_OPT_ROTATION, ¤tConfig.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, ¤tConfig.EmuOpt, 0x002, 0, 0, 1, 1 }, - { NULL, MB_RANGE, MA_OPT_FRAMESKIP, ¤tConfig.Frameskip, 0, -1, 16, 1, 1 }, - { "Enable sound", MB_ONOFF, MA_OPT_ENABLE_SOUND, ¤tConfig.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, ¤tConfig.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, ¤tConfig.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, ¤tConfig.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, ¤tConfig.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 index 14d4a3ff..00000000 --- a/platform/uiq3/engine/PolledAS.h +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************* - * - * File: PolledAS.h - * - * Author: Peter van Sebille (peter@yipton.net) - * - * (c) Copyright 2001, Peter van Sebille - * All Rights Reserved - * - *******************************************************************/ - -#ifndef __POLLED_AS_H -#define __POLLED_AS_H - -class CPrivatePolledActiveScheduler; - -class CPolledActiveScheduler : public CBase -{ -public: - ~CPolledActiveScheduler(); - static CPolledActiveScheduler* NewL(); - static CPolledActiveScheduler* Instance(); - void Schedule(); -protected: - CPolledActiveScheduler(){}; - void ConstructL(); - CPrivatePolledActiveScheduler* iPrivatePolledActiveScheduler; -}; - - -#endif /* __POLLED_AS_H */ - diff --git a/platform/uiq3/engine/audio_mediaserver.cpp b/platform/uiq3/engine/audio_mediaserver.cpp deleted file mode 100644 index e9f77d07..00000000 --- a/platform/uiq3/engine/audio_mediaserver.cpp +++ /dev/null @@ -1,317 +0,0 @@ -/******************************************************************* - * - * File: Audio_mediaserver.cpp - * - * Author: Peter van Sebille (peter@yipton.net) - * - * Modified/adapted for picodriveN by notaz, 2006 - * - * (c) Copyright 2006, notaz - * (c) Copyright 2001, Peter van Sebille - * All Rights Reserved - * - *******************************************************************/ - -#include "audio_mediaserver.h" -#include "debug.h" - -//#define DEBUG_UNDERFLOWS -//#undef DEBUGPRINT -//#define DEBUGPRINT(x...) - - -const TInt KUpdatesPerSec = 10; -const TInt KBlockTime = 1000000 / KUpdatesPerSec; -const TInt KMaxLag = 200000; // max sound lag, lower values increase chance of underflow -const TInt KMaxUnderflows = 50; // max underflows/API errors we are going allow in a row (to prevent lockups) - - -/******************************************* - * - * CGameAudioMS - * - *******************************************/ - -CGameAudioMS::CGameAudioMS(TInt aRate, TBool aStereo, TInt aWritesPerSec, TInt aVolume) -: iRate(aRate), iStereo(aStereo), iWritesPerSec(aWritesPerSec), iVolume(aVolume) -{ -} - - -CGameAudioMS* CGameAudioMS::NewL(TInt aRate, TBool aStereo, TInt aWritesPerSec, TInt aVolume) -{ - DEBUGPRINT(_L("CGameAudioMS::NewL(%i, %i, %i, %i)"), aRate, aStereo, aWritesPerSec, aVolume); - CGameAudioMS* self = new(ELeave) CGameAudioMS(aRate, aStereo, aWritesPerSec, aVolume); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); // self - return self; -} - - -CGameAudioMS::~CGameAudioMS() -{ - DEBUGPRINT(_L("CGameAudioMS::~CGameAudioMS()")); - if(iMdaAudioOutputStream) { - iScheduler->Schedule(); // let it finish it's stuff - iMdaAudioOutputStream->Stop(); - delete iMdaAudioOutputStream; - } - if(iServer) delete iServer; - - for (TInt i=0; iDes().FillZ (iBufferSize+4); - } - - iCurrentBuffer = 0; - iCurrentBufferSize = 0; - - DEBUGPRINT(_L("sound: iMaxWriteSamples: %i, iBufferSize: %i"), iMaxWriteSamples, iBufferSize); - - // here we actually test if we can create and open CMdaAudioOutputStream at all, but really create and use it later. - iMdaAudioOutputStream = CMdaAudioOutputStream::NewL(iListener, iServer); - if (iMdaAudioOutputStream) { - if (iVolume < 0 || iVolume > iMdaAudioOutputStream->MaxVolume()) - iVolume = iMdaAudioOutputStream->MaxVolume(); - delete iMdaAudioOutputStream; - iMdaAudioOutputStream = 0; - } -} - -// returns a pointer to buffer for next frame, -// to be used when iSoundBuffers are used directly -TInt16 *CGameAudioMS::NextFrameL(TInt aPcmFrames) -{ - TInt mul = iStereo ? 4 : 2; - TInt bytes = aPcmFrames * mul; - iCurrentPosition += bytes / 2; - iCurrentBufferSize += bytes; - - if (aPcmFrames > iMaxWriteSamples) { - DEBUGPRINT(_L("too many samples: %i > %i"), aPcmFrames, iMaxWriteSamples); - } - - if (iCurrentBufferSize + iMaxWriteSamples * mul > iBufferSize) - { - //DEBUGPRINT(_L("write on iCurrentBufferSize %i"), iCurrentBufferSize); - WriteBlockL(); - } - - iScheduler->Schedule(); - - if(iListener.iUnderflowed) { - if(iListener.iUnderflowed > KMaxUnderflows) { - delete iMdaAudioOutputStream; - iMdaAudioOutputStream = 0; - return 0; - } - UnderflowedL(); // not again! - } - - return iCurrentPosition; -} - -void CGameAudioMS::WriteBlockL() -{ - iScheduler->Schedule(); - // do not write until stream is open - if(!iListener.iIsOpen) WaitForOpenToCompleteL(); - //if(!iListener.iHasCopied) WaitForCopyToCompleteL(); // almost never happens anyway and sometimes even deadlocks? - //iListener.iHasCopied = EFalse; - - - if(!iListener.iUnderflowed) { - TInt64 delta; - // don't write if sound is lagging too much - delta = iTime - iMdaAudioOutputStream->Position().Int64(); - if (delta > MAKE_TINT64(0, KMaxLag)) - // another query sometimes returns very different result - delta = iTime - iMdaAudioOutputStream->Position().Int64(); - - if(delta <= MAKE_TINT64(0, KMaxLag)) { - //RDebug::Print(_L("delta: %i"), iTime.Low() - iMdaAudioOutputStream->Position().Int64().Low()); - iSoundBuffers[iCurrentBuffer]->Des().SetLength(iCurrentBufferSize); - iMdaAudioOutputStream->WriteL(*iSoundBuffers[iCurrentBuffer]); - iTime += KBlockTime; - } else { - DEBUGPRINT(_L("lag: %i"), I64LOW(delta)); - } - } - - if (++iCurrentBuffer == KSoundBuffers) - iCurrentBuffer = 0; - iSoundBuffers[iCurrentBuffer]->Des().SetMax(); - iCurrentPosition = (TInt16*) iSoundBuffers[iCurrentBuffer]->Ptr(); - iCurrentBufferSize = 0; -} - -void CGameAudioMS::Pause() -{ - if(!iMdaAudioOutputStream) return; - - iScheduler->Schedule(); // let it finish it's stuff - iMdaAudioOutputStream->Stop(); - delete iMdaAudioOutputStream; - iMdaAudioOutputStream = 0; -} - -// call this before doing any playback! -TInt16 *CGameAudioMS::ResumeL() -{ - DEBUGPRINT(_L("CGameAudioMS::Resume()")); - iScheduler->Schedule(); - - // we act a bit strange here: simulate buffer underflow, which actually starts audio - iListener.iIsOpen = ETrue; - iListener.iUnderflowed = 1; - iListener.iLastError = 0; - iCurrentBufferSize = 0; - iCurrentPosition = (TInt16*) iSoundBuffers[iCurrentBuffer]->Ptr(); - return iCurrentPosition; -} - -// handles underflow condition -void CGameAudioMS::UnderflowedL() -{ -#ifdef DEBUG_UNDERFLOWS - DEBUGPRINT(_L("UnderflowedL()")); -#endif - - if (iListener.iLastError != KErrUnderflow) - { - // recreate the stream - //iMdaAudioOutputStream->Stop(); - if(iMdaAudioOutputStream) delete iMdaAudioOutputStream; - iMdaAudioOutputStream = CMdaAudioOutputStream::NewL(iListener, iServer); - iMdaAudioOutputStream->Open(&iMdaAudioDataSettings); - iMdaAudioOutputStream->SetAudioPropertiesL(iMdaAudioDataSettings.iSampleRate, iMdaAudioDataSettings.iChannels); - iMdaAudioOutputStream->SetVolume(iVolume); // new in UIQ3 - - iListener.iIsOpen = EFalse; // wait for it to open - //iListener.iHasCopied = ETrue; // but don't wait for last copy to complete - // let it open and feed some stuff to make it happy - User::After(0); - iScheduler->Schedule(); - iListener.iLastError = 0; - if(!iListener.iIsOpen) WaitForOpenToCompleteL(); - } else { - iListener.iLastError = iListener.iUnderflowed = 0; - } - iTime = iMdaAudioOutputStream->Position().Int64(); -} - -void CGameAudioMS::WaitForOpenToCompleteL() -{ - DEBUGPRINT(_L("CGameAudioMS::WaitForOpenToCompleteL")); - TInt count = 20; // 2 seconds - TInt waitPeriod = 100 * 1000; - - if(!iListener.iIsOpen) { - // it is often enough to do this - User::After(0); - iScheduler->Schedule(); - } - while (!iListener.iIsOpen && --count) - { - User::After(waitPeriod); - iScheduler->Schedule(); - } - if (!iListener.iIsOpen) - User::LeaveIfError(KErrNotSupported); -} - -TInt CGameAudioMS::ChangeVolume(TInt aUp) -{ - //DEBUGPRINT(_L("CGameAudioMS::ChangeVolume(%i)"), aUp); - - if (iMdaAudioOutputStream) { - if (aUp) { - iVolume += 5; - if (iVolume > iMdaAudioOutputStream->MaxVolume()) - iVolume = iMdaAudioOutputStream->MaxVolume(); - } else { - iVolume -= 5; - if (iVolume < 0) iVolume = 0; - } - iMdaAudioOutputStream->SetVolume(iVolume); - } - - return iVolume; -} - -void TGameAudioEventListener::MaoscOpenComplete(TInt aError) -{ -#ifdef DEBUG_UNDERFLOWS - DEBUGPRINT(_L("CGameAudioMS::MaoscOpenComplete, error=%d"), aError); -#endif - - iIsOpen = ETrue; - if(aError) { - iLastError = aError; - iUnderflowed++; - } - else iUnderflowed = 0; -} - -void TGameAudioEventListener::MaoscBufferCopied(TInt aError, const TDesC8& aBuffer) -{ - if (aError) - DEBUGPRINT(_L("CGameAudioMS::MaoscBufferCopied, error=%d"), aError); - -// iHasCopied = ETrue; - - if(aError) { // shit! - iLastError = aError; - iUnderflowed++; - } -} - -void TGameAudioEventListener::MaoscPlayComplete(TInt aError) -{ -#ifdef DEBUG_UNDERFLOWS - DEBUGPRINT(_L("CGameAudioMS::MaoscPlayComplete: %i"), aError); -#endif - if(aError) { - iLastError = aError; - iUnderflowed++; // never happened to me while testing, but just in case - } -} - diff --git a/platform/uiq3/engine/audio_mediaserver.h b/platform/uiq3/engine/audio_mediaserver.h deleted file mode 100644 index fc94f7c1..00000000 --- a/platform/uiq3/engine/audio_mediaserver.h +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************* - * - * File: Audio_mediaserver.h - * - * Author: Peter van Sebille (peter@yipton.net) - * - * Modified/adapted for picodriveN by notaz, 2006 - * - * (c) Copyright 2006, notaz - * (c) Copyright 2001, Peter van Sebille - * All Rights Reserved - * - *******************************************************************/ - -#ifndef __AUDIO_MEDIASERVER_H -#define __AUDIO_MEDIASERVER_H - -#include -#include - -//#include "audio.h" -#include "PolledAS.h" - -const TInt KSoundBuffers = 4; - - -class TGameAudioEventListener : public MMdaAudioOutputStreamCallback -{ -public: // implements MMdaAudioOutputStreamCallback - void MaoscOpenComplete(TInt aError); - void MaoscBufferCopied(TInt aError, const TDesC8& ); - void MaoscPlayComplete(TInt aError); - - TBool iIsOpen; -// TBool iHasCopied; - TInt iUnderflowed; - TInt iLastError; -}; - - -class CGameAudioMS // : public IGameAudio // IGameAudio MUST be specified first! -{ -public: // implements IGameAudio - TInt16 *NextFrameL(TInt aPcmFrames); - TInt16 *ResumeL(); - void Pause(); - TInt ChangeVolume(TInt aUp); - -public: - ~CGameAudioMS(); - CGameAudioMS(TInt aRate, TBool aStereo, TInt aWritesPerSec, TInt aVolume); - static CGameAudioMS* NewL(TInt aRate, TBool aStereo, TInt aWritesPerSec, TInt aVolume); - -protected: - void WriteBlockL(); - void UnderflowedL(); - void ConstructL(); - -protected: - void WaitForOpenToCompleteL(); - - TInt iRate; - TBool iStereo; - - CMdaAudioOutputStream *iMdaAudioOutputStream; - TMdaAudioDataSettings iMdaAudioDataSettings; - - TGameAudioEventListener iListener; - - CPolledActiveScheduler *iScheduler; - - HBufC8* iSoundBuffers[KSoundBuffers]; - TInt iWritesPerSec; // fps, may be more actual writes - TInt iMaxWriteSamples; // max samples per write - TInt16* iCurrentPosition; - TInt iCurrentBuffer; // active buffer - TInt iCurrentBufferSize; // bytes filled in buffer - TInt iBufferSize; - CMdaServer* iServer; - - TInt64 iTime; - TInt iVolume; -}; - -#endif /* __AUDIO_MEDIASERVER_H */ diff --git a/platform/uiq3/engine/blit.c b/platform/uiq3/engine/blit.c deleted file mode 100644 index 809f0f70..00000000 --- a/platform/uiq3/engine/blit.c +++ /dev/null @@ -1,34 +0,0 @@ - -/* -void vidConvCpyRGB32 (void *to, void *from, int lines, int p240) -{ - unsigned short *ps = (unsigned short *) from; - unsigned long *pd = (unsigned long *) to; - int x, y; - int to_x = p240 ? 240 : 224; - if(!p240) pd += 8; - - for(y = 0; y < lines; y++) // ps < ps_end; ps++) - for(x = 0; x < to_x; x++, ps++) - // Convert 0000bbb0 ggg0rrr0 - // to ..0 rrr00000 ggg00000 bbb00000 - *(pd+y*256+x) = ((*ps&0x000F)<<20) | ((*ps&0x00F0)<<8) | ((*ps&0x0F00)>>4); -} -*/ - -// stubs -void vidConvCpyRGB32 (void *to, void *from, int pixels) {} -void vidConvCpyRGB32sh(void *to, void *from, int pixels) {} -void vidConvCpyRGB32hi(void *to, void *from, int pixels) {} - -void vidConvCpy_90 (void *to, void *from, void *pal, int width) {} -void vidConvCpy_270 (void *to, void *from, void *pal, int width) {} -void vidConvCpy_center_0 (void *to, void *from, void *pal) {} -void vidConvCpy_center_180(void *to, void *from, void *pal) {} -void vidConvCpy_center2_40c_0 (void *to, void *from, void *pal, int lines) {} -void vidConvCpy_center2_40c_180(void *to, void *from, void *pal, int lines) {} -void vidConvCpy_center2_32c_0 (void *to, void *from, void *pal, int lines) {} -void vidConvCpy_center2_32c_180(void *to, void *from, void *pal, int lines) {} - -void vidClear(void *to, int lines) {} - diff --git a/platform/uiq3/engine/blit.h b/platform/uiq3/engine/blit.h deleted file mode 100644 index 4255b387..00000000 --- a/platform/uiq3/engine/blit.h +++ /dev/null @@ -1,22 +0,0 @@ -// (c) Copyright 2006 notaz, All rights reserved. -// Free for non-commercial use. - -// For commercial use, separate licencing terms must be obtained. - -extern "C" -{ - void vidConvCpyRGB32 (void *to, void *from, int pixels); - void vidConvCpyRGB32sh(void *to, void *from, int pixels); - void vidConvCpyRGB32hi(void *to, void *from, int pixels); - - void vidConvCpy_90 (void *to, void *from, void *pal, int width); - void vidConvCpy_270 (void *to, void *from, void *pal, int width); - void vidConvCpy_center_0 (void *to, void *from, void *pal); - void vidConvCpy_center_180(void *to, void *from, void *pal); - void vidConvCpy_center2_40c_0 (void *to, void *from, void *pal, int lines); - void vidConvCpy_center2_40c_180(void *to, void *from, void *pal, int lines); - void vidConvCpy_center2_32c_0 (void *to, void *from, void *pal, int lines); - void vidConvCpy_center2_32c_180(void *to, void *from, void *pal, int lines); - - void vidClear(void *to, int lines); -} diff --git a/platform/uiq3/engine/blit.s b/platform/uiq3/engine/blit.s deleted file mode 100644 index f10a3cc8..00000000 --- a/platform/uiq3/engine/blit.s +++ /dev/null @@ -1,724 +0,0 @@ -@ vim:filetype=armasm -@ some color conversion and blitting routines - -@ (c) Copyright 2006, notaz -@ All Rights Reserved - -.include "port_config.s" - - -@ Convert 0000bbb0 ggg0rrr0 0000bbb0 ggg0rrr0 -@ to 00000000 rrr00000 ggg00000 bbb00000 ... - -@ lr = 0x00e000e0, out: r3=lower_pix, r2=higher_pix; trashes rin -@ if sh==2, r8=0x00404040 (sh!=0 destroys flags!) -.macro convRGB32_2 rin sh=0 - and r2, lr, \rin, lsr #4 @ blue - and r3, \rin, lr - orr r2, r2, r3, lsl #8 @ g0b0g0b0 - - mov r3, r2, lsl #16 @ g0b00000 - and \rin,lr, \rin, ror #12 @ 00r000r0 (reversed) - orr r3, r3, \rin, lsr #16 @ g0b000r0 -.if \sh == 1 - mov r3, r3, ror #17 @ shadow mode -.elseif \sh == 2 - adds r3, r3, #0x40000000 @ green - orrcs r3, r3, #0xe0000000 - mov r3, r3, ror #8 - adds r3, r3, #0x40000000 - orrcs r3, r3, #0xe0000000 - mov r3, r3, ror #16 - adds r3, r3, #0x40000000 - orrcs r3, r3, #0xe0000000 - mov r3, r3, ror #24 - orr r3, r3, r3, lsr #3 -.else - mov r3, r3, ror #16 @ r3=low - orr r3, r3, r3, lsr #3 -.endif - - str r3, [r0], #4 - - mov r2, r2, lsr #16 - orr r2, r2, \rin, lsl #16 -.if \sh == 1 - mov r2, r2, lsr #1 -.elseif \sh == 2 - mov r2, r2, ror #8 - adds r2, r2, #0x40000000 @ blue - orrcs r2, r2, #0xe0000000 - mov r2, r2, ror #8 - adds r2, r2, #0x40000000 - orrcs r2, r2, #0xe0000000 - mov r2, r2, ror #8 - adds r2, r2, #0x40000000 - orrcs r2, r2, #0xe0000000 - mov r2, r2, ror #8 - orr r2, r2, r2, lsr #3 -.else - orr r2, r2, r2, lsr #3 -.endif - - str r2, [r0], #4 -.endm - - -.global vidConvCpyRGB32 @ void *to, void *from, int pixels - -vidConvCpyRGB32: - stmfd sp!, {r4-r7,lr} - - mov r12, r2, lsr #3 @ repeats - mov lr, #0x00e00000 - orr lr, lr, #0x00e0 - -.loopRGB32: - subs r12, r12, #1 - - ldmia r1!, {r4-r7} - convRGB32_2 r4 - convRGB32_2 r5 - convRGB32_2 r6 - convRGB32_2 r7 - - bgt .loopRGB32 - - ldmfd sp!, {r4-r7,lr} - bx lr - - -.global vidConvCpyRGB32sh @ void *to, void *from, int pixels - -vidConvCpyRGB32sh: - stmfd sp!, {r4-r7,lr} - - mov r12, r2, lsr #3 @ repeats - mov lr, #0x00e00000 - orr lr, lr, #0x00e0 - -.loopRGB32sh: - subs r12, r12, #1 - - ldmia r1!, {r4-r7} - convRGB32_2 r4, 1 - convRGB32_2 r5, 1 - convRGB32_2 r6, 1 - convRGB32_2 r7, 1 - - bgt .loopRGB32sh - - ldmfd sp!, {r4-r7,lr} - bx lr - - -.global vidConvCpyRGB32hi @ void *to, void *from, int pixels - -vidConvCpyRGB32hi: - stmfd sp!, {r4-r7,lr} - - mov r12, r2, lsr #3 @ repeats - mov lr, #0x00e00000 - orr lr, lr, #0x00e0 - -.loopRGB32hi: - ldmia r1!, {r4-r7} - convRGB32_2 r4, 2 - convRGB32_2 r5, 2 - convRGB32_2 r6, 2 - convRGB32_2 r7, 2 - - subs r12, r12, #1 - bgt .loopRGB32hi - - ldmfd sp!, {r4-r7,lr} - bx lr - - -@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ - -@ -------- M2 stuff --------- -/* -.global vidConvCpy_90 @ void *to, void *from, int width - -vidConvCpy_90: - stmfd sp!, {r4-r10,lr} - - mov lr, #0x00F00000 - orr lr, lr, #0x00F0 - - mov r12, #224/4 @ row counter - mov r10, r2, lsl #2 @ we do 2 pixel wide copies - - add r8, r0, #256*4 @ parallel line - add r1, r1, #0x23000 - add r1, r1, #0x00B80 @ r1+=328*223*2+8*2 - mov r9, r1 - - mov r4, #0 @ fill bottom border - mov r5, #0 - mov r6, #0 - mov r7, #0 - stmia r0!, {r4-r7} - stmia r0!, {r4-r7} - stmia r8!, {r4-r7} - stmia r8!, {r4-r7} - -.loopM2RGB32_90: - subs r12, r12, #1 - - @ at first this loop was written differently: src pixels were fetched with ldm's and - @ dest was not sequential. It ran nearly 2 times slower. It seems it is very important - @ to do sequential memory access on those items, which we have more (to offload addressing bus?). - - ldr r4, [r1], #-328*2 - ldr r5, [r1], #-328*2 - ldr r6, [r1], #-328*2 - ldr r7, [r1], #-328*2 - - convRGB32_2 r4, 1 - convRGB32_2 r5, 1 - convRGB32_2 r6, 1 - convRGB32_2 r7, 1 - - str r4, [r8], #4 - str r5, [r8], #4 - str r6, [r8], #4 - str r7, [r8], #4 - - bne .loopM2RGB32_90 - - mov r4, #0 @ top border - mov r5, #0 - mov r6, #0 - stmia r0!, {r4-r6,r12} - stmia r0!, {r4-r6,r12} - stmia r8!, {r4-r6,r12} - stmia r8!, {r4-r6,r12} - - subs r10, r10, #1 - ldmeqfd sp!, {r4-r10,pc} @ return - - add r0, r8, #16*4 @ set new dst pointer - add r8, r0, #256*4 - add r9, r9, #2*2 @ fix src pointer - mov r1, r9 - - stmia r0!, {r4-r6,r12} @ bottom border - stmia r0!, {r4-r6,r12} - stmia r8!, {r4-r6,r12} - stmia r8!, {r4-r6,r12} - - mov r12, #224/4 @ restore row counter - b .loopM2RGB32_90 - - - -@ converter for vidConvCpy_270 -@ lr = 0x00F000F0, out: r3=lower_pix, r2=higher_pix; trashes rin -.macro convRGB32_3 rin - and r2, lr, \rin, lsr #4 @ blue - and r3, \rin, lr - orr r2, r2, r3, lsl #8 @ g0b0g0b0 - - mov r3, r2, lsl #16 @ g0b00000 - and \rin,lr, \rin, ror #12 @ 00r000r0 (reversed) - orr r3, r3, \rin, lsr #16 @ g0b000r0 - - mov r2, r2, lsr #16 - orr r2, r2, \rin, lsl #16 - str r2, [r0], #4 - - mov \rin,r3, ror #16 @ r3=low -.endm -*/ -@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ - - -@ takes byte-sized pixels from r3-r6, fetches from pal and stores to r7,r8,r10,lr -@ r2=pal -.macro mode2_4pix shift - and r7, r11, r3, lsr #\shift - ldr r7, [r2, r7, lsl #2] - - and r8, r11, r4, lsr #\shift - ldr r8, [r2, r8, lsl #2] - - and r10,r11, r5, lsr #\shift - ldr r10,[r2, r10,lsl #2] - - and lr, r11, r6, lsr #\shift - ldr lr, [r2, lr, lsl #2] -.endm - -@ r2=pal, r11=0xff -.macro mode2_4pix_getpix0 dreg sreg - and \dreg, r11, \sreg - ldr \dreg, [r2, \dreg, lsl #2] -.endm - -.macro mode2_4pix_getpix1 dreg sreg - and \dreg, r11, \sreg, lsr #8 - ldr \dreg, [r2, \dreg, lsl #2] -.endm - -.macro mode2_4pix_getpix2 dreg sreg - and \dreg, r11, \sreg, lsr #16 - ldr \dreg, [r2, \dreg, lsl #2] -.endm - -.macro mode2_4pix_getpix3 dreg sreg - and \dreg, r11, \sreg, lsr #24 - ldr \dreg, [r2, \dreg, lsl #2] -.endm - -@ takes byte-sized pixels from reg, fetches from pal and stores to r3-r6 -@ r11=0xFF, r2=pal -.macro mode2_4pix2_0 reg - mode2_4pix_getpix0 r3, \reg - mode2_4pix_getpix1 r4, \reg - mode2_4pix_getpix2 r5, \reg - mode2_4pix_getpix3 r6, \reg -.endm - -@ ... -.macro mode2_4pix2_180 reg - mode2_4pix_getpix3 r3, \reg - mode2_4pix_getpix2 r4, \reg - mode2_4pix_getpix1 r5, \reg - mode2_4pix_getpix0 r6, \reg -.endm - -@ takes byte-sized pixels from reg, fetches from pal and stores to r3-r5 -@ r11=0xFF, r2=pal, r10=0xfcfcfc, r6=tmp -.macro mode2_4pix_to3 reg is180 -.if \is180 - mode2_4pix_getpix3 r3, \reg - mode2_4pix_getpix2 r4, \reg -.else - mode2_4pix_getpix0 r3, \reg @ gathering loads cause a weird-hang - mode2_4pix_getpix1 r4, \reg -.endif - - sub r3, r3, r3, lsr #2 @ r3 *= 0.75 - add r3, r3, r4, lsr #2 @ r3 += r4 * 0.25 - and r3, r3, r10 - -.if \is180 - mode2_4pix_getpix1 r5, \reg - mode2_4pix_getpix0 r6, \reg -.else - mode2_4pix_getpix2 r5, \reg - mode2_4pix_getpix3 r6, \reg -.endif - - mov r4, r4, lsr #1 - add r4, r4, r5, lsr #1 @ r4 = (r4 + r5) / 2; -@ and r4, r4, r10 - sub r6, r6, r6, lsr #2 @ r6 *= 0.75 - add r5, r6, r5, lsr #2 @ r5 = r6 + r5 * 0.25 - and r5, r5, r10 -.endm - - -@ void *to, void *from, void *pal, int width -.macro vidConvCpyM2_landscape is270 - stmfd sp!, {r4-r11,lr} - - mov r11, #0xff - - mov r12, #(224/4-1)<<16 @ row counter - orr r12, r12, r3, lsl #1 @ we do 4 pixel wide copies (right to left) - -.if \is270 - add r1, r1, #324 -.else - add r1, r1, #0x11c00 - add r1, r1, #0x00308 @ 328*224+8 -.endif - mov r9, r1 - - mov r3, #0 @ fill top border - mov r4, #0 - mov r5, #0 - mov r6, #0 - stmia r0!, {r3-r6} - stmia r0!, {r3-r6} - add r7, r0, #(240+BORDER_R)*4-8*4 - stmia r7!, {r3-r6} - stmia r7!, {r3-r6} - add r7, r7, #(240+BORDER_R)*4-8*4 - stmia r7!, {r3-r6} - stmia r7!, {r3-r6} - add r7, r7, #(240+BORDER_R)*4-8*4 - stmia r7!, {r3-r6} - stmia r7!, {r3-r6} - -0: @ .loopM2RGB32_270: - subs r12, r12, #1<<16 - -.if \is270 - ldr r3, [r1], #328 - ldr r4, [r1], #328 - ldr r5, [r1], #328 - ldr r6, [r1], #328 -.else - ldr r3, [r1, #-328]! - ldr r4, [r1, #-328]! - ldr r5, [r1, #-328]! - ldr r6, [r1, #-328]! -.endif - -.if \is270 - mode2_4pix 24 -.else - mode2_4pix 0 -.endif - stmia r0, {r7,r8,r10,lr} - add r0, r0, #(240+BORDER_R)*4 - -.if \is270 - mode2_4pix 16 -.else - mode2_4pix 8 -.endif - stmia r0, {r7,r8,r10,lr} - add r0, r0, #(240+BORDER_R)*4 - -.if \is270 - mode2_4pix 8 -.else - mode2_4pix 16 -.endif - stmia r0, {r7,r8,r10,lr} - add r0, r0, #(240+BORDER_R)*4 - -.if \is270 - mode2_4pix 0 -.else - mode2_4pix 24 -.endif - stmia r0!,{r7,r8,r10,lr} - sub r0, r0, #(240+BORDER_R)*4*3 - - bpl 0b @ .loopM2RGB32_270 - - mov r3, #0 @ bottom border - mov r4, #0 - mov r5, #0 - mov r6, #0 - stmia r0!, {r3-r6} - stmia r0!, {r3-r6} - add r0, r0, #(240+BORDER_R)*4-8*4 - stmia r0!, {r3-r6} - stmia r0!, {r3-r6} - add r0, r0, #(240+BORDER_R)*4-8*4 - stmia r0!, {r3-r6} - stmia r0!, {r3-r6} - add r0, r0, #(240+BORDER_R)*4-8*4 - stmia r0!, {r3-r6} - nop @ phone crashes if this is commented out. Do I stress it too much? - stmia r0!, {r3-r6} - - add r12, r12, #1<<16 - subs r12, r12, #1 - ldmeqfd sp!, {r4-r11,pc} @ return - -.if BORDER_R - add r0, r0, #BORDER_R*4 -.endif -.if \is270 - sub r9, r9, #4 @ fix src pointer -.else - add r9, r9, #4 -.endif - mov r1, r9 - - stmia r0!, {r3-r6} @ top border - stmia r0!, {r3-r6} - add r7, r0, #(240+BORDER_R)*4-8*4 - stmia r7!, {r3-r6} - stmia r7!, {r3-r6} - add r7, r7, #(240+BORDER_R)*4-8*4 - stmia r7!, {r3-r6} - stmia r7!, {r3-r6} - add r7, r7, #(240+BORDER_R)*4-8*4 - stmia r7!, {r3-r6} - stmia r7!, {r3-r6} - - orr r12, r12, #(224/4-1)<<16 @ restore row counter - b 0b @ .loopM2RGB32_270 -.endm - - -.global vidConvCpy_90 @ void *to, void *from, void *pal, int width - -vidConvCpy_90: - vidConvCpyM2_landscape 0 - - -.global vidConvCpy_270 @ void *to, void *from, void *pal, int width - -vidConvCpy_270: - vidConvCpyM2_landscape 1 - - -.global vidConvCpy_center_0 @ void *to, void *from, void *pal - -vidConvCpy_center_0: - stmfd sp!, {r4-r6,r11,lr} - - mov r11, #0xff - add r1, r1, #8 @ not border (centering 32col here) - - mov r12, #(240/4-1)<<16 - orr r12, r12, #224 - -.loopRGB32_c0: - ldr lr, [r1], #4 - subs r12, r12, #1<<16 - - mode2_4pix2_0 lr - stmia r0!, {r3-r6} - bpl .loopRGB32_c0 - - sub r12, r12, #1 - adds r12, r12, #1<<16 - ldmeqfd sp!, {r4-r6,r11,pc} @ return -.if BORDER_R - add r0, r0, #BORDER_R*4 -.endif - add r1, r1, #88 - orr r12, #(240/4-1)<<16 - b .loopRGB32_c0 - - -.global vidConvCpy_center_180 @ void *to, void *from, void *pal - -vidConvCpy_center_180: - stmfd sp!, {r4-r6,r11,lr} - - mov r11, #0xff - add r1, r1, #0x11c00 - add r1, r1, #0x002B8 @ #328*224-72 - - mov r12, #(240/4-1)<<16 - orr r12, r12, #224 - -.loopRGB32_c180: - ldr lr, [r1, #-4]! - subs r12, r12, #1<<16 - - mode2_4pix2_180 lr - stmia r0!, {r3-r6} - bpl .loopRGB32_c180 - - sub r12, r12, #1 - adds r12, r12, #1<<16 - ldmeqfd sp!, {r4-r6,r11,pc} @ return -.if BORDER_R - add r0, r0, #BORDER_R*4 -.endif - sub r1, r1, #88 - orr r12, #(240/4-1)<<16 - b .loopRGB32_c180 - - -@ note: the following code assumes that (pal[x] & 0x030303) == 0 - -.global vidConvCpy_center2_40c_0 @ void *to, void *from, void *pal, int lines - -vidConvCpy_center2_40c_0: - stmfd sp!, {r4-r6,r10,r11,lr} - - mov r11, #0xff - mov r10, #0xfc - orr r10, r10, lsl #8 - orr r10, r10, lsl #8 - add r1, r1, #8 @ border - - mov r12, #(240/3-1)<<16 - orr r12, r12, r3 - -.loopRGB32_c2_40c_0: - ldr lr, [r1], #4 - subs r12, r12, #1<<16 - - mode2_4pix_to3 lr, 0 - - stmia r0!, {r3-r5} - bpl .loopRGB32_c2_40c_0 - - sub r12, r12, #1 - adds r12, r12, #1<<16 - ldmeqfd sp!, {r4-r6,r10,r11,pc} @ return -.if BORDER_R - add r0, r0, #BORDER_R*4 -.endif - add r1, r1, #8 - orr r12, #(240/3-1)<<16 - b .loopRGB32_c2_40c_0 - - -.global vidConvCpy_center2_40c_180 @ void *to, void *from, void *pal, int lines - -vidConvCpy_center2_40c_180: - stmfd sp!, {r4-r6,r10,r11,lr} - - mov r11, #0xff - mov r10, #0xfc - orr r10, r10, lsl #8 - orr r10, r10, lsl #8 - - mov r4, #328 - mla r1, r3, r4, r1 -@ add r1, r1, #0x11000 -@ add r1, r1, #0x00f00 @ #328*224 - - mov r12, #(240/3-1)<<16 - orr r12, r12, r3 - -.loop_c2_40c_180: - ldr lr, [r1, #-4]! - subs r12, r12, #1<<16 - - mode2_4pix_to3 lr, 1 - - stmia r0!, {r3-r5} - bpl .loop_c2_40c_180 - - sub r12, r12, #1 - adds r12, r12, #1<<16 - ldmeqfd sp!, {r4-r6,r10,r11,pc} @ return -.if BORDER_R - add r0, r0, #BORDER_R*4 -.endif - sub r1, r1, #8 - orr r12, #(240/3-1)<<16 - b .loop_c2_40c_180 - - -.global vidConvCpy_center2_32c_0 @ void *to, void *from, void *pal, int lines - -vidConvCpy_center2_32c_0: - stmfd sp!, {r4-r11,lr} - - mov r10, #0xfc - orr r10, r10, lsl #8 - orr r10, r10, lsl #8 - mov r11, #0xff - add r1, r1, #8 @ border - - mov r12, #(240/15-1)<<16 - orr r12, r12, r3 - -.loop_c2_32c_0: - ldmia r1!, {r7-r9,lr} - subs r12, r12, #1<<16 - - mode2_4pix2_0 r7 - stmia r0!, {r3-r6} - mode2_4pix2_0 r8 - stmia r0!, {r3-r6} - mode2_4pix2_0 r9 - stmia r0!, {r3-r6} - mode2_4pix_to3 lr, 0 - stmia r0!, {r3-r5} - bpl .loop_c2_32c_0 - - sub r12, r12, #1 - adds r12, r12, #1<<16 - ldmeqfd sp!, {r4-r11,pc} @ return -.if BORDER_R - add r0, r0, #BORDER_R*4 -.endif - add r1, r1, #64+8 - orr r12, #(240/15-1)<<16 - b .loop_c2_32c_0 - - -.global vidConvCpy_center2_32c_180 @ void *to, void *from, void *pal, int lines - -vidConvCpy_center2_32c_180: - stmfd sp!, {r4-r11,lr} - - mov r10, #0xfc - orr r10, r10, lsl #8 - orr r10, r10, lsl #8 - mov r11, #0xff - - mov r4, #328 - mla r1, r3, r4, r1 -@ add r1, r1, #0x11000 -@ add r1, r1, #0x00f00 @ #328*224 - - mov r12, #(240/15-1)<<16 - orr r12, r12, r3 - -.loop_c2_32c_180: - ldmdb r1!, {r7-r9,lr} - subs r12, r12, #1<<16 - - mode2_4pix2_180 lr - stmia r0!, {r3-r6} - mode2_4pix2_180 r9 - stmia r0!, {r3-r6} - mode2_4pix2_180 r8 - stmia r0!, {r3-r6} - mode2_4pix_to3 r7, 1 - stmia r0!, {r3-r5} - bpl .loop_c2_32c_180 - - sub r12, r12, #1 - adds r12, r12, #1<<16 - ldmeqfd sp!, {r4-r11,pc} @ return -.if BORDER_R - add r0, r0, #BORDER_R*4 -.endif - sub r1, r1, #64+8 - orr r12, #(240/15-1)<<16 - b .loop_c2_32c_180 - - -@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ - - -.global vidClear @ void *to, int lines - -vidClear: - stmfd sp!, {lr} - mov r12, #240/16-1 - orr r12, r1, r12, lsl #16 - mov r1, #0 - mov r2, #0 - mov r3, #0 - mov lr, #0 - -.loopVidClear: - subs r12, r12, #1<<16 - - stmia r0!, {r1-r3,lr} - stmia r0!, {r1-r3,lr} - stmia r0!, {r1-r3,lr} - stmia r0!, {r1-r3,lr} - bpl .loopVidClear - - sub r12, r12, #1 - adds r12, r12, #1<<16 - ldmeqfd sp!, {pc} @ return -.if BORDER_R - add r0, r0, #BORDER_R*4 -.endif - orr r12, #(240/16-1)<<16 - b .loopVidClear - -@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ - -.equ EExecSetExceptionHandler, (90) - -.global my_SetExceptionHandler - -my_SetExceptionHandler: - mov ip, lr - swi EExecSetExceptionHandler - diff --git a/platform/uiq3/engine/debug.cpp b/platform/uiq3/engine/debug.cpp deleted file mode 100644 index 46725f3c..00000000 --- a/platform/uiq3/engine/debug.cpp +++ /dev/null @@ -1,270 +0,0 @@ - -#include // RDebug -#include "debug.h" - -//#define LOG_FILE "C:\\logs\\pico.log" -#define LOG_FILE _L("D:\\pico.log") - -#ifdef __WINS__ - -void ExceptionHandler(TExcType exc) {} - -#else - -static const wchar_t * const exception_names[] = { - L"General", - L"IntegerDivideByZero", - L"SingleStep", - L"BreakPoint", - L"IntegerOverflow", - L"BoundsCheck", - L"InvalidOpCode", - L"DoubleFault", - L"StackFault", - L"AccessViolation", - L"PrivInstruction", - L"Alignment", - L"PageFault", - L"FloatDenormal", - L"FloatDivideByZero", - L"FloatInexactResult", - L"FloatInvalidOperation", - L"FloatOverflow", - L"FloatStackCheck", - L"FloatUnderflow", - L"Abort", - L"Kill", - L"DataAbort", - L"CodeAbort", - L"MaxNumber", - L"InvalidVector", - L"UserInterrupt", - L"Unknown" -}; - - -#if 0 -static void getASpace(TUint *code_start, TUint *code_end, TUint *stack_start, TUint *stack_end) -{ - TUint pc, sp; - RChunk chunk; - TFullName chunkname; - TFindChunk findChunk(_L("*")); - - asm volatile ("str pc, %0" : "=m" (pc) ); - asm volatile ("str sp, %0" : "=m" (sp) ); - - while( findChunk.Next(chunkname) != KErrNotFound ) { - chunk.Open(findChunk); - if((TUint)chunk.Base()+chunk.Bottom() < pc && pc < (TUint)chunk.Base()+chunk.Top()) { - if(code_start) *code_start = (TUint)chunk.Base()+chunk.Bottom(); - if(code_end) *code_end = (TUint)chunk.Base()+chunk.Top(); - } else - if((TUint)chunk.Base()+chunk.Bottom() < sp && sp < (TUint)chunk.Base()+chunk.Top()) { - if(stack_start) *stack_start = (TUint)chunk.Base()+chunk.Bottom(); - if(stack_end) *stack_end = (TUint)chunk.Base()+chunk.Top(); - } - chunk.Close(); - } -} -#endif - -// tmp -#if defined(__DEBUG_PRINT) -extern "C" char *PDebugMain(); -#endif - -// our very own exception handler -void ExceptionHandler(TExcType exc) -{ - DEBUGPRINT(_L("ExceptionHandler() called!!!")); // this seems to never be called - -#if 0 - TUint lr, sp, i; - TUint stack_end = 0; // ending address of our stack chunk - TUint code_start = 0, code_end = 0; // starting and ending addresses of our code chunk - TUint guessed_address = 0; - - asm volatile ("str lr, %0" : "=m" (lr) ); - asm volatile ("str sp, %0" : "=m" (sp) ); - - // first get some info about the chunks we live in - getASpace(&code_start, &code_end, 0, &stack_end); - - // now we begin some black magic tricks - // we go up our stack until we pass our caller address - for(; sp < stack_end; sp += 4) - if(*(TUint *)sp == lr) break; - - // there might be mirored caller address - for(i = sp + 4; i < sp + 0x300 && i < stack_end; i += 4) - if(*(TUint *)i == lr) { sp = i; break; } - - // aah, it is always 0x9c bytes away from the caller address in my firmware, - // don't know how to detect it in any other way - sp += 0x9c; - guessed_address = *(TUint *)sp; - - // output the info - TUint exec_show = exc; - if(exec_show > 27) exec_show = 27; - TPtrC ptrExc((TUint16 *) exception_names[exec_show]); - - RDebug::Print(_L("!!!Exception %i (%S) @ 0x%08x (guessed; relative=0x%08x)"), exc, &ptrExc, guessed_address, guessed_address - code_start); -#ifdef __DEBUG_PRINT_FILE - DEBUGPRINT( _L("!!!Exception %i (%S) @ 0x%08x (guessed; relative=0x%08x)"), exc, &ptrExc, guessed_address, guessed_address - code_start); -#endif - - TBuf<148> buff1; - TBuf<10> buff2; - buff1.Copy(_L(" guessed stack: ")); - - for(sp += 4, i = 0; i < 5 && sp < stack_end; sp += 4) { - if((*(TUint *)sp >> 28) == 5) { - if(i++) buff1.Append(_L(", ")); - buff2.Format(_L("0x%08x"), *(TUint *)sp); - buff1.Append(buff2); - } - else if(code_start < *(TUint *)sp && *(TUint *)sp < code_end) { - if(i++) buff1.Append(_L(", ")); - buff2.Format(_L("0x%08x"), *(TUint *)sp); - buff1.Append(buff2); - buff1.Append(_L(" (")); - buff2.Format(_L("0x%08x"), *(TUint *)sp - code_start); - buff1.Append(buff2); - buff1.Append(_L(")")); - } - } - RDebug::Print(_L("%S"), &buff1); -#ifdef __DEBUG_PRINT_FILE - DEBUGPRINT(_L("%S"), &buff1); -#endif - - // tmp -#if defined(__DEBUG_PRINT) - char *ps, *cstr = PDebugMain(); - for(ps = cstr; *ps; ps++) { - if(*ps == '\n') { - *ps = 0; - lprintf(cstr); - cstr = ps+1; - } - } -#endif - -// RDebug::Print(_L("Stack dump:")); -// asm volatile ("str sp, %0" : "=m" (sp) ); -// for(TUint i = sp+0x400; i >= sp-16; i-=4) -// RDebug::Print(_L("%08x: %08x"), i, *(int *)i); - - // more descriptive replacement of "KERN-EXEC 3" panic - buff1.Format(_L("K-EX3: %S"), &ptrExc); - User::Panic(buff1, exc); -#endif -} - -#endif // ifdef __WINS__ - - -#if 1 // def __DEBUG_PRINT_C - #include // va_* - #include // vsprintf - - // debug print from c code - extern "C" void lprintf(const char *format, ...) - { - va_list args; - char buffer[512]; - int len; - - va_start(args,format); - len = vsprintf(buffer,format,args); - va_end(args); - if (buffer[len-1] == '\n') - buffer[len-1] = 0; - - DEBUGPRINT(_L("%S"), DO_CONV(buffer)); - } -#endif - - -#if defined(__DEBUG_PRINT) || defined(__WINS__) - -#ifndef __DLL__ - // c string dumper for RDebug::Print() - static TBuf<1024> sTextBuffer; - TDesC* DO_CONV(const char* s) - { - TPtrC8 text8((TUint8*) (s)); - sTextBuffer.Copy(text8); - return &sTextBuffer; - } -#endif - -#ifdef __DEBUG_PRINT_FILE - #include - - //static RFile logFile; -// static TBool logInited = 0; - RMutex logMutex; - - static void debugPrintFileInit() - { - // try to open - logMutex.CreateLocal(); - /*RFs fserv; - fserv.Connect(); - RFile logFile; - logFile.Replace(fserv, LOG_FILE, EFileWrite|EFileShareAny); - logFile.Close(); - fserv.Close();*/ - } - - // debug print to file - void debugPrintFile(TRefByValue aFmt, ...) - { - if (logMutex.Handle() <= 0) debugPrintFileInit(); - - logMutex.Wait(); - RFs fserv; - fserv.Connect(); - - TTime now; now.UniversalTime(); - TBuf<512> tmpBuff; - TBuf8<512> tmpBuff8; - TInt size, res; - - RThread thisThread; - RFile logFile; - res = logFile.Open(fserv, LOG_FILE, EFileWrite|EFileShareAny); - if(res) goto fail1; - - logFile.Size(size); logFile.Seek(ESeekStart, size); - - now.FormatL(tmpBuff, _L("%H:%T:%S.%C: ")); - tmpBuff8.Copy(tmpBuff); - logFile.Write(tmpBuff8); - - tmpBuff8.Format(TPtr8((TUint8 *)"%03i: ", 6, 6), (TInt32) thisThread.Id()); - logFile.Write(tmpBuff8); - - VA_LIST args; - VA_START(args, aFmt); - tmpBuff.FormatList(aFmt, args); - VA_END(args); - tmpBuff8.Copy(tmpBuff); - logFile.Write(tmpBuff8); - - logFile.Write(TPtrC8((TUint8 const *) "\n")); - logFile.Flush(); - logFile.Close(); - fail1: - thisThread.Close(); - fserv.Close(); - - logMutex.Signal(); - } -#endif - -#endif - diff --git a/platform/uiq3/engine/debug.h b/platform/uiq3/engine/debug.h deleted file mode 100644 index fb62cf6c..00000000 --- a/platform/uiq3/engine/debug.h +++ /dev/null @@ -1,27 +0,0 @@ -#include - -#define __DEBUG_PRINT_C -#define __DEBUG_PRINT_FILE - -#if defined(__DEBUG_PRINT) || defined(__WINS__) - #include // RDebug - #ifdef __DEBUG_PRINT_FILE - void debugPrintFile(TRefByValue aFmt, ...); - #define DEBUGPRINT debugPrintFile - #else - #define DEBUGPRINT RDebug::Print - #endif - TDesC* DO_CONV(const char* s); - #ifdef __DEBUG_PRINT_C - #ifdef __cplusplus - extern "C" - #endif - void lprintf(const char *format, ...); - #endif -#else - #define DEBUGPRINT(x...) - #undef __DEBUG_PRINT_C - #undef __DEBUG_PRINT_FILE -#endif - -void ExceptionHandler(TExcType exc); diff --git a/platform/uiq3/engine/main.cpp b/platform/uiq3/engine/main.cpp deleted file mode 100644 index 66fee338..00000000 --- a/platform/uiq3/engine/main.cpp +++ /dev/null @@ -1,921 +0,0 @@ -// mainloop with window server event handling -// event polling mechnism was taken from -// Peter van Sebille's projects - -// (c) Copyright 2006, notaz -// All Rights Reserved - -#include -#include -#include -#include - -#include -#include -#include - -#include "debug.h" -#include "../Engine.h" - -#include -#include "../../common/emu.h" -#include "../emu.h" -#include "vid.h" -#include "PolledAS.h" -//#include "audio.h" -#include "audio_mediaserver.h" - -//#include -#include - - -//#define BENCHMARK - - -// scancodes we care about -enum TUsedScanCodes { - EStdKeyM600JogUp = EStdKeyDevice1, - EStdKeyM600JogDown = EStdKeyDevice2, -}; - -static unsigned char keyFlags[256]; // lsb->msb: key_down, pulse_only, ?, ?, ?, ?, not_configurable, disabled -static unsigned char pressedKeys[11]; // List of pressed key scancodes, up to 10 - -// list of areas -TPicoAreaConfigEntry areaConfig[] = { - { TRect( 0, 0, 0, 0) }, - // small corner bottons - { TRect( 0, 0, 15, 15) }, - { TRect(224, 0, 239, 15) }, - { TRect( 0, 304, 15, 319) }, - { TRect(224, 304, 239, 319) }, - // normal buttons - { TRect( 0, 0, 79, 63) }, - { TRect( 80, 0, 159, 63) }, - { TRect(160, 0, 239, 63) }, - { TRect( 0, 64, 79, 127) }, - { TRect( 80, 64, 159, 127) }, - { TRect(160, 64, 239, 127) }, - { TRect( 0, 128, 79, 191) }, - { TRect( 80, 128, 159, 191) }, - { TRect(160, 128, 239, 191) }, - { TRect( 0, 192, 79, 255) }, - { TRect( 80, 192, 159, 255) }, - { TRect(160, 192, 239, 255) }, - { TRect( 0, 256, 79, 319) }, - { TRect( 80, 256, 159, 319) }, - { TRect(160, 256, 239, 319) }, - { TRect( 0, 0, 0, 0) } -}; - -// PicoPad[] format: SACB RLDU -const char *actionNames[] = { - "UP", "DOWN", "LEFT", "RIGHT", "B", "C", "A", "START", - 0, 0, 0, 0, 0, 0, 0, 0, // Z, Y, X, MODE (enabled only when needed), ?, ?, ?, ? - 0, 0, 0, 0, "VOLUME@UP", "VOLUME@DOWN", "NEXT@SAVE@SLOT", "PREV@SAVE@SLOT", // ?, ?, ?, ?, vol_up, vol_down, next_slot, prev_slot - 0, 0, "PAUSE@EMU", "SAVE@STATE", "LOAD@STATE", 0, 0, "DONE" // ?, switch_renderer, [...], "FRAMESKIP@8", "AUTO@FRAMESKIP" -}; - - -// globals are allowed, so why not to (ab)use them? -//TInt machineUid = 0; -int gamestate = PGS_Paused, gamestate_next = PGS_Paused; -char *loadrom_fname = NULL; -int loadrom_result = 0; -static timeval noticeMsgTime = { 0, 0 }; // when started showing -static CGameAudioMS *gameAudio = 0; // the audio object itself -static int reset_timing = 0; -static int pico_was_reset = 0; -extern RSemaphore initSemaphore; -extern RSemaphore pauseSemaphore; -extern RSemaphore loadWaitSemaphore; - -// some forward declarations -static void MainInit(); -static void MainExit(); -static void DumpMemInfo(); - - -class TPicoDirectScreenAccess : public MDirectScreenAccess -{ -public: // implements MDirectScreenAccess - void Restart(RDirectScreenAccess::TTerminationReasons aReason); -public: // implements MAbortDirectScreenAccess - void AbortNow(RDirectScreenAccess::TTerminationReasons aReason); -}; - - -// just for a nicer grouping of WS related stuff -class CGameWindow -{ -public: - static void ConstructResourcesL(void); - static void FreeResources(void); - static void DoKeys(void); - static void DoKeysConfig(TUint &which); - static void RunEvents(TUint32 which); - - static RWsSession* iWsSession; - static RWindowGroup iWsWindowGroup; - static RWindow iWsWindow; - static CWsScreenDevice* iWsScreen; - static CWindowGc* iWindowGc; - static TRequestStatus iWsEventStatus; -// static TThreadId iLauncherThreadId; -// static RDirectScreenAccess* iDSA; -// static TRequestStatus iDSAstatus; - static TPicoDirectScreenAccess iPDSA; - static CDirectScreenAccess* iDSA; -}; - - -static void updateSound(int len) -{ - PsndOut = gameAudio->NextFrameL(len); - if(!PsndOut) { // sound output problems? - strcpy(noticeMsg, "SOUND@OUTPUT@ERROR;@SOUND@DISABLED"); - gettimeofday(¬iceMsgTime, 0); - } -} - - -static void SkipFrame(void) -{ - PicoSkipFrame=1; - PicoFrame(); - PicoSkipFrame=0; -} - - -static void simpleWait(int thissec, int lim_time) -{ - struct timeval tval; - int sleep = 0; - - gettimeofday(&tval, 0); - if(thissec != tval.tv_sec) tval.tv_usec+=1000000; - - sleep = lim_time - tval.tv_usec - 2000; - if (sleep > 0) { -// User::After((sleep = lim_time - tval.tv_usec)); - User::AfterHighRes(sleep); - } -} - - -static void TargetEpocGameL() -{ - char buff[24]; // fps count c string - struct timeval tval; // timing - int thissec = 0, frames_done = 0, frames_shown = 0; - int target_fps, target_frametime; - int i, lim_time; - - MainInit(); - buff[0] = 0; - - // try to start pico - DEBUGPRINT(_L("PicoInit()")); - PicoInit(); - PicoDrawSetColorFormat(2); - PicoWriteSound = updateSound; - - // loop? - for(;;) - { - if (gamestate == PGS_Running) - { - #ifdef __DEBUG_PRINT - TInt mem, cells = User::CountAllocCells(); - User::AllocSize(mem); - DEBUGPRINT(_L("worker: cels=%d, size=%d KB"), cells, mem/1024); - #endif - - // switch context to other thread - User::After(50000); - // prepare window and stuff - CGameWindow::ConstructResourcesL(); - - // if the system has something to do, it should better do it now - User::After(50000); - //CPolledActiveScheduler::Instance()->Schedule(); - - // pal/ntsc might have changed, reset related stuff - if(Pico.m.pal) { - target_fps = 50; - if(!noticeMsgTime.tv_sec) strcpy(noticeMsg, "PAL@SYSTEM@/@50@FPS"); - } else { - target_fps = 60; - if(!noticeMsgTime.tv_sec) strcpy(noticeMsg, "NTSC@SYSTEM@/@60@FPS"); - } - target_frametime = 1000000/target_fps; - if (!noticeMsgTime.tv_sec && pico_was_reset) - gettimeofday(¬iceMsgTime, 0); - - // prepare CD buffer - if (PicoAHW & PAHW_MCD) PicoCDBufferInit(); - - pico_was_reset = 0; - reset_timing = 1; - - while (gamestate == PGS_Running) - { - gettimeofday(&tval, 0); - if(reset_timing) { - reset_timing = 0; - thissec = tval.tv_sec; - frames_done = tval.tv_usec/target_frametime; - } - - // show notice message? - char *notice = 0; - if(noticeMsgTime.tv_sec) { - if((tval.tv_sec*1000000+tval.tv_usec) - (noticeMsgTime.tv_sec*1000000+noticeMsgTime.tv_usec) > 2000000) // > 2.0 sec - noticeMsgTime.tv_sec = noticeMsgTime.tv_usec = 0; - else notice = noticeMsg; - } - - // second changed? - if (thissec != tval.tv_sec) - { -#ifdef BENCHMARK - static int bench = 0, bench_fps = 0, bench_fps_s = 0, bfp = 0, bf[4]; - if(++bench == 10) { - bench = 0; - bench_fps_s = bench_fps; - bf[bfp++ & 3] = bench_fps; - bench_fps = 0; - } - bench_fps += frames_shown; - sprintf(buff, "%02i/%02i/%02i", frames_shown, bench_fps_s, (bf[0]+bf[1]+bf[2]+bf[3])>>2); -#else - if (currentConfig.EmuOpt & EOPT_SHOW_FPS) - sprintf(buff, "%02i/%02i", frames_shown, frames_done); -#endif - - - thissec = tval.tv_sec; - - if(PsndOut == 0 && currentConfig.Frameskip >= 0) { - frames_done = frames_shown = 0; - } else { - // it is quite common for this implementation to leave 1 fame unfinished - // when second changes, but we don't want buffer to starve. - if(PsndOut && frames_done < target_fps && frames_done > target_fps-5) { - SkipFrame(); frames_done++; - } - - frames_done -= target_fps; if (frames_done < 0) frames_done = 0; - frames_shown -= target_fps; if (frames_shown < 0) frames_shown = 0; - if (frames_shown > frames_done) frames_shown = frames_done; - } - User::ResetInactivityTime(); - } - - - lim_time = (frames_done+1) * target_frametime; - if (currentConfig.Frameskip >= 0) // frameskip enabled - { - for (i = 0; i < currentConfig.Frameskip && gamestate == PGS_Running; i++) - { - CGameWindow::DoKeys(); - SkipFrame(); frames_done++; - if (PsndOut) { // do framelimitting if sound is enabled - gettimeofday(&tval, 0); - if(thissec != tval.tv_sec) tval.tv_usec+=1000000; - if(tval.tv_usec < lim_time) { // we are too fast - simpleWait(thissec, lim_time); - } - } - lim_time += target_frametime; - } - } - else if(tval.tv_usec > lim_time) { // auto frameskip - // no time left for this frame - skip - CGameWindow::DoKeys(); - SkipFrame(); frames_done++; - continue; - } - - // we might have lost focus already - if (gamestate != PGS_Running) break; - - CGameWindow::DoKeys(); - PicoFrame(); - - // check time - gettimeofday(&tval, 0); - if(thissec != tval.tv_sec) tval.tv_usec+=1000000; - - // sleep if we are still too fast - if(PsndOut != 0 || currentConfig.Frameskip < 0) - { - // TODO: check if User::After() is accurate - gettimeofday(&tval, 0); - if(thissec != tval.tv_sec) tval.tv_usec+=1000000; - if(tval.tv_usec < lim_time) - { - // we are too fast - simpleWait(thissec, lim_time); - } - } - - CPolledActiveScheduler::Instance()->Schedule(); - - if (gamestate != PGS_Paused) - vidDrawFrame(notice, buff, frames_shown); - - frames_done++; frames_shown++; - } // while - - if (PicoAHW & PAHW_MCD) PicoCDBufferFree(); - - // save SRAM - if ((currentConfig.EmuOpt & EOPT_EN_SRAM) && SRam.changed) { - emu_save_load_game(0, 1); - SRam.changed = 0; - } - CPolledActiveScheduler::Instance()->Schedule(); - CGameWindow::FreeResources(); - } - else if(gamestate == PGS_Reset) - { - PicoReset(); - pico_was_reset = 1; - gamestate = PGS_Running; - } - else if(gamestate == PGS_ReloadRom) - { - loadrom_result = emu_reload_rom(loadrom_fname); - pico_was_reset = 1; - if (loadrom_result) - gamestate = PGS_Running; - else { - extern char menuErrorMsg[]; - gamestate = PGS_Paused; - lprintf("%s\n", menuErrorMsg); - } - DEBUGPRINT(_L("done loading ROM, retval=%i"), loadrom_result); - loadWaitSemaphore.Signal(); - User::After(50000); - } - else if(gamestate == PGS_Paused) { - DEBUGPRINT(_L("pausing..")); - pauseSemaphore.Wait(); - } - else if(gamestate == PGS_KeyConfig) - { - // switch context to other thread - User::After(50000); - // prepare window and stuff - CGameWindow::ConstructResourcesL(); - - TUint whichAction = 0; - while(gamestate == PGS_KeyConfig) { - CGameWindow::DoKeysConfig(whichAction); - CPolledActiveScheduler::Instance()->Schedule(); - if (gamestate != PGS_Paused) - vidKeyConfigFrame(whichAction); - User::After(150000); - } - - emu_write_config(0); - CGameWindow::FreeResources(); - } else if(gamestate == PGS_Quit) { - break; - } - } - - // this thread has to close it's own handles, - // other one will crash trying to do that - PicoExit(); - - MainExit(); -} - - -// main initialization -static void MainInit() -{ - DEBUGPRINT(_L("\r\n\r\nstarting..")); - - DEBUGPRINT(_L("CPolledActiveScheduler::NewL()")); - CPolledActiveScheduler::NewL(); // create Polled AS for the sound engine - -// HAL::Get(HALData::EMachineUid, machineUid); // find out the machine UID - - DumpMemInfo(); - -// if (pauseSemaphore.Handle() <= 0) -// pauseSemaphore.CreateLocal(0); - DEBUGPRINT(_L("initSemaphore.Signal()")); - initSemaphore.Signal(); -} - - -// does not return -static void MainExit() -{ - RThread thisThread; - - DEBUGPRINT(_L("%i: cleaning up.."), (TInt32) thisThread.Id()); - -// pauseSemaphore.Close(); - - if(gameAudio) delete gameAudio; - - // Polled AS - delete CPolledActiveScheduler::Instance(); -} - -static void DumpMemInfo() -{ - TInt ramSize, ramSizeFree, romSize; - - HAL::Get(HALData::EMemoryRAM, ramSize); - HAL::Get(HALData::EMemoryRAMFree, ramSizeFree); - HAL::Get(HALData::EMemoryROM, romSize); - - DEBUGPRINT(_L("ram=%dKB, ram_free=%dKB, rom=%dKB"), ramSize/1024, ramSizeFree/1024, romSize/1024); -} - - -extern "C" TInt my_SetExceptionHandler(TInt, TExceptionHandler, TUint32); - -TInt EmuThreadFunction(TAny*) -{ - TInt ret; - const TUint32 exs = KExceptionAbort|KExceptionKill|KExceptionUserInterrupt|KExceptionFpe|KExceptionFault|KExceptionInteger|KExceptionDebug; - - DEBUGPRINT(_L("EmuThreadFunction(), def ExceptionHandler %08x, my %08x"), - User::ExceptionHandler(), ExceptionHandler); - User::SetJustInTime(1); - ret = User::SetExceptionHandler(ExceptionHandler, exs/*(TUint32) -1*/); // does not work :( - // my_SetExceptionHandler(KCurrentThreadHandle, ExceptionHandler, 0xffffffff); - DEBUGPRINT(_L("SetExceptionHandler %i, %08x"), ret, User::ExceptionHandler()); - User::ModifyExceptionMask(0, exs); - - //TInt pc, sp; - //asm volatile ("str pc, %0" : "=m" (pc) ); - //asm volatile ("str sp, %0" : "=m" (sp) ); - //RDebug::Print(_L("executing @ 0x%08x, sp=0x%08x"), pc, sp); - -/* - RDebug::Print(_L("Base Bottom Top Size RW Name")); - TBuf<4> l_r(_L("R")), l_w(_L("W")), l_d(_L("-")); - RChunk chunk; - TFullName chunkname; - TFindChunk findChunk(_L("*")); - while( findChunk.Next(chunkname) != KErrNotFound ) { - chunk.Open(findChunk); - 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); - chunk.Close(); - } -*/ - - // can't do that, will crash here -// if(cleanup) { -// DEBUGPRINT(_L("found old CTrapCleanup, deleting..")); -// delete cleanup; -// } - - CTrapCleanup *cleanup = CTrapCleanup::New(); - - TRAPD(error, TargetEpocGameL()); - - __ASSERT_ALWAYS(!error, User::Panic(_L("PicoDrive"), error)); - delete cleanup; - - DEBUGPRINT(_L("exitting..")); - return 1; -} - - -void TPicoDirectScreenAccess::Restart(RDirectScreenAccess::TTerminationReasons aReason) -{ - DEBUGPRINT(_L("TPicoDirectScreenAccess::Restart(%i)"), aReason); - -// if (CGameWindow::iDSA) { -// TRAPD(error, CGameWindow::iDSA->StartL()); -// if (error) DEBUGPRINT(_L("iDSA->StartL() error: %i"), error); -// } -} - - -void TPicoDirectScreenAccess::AbortNow(RDirectScreenAccess::TTerminationReasons aReason) -{ - DEBUGPRINT(_L("TPicoDirectScreenAccess::AbortNow(%i)"), aReason); - - // the WS wants us to stop, so let's obey - gamestate = PGS_Paused; -} - - -void CGameWindow::ConstructResourcesL() -{ - DEBUGPRINT(_L("ConstructResourcesL()")); - // connect to window server - // tried to create it globally and not re-connect everytime, - // but my window started to lose focus strangely - iWsSession = new(ELeave) RWsSession(); - User::LeaveIfError(iWsSession->Connect()); - - // * Tell the Window Server not to mess about with our process priority - // * Also, because of the way legacy games are written, they never sleep - // * and thus never voluntarily yield the CPU. We set our process priority - // * to EPriorityForeground and hope that a Telephony application on - // * this device runs at EPriorityForeground as well. If not, tough! ;-) - - iWsSession->ComputeMode(RWsSession::EPriorityControlDisabled); - RProcess me; - me.SetPriority(EPriorityForeground); - - iWsScreen = new(ELeave) CWsScreenDevice(*iWsSession); - User::LeaveIfError(iWsScreen->Construct()); -// User::LeaveIfError(iWsScreen->CreateContext(iWindowGc)); - - iWsWindowGroup = RWindowGroup(*iWsSession); - User::LeaveIfError(iWsWindowGroup.Construct((TUint32)&iWsWindowGroup)); - //iWsWindowGroup.SetOrdinalPosition(0); - //iWsWindowGroup.SetName(KServerWGName); - iWsWindowGroup.EnableScreenChangeEvents(); // flip events (EEventScreenDeviceChanged) - iWsWindowGroup.EnableFocusChangeEvents(); // EEventFocusGroupChanged - iWsWindowGroup.SetOrdinalPosition(0, 1); // TInt aPos, TInt aOrdinalPriority - - iWsWindow=RWindow(*iWsSession); - User::LeaveIfError(iWsWindow.Construct(iWsWindowGroup, (TUint32)&iWsWindow)); - iWsWindow.SetSize(iWsScreen->SizeInPixels()); - iWsWindow.PointerFilter(EPointerFilterDrag, 0); - iWsWindow.SetPointerGrab(ETrue); - iWsWindow.SetVisible(ETrue); - iWsWindow.Activate(); - -#if 0 - // request access through RDirectScreenAccess api, but don't care about the result - // hangs? - RRegion *dsa_region = 0; - iDSA = new(ELeave) RDirectScreenAccess(*iWsSession); - if(iDSA->Construct() == KErrNone) - iDSA->Request(dsa_region, iDSAstatus, iWsWindow); - DEBUGPRINT(_L("DSA: %i"), dsa_region ? dsa_region->Count() : -1); -#endif - - TInt ret; - - // request access through CDirectScreenAccess - iDSA = CDirectScreenAccess::NewL(*iWsSession, *iWsScreen, iWsWindow, iPDSA); - - // now get the screenbuffer - TScreenInfoV01 screenInfo; - TPckg sI(screenInfo); - UserSvr::ScreenInfo(sI); - - if(!screenInfo.iScreenAddressValid) - User::Leave(KErrNotSupported); - - DEBUGPRINT(_L("framebuffer=0x%08x (%dx%d)"), screenInfo.iScreenAddress, - screenInfo.iScreenSize.iWidth, screenInfo.iScreenSize.iHeight); - - // vidInit - DEBUGPRINT(_L("vidInit()")); - ret = vidInit((void *)screenInfo.iScreenAddress, 0); - DEBUGPRINT(_L("vidInit() done (%i)"), ret); - - User::LeaveIfError(ret); - - memset(keyFlags, 0, 256); - keyFlags[EStdKeyM600JogUp] = keyFlags[EStdKeyM600JogDown] = 2; // add "pulse only" for jog up/down - keyFlags[EStdKeyOff] = 0x40; // not configurable - - // try to start the audio engine - static int PsndRate_old = 0, PicoOpt_old = 0, pal_old = 0; - - if (gamestate == PGS_Running && (currentConfig.EmuOpt & EOPT_EN_SOUND)) - { - TInt err = 0; - if(PsndRate != PsndRate_old || (PicoOpt&11) != (PicoOpt_old&11) || Pico.m.pal != pal_old) { - // if rate changed, reset all enabled chips, else reset only those chips, which were recently enabled - //sound_reset(PsndRate != PsndRate_old ? PicoOpt : (PicoOpt&(PicoOpt^PicoOpt_old))); - PsndRerate(1); - } - if(!gameAudio || PsndRate != PsndRate_old || ((PicoOpt&8) ^ (PicoOpt_old&8)) || Pico.m.pal != pal_old) { // rate or stereo or pal/ntsc changed - if(gameAudio) delete gameAudio; gameAudio = 0; - DEBUGPRINT(_L("starting audio: %i len: %i stereo: %i, pal: %i"), PsndRate, PsndLen, PicoOpt&8, Pico.m.pal); - TRAP(err, gameAudio = CGameAudioMS::NewL(PsndRate, (PicoOpt&8) ? 1 : 0, - Pico.m.pal ? 50 : 60, currentConfig.volume)); - } - if( gameAudio) { - TRAP(err, PsndOut = gameAudio->ResumeL()); - } - if(err) { - if(gameAudio) delete gameAudio; - gameAudio = 0; - PsndOut = 0; - strcpy(noticeMsg, "SOUND@STARTUP@FAILED"); - gettimeofday(¬iceMsgTime, 0); - } - PsndRate_old = PsndRate; - PicoOpt_old = PicoOpt; - pal_old = Pico.m.pal; - } else { - if(gameAudio) delete gameAudio; - gameAudio = 0; - PsndOut = 0; - } - - CPolledActiveScheduler::Instance()->Schedule(); - - // start key WS event polling - iWsSession->EventReady(&iWsEventStatus); - - iWsSession->Flush(); // check: short hang in UIQ2 - User::After(1); - - // I don't know why but the Window server sometimes hangs completely (hanging the phone too) after calling StartL() - // Is this a sync broblem? weird bug? - TRAP(ret, iDSA->StartL()); - if (ret) DEBUGPRINT(_L("iDSA->StartL() error: %i"), ret); - -// User::After(1); -// CPolledActiveScheduler::Instance()->Schedule(); - - DEBUGPRINT(_L("CGameWindow::ConstructResourcesL() finished.")); -} - -// this may be run even if there is nothing to free -void CGameWindow::FreeResources() -{ - if(gameAudio) gameAudio->Pause(); - - //DEBUGPRINT(_L("CPolledActiveScheduler::Instance(): %08x"), CPolledActiveScheduler::Instance()); - if(CPolledActiveScheduler::Instance()) - CPolledActiveScheduler::Instance()->Schedule(); - -#if 0 - // free RDirectScreenAccess stuff (seems to be deleted automatically after crash?) - if(iDSA) { - iDSA->Cancel(); - iDSA->Close(); - delete iDSA; - } - iDSA = NULL; -#endif - if(iDSA) delete iDSA; - iDSA = 0; - - if(iWsSession->WsHandle() > 0 && iWsEventStatus != KRequestPending) // TODO: 2 UIQ2 (?) - iWsSession->EventReadyCancel(); - - if(iWsWindow.WsHandle() > 0) - iWsWindow.Close(); - - if(iWsWindowGroup.WsHandle() > 0) - iWsWindowGroup.Close(); - - // these must be deleted before calling iWsSession->Close() - if(iWsScreen) { - delete iWsScreen; - iWsScreen = NULL; - } - - if(iWsSession->WsHandle() > 0) { - iWsSession->Close(); - delete iWsSession; - } - - vidFree(); -} - - -void CGameWindow::DoKeys(void) -{ - TWsEvent iWsEvent; - TInt iWsEventType; - unsigned long allActions = 0; - static unsigned long areaActions = 0, forceUpdate = 0; - int i, nEvents; - - for(nEvents = 0; iWsEventStatus != KRequestPending; nEvents++) - { - iWsSession->GetEvent(iWsEvent); - iWsEventType = iWsEvent.Type(); - - // pointer events? - if(iWsEventType == EEventPointer) { - if(iWsEvent.Pointer()->iType == TPointerEvent::EButton1Up) { - areaActions = 0; // remove all directionals - } else { // if(iWsEvent.Pointer()->iType == TPointerEvent::EButton1Down) { - TPoint p = iWsEvent.Pointer()->iPosition; - const TPicoAreaConfigEntry *e = areaConfig + 1; - for(i = 0; !e->rect.IsEmpty(); e++, i++) - if(e->rect.Contains(p)) { - areaActions = currentConfig.KeyBinds[i+256]; - break; - } - //DEBUGPRINT(_L("pointer event: %i %i"), p.iX, p.iY); - } - } - else if(iWsEventType == EEventKeyDown || iWsEventType == EEventKeyUp) { - TInt iScanCode = iWsEvent.Key()->iScanCode; - //DEBUGPRINT(_L("key event: 0x%02x"), iScanCode); - - if(iScanCode < 256) - { - if(iWsEventType == EEventKeyDown) { - keyFlags[iScanCode] |= 1; - for(i=0; i < 10; i++) { - if( pressedKeys[i] == (TUint8) iScanCode) break; - if(!pressedKeys[i]) { pressedKeys[i] = (TUint8) iScanCode; break; } - } - } else if(!(keyFlags[iScanCode]&2)) { - keyFlags[iScanCode] &= ~1; - for(i=0; i < 10; i++) { - if(pressedKeys[i] == (TUint8) iScanCode) { pressedKeys[i] = 0; break; } - } - } - - // power? - if(iScanCode == EStdKeyOff) gamestate = PGS_Paused; - } else { - DEBUGPRINT(_L("weird scancode: 0x%02x"), iScanCode); - } - } - else if(iWsEventType == EEventScreenDeviceChanged) { - // ??? - //User::After(500000); - //reset_timing = 1; - DEBUGPRINT(_L("EEventScreenDeviceChanged, focus: %i, our: %i"), - iWsSession->GetFocusWindowGroup(), iWsWindowGroup.Identifier()); - } - else if(iWsEventType == EEventFocusGroupChanged) { - TInt focusGrpId = iWsSession->GetFocusWindowGroup(); - DEBUGPRINT(_L("EEventFocusGroupChanged: %i, our: %i"), - focusGrpId, iWsWindowGroup.Identifier()); - // if it is not us and not launcher that got focus, pause emu - if(focusGrpId != iWsWindowGroup.Identifier()) - gamestate = PGS_Paused; - } - - iWsEventStatus = KRequestPending; - iWsSession->EventReady(&iWsEventStatus); - } - - if(nEvents || forceUpdate) { - allActions = areaActions; - forceUpdate = 0; - - // add all pushed button actions - for(i = 9; i >= 0; i--) { - int scan = pressedKeys[i]; - if(scan) { - if(keyFlags[scan] & 1) allActions |= currentConfig.KeyBinds[scan]; - if((keyFlags[scan]& 3)==3) forceUpdate = 1; - if(keyFlags[scan] & 2) keyFlags[scan] &= ~1; - } - } - - PicoPad[0] = (unsigned short) allActions; - if(allActions & 0xFFFF0000) { - RunEvents(allActions >> 16); - areaActions = 0; - } - } - - if (movie_data) emu_updateMovie(); -} - - -void CGameWindow::DoKeysConfig(TUint &which) -{ - TWsEvent iWsEvent; - int i; - - while(iWsEventStatus != KRequestPending) - { - TUint currentActCode = 1 << which; - - iWsSession->GetEvent(iWsEvent); - - // pointer events? - if(iWsEvent.Type() == EEventPointer) { - TPoint p = iWsEvent.Pointer()->iPosition; - TRect prev(56, 0, 120, 26); - TRect next(120, 0, 180, 26); - - if(iWsEvent.Pointer()->iType == TPointerEvent::EButton1Down) { - if(prev.Contains(p)) do { which = (which-1) & 0x1F; } while(!actionNames[which]); - else if(next.Contains(p)) do { which = (which+1) & 0x1F; } while(!actionNames[which]); - else if(which == 31) gamestate = PGS_Paused; // done - else { - const TPicoAreaConfigEntry *e = areaConfig + 1; - for(i = 0; e->rect != TRect(0,0,0,0); e++, i++) - if(e->rect.Contains(p)) { - currentConfig.KeyBinds[i+256] ^= currentActCode; - break; - } - } - } - } - else if(iWsEvent.Type() == EEventKeyDown || iWsEvent.Type() == EEventKeyUp) - { - TUint scan = (TUint) iWsEvent.Key()->iScanCode; - - // key events? - if(iWsEvent.Type() == EEventKeyDown) { - if(which == 31) { - gamestate = PGS_Paused; - } else if (scan < 256) { - if(!(keyFlags[scan]&0x40)) currentConfig.KeyBinds[scan] ^= currentActCode; - } - } - - // power? - if(iWsEvent.Key()->iScanCode == EStdKeyOff) gamestate = PGS_Paused; - } - else if(iWsEvent.Type() == EEventFocusGroupChanged) { - TInt focusGrpId = iWsSession->GetFocusWindowGroup(); - // if we lost focus, exit config mode - if(focusGrpId != iWsWindowGroup.Identifier()) - gamestate = PGS_Paused; - } - -// iWsEventStatus = KRequestPending; - iWsSession->EventReady(&iWsEventStatus); - } -} - - -void CGameWindow::RunEvents(TUint32 which) -{ - if (which & 0x4000) currentConfig.Frameskip = -1; - if (which & 0x2000) currentConfig.Frameskip = 8; - if (which & 0x1800) { // save or load (but not both) - if(PsndOut) gameAudio->Pause(); // this may take a while, so we pause sound output - - vidDrawNotice((which & 0x1000) ? "LOADING@GAME" : "SAVING@GAME"); - emu_save_load_game(which & 0x1000, 0); - - if(PsndOut) PsndOut = gameAudio->ResumeL(); - reset_timing = 1; - } - if (which & 0x0400) gamestate = PGS_Paused; - if (which & 0x0200) { // switch renderer - if (!(currentConfig.scaling == TPicoConfig::PMFit && - (currentConfig.rotation == TPicoConfig::PRot0 || currentConfig.rotation == TPicoConfig::PRot180))) - { - PicoOpt^=0x10; - vidInit(0, 1); - - strcpy(noticeMsg, (PicoOpt&0x10) ? "ALT@RENDERER" : "DEFAULT@RENDERER"); - gettimeofday(¬iceMsgTime, 0); - } - } - if(which & 0x00c0) { - if(which&0x0080) { - state_slot -= 1; - if(state_slot < 0) state_slot = 9; - } else { - state_slot += 1; - if(state_slot > 9) state_slot = 0; - } - sprintf(noticeMsg, "SAVE@SLOT@%i@SELECTED", state_slot); - gettimeofday(¬iceMsgTime, 0); - } - if ((which & 0x0030) && gameAudio != NULL) { - currentConfig.volume = gameAudio->ChangeVolume((which & 0x0010) ? 1 : 0); - sprintf(noticeMsg, "VOL@%02i@", currentConfig.volume); - gettimeofday(¬iceMsgTime, 0); - } -} - - -extern "C" void plat_status_msg(const char *format, ...) -{ - va_list vl; - char *p; - - va_start(vl, format); - vsnprintf(noticeMsg, sizeof(noticeMsg), fmt, vl); - va_end(vl); - - p = noticeMsg; - while (*p) { - if (*p == ' ') *p = '@'; - if (*p < '0' || *p > 'Z') { *p = 0; break; } - p++; - } - gettimeofday(¬iceMsgTime, 0); -} - -// static class members -RWsSession* CGameWindow::iWsSession; -RWindowGroup CGameWindow::iWsWindowGroup; -RWindow CGameWindow::iWsWindow; -CWsScreenDevice* CGameWindow::iWsScreen = NULL; -CWindowGc* CGameWindow::iWindowGc = NULL; -TRequestStatus CGameWindow::iWsEventStatus = KRequestPending; -//RDirectScreenAccess* CGameWindow::iDSA; -//TRequestStatus CGameWindow::iDSAstatus = KRequestPending; -TPicoDirectScreenAccess CGameWindow::iPDSA; -CDirectScreenAccess* CGameWindow::iDSA = NULL; - diff --git a/platform/uiq3/engine/polledas.cpp b/platform/uiq3/engine/polledas.cpp deleted file mode 100644 index 898f76e1..00000000 --- a/platform/uiq3/engine/polledas.cpp +++ /dev/null @@ -1,269 +0,0 @@ -/******************************************************************* - * - * File: PolledAS.cpp - * - * Author: Peter van Sebille (peter@yipton.net) - * - * (c) Copyright 2002, Peter van Sebille - * All Rights Reserved - * - *******************************************************************/ - -/* - * Oh Lord, forgive me for I have sinned. - * In their infinite wisdom, Symbian Engineers have decided that - * the Active Scheduler's queue of Active Objects is private - * and no getters are provided... sigh. - * This mere mortal will have to excercise the power of C pre-processor - * once more to circumvent the will of the gods. - */ - - -#include - -// from e32base.h -class CBase - { -public: - /** - Default constructor - */ - inline CBase() {} - IMPORT_C virtual ~CBase(); - inline TAny* operator new(TUint aSize, TAny* aBase) __NO_THROW { Mem::FillZ(aBase, aSize); return aBase; } - inline TAny* operator new(TUint aSize) __NO_THROW { return User::AllocZ(aSize); } - inline TAny* operator new(TUint aSize, TLeave) { return User::AllocZL(aSize); } - inline TAny* operator new(TUint aSize, TUint aExtraSize) { return User::AllocZ(aSize + aExtraSize); } - inline TAny* operator new(TUint aSize, TLeave, TUint aExtraSize) { return User::AllocZL(aSize + aExtraSize); } - IMPORT_C static void Delete(CBase* aPtr); -protected: - IMPORT_C virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1); -private: - CBase(const CBase&); - CBase& operator=(const CBase&); -private: - }; - - -class TRequestStatusFaked - { -public: - inline TRequestStatusFaked() : iFlags(0) {}; - inline TRequestStatusFaked(TInt aVal) : iStatus(aVal), iFlags(aVal==KRequestPending ? TRequestStatusFaked::ERequestPending : 0) {} -/* inline TInt operator=(TInt aVal); - inline TBool operator==(TInt aVal) const; -*/ - inline TBool operator!=(TInt aVal) const {return(iStatus!=aVal);} -/* - inline TBool operator>=(TInt aVal) const; - inline TBool operator<=(TInt aVal) const; - inline TBool operator>(TInt aVal) const; - inline TBool operator<(TInt aVal) const; - inline TInt Int() const; -private: -*/ - enum - { - EActive = 1, //bit0 - ERequestPending = 2, //bit1 - }; - TInt iStatus; - TUint iFlags; - friend class CActive; - friend class CActiveScheduler; - friend class CServer2; - }; - - -class CActive : public CBase - { -public: -enum TPriority - { - EPriorityIdle=-100, - EPriorityLow=-20, - EPriorityStandard=0, - EPriorityUserInput=10, - EPriorityHigh=20, - }; -public: - IMPORT_C ~CActive(); - IMPORT_C void Cancel(); - IMPORT_C void Deque(); - IMPORT_C void SetPriority(TInt aPriority); - inline TBool IsActive() const {return(iStatus.iFlags&TRequestStatus::EActive);} - inline TBool IsAdded() const {return(iLink.iNext!=NULL);} - inline TInt Priority() const {return iLink.iPriority;} -protected: - IMPORT_C CActive(TInt aPriority); - IMPORT_C void SetActive(); - virtual void DoCancel() =0; - virtual void RunL() =0; - IMPORT_C virtual TInt RunError(TInt aError); -protected: - IMPORT_C virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1); -public: - TRequestStatusFaked iStatus; // hope this will work -private: -// TBool iActive; - TPriQueLink iLink; - TAny* iSpare; - friend class CActiveScheduler; - friend class CServer; - friend class CServer2; - friend class CPrivatePolledActiveScheduler; // added - }; - - - -class CActiveScheduler : public CBase - { - friend class CActiveSchedulerWait; -public: - struct TLoop; - typedef TLoop* TLoopOwner; -public: - IMPORT_C CActiveScheduler(); - IMPORT_C ~CActiveScheduler(); - IMPORT_C static void Install(CActiveScheduler* aScheduler); - IMPORT_C static CActiveScheduler* Current(); - IMPORT_C static void Add(CActive* aActive); - IMPORT_C static void Start(); - IMPORT_C static void Stop(); - IMPORT_C static TBool RunIfReady(TInt& aError, TInt aMinimumPriority); - IMPORT_C static CActiveScheduler* Replace(CActiveScheduler* aNewActiveScheduler); - IMPORT_C virtual void WaitForAnyRequest(); - IMPORT_C virtual void Error(TInt aError) const; - IMPORT_C void Halt(TInt aExitCode) const; - IMPORT_C TInt StackDepth() const; -private: - static void Start(TLoopOwner* aOwner); - IMPORT_C virtual void OnStarting(); - IMPORT_C virtual void OnStopping(); - IMPORT_C virtual void Reserved_1(); - IMPORT_C virtual void Reserved_2(); - void Run(TLoopOwner* const volatile& aLoop); - void DoRunL(TLoopOwner* const volatile& aLoop, CActive* volatile & aCurrentObj); - friend class CPrivatePolledActiveScheduler; // added -protected: - IMPORT_C virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1); -protected: - inline TInt Level() const {return StackDepth();} // deprecated -private: - TLoop* iStack; - TPriQue iActiveQ; - TAny* iSpare; - }; - - - -class TCleanupItem; -class CleanupStack - { -public: - IMPORT_C static void PushL(TAny* aPtr); - IMPORT_C static void PushL(CBase* aPtr); - IMPORT_C static void PushL(TCleanupItem anItem); - IMPORT_C static void Pop(); - IMPORT_C static void Pop(TInt aCount); - IMPORT_C static void PopAndDestroy(); - IMPORT_C static void PopAndDestroy(TInt aCount); - IMPORT_C static void Check(TAny* aExpectedItem); - inline static void Pop(TAny* aExpectedItem); - inline static void Pop(TInt aCount, TAny* aLastExpectedItem); - inline static void PopAndDestroy(TAny* aExpectedItem); - inline static void PopAndDestroy(TInt aCount, TAny* aLastExpectedItem); - }; - - -/* - * This will declare CPrivatePolledActiveScheduler as a friend - * of all classes that define a friend. CPrivatePolledActiveScheduler needs to - * be a friend of CActive - */ -//#define friend friend class CPrivatePolledActiveScheduler; friend - - -/* - * This will change the: - * void DoStart(); - * method in CActiveScheduler to: - * void DoStart(); friend class CPrivatePolledActiveScheduler; - * We need this to access the private datamembers in CActiveScheduler. - */ -//#define DoStart() DoStart(); friend class CPrivatePolledActiveScheduler; -//#include -#include "PolledAS.h" - - -class CPrivatePolledActiveScheduler : public CActiveScheduler -{ -public: - void Schedule(); -}; - - -void CPrivatePolledActiveScheduler::Schedule() -{ - TDblQueIter q(iActiveQ); - q.SetToFirst(); - FOREVER - { - CActive *pR=q++; - if (pR) - { - //TRequestStatus::EActive = 1, //bit0 - //TRequestStatus::ERequestPending = 2, //bit1 - if (pR->IsActive() && pR->iStatus!=KRequestPending) - { -// pR->iActive=EFalse; // won't this cause trouble? - pR->iStatus.iFlags&=~TRequestStatusFaked::EActive; - //debugPrintFile(_L("as: %08x"), pR); - TRAPD(r,pR->RunL()); - //pR->iStatus=TRequestStatus::ERequestPending; - break; - } - } - else - break; - } -} - - -static CPolledActiveScheduler* sPolledActiveScheduler = NULL; - -CPolledActiveScheduler::~CPolledActiveScheduler() -{ - sPolledActiveScheduler = NULL; - delete iPrivatePolledActiveScheduler; -} - -CPolledActiveScheduler* CPolledActiveScheduler::NewL() -{ - // if (sPolledActiveScheduler == NULL) - { - sPolledActiveScheduler = new(ELeave)CPolledActiveScheduler; - CleanupStack::PushL(sPolledActiveScheduler); - sPolledActiveScheduler->ConstructL(); - CleanupStack::Pop(); - } - return sPolledActiveScheduler; -} - -void CPolledActiveScheduler::ConstructL() -{ - iPrivatePolledActiveScheduler = new(ELeave) CPrivatePolledActiveScheduler; - iPrivatePolledActiveScheduler->Install(iPrivatePolledActiveScheduler); -} - - -void CPolledActiveScheduler::Schedule() -{ - iPrivatePolledActiveScheduler->Schedule(); -} - -CPolledActiveScheduler* CPolledActiveScheduler::Instance() -{ -// return (CPolledActiveScheduler*) CActiveScheduler::Current(); - return sPolledActiveScheduler; -} diff --git a/platform/uiq3/engine/vid.cpp b/platform/uiq3/engine/vid.cpp deleted file mode 100644 index d004bdfd..00000000 --- a/platform/uiq3/engine/vid.cpp +++ /dev/null @@ -1,628 +0,0 @@ -// EmuScan routines for Pico, also simple text and shape drawing routines. - -// (c) Copyright 2006, notaz -// All Rights Reserved - -#include "vid.h" -#include "../Engine.h" -#include -#include "../../common/emu.h" -#include "blit.h" -#include "debug.h" - - -// global stuff -extern TPicoAreaConfigEntry areaConfig[]; -extern const char *actionNames[]; - -// main framebuffer -static void *screenbuff = 0; // pointer to real device video memory -//static -extern "C" { unsigned char *PicoDraw2FB = 0; } // temporary buffer -const int framebuffsize = (8+320)*(8+240+8)*2+8*2; // PicoDraw2FB size (in bytes+to support new rendering mode) - -// drawer function pointers -static void (*drawTextFps)(const char *text) = 0; -static void (*drawTextNotice)(const char *text) = 0; - -// blitter -static void (*vidBlit)(int full) = 0; - -// colors -const unsigned short color_red = 0x022F; -const unsigned short color_red_dim = 0x0004; -const unsigned short color_green = 0x01F1; -const unsigned short color_blue = 0x0F11; -const unsigned short color_grey = 0x0222; - -// other -int txtheight_fit = 138; - -// bitmasks -static const unsigned long mask_numbers[] = { - 0x12244800, // 47 2F / - 0x69999600, // 48 30 0 - 0x26222200, // 49 31 1 - 0x69168F00, // 50 32 2 - 0x69219600, // 51 33 3 - 0x266AF200, // 52 34 4 - 0xF8E11E00, // 53 35 5 - 0x68E99600, // 54 36 6 - 0x71222200, // 55 37 7 - 0x69699600, // 56 38 8 - 0x69719600, // 57 39 9 - 0x04004000, // 58 3A : - 0x04004400, // 59 3B ; - 0x01242100, // 60 3C < - 0x00707000, // 61 3D = - 0x04212400, // 62 3E > - 0x69240400, // 63 3F ? - 0x00000000, // 64 40 @ [used instead of space for now] - 0x22579900, // 65 41 A - 0xE9E99E00, // 66 42 B - 0x69889600, // 67 43 C - 0xE9999E00, // 68 44 D - 0xF8E88F00, // 69 45 E - 0xF8E88800, // 70 46 F - 0x698B9700, // 71 47 G - 0x99F99900, // 72 48 H - 0x44444400, // 73 49 I - 0x11119600, // 74 4A J - 0x9ACCA900, // 75 4B K - 0x88888F00, // 76 4C L - 0x9F999900, // 77 4D M - 0x9DDBB900, // 78 4E N - 0x69999600, // 79 4F O - 0xE99E8800, // 80 50 P - 0x6999A500, // 81 51 Q - 0xE99E9900, // 82 52 R - 0x69429600, // 83 53 S - 0x72222200, // 84 54 T - 0x99999600, // 85 55 U - 0x55552200, // 86 56 V - 0x9999F900, // 87 57 W - 0x55225500, // 88 58 X - 0x55222200, // 89 59 Y - 0xF1248F00, // 90 5A Z -}; - - -//////////////////////////////// -// PicoScan functions - -static int EmuScanBegin8(unsigned int num) -{ - DrawLineDest = PicoDraw2FB + 328*num + 8; - - return 0; -} - - -static int EmuScanEndFit0(unsigned int num) -{ - // 0.75, 168 lines - - static int u = 0, num2 = 0; - if(!num) u = num2 = 0; - - DrawLineDest = PicoDraw2FB + 328*(++num2) + 8; - - u += 6666; - - if(u < 10000) { -// u += 7500; - return 1; - } - - u -= 10000; - - return 0; -} - - -//////////////////////////////// -// text drawers -// warning: text must be at least 1px away from screen borders - -static void drawTextM2(int x, int y, const char *text) -{ - unsigned char *vidmem = PicoDraw2FB + 328*8 + 8; - int charmask, i, cx = x, cy; - unsigned char *l, *le; - - // darken the background (left border) - for(l=vidmem+(cx-1)+(y-1)*328, le=l+8*328; l < le; l+=328) *l = 0xE0; - - for(const char *p=text; *p; p++) { - cy = y; - charmask = *(mask_numbers + (*p - 0x2F)); - - for(l = vidmem+cx+(y-1)*328, le = l+8*328; l < le; l+=328-4) { - *l = 0xE0; l++; *l = 0xE0; l++; - *l = 0xE0; l++; *l = 0xE0; l++; - *l = 0xE0; - } - - for(i=0; i < 24; i++) { - if(charmask&0x80000000) *( vidmem + (cx+(i&3)) + (cy+(i>>2))*328 ) = 0xf0; - charmask <<= 1; - } - cx += 5; - } -} - - -static void drawTextM2Fat(int x, int y, const char *text) -{ - unsigned char *vidmem = PicoDraw2FB + 328*8 + 8; - int charmask, i, cx = x&~1, cy; - unsigned short *l, *le; - - // darken the background (left border) - for(l=(unsigned short *)(vidmem+(cx-2)+(y-1)*328), le=l+8*328/2; l < le; l+=328/2) *l = 0xE0; - - for(const char *p=text; *p; p++) { - cy = y; - for(l = (unsigned short *)(vidmem+cx+(y-1)*328), le = l+8*328/2; l < le; l+=328/2) { - l += 4; - *l-- = 0xe0e0; *l-- = 0xe0e0; *l-- = 0xe0e0; *l-- = 0xe0e0; *l = 0xe0e0; - } - - charmask = *(mask_numbers + (*p - 0x2F)); - - for(i=0; i < 24; i++) { - if(charmask&0x80000000) *(unsigned short *)( vidmem + cx+(i&3)*2 + (cy+(i>>2))*328 ) = 0xf0f0; - charmask <<= 1; - } - cx += 5*2; - } -} - - -static void drawTextFpsCenter0(const char *text) -{ - if(!text) return; - drawTextM2((Pico.video.reg[12]&1) ? 234 : 214, 216, text); -} - -static void drawTextFpsFit0(const char *text) -{ - if(!text) return; - drawTextM2Fat((Pico.video.reg[12]&1) ? 256-32 : 224-32, 160, text); -} - -static void drawTextFpsFit2_0(const char *text) -{ - if(!text) return; - drawTextM2Fat((Pico.video.reg[12]&1) ? 256-32 : 224-32, 216, text); -} - -static void drawTextFps0(const char *text) -{ - if(!text) return; - drawTextM2((Pico.video.reg[12]&1) ? 256 : 224, 216, text); -} - -static void drawTextNoticeCenter0(const char *text) -{ - if(!text) return; - drawTextM2(42, 216, text); -} - -static void drawTextNoticeFit0(const char *text) -{ - if(!text) return; - drawTextM2Fat(2, 160, text); -} - -static void drawTextNoticeFit2_0(const char *text) -{ - if(!text) return; - drawTextM2Fat(2, 216, text); -} - -static void drawTextNotice0(const char *text) -{ - if(!text) return; - drawTextM2(2, 216, text); -} - - -// ----------------------------------------------------------------- - -static int localPal[0x100]; - -static void fillLocalPal(void) -{ - Pico.m.dirtyPal = 0; - - if (PicoOpt&0x10) { - // 8bit fast renderer - vidConvCpyRGB32(localPal, Pico.cram, 0x40); - return; - } - - // 8bit accurate renderer - if(Pico.video.reg[0xC]&8) { // shadow/hilight mode - vidConvCpyRGB32(localPal, Pico.cram, 0x40); - vidConvCpyRGB32sh(localPal+0x40, Pico.cram, 0x40); - vidConvCpyRGB32hi(localPal+0x80, Pico.cram, 0x40); - memcpy32(localPal+0xc0, localPal+0x40, 0x40); - localPal[0xe0] = 0x00000000; // reserved pixels for OSD - localPal[0xf0] = 0x00ee0000; - } - else if (rendstatus & PDRAW_SONIC_MODE) { // mid-frame palette changes - vidConvCpyRGB32(localPal, Pico.cram, 0x40); - vidConvCpyRGB32(localPal+0x40, HighPal, 0x40); - vidConvCpyRGB32(localPal+0x80, HighPal+0x40, 0x40); - } else { - vidConvCpyRGB32(localPal, Pico.cram, 0x40); - memcpy32(localPal+0x80, localPal, 0x40); // for sprite prio mess - } -} - - -// note: the internal 8 pixel border is taken care by asm code -static void vidBlit_90(int full) -{ - unsigned char *ps = PicoDraw2FB+328*8; - unsigned long *pd = (unsigned long *) screenbuff; - - if(Pico.video.reg[12]&1) - vidConvCpy_90(pd, ps, localPal, 320/8); - else { - if(full) vidClear(pd, 32); - pd += (240+VID_BORDER_R)*32; - vidConvCpy_90(pd, ps, localPal, 256/8); - if(full) vidClear(pd + (240+VID_BORDER_R)*256, 32); - } -} - - -static void vidBlit_270(int full) -{ - unsigned char *ps = PicoDraw2FB+328*8; - unsigned long *pd = (unsigned long *) screenbuff; - - if(Pico.video.reg[12]&1) - vidConvCpy_270(pd, ps, localPal, 320/8); - else { - if(full) vidClear(pd, 32); - pd += (240+VID_BORDER_R)*32; - ps -= 64; // the blitter starts copying from the right border, so we need to adjust - vidConvCpy_270(pd, ps, localPal, 256/8); - if(full) vidClear(pd + (240+VID_BORDER_R)*256, 32); - } -} - - -static void vidBlitCenter_0(int full) -{ - unsigned char *ps = PicoDraw2FB+328*8+8; - unsigned long *pd = (unsigned long *) screenbuff; - - if(Pico.video.reg[12]&1) ps += 32; - vidConvCpy_center_0(pd, ps, localPal); - if(full) vidClear(pd + (240+VID_BORDER_R)*224, 96); -} - - -static void vidBlitCenter_180(int full) -{ - unsigned char *ps = PicoDraw2FB+328*8+8; - unsigned long *pd = (unsigned long *) screenbuff; - - if(Pico.video.reg[12]&1) ps += 32; - vidConvCpy_center_180(pd, ps, localPal); - if(full) vidClear(pd + (240+VID_BORDER_R)*224, 96); -} - - -static void vidBlitFit_0(int full) -{ - if(Pico.video.reg[12]&1) - vidConvCpy_center2_40c_0(screenbuff, PicoDraw2FB+328*8, localPal, 168); - else vidConvCpy_center2_32c_0(screenbuff, PicoDraw2FB+328*8, localPal, 168); - if(full) vidClear((unsigned long *)screenbuff + (240+VID_BORDER_R)*168, 320-168); -} - - -static void vidBlitFit_180(int full) -{ - if(Pico.video.reg[12]&1) - vidConvCpy_center2_40c_180(screenbuff, PicoDraw2FB+328*8, localPal, 168); - else vidConvCpy_center2_32c_180(screenbuff, PicoDraw2FB+328*8-64, localPal, 168); - if(full) vidClear((unsigned long *)screenbuff + (240+VID_BORDER_R)*168, 320-168); -} - - -static void vidBlitFit2_0(int full) -{ - if(Pico.video.reg[12]&1) - vidConvCpy_center2_40c_0(screenbuff, PicoDraw2FB+328*8, localPal, 224); - else vidConvCpy_center2_32c_0(screenbuff, PicoDraw2FB+328*8, localPal, 224); - if(full) vidClear((unsigned long *)screenbuff + (240+VID_BORDER_R)*224, 96); -} - - -static void vidBlitFit2_180(int full) -{ - if(Pico.video.reg[12]&1) - vidConvCpy_center2_40c_180(screenbuff, PicoDraw2FB+328*8, localPal, 224); - else vidConvCpy_center2_32c_180(screenbuff, PicoDraw2FB+328*8-64, localPal, 224); - if(full) vidClear((unsigned long *)screenbuff + (240+VID_BORDER_R)*224, 96); -} - -static void vidBlitCfg(void) -{ - unsigned short *ps = (unsigned short *) PicoDraw2FB; - unsigned long *pd = (unsigned long *) screenbuff; - int i; - - // hangs randomly (due to repeated ldms/stms?) - //for (int i = 1; i < 320; i++, ps += 240, pd += 256) - // vidConvCpyRGB32(pd, ps, 240); - - for (i = 0; i < 320; i++, pd += VID_BORDER_R) - for (int u = 0; u < 240; u++, ps++, pd++) - *pd = ((*ps & 0xf) << 20) | ((*ps & 0xf0) << 8) | ((*ps & 0xf00) >> 4); -} - - -//////////////////////////////// -// main functions - -int vidInit(void *vidmem, int reinit) -{ - if(!reinit) { - // prepare framebuffer - screenbuff = vidmem; - PicoDraw2FB = (unsigned char *) malloc(framebuffsize); - - if(!screenbuff) return KErrNotSupported; - if(!PicoDraw2FB) return KErrNoMemory; - - memset(PicoDraw2FB, 0, framebuffsize); - } - - // select suitable blitters - vidBlit = vidBlit_270; - PicoScanBegin = EmuScanBegin8; - PicoScanEnd = NULL; - drawTextFps = drawTextFps0; - drawTextNotice = drawTextNotice0; - - memset(localPal, 0, 0x100*4); - localPal[0xe0] = 0x00000000; // reserved pixels for OSD - localPal[0xf0] = 0x00ee0000; - - // setup all orientation related stuff - if (currentConfig.rotation == TPicoConfig::PRot0) - { - if (currentConfig.scaling == TPicoConfig::PMCenter) { - vidBlit = vidBlitCenter_0; - drawTextFps = drawTextFpsCenter0; - drawTextNotice = drawTextNoticeCenter0; - } else if (currentConfig.scaling == TPicoConfig::PMFit2) { - vidBlit = vidBlitFit2_0; - drawTextFps = drawTextFpsFit2_0; - drawTextNotice = drawTextNoticeFit2_0; - } else { - vidBlit = vidBlitFit_0; - drawTextFps = drawTextFpsFit0; - drawTextNotice = drawTextNoticeFit0; - PicoScanBegin = NULL; - PicoScanEnd = EmuScanEndFit0; - } - } else if (currentConfig.rotation == TPicoConfig::PRot90) { - vidBlit = vidBlit_90; - } - else if (currentConfig.rotation == TPicoConfig::PRot180) - { - if (currentConfig.scaling == TPicoConfig::PMCenter) - { - vidBlit = vidBlitCenter_180; - drawTextFps = drawTextFpsCenter0; - drawTextNotice = drawTextNoticeCenter0; - } - else if (currentConfig.scaling == TPicoConfig::PMFit2) { - vidBlit = vidBlitFit2_180; - drawTextFps = drawTextFpsFit2_0; - drawTextNotice = drawTextNoticeFit2_0; - } else { - vidBlit = vidBlitFit_180; - drawTextFps = drawTextFpsFit0; - drawTextNotice = drawTextNoticeFit0; - PicoScanBegin = NULL; - PicoScanEnd = EmuScanEndFit0; - } - } - else if (currentConfig.rotation == TPicoConfig::PRot270) { - vidBlit = vidBlit_270; - } - - fillLocalPal(); - vidBlit(1); - PicoOpt |= 0x100; - Pico.m.dirtyPal = 1; - - return 0; -} - -void vidFree() -{ - free(PicoDraw2FB); - PicoDraw2FB = 0; -} - -void vidDrawFrame(char *noticeStr, char *fpsStr, int num) -{ - DrawLineDest = PicoDraw2FB + 328*8 + 8; - -// PicoFrame(); // moved to main loop - if (currentConfig.EmuOpt & EOPT_SHOW_FPS) - drawTextFps(fpsStr); - drawTextNotice(noticeStr); - - if (Pico.m.dirtyPal) fillLocalPal(); - vidBlit(!num); // copy full frame once a second -} - -// ----------------------------------------------------------------- - -static void drawText0(int x, int y, const char *text, long color) -{ - unsigned short *vidmem=(unsigned short *)PicoDraw2FB; - int charmask, i, cx = x, cy; - unsigned short *l, *le, dmask=0x0333; - - // darken the background (left border) - for(l=vidmem+(cx-1)+(y-1)*240, le=vidmem+(cx-1)+(y+7)*240; l < le; l+=240) - *l = (*l >> 2) & dmask; - - for(const char *p=text; *p; p++) { - cy = y; - charmask = *(mask_numbers + (*p - 0x2F)); - - for(l = vidmem+cx+(y-1)*240, le = vidmem+cx+(y+7)*240; l < le; l+=240-4) { - *l = (*l >> 2) & dmask; l++; *l = (*l >> 2) & dmask; l++; - *l = (*l >> 2) & dmask; l++; *l = (*l >> 2) & dmask; l++; - *l = (*l >> 2) & dmask; - } - - for(i=0; i < 24; i++) { - // draw dot. Is this fast? - if(charmask&0x80000000) *( vidmem + (cx+(i&3)) + (cy+(i>>2))*240 ) = color; - charmask <<= 1; - } - cx += 5; - } -} - -// draws rect with width - 1 and height - 1 -static void drawRect(const TRect &rc, unsigned short color) -{ - unsigned short *vidmem=(unsigned short *)PicoDraw2FB; - - if(rc.iTl.iX - rc.iBr.iX && rc.iTl.iY - rc.iBr.iY) { - int stepX = rc.iTl.iX < rc.iBr.iX ? 1 : -1; - int stepY = rc.iTl.iY < rc.iBr.iY ? 1 : -1; - - for(int x = rc.iTl.iX;; x += stepX) { - *(vidmem + rc.iTl.iY*240 + x) = *(vidmem + (rc.iBr.iY - stepY)*240 + x) = color; - if(x == rc.iBr.iX - stepX) break; - } - - for(int y = rc.iTl.iY;; y += stepY) { - *(vidmem + y*240 + rc.iTl.iX) = *(vidmem + y*240 + rc.iBr.iX - stepX) = color; - if(y == rc.iBr.iY - stepY) break; - } - } -} - -// draws fullsize filled rect -static void drawRectFilled(const TRect rc, unsigned short color) -{ - unsigned short *vidmem=(unsigned short *)PicoDraw2FB; - - if(rc.iTl.iX - rc.iBr.iX && rc.iTl.iY - rc.iBr.iY) { - int stepX = rc.iTl.iX < rc.iBr.iX ? 1 : -1; - int stepY = rc.iTl.iY < rc.iBr.iY ? 1 : -1; - - for(int y = rc.iTl.iY;; y += stepY) { - for(int x = rc.iTl.iX;; x += stepX) { - *(vidmem + y*240 + x) = *(vidmem + y*240 + x) = color; - if(x == rc.iBr.iX) break; - } - if(y == rc.iBr.iY) break; - } - } -} - -// direction: -1 left, 1 right -static void drawArrow0(TPoint p, int direction, unsigned short color) -{ - unsigned short *vidmem=(unsigned short *)PicoDraw2FB; - int width = 15; - int x = p.iX; - int y = p.iY; - - for(; width > 0; x+=direction, y++, width -=2) - for(int i=0; i < width; i++) - *(vidmem + x + y*240 + i*240) = color; -} - -static char *vidGetScanName(int scan) -{ - static char buff[32]; - - if((scan >= '0' && scan <= '9') || (scan >= 'A' && scan <= 'Z')) { - buff[0] = (char) scan; buff[1] = 0; - } else { - switch(scan) { - case 0x01: strcpy(buff, "BSPACE"); break; - case 0x03: strcpy(buff, "OK"); break; - case 0x05: strcpy(buff, "SPACE"); break; - case 0x0e: strcpy(buff, "AST"); break; - case 0x0f: strcpy(buff, "HASH"); break; - case 0x12: strcpy(buff, "SHIFT"); break; - case 0x19: strcpy(buff, "ALT"); break; - case 0x79: strcpy(buff, "PLUS"); break; - case 0x7a: strcpy(buff, "DOT"); break; - case 0xa5: strcpy(buff, "JOG@UP"); break; - case 0xa6: strcpy(buff, "JOG@DOWN"); break; - case 0xb5: strcpy(buff, "INET"); break; - case 0xd4: strcpy(buff, "JOG@PUSH"); break; - case 0xd5: strcpy(buff, "BACK"); break; - default: sprintf(buff, "KEY@%02X", scan); break; - } - } - - return buff; -} - -void vidKeyConfigFrame(const TUint whichAction) -{ - int i; - char buttonNames[128]; - buttonNames[0] = 0; - memset(PicoDraw2FB, 0, framebuffsize); - - unsigned long currentActCode = 1 << whichAction; - - // draw all "buttons" in reverse order - const TPicoAreaConfigEntry *e = areaConfig + 1; i = 0; - while(e->rect != TRect(0,0,0,0)) { e++; i++; } - for(e--, i--; e->rect != TRect(0,0,0,0); e--, i--) - drawRect(e->rect, (currentConfig.KeyBinds[i+256] & currentActCode) ? color_red : color_red_dim); - - // action name control - drawRectFilled(TRect(72, 2, 168, 20), color_grey); // 96x14 - drawArrow0(TPoint(80, 3), -1, color_green); - drawArrow0(TPoint(160, 3), 1, color_green); - - drawText0(86, 9, actionNames[whichAction], color_red); - - // draw active button names if there are any - for (i = 0; i < 256; i++) { - if (currentConfig.KeyBinds[i] & currentActCode) { - if(buttonNames[0]) strcat(buttonNames, ";@"); - strcat(buttonNames, vidGetScanName(i)); - } - } - - if (buttonNames[0]) { - buttonNames[61] = 0; // only 60 chars fit - drawText0(6, 48, buttonNames, color_blue); - } - - vidBlitCfg(); -} - -void vidDrawNotice(const char *txt) -{ - if(PicoDraw2FB) { - drawTextNotice(txt); - vidBlit(1); - } -} diff --git a/platform/uiq3/engine/vid.h b/platform/uiq3/engine/vid.h deleted file mode 100644 index d6b89959..00000000 --- a/platform/uiq3/engine/vid.h +++ /dev/null @@ -1,9 +0,0 @@ -#include - -// let's do it in more c-like way -int vidInit(void *vidmem, int reinit); -void vidFree(); -void vidDrawFrame(char *noticeStr, char *fpsStr, int num); -void vidKeyConfigFrame(const TUint whichAction); -void vidDrawFCconfigDone(); -void vidDrawNotice(const char *txt); // safe to call anytime, draws text for 1 frame diff --git a/platform/uiq3/picodrive.hrh b/platform/uiq3/picodrive.hrh deleted file mode 100644 index 445c7fb4..00000000 --- a/platform/uiq3/picodrive.hrh +++ /dev/null @@ -1,86 +0,0 @@ - -enum TAppMenuCommands -{ - // Emu menu - EEikCmdPicoMain = 10000, - EEikCmdPicoResume, - EEikCmdPicoLoadState, - EEikCmdPicoSaveState, - EEikCmdPicoLoadROM, - EEikCmdPicoReset, - EEikCmdPicoConfig, - EEikCmdPicoKeys, - EEikCmdPicoSettings, - - // Frameskip submenu - EEikCmdPicoFrameskip, - EEikCmdPicoFrameskipAuto, - EEikCmdPicoFrameskip0, - EEikCmdPicoFrameskip1, - EEikCmdPicoFrameskip2, - EEikCmdPicoFrameskip4, - EEikCmdPicoFrameskip8, - - // Debug menu - EEikCmdPicoDebug, -// EEikCmdPicoDebugKillEmu, - EEikCmdPicoDebugInfo, - - // config Dialog - ECtlOptDone, - // pages - ECtlOptPageMain, - ECtlOptPageSound, - ECtlOptPageMCD, - ECtlOptPageMisc, - // main page - ECtlOptRotationLabel, - ECtlOptRotation, - ECtlOptRotation0, - ECtlOptRotation90, - ECtlOptRotation180, - ECtlOptRotation270, - ECtlOptScreenModeLabel, - ECtlOptScreenMode, - ECtlOptScreenModeCenter, - ECtlOptScreenModeFit, - ECtlOptScreenModeFit2, - ECtlOptUseAltRend, -// ECtlOptUseAccTiming, -// ECtlOptUseAccSprites, - ECtlOptShowFPS, - // sound page - ECtlOptEnableSound, - ECtlOptChipSelLabel, - ECtlOptEmulateZ80, - ECtlOptEmulateYM2612, - ECtlOptEmulateSN76496, - ECtlOptSndQLabel, - ECtlOptSndQuality, - // MCD page - ECtlOptCDleds, - ECtlOptCDcdda, - ECtlOptCDpcm, - ECtlOptCDramcart, - ECtlOptCDscalerot, - ECtlOptCDbettersync, - // misc page - ECtlOpt6ButtonPad, - ECtlOptGzipStates, - ECtlOptUseSRAM, - ECtlOptMotDontUseVol, - ECtlOptRegion, - // about dialog - EEikCmdPicoAboutDoneCmd, - EEikCmdPicoAboutCreditsCmd, - ECtlPicoAboutText, - // credits - ECtlPicoCreditsText, - // debug - ECtlDebugEdit -}; - - -#define ECtlAboutVersion 1 -#define ECtlAboutLinks 2 - diff --git a/platform/uiq3/picodrive.pkg b/platform/uiq3/picodrive.pkg deleted file mode 100644 index ca13ec7d..00000000 --- a/platform/uiq3/picodrive.pkg +++ /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 index 2eea0337..00000000 --- a/platform/uiq3/port_config.h +++ /dev/null @@ -1,33 +0,0 @@ -// port specific settings - -#ifndef PORT_CONFIG_H -#define PORT_CONFIG_H - -#define CASE_SENSITIVE_FS 0 -#define DONT_OPEN_MANY_FILES 0 -#define REDUCE_IO_CALLS 0 -#define SIMPLE_WRITE_SOUND 0 - -// draw2.c -#define START_ROW 0 // which row of tiles to start rendering at? -#define END_ROW 28 // ..end - -// pico.c -#define CAN_HANDLE_240_LINES 0 // for now - -// logging emu events -#define EL_LOGMASK (EL_STATUS) // |EL_SVP|EL_ANOMALY) - -//extern void dprintf(char *format, ...); -//#define dprintf(f,...) printf("%05i:%03i: " f "\n",Pico.m.frame_count,Pico.m.scanline,##__VA_ARGS__) -#define dprintf(x...) - -// platform -#define PATH_SEP "\\" -#define PATH_SEP_C '\\' -#define MENU_X2 0 - -// engine/vid.cpp, also update BORDER_R in port_config.s -#define VID_BORDER_R 16 - -#endif // PORT_CONFIG_H diff --git a/platform/uiq3/port_config.s b/platform/uiq3/port_config.s deleted file mode 100644 index e0b359a1..00000000 --- a/platform/uiq3/port_config.s +++ /dev/null @@ -1,15 +0,0 @@ -@ vim:filetype=armasm - -@ .equiv START_ROW, 1 -@ .equiv END_ROW, 27 -@ one row means 8 pixels. If above example was used, (27-1)*8=208 lines would be rendered. -.equiv START_ROW, 0 -.equiv END_ROW, 28 - -.equiv UNALIGNED_DRAWLINEDEST, 0 - -@ this should be set to one only for GP2X port -.equiv EXTERNAL_YM2612, 0 - -@ also update VID_BORDER_R in port_config.h -.equiv BORDER_R, 16 diff --git a/platform/uiq3/rsc/Pico18x18.bmp b/platform/uiq3/rsc/Pico18x18.bmp deleted file mode 100644 index 840c55a38f71c49a09a521446d46afcb9d5acb61..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1062 zcmZ?rRbycQ12Z700mMR3%*Y@C7XQG^z@Wqp!C(O(@gD}l|G(S%|3Bx)K86hM{|x_2 z|Nl7n|G(Vt)eN0{FeL~YNgq(q<@;5Q`7J=kWGRMtcC+$3Z^ibMA`~OBQ1u~65MWYS zAA`0OgFXX;Jp+RQ1A`tgKoZdG$FQ%)dJ)4UDehu7-grN5X%|s5CqYX?24iLhb3_ON z&A`yd@FPuO=OmfMb)wGUe91AKwn4(ScEUDRthy2m{?c$;QT6F3oe{RkHzd8T^ zn;oBFIK@Rgn-7>3{NFt~{{R1p|NjGj-qZ}&lZ|)aFVX?)0}^mxd*YPB|Dz0ldL2uX zfr4{W9>)BCH~s(rqyPV#{{LvWHj$wO8XmB4fosKN=-j;={_nr!;xg~TTDU9&0|1B~ BeC_}M diff --git a/platform/uiq3/rsc/Pico18x18m.bmp b/platform/uiq3/rsc/Pico18x18m.bmp deleted file mode 100644 index 734d64080e45f1912de53f7f4a75ba7dce343e03..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 334 zcmZ?r^pkXfZ4 zCE{UhAPoW#JCNBQ7#Q@S;-6iVlz`g6YQCl_DJk$n*y*LAPD&0;VDXu00xjipk6?0C~4?w!dlnI$0g>8T1c!<5`WY{6M8okfcnl=y*c oftXhzW@*!mKy2afyHdF3oK*1#ssEo|@?-YN0JuB9PqhcJ0jQvkf&c&j diff --git a/platform/uiq3/rsc/Pico40x40.bmp b/platform/uiq3/rsc/Pico40x40.bmp deleted file mode 100644 index 81ad7e715457ae78304ba8c94a6989b973b947d0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4854 zcmeI0d011&7QhD(*#abhED}O)kS)lPkOT;XohFeXGCUE2#F}7Z3eU0iFX)2XMc7 zD5`BHwq_hEcYO^lLjoB*Y6rLva1g*Bo{DzO32vE=mIenqCH`K_yXwU*>du1x82}T= zZhP7TI&0B3H?m?k5~~pkMMy3nqyukf14O;NE!r~&_2i)l_jh&nVKR08F<YIyNg!EX&hXFpY_NP+EJcO3&@ISEK|EvEm zS%9JY7#VgV>q&@_i-t}_CP$FzHW%G{|0Nw%=oX?DAs1KVW{f-#a!1Hzz(tV-^3lf< zdB-8j-~L)U;zpw+hOWSX>f>rI@HXdj&3QZ%4wu5=7HyVG)j@iAYW!ok2JMOq5B2eMDWb{e40RD;qPb0^EDhk ze6TwUi40M+<`1LMNq^?nN!TaV^rfY?Ge*<0lgx9}77NlWywo}#se=>}eMTCclfaS* zX#zf#y!`!0I+f2iWV2B?5(wM=0Ge8rZ*+Yz*3p1%sb{sdUQc2%B|9jHWS`g(7kXEusXx4MZ_9Ix(V?W%X$ zT+3KhM$1f~jn$YIC+R3-j5$77a+F!T0!7M@j6hO?olZoShU?N<2A-@zZuV%HEpjA$ zt%~16SJrK{hXc;%w$aaSVw~G#^F>?m%bws#qv_vmV4iJb?r*|2&1SYup)V>X2c1%! zYFnT-jFwyac-V(?oikMCu{bRbcTK~?3T2d#5R;%F)1W{zo|mDQqb^(Y9&W(B0~+X6 z-0v3L{9JJJGrsn^{G%HC6=RwAk2;MpZ`ec(q@a0xO88 z`wn*u_u`L9aM9qb6kL#v(-H_IArMaJizTK3LgN75d$_)EavVG^f_nx1KjmmaaekjD z*FPIT`g2#vz2iyGE@a*QBJEgf;O2Vk#sjPasDQqF?VVz{Iu34) zf~&C`XW`8i;q&uk)hT$5Mm|YR6v@@c&qLE?wF+-G6-wYf{^xh_t62#*o z^H)J9zqb4?fT}v{djRt496+ywz5;k$2sd)zO5~nKVntcx%Cdkt*|I4q@@dKP5*aZ@ z99tPJR0^GjTE|xqVbH5QxH4eLILVZx$f6iYz6^!fhPjc0_N#=d+>C3*h6O2uLc$S+ zs%vSGd60}B;X8oy0HoF(uk8P*5N>5XIqTOkkJvhwST$L+zD%-Ssa!aM7@wvXn?!O` znx)nV5lz#k0HoeHOsuPxEy$JEq!1I7-mSH0=&zz^)MUZfRW!7Gq~*9Ylfqg4us8z04m{m5!_YZ?c#Q>;di%1-fm9WUBe8YYk(T{Y10j?rVbiX>&9tt zp!$CfP!3Nt*Y>J*H{i9JS7T9?)JU4t=Z!0~_M{t~nTmBRVy&IXTv9N!CXEmB z{Dq{=ohIawG4ojf@(T*#N!H76gb%s}-EBcH+u4p%P039o?Mynme0ZAIcPZ@hUjBn4=8@w~kk}zZIPBCc7VO7*JFrVTSbyK= zbbE&rv>R@299mN_`r;nVk0)d;HPST|L`6cTP3$j+*6>;tbK4xo`7O*-ZOkKUm>mmQ zt(A=VdDLQ!jyy(BB1H^GeMum>tVlHR@I(|`FwGf7^N~0~r|X>)tSdXra@9t@92&>h z(wk$bR#`8djKP=mJBOKvnxt1glWeV(ZJnMG2cg!d=Mc>BB0GXIN zyPI>kdZ7_W6p3uv<{Td<_?n?T>2h?X`rInFp3Eqz#0Qy0Agcbq4`>8jNI$tDr~kS1 z=hMo^y{i7+um`6!J-b}iR!S;V{CuUfNUj)zCpGt(1dviO(fSjsh}SkBu55Zgsc!^F+B?b zGP^&WswI8Yvz5@l1p4FpdXwNfvGXHYS*(0|Dlt)okCw@cWy)+Z70H|rFT-vga%`L7 zSd(tGLSdPauFI9{cn>!inWX1E+%~j2E%YuWDviQ$H!`E^8@&nzUt72i*+=PEk}69O z1w$wUAnDqLJ@;>38d$2kK|29%i?v?`G*61CN+hb1@JcmaD2px@yZDydCB6S8m6 z#gxcOhz!XyvrlVF2|S8^zOBG-D~x)tqh#-{m8x-0nn2T+ETa|Q7QLUMGi>}bVwHJ2Zteo&?PqobvT0) zLvlOAM=nFwrO1w4Bd;wG47W1AKHmMZpX8EWaX$3tYp+Bf{5Yh2PQZp*X-z6VIT0@q zizHlfzZm)Qspf}oov-c7>w7Wj)uIOc*|qiXEDoNFnkP%jB*wUmpM|@p6M8t#O~suj zgqS8dlA!Vg&LV^=5Gq6DZu2VnwsxrD%FOeJx&TP$m=FEg{Xh6!+#a}NVL0jes}k|) z8S*i>XT0rNfHo}*E{z!vuma!=z$(zrg8u6OLbxMrofc9W#m&Sm1(|i$iaGiL1Hd<#$N7V?u%C3QBLK$2L-pf}-nWi$mzVl2FBh(=lq^i;Rx^>K z=TwplkTbAR?gZEmuyVkA_W%UF_y_+&N5G79S()5aE_2r4(N$r#L4j`=zflU9H`Da~ zv|Q4k!xg`~$LN>#xL@4L{(6a3SLTpP3m$D0*^YL7w+Hmb!EG{H+5~VMVD5m{q!*2P z@gx7tM*mN0f@>0eGjY=x+_2u_H&E{oi|U%#S9cD9b_6Zx$sGH}5tWRBx9c(BWqO5x&SS-A?S_z1UqyWyXg@Zotpyih&`ca+UIQO z<$S+`e_$5tM49zUCQ7IMdBkt^K)F~q>Loe(f08`xab8yA+&E4&esW3Jym!|BCoWqc Ai2wiq diff --git a/platform/uiq3/rsc/Pico40x40m.bmp b/platform/uiq3/rsc/Pico40x40m.bmp deleted file mode 100644 index 32a75ef50c44237bdcd3212fcb5c4ab8da6eedc1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4854 zcmeH^F%H5o3`NV##>CFT2{-^dcji>AVAYZp{n$>FIE{*0sa5>*{hyOQU!TjeJ`eid zllQb-SN%=a-E!Tv~V5hh^;AHfrekB zb44k1ORkK>14ub^@%IOW+naJ;ngO_*{o?6dKB;`+cLbJ#uoguYH5NT!uvobcja*jR U^4`3$U&$$;^dqbU07NRw*x1I{6w^z9 z04DTKC?Sv+N(d$NP)xJVUdc}0ZuY$_+4u4`-+u3YNArzFGo$~%=bU@bIrs8oIG#w^ zIQZys0Szpm;$gDU>ZQko5!ACE(mR(=+$25w4%nWK1aVu zhT^He`TzgukCeTW%K_#Ad<*aZ;3Pm3K-Bw}p2wC7x6bwJYIa&#V_YpmMPdyX`Y-q+ z<0?l2Q~;a;cmi-0U;#kJ0JvP2h$o(k0yVDSJ($)2eEthCDQSsPn5(@OYG%i?mY#vH?B^=m+>(d4l`F z{%&97?)d>-lib_KS~M4+sotp+$#4GuKjBB)wY&0^W`L1*0aOEwl!NE7Wuk3!d0kD8 zo#Ro3S-M37?)*Z8#vvrs(eywlA}0@9-6()%0Nns}05t&a*R~6H%@69H;?vWFCdD9M z+CKr`N4&yedDjSl0&D{?FcpCN@-}bFG(qn?&t1)EPe_z@B7VnA6*Lj4j7G-mRBXlC z^hAWXD_XD$ij=-n3-as%a67a>ykWLq?=*C#2=OQ%@z4LXTWm(Hae~8Ha61iv38y3O zcA*VYw7^Q>iZLqMa$5w;FMM4vwN>4&LygX$pzVm)G`!dJb#FXe#g0seTil;E8Sg1Y zE9fZMbMUEu@v+{%MR#JpMGEPV&HdG1uS2H&9W$Z(>J((yf#_T<^q+6An^dirmcSh8 zSIxpB)1S1pBJ`OSszj(1p)Dx%Pm1#2u>Rcx|L%eR*F7Lc;DiGTl{-l7E}|?$HWkRC zPI06xLaL9E+BKwlRu?_X{Vzl8pQ1;!R6Zc}OUV3FWHnODJXzn%P{U!Ey0eP9v!=Q$ z(sO6(x!UNtSsM5nt1_j?bU7wML2v#H(6v>LBdz7gSr<7VbvLByqJbPukpmOi+aV?k zF_}ss5Q~BA3FJU%x*HpEv<$+ABbPFydO!oo|F2kRqJ79F50S1aJQW=;dn(t*knL;8 z;V6YoW&7%Sc<8vhDaBpO%~i$T0okz>!m`(LB@DRcdLeGer4*^`|JPGM*6UD?y2i*z z{i-C5%yf;=Xd^cds;@7N!=`cB_-KU1-;c`SC{DN>nje?q>#OJGspaa5@gt@kCZg#= z*Y~qPu|CML3j5B#tZ8Iaq2*j^O**YoN~_GERc9EMr|Ss?I&mUxzhDENzkWb~0gp#> zW6=e^Mj=6%7nRGQ`YBi_iTG%_xF}gLF$)8>s}A2DC0H0EoH6|2O}l;sYV|iPOrw^i zQ_H18f?3pN(#B-zS4vTc5J^%DL{3_2Y*T$lR+^_#co4;xqoAOaAr?M^EU=H*X*v$q zjpU(tCp(kPe<%T!Y!dY)SvM4zjn6hJks9Wu85Ru@p;crkq%y;xLPo0!F`$Xmy{a^= zYjm`e+>)HF<3kMC978ty7Z%v4uo(LKP<*^KoQ7*UI_X4&pkgCu%Y%Oq1+DZLbgr1$ z-o)&h$XwsV*f_~@T7~)S3ReWwK$dNmMl|zF=(x^j!E#g$^+k2;KL|fM9?$%IA<;XNSldi=O(HrP zm_1F*jguK08qFu<&|8)>n@?<>O>CS&tZ5=T zCSn%!MWbwQx6$Lnbu0>X8?vd@X|$RQN`*u#IYB*EjMBnUNVd8q+rE%*o+!}A6xhna z>Sz2|DMo%AJ?z&$JpEF;Y-3@fNq(|PW}Hbn-vlRr|7b%$)G;rvCysX#C%cGa?Zlp? z#GWNeB6Eo?pE5SiV!YT!FAJv_$55wBOva3`o?C2Gm`*KDr&VPbjh5+TB%(+W5{Wb% z;)w)bMogHYo3Eia+lcKuC=`D`JY-=XF^-LJE=bU|N=G^ik?|Cze1^SbW?XL=MWz;diZLF9NR<7m6Z z#om~o&ILGdY&WfAUR_J>v!?5CS7Y!$Z7Xm3A@IaSOLhZVfAQg$pDq(H1` zpf4yf${(VDM_1!fQuPQDrKM^)I?{9~!<#b=Q{$*{LNyVoA|y4$Bq1SPMv#f4M9z@` z6fd?hMa4cR6|2T1G%90XKe83UP3yLJR9!i1vCsM$tRQ8s(=`OQgDG8O$;1F6lyxRFP$F zqAlBnVq)StJJTyKmL(Ble{4V?va8%NNDeUnv!IKlg55DxjcQEAs5&n-yhCS%Zgx6m2{=~CBn_GKrPp+{& zvBvhuYOBMo4!al8cg(llIK#H9iRfx1<`)fX%(Wb!~2P?_bZtS(&y})tv zthn6^eYVfH>6%1eQf;@WG__e4*C>sjoIy5A?PVf{RG2tJ5+HQbH8c!bRp3_~W1l{R z-z$fVE+SQrwO(Kz4MJO@|4Act>`gr`#bv;GUUkZ=Q;8__wuYgw-@Vt27 zeF;Fovhi#+gl%ym$TRxC;XgeZ@%Tja^D~tLwX48cg?(<4x z8#2fSDHc(aO#Df*u#6N}kdnFSP7H#gYZ%a0;F2T8dcpngkwXeggp8a7c7BXmyih+z zs28iGK#H&;)FY!l9=}uF23*W6g(s!(q7>d2gS-UfxJZr*%iJh00rWQmG$=~71Eumu zrShkx@*8FFT^Zae8Tc;e$yZ57R*O0t$<8M6!iv!8xx&UF3S^T^R3ReENqm$o%rw?E zF;b=awiaN$VEk^`Bv~QwUsWZXJu>=}6n1{BMY2#i#t!O2grYvSj>>E8Y6PePc_~1? z5^ANg94)R*b}UK8SLOli1DFBu84Ogx^AdPe3O7p?6mAyF@1&mHAYNK4>S`7)EN9Ov z6)F2)p#@B2dm>oT7N6 z1X3rKv`isw(?}$-`A8M0X?>+rIlm0<)dS!vG+t8a0+7CXY&|lh1>hLK7XW(zwkWU9 zg%^1WO+74yzbGl(DTbRd+vkuS6FCdZeCCw~&MX+BfbloU2JvGp#EyxLsg2Rs)%A$> zW@X2_rA0@V@rgsLLt4i>Ew1)!$req?U}cCLq$D9FJ+ny_K?LHP{f`t7nm)`H87h~b zG}(-Lc)K3pDPEF@axB`k`neMSae&>*H70zV5ASl}S+Rn`J#0nA@2)35Iw5LrAX~>r zudWN6U&fhRA|6x$#*anW{}?}()LCiv9xO8xfy;ktobLyoVyt}!yz#ioKg+PZlq&@tsr1n_Vcbmngtv zDOb3_FEV0bma(C+ho56ov0nk)&w>}}k59*SHU+nh51UmG)0iP{N*7m(MCByLgM_X^ zX6oOgfO3RtO>Ek@OiHB;Px@*>5qiNvy7rF9)Kr&-(k~vs4`SGOfeaJ*3IJyvyOc5k zUgazL|3Nw2DDS`Ob8scObAfo%Y*G6}vZFC%4ho`i-rc859 zY<7*Q4NjPtVCU+ji%|S@SuH>%+{(PwmvF30)H+_Yq?(+bt8kn;30Xl}&nVI{B~X;} z-^7pdk@fyu^RcNtV ziuIUb<9!Oq$9Z3E@;%nUKC#B<%)0RVtMbkjdzOyZQeUsBa^AqW z#=v-jfl(dBc$|(=qq=6FfyN>_v2VCA;3Zy}!o!{XM%H(GWH>9ZL8{tg}JjBKm_u^d0v(ua_TiHk3IcL`TLnmkD1`~8b z9bGXn%b|Je7&_7QoP6{hee_tadae!>voL)Fo*HUEXmb9P7QAR%4)03j-(_6bBzt^1 zW_hh($_U{^iGo6v7_W`S?^uYqzJU(pU(o~TBymjEPoSUQOdM___AVj1rxG3Y%;lr( zR#upQl4VpTqm9W>kB?K05>WiOM!r6n0m@Cd2yhdi2VkzkXywJwUj=s~o}37KcG~aq z7WRn_UpUE)&DBI>wN2cqmbMg@g=v7-Fj?}jb<=G&Pq*rxZ1uxo>+9=nyGL1{9b+;& z4k3w-o`1dkK_z@hzOhest1otSeb|!Pu(>7V)EshbGH+3{w$K{e`F{qF&(U7ed1fu^ zR0naUn>f`)^sQ0`!_$b)24?3t`n)2e;tVQ|ffM3XA{7CZ5!(l;>Y&(AJnUc%vZ-Ow=Xc6 zGe$o%!F*h?MRlH0Ri4GliFUVku=KOP_+9I}B+F01NdkF{stKOT0fN7OowT+<|4 zHd<5@_bcRsUqzgeUU1%_Tt>gXjecbdB6q^gFrbqy@2!7C-AR9R)O7E{;A?yN z>!yiTPQYV$t2Kk1O~0AEFp&hk9FF7W9|#<#nyukWz^W}EH#9-AW__WPFF z?_6NhGnLU`dI#Gd6FInvyBQ zw=HDB*TkK@c25o(w^XTlakOmR3_QJ5SoXN`gR59Lc~>JzMX0YxA%%#|*RrBBZ)_!= z9U=a*i*bH~-R4<=&>FvUx~ONmce}(p*!^$fj|rTU3H`z?b5g(BCVF=z{NWM5`v*fF z9O6DY$@>qpLkTC(*l_9hTMFjgtly#L-iQI3V%MCle}hBuSDbk!(}sw`max zk3Cpkx!u4S&Ec-d+zUkskSLadGZAmEU#ciNA)!O~Ns(Gql<_bY z&BKF$TliT!xWb*)=I7Lw)VqLwHkuZqjlpB(nIbe?p+rTCLSFddD6%IH-eg_gCGA~Y zhIf(-+)sObHRbiUMX&GXyuK=ac~$u8LWTS<1sAt4d!}$^>C(jH@bV5U^%0bM?$J^M~ zM?pc1y~!MrZkl`njbdV1lQXPmzU_{Q`kW>eREP|*VuzX!(kGE22T{TiB^pujlpTbS zholj2y(q-t<)(RfR!fB!1@J-!&s#x01wJ&wllYfs#r>CMk57`j7e!3T64j@Rn=?d{ zGRevqvTTR~)u+}A2jD#%UsXZVneOk$C7 z6S59K6fV*aMie$edS(c3TdDv^+B$E69Pmuq1@aZ}_6v}2g!kp}y5z%ml1Fy(BHW0DDJWa$w8m`}oe!&_+T8?E$4I>7H{P%} zu_*J$?C2jmh5_|a-)kZoW~ru+M9&Ig`wpE}>s0Q*I>z|h+hJBy(Y z8*xyxdGR2H9>j=7CjN-(iuBWvaR{Qw5X}ssB>27t_y2{RQ!n&h1vm_FSs9z*m~$EQ zV->`{Iv4-$n#Y0)|E0CUI*B5f#{tRD_(c`M*wQ#{G}n4*J@dg*1|EJ7tW=a7d#4ef z&tvSEMqIA13WW^xA=2fg?ZG7xFSp|<&$DA3e`cy%p&0Sm+;X!BNrVUIkbyr(CnN|D z(OUd)N&rtkFbMITqRoQ_@h?V17h>dU+0I6mVTc;4=zkqAgu-V|#`wp40O8rq7(b4X zF@8Li<1I;;O9?!ey}cChuJq&|lx(8|UeoiDIQ+D{EYFkxY;9LHtdKvH&qQAiD@;8ilBV$RGrvROIi80%8Fs z1H|o`yZq@r93I~TxCYRt3@^vQ%UZaTFmPQ4-$nLJ^X`}!+B$)3kO;9MjY=SEVijJT z6Xuv4C`?+86Dv|9hU68Hmg%Gl9;pP1x|Uv?qAo{C5~H{w7kFFRIvHs!M8q~kcp#cL z(#OU#NDUpHgy*2*A8*L6Zo!>@QMrF?Cjed=`BdTE_lsVgCpXO|x6KR1Sz*tVprxY} zS$T6NIW8HiAZjF^7wX!Gqc8chs)5%<@Tvg%&2R5=eQ;#9T+uTr$~;=qe^31S+CF%n zBflF9{n6`Ya3&;2*C$%1kSL1Gtt12TNh=AdCM1U?l5R564QF0?B1)doAjmV*=dD2I z^ATeOV$ML;nm>ad{52eI;SGoW+gIX{7)O;`0S+i5%tH830k^Z>UgmB8Ebz$ckbO)2 zHcX3{kuMqy%f}{?r2;`-xI>T=#);oB9>BDshB2bBwEx=%09>h93eXO)0!NSX=kw+L z=kaX=54_&p4n5i#G+NAUN|%%f)rBNAg^VmAJ#$E_G*T~~j4C9_(WLj}a8xqX$;7C@ z)yQTsV$4Bmwf_}7rl31}whZ2;Upkt3VBQ%3oE75mevD!-+51}fDf~IE#U1tjvX$2} zCA>i@#$^QT1vB%><_xknF0n%3$unz)54`|i;)#Z1i(P-0qug4i`4s9bD?!)y!GbWTfaK@J)X`FjEIP%u`xI~1SeZI&4W&-l-;_+Q-WyW>;d zmN@}4@&oEprKO62h!T&(LNTh={O`bi*A*lcGhkK^1Y8O4zr?)P=lH{ZkEeT# z`&Vn8$TP^-$h8{z_ulDnaxR`V@gTWXSugrTJ`n%@ZJ%6@hh?0k7s}rWUjE3txRw3+ zeBZWlxVqvqDJyPjDkVms8$;^V_}RI+|GhW=uIo~d2A}jvW>=OPyj`XDU@US{-(Z8zf%i4=PVnTa{mp$Ir`K>l zU(8)Kj=iSIZ(4p(eQN6T2$cS30YBI?!SI+3xBPDOjr{PYOtGf$V&t1|!r_@GJam6? z#P7;F|5G#7erPs1m5Z7PRP^TpKS%+s&2YPOc(fc3s`oSAT#fv2YxwHvc3C8IRKE4- M}KB09;yd1@8A#*LMIbSDU@{S zAQ2DtlAAy1BurvKJOpNQ5X44y-p#d=Gz;Q&cffxjV46hfL0`Y`WV30LdhzB1vpX}N z=hyo_-X1_Y=R>7Lyp$87dCzl8eY2Ov z>YC@W{`Bs_&qQ;xZo8~+_U+Zp2ex;FUuxpETbwn{u5Px#M-D>Mvt6+vY_IooV=z4_ z9>P*y6Lrr$XBfscA*S5J<)!>%Asn~lxoKn2sgEBGmvY-e%{LwzQkLkE?E5z!8sPtH zyG@i`{I@ljL`gy;xu-i21(oUKX%1Zshf_x#w)9e(eJ{foM;rzid(5HtFyCRy4r+`X zazJ?MKnC{;97?b?23@KO`in!UL*~i&9S_C|YI`~kPZlWK;O++ltVFU_nxKb1t`yF> z?M;?c36fP6bQ7t%IsR09lE0*yAlXb-C!~Ol?mFy%bN)3)4{DJm#DZ&jw$tTK0PLI& z(1Th;hLBt#uN*pjHw2%%#JM-dm_;>55!thKO zDqiue3wb0kv4R7>yu9*yJzS_wxfRCfv`RqHWj9`k9~MQeR$KC`;1|%rSQQSPXA#e( zV2$>Ahg*dk8CqsH3GMKK<;L2(NqYkcrmzDRWj*w~TcLDs1GY4+@!Mxf(yrAamEWQl z^3!Estu$=_ud)|@O~BVt-&dU8FlzH|)zU`bu%(oB{4Y4fwI$DY8B&Zs8_)SwtEd{t zsG(@zZ>I6~lwZkF%1*>rQR-Xh=y!C4p*-_MnQJ-NfE_9>4(uyPdt8B&z zFp1FpWZq{zQa-$+w1p0cCgLz4e;T+%$d*)zSPk_`0?;cwO`BkY_H5j3(>-@ z3Zrz$DLW<<4rS^YkDQW*kslN@3*W@y9P=?2opZ)CqH8a!hoB$a$cs-mnh&BmH5Q8m z_86Phc=qCL46Qfii&L0fbjJlZ%TVBlv(A01hiXLYQQVlhhsi~A9(V!U&uQrVWRW5C zm`nNDmF8v=hpDm^pQtY`Uomr#Z&pqlM*nVn9g|(cvtZ`rjrvD{N%%@*lvv+Zq4> diff --git a/platform/uiq3/rsc/picodrive.rss b/platform/uiq3/rsc/picodrive.rss deleted file mode 100644 index eb5f5a62..00000000 --- a/platform/uiq3/rsc/picodrive.rss +++ /dev/null @@ -1,637 +0,0 @@ -NAME PCDR - -#include -#include -#include -#include -#include "picodrive.hrh" - - -RESOURCE RSS_SIGNATURE { } - -// Defines the name of the default file the application framework creates. -// This resource must always be the second resource in the resource file. -RESOURCE TBUF { buf = "PicoDrive"; } - -RESOURCE EIK_APP_INFO { } - - -// A view shall use the QIK_VIEW_CONFIGURATIONS resource struct to define which -// UI configurations it supports. Can also use QIK_VIEW_CONFIGURATIONS to setup -// the view to switch layout and command list automatically when changes of UI -// configuration occur. This is done with the view and command_list members of -// the QIK_VIEW_CONFIGURATIONS. -// The application supports the reference UI Configurations that are supported -// in the UIQ 3 SDK. Use the UiqEnv tool, to change the UI Configuration in the -// emulator in order to develop and test the application with varying phone styles. -RESOURCE QIK_VIEW_CONFIGURATIONS r_app_ui_configurations -{ - configurations = - { - QIK_VIEW_CONFIGURATION - { - ui_config_mode = KQikPenStyleTouchPortrait; - command_list = r_app_commands; - view = r_app_layout; - }, - QIK_VIEW_CONFIGURATION - { - ui_config_mode = KQikPenStyleTouchLandscape; - command_list = r_app_commands; - view = r_app_layout; - }, - QIK_VIEW_CONFIGURATION - { - ui_config_mode = KQikSoftkeyStyleTouchPortrait; - command_list = r_app_commands; - view = r_app_layout; - }, - QIK_VIEW_CONFIGURATION - { - ui_config_mode = KQikSoftkeyStylePortrait; - command_list = r_app_commands; - view = r_app_layout; - }, - QIK_VIEW_CONFIGURATION - { - ui_config_mode = KQikSoftkeyStyleSmallPortrait; - command_list = r_app_commands; - view = r_app_layout; - } - }; -} - -// Commands are defined with the QIK_COMMAND_LIST struct, -// commands can also be created in code by instantiating CQikCommand. -// The control command id for debug command is a reserved id from uikon.hrh. -// The id for each command is defined in the .hrh file. -RESOURCE QIK_COMMAND_LIST r_app_commands -{ - items = - { -// QIK_COMMAND { id=EEikCmdPicoMain; text="Main"; type=EQikCommandTypeDone; namedGroupLinkId=EEikCmdPicoMain; }, -// QIK_COMMAND { id=EEikCmdPicoDebugInfo; text="Debug info"; type=EQikCommandTypeScreen; stateFlags=EQikCmdFlagDebugOnly; }, - QIK_COMMAND { id=EEikCmdPicoFrameskip; text="Frameskip"; type=EQikCommandTypeScreen; namedGroupLinkId=EEikCmdPicoFrameskip; }, - QIK_COMMAND { id=EEikCmdPicoFrameskipAuto; text="Auto"; type=EQikCommandTypeScreen; namedGroupId=EEikCmdPicoFrameskip; - groupId=EEikCmdPicoFrameskip; stateFlags=EQikCmdFlagRadioStart; }, - QIK_COMMAND { id=EEikCmdPicoFrameskip0; text="0"; type=EQikCommandTypeScreen; namedGroupId=EEikCmdPicoFrameskip; - groupId=EEikCmdPicoFrameskip0; stateFlags=EQikCmdFlagRadioMiddle; }, - QIK_COMMAND { id=EEikCmdPicoFrameskip1; text="1"; type=EQikCommandTypeScreen; namedGroupId=EEikCmdPicoFrameskip; - groupId=EEikCmdPicoFrameskip0; stateFlags=EQikCmdFlagRadioMiddle; }, - QIK_COMMAND { id=EEikCmdPicoFrameskip2; text="2"; type=EQikCommandTypeScreen; namedGroupId=EEikCmdPicoFrameskip; - groupId=EEikCmdPicoFrameskip0; stateFlags=EQikCmdFlagRadioMiddle; }, - QIK_COMMAND { id=EEikCmdPicoFrameskip4; text="4"; type=EQikCommandTypeScreen; namedGroupId=EEikCmdPicoFrameskip; - groupId=EEikCmdPicoFrameskip0; stateFlags=EQikCmdFlagRadioMiddle; }, - QIK_COMMAND { id=EEikCmdPicoFrameskip8; text="8"; type=EQikCommandTypeScreen; namedGroupId=EEikCmdPicoFrameskip; - groupId=EEikCmdPicoFrameskip0; stateFlags=EQikCmdFlagRadioEnd; }, - QIK_COMMAND { id=EEikCmdPicoConfig; text="Configure"; type=EQikCommandTypeScreen; namedGroupLinkId=EEikCmdPicoConfig; }, - QIK_COMMAND { id=EEikCmdPicoKeys; text="Keys"; type=EQikCommandTypeScreen; namedGroupId=EEikCmdPicoConfig; }, - QIK_COMMAND { id=EEikCmdPicoSettings; text="Settings"; type=EQikCommandTypeScreen; namedGroupId=EEikCmdPicoConfig; }, - QIK_COMMAND { id=EEikCmdHelpAbout; text="About"; type=EQikCommandTypeScreen; namedGroupId=EEikCmdPicoConfig; }, - - QIK_COMMAND { id=EEikCmdPicoLoadROM; text="Load new ROM/ISO";type=EQikCommandTypeScreen; groupId=EEikCmdPicoResume; }, - QIK_COMMAND { id=EEikCmdPicoReset; text="Reset game"; type=EQikCommandTypeScreen; groupId=EEikCmdPicoResume; }, - QIK_COMMAND { id=EEikCmdPicoLoadState; text="Load state"; type=EQikCommandTypeScreen; groupId=EEikCmdPicoResume; }, - QIK_COMMAND { id=EEikCmdPicoSaveState; text="Save state"; type=EQikCommandTypeScreen; groupId=EEikCmdPicoResume; }, - QIK_COMMAND { id=EEikCmdPicoResume; text="Resume game"; type=EQikCommandTypeScreen; groupId=EEikCmdPicoResume; cpfFlags=EQikCpfFlagIsDefault; }, - - QIK_COMMAND { id=EEikCmdExit; text="Exit"; type=EQikCommandTypeScreen; groupId=EEikCmdExit; } - }; -} - - -// Defines the view by linking to the pages. -RESOURCE QIK_VIEW r_app_layout -{ - pages = {}; -} - - -/************************************** - * - * config dialog - * - **************************************/ - -RESOURCE DIALOG r_pico_config -{ - title = "Settings"; - buttons = R_EIK_BUTTONS_CANCEL_OK; - flags = EEikDialogFlagWait; - pages = r_pico_config_pages; -} - -RESOURCE ARRAY r_pico_config_pages -{ - items = { - PAGE - { - id = ECtlOptPageMain; - text = "Main"; - lines = r_pico_config_page_main; - }, - PAGE - { - id = ECtlOptPageSound; - text = "Sound"; - lines = r_pico_config_page_sound; - }, - PAGE - { - id = ECtlOptPageMCD; - text = "MegaCD"; - lines = r_pico_config_page_mcd; - }, - PAGE - { - id = ECtlOptPageMisc; - text = "Misc"; - lines = r_pico_config_page_misc; - } - }; -} - - -RESOURCE ARRAY r_pico_config_page_main -{ - items = { - DLG_LINE - { - id = ECtlOptRotationLabel; - type = EEikCtLabel; - prompt = "Screen Rotation"; - control = LABEL { horiz_align = EEikLabelAlignHLeft; }; - }, - DLG_LINE - { - id = ECtlOptRotation; - type = EEikCtHorOptionButList; - control = HOROPBUT - { - array_id = r_pico_config_rotation_buttons; - }; - }, - DLG_LINE - { - id = ECtlOptScreenModeLabel; - type = EEikCtLabel; - prompt = "Screen Mode"; - control = LABEL { horiz_align = EEikLabelAlignHLeft; }; - }, - DLG_LINE - { - id = ECtlOptScreenMode; - type = EEikCtHorOptionButList; - control = HOROPBUT - { - array_id = r_pico_config_screenmode_buttons; - }; - }, - DLG_LINE - { - id = ECtlOptUseAltRend; - type = EEikCtCheckBox; - prompt = "Fast renderer (inaccurate)"; - }, - DLG_LINE - { - id = ECtlOptShowFPS; - type = EEikCtCheckBox; - prompt = "Show FPS"; - } - }; -} - - -RESOURCE ARRAY r_pico_config_page_sound -{ - items = { - DLG_LINE - { - id = ECtlOptEnableSound; - type = EEikCtCheckBox; - prompt = "Enable sound"; - }, - DLG_LINE - { - id = ECtlOptChipSelLabel; - type = EEikCtLabel; - prompt = "Emulate these sound chips:"; - control = LABEL { horiz_align = EEikLabelAlignHLeft; }; - }, - DLG_LINE - { - id = ECtlOptEmulateZ80; - type = EEikCtCheckBox; - prompt = "Z80"; - }, - DLG_LINE - { - id = ECtlOptEmulateYM2612; - type = EEikCtCheckBox; - prompt = "YM2612"; - }, - DLG_LINE - { - id = ECtlOptEmulateSN76496; - type = EEikCtCheckBox; - prompt = "SN76496 (PSG)"; - }, - DLG_LINE - { - id = ECtlOptSndQLabel; - type = EEikCtLabel; - prompt = "Quality (lowest is fastest)"; - control = LABEL { horiz_align = EEikLabelAlignHLeft; }; - }, - DLG_LINE - { - id = ECtlOptSndQuality; - type = EEikCtChoiceList; - prompt = ""; - control = CHOICELIST { array_id = r_pico_config_snd_quality; }; - itemflags = EEikDlgItemNonFocusing; - } - }; -} - - -RESOURCE ARRAY r_pico_config_page_mcd -{ - items = { - DLG_LINE - { - id = ECtlOptCDcdda; - type = EEikCtCheckBox; - prompt = "CDDA audio"; - }, - DLG_LINE - { - id = ECtlOptCDpcm; - type = EEikCtCheckBox; - prompt = "PCM audio"; - }, - DLG_LINE - { - id = ECtlOptCDramcart; - type = EEikCtCheckBox; - prompt = "SaveRAM cart"; - }, - DLG_LINE - { - id = ECtlOptCDscalerot; - type = EEikCtCheckBox; - prompt = "Scale/Rot. fx (slow)"; - }, - DLG_LINE - { - id = ECtlOptCDbettersync; - type = EEikCtCheckBox; - prompt = "Better sync (slow)"; - } - }; -} - - -RESOURCE ARRAY r_pico_config_page_misc -{ - items = { - DLG_LINE - { - id = ECtlOpt6ButtonPad; - type = EEikCtCheckBox; - prompt = "6 button pad"; - }, - DLG_LINE - { - id = ECtlOptGzipStates; - type = EEikCtCheckBox; - prompt = "gzip save states"; - }, - DLG_LINE - { - id = ECtlOptUseSRAM; - type = EEikCtCheckBox; - prompt = "Use SRAM saves (.srm)"; - }, - DLG_LINE - { - id = ECtlOptRegion; - type = EEikCtChoiceList; - prompt = "Region:"; - control = CHOICELIST { array_id = r_pico_config_region; }; - itemflags = EEikDlgItemNonFocusing; - } - }; -} - - -RESOURCE ARRAY r_pico_config_rotation_buttons -{ - items = { - OPBUT { id = ECtlOptRotation0; text = "0º"; }, - OPBUT { id = ECtlOptRotation90; text = "90º"; }, - OPBUT { id = ECtlOptRotation180; text = "180º"; }, - OPBUT { id = ECtlOptRotation270; text = "270º"; } - }; -} - - -RESOURCE ARRAY r_pico_config_screenmode_buttons -{ - items = { - OPBUT { id = ECtlOptScreenModeCenter; text = "Center"; }, - OPBUT { id = ECtlOptScreenModeFit; text = "Fit"; }, - OPBUT { id = ECtlOptScreenModeFit2; text = "Fit2"; } - }; -} - - -RESOURCE ARRAY r_pico_config_snd_quality -{ - items = { - LBUF { txt = "8000Hz mono"; }, - LBUF { txt = "11025Hz mono"; }, - LBUF { txt = "16000Hz mono"; }, - LBUF { txt = "22050Hz mono"; }, - LBUF { txt = "44100Hz mono"; }, - LBUF { txt = "8000Hz stereo"; }, - LBUF { txt = "11025Hz stereo"; }, - LBUF { txt = "16000Hz stereo"; }, - LBUF { txt = "22050Hz stereo"; }, - LBUF { txt = "44100Hz stereo"; } - }; -} - - -RESOURCE ARRAY r_pico_config_region -{ - items = { - LBUF { txt = "Auto"; }, - LBUF { txt = "Europe"; }, - LBUF { txt = "USA"; }, - LBUF { txt = "Japan PAL"; }, - LBUF { txt = "Japan NTSC"; } - }; -} - - -/************************************** - * - * about dialog - * - **************************************/ - -// A simple dialog shall use the QIK_DIALOG resource struct to -// define which UI configurations it supports. -RESOURCE QIK_DIALOG r_pico_about -{ - title = "About"; - configurations = - { - QIK_DIALOG_CONFIGURATION - { - ui_config_mode = 0; - container = r_pico_about_container; - command_list = r_pico_about_commands; - } - }; - controls = r_pico_about_controls; -} - -RESOURCE QIK_COMMAND_LIST r_pico_about_commands -{ - items= - { - QIK_COMMAND - { - id = EEikCmdPicoAboutDoneCmd; - type = EQikCommandTypeDone; - text = "Done"; - }, - QIK_COMMAND - { - id = EEikCmdPicoAboutCreditsCmd; - type = EQikCommandTypeItem; - text = "Credits"; - } - }; -} - -// A collection of controls that can be used throughout the various -// view/container/building block structs by using the unique handle in -// QIK_CONTROL. So you can specify how the control should be created here and -// just reference to it from other places. -RESOURCE QIK_CONTROL_COLLECTION r_pico_about_controls -{ - items = - { - QIK_CONTROL - { - unique_handle = ECtlPicoAboutText; - type = EEikCtRichTextEditor; - control = r_pico_about_rtxted; - itemflags = EQikCtrlFlagIsEditInPlace; - } - }; -} - -// the controls themselves -RESOURCE RTXTED r_pico_about_rtxted -{ - flags = EEikEdwinDisplayOnly|EEikEdwinReadOnly|EEikEdwinNoHorizScrolling; - numlines = 13; - displayMode = 1; // EDisplayModeView; -} - -// Defines the content of the simple dialog and how they are laid out. -// Default layout manager is used for laying out the controls, which is a row -// layout. -RESOURCE QIK_CONTAINER_SETTINGS r_pico_about_container -{ - controls = - { - QIK_CONTAINER_ITEM_CI_LI - { - type = EQikCtOnelineBuildingBlock; - control = r_pico_about_bb1; - } - }; -} - -// Building block that contains the label. -RESOURCE QIK_SYSTEM_BUILDING_BLOCK r_pico_about_bb1 -{ - content = - { - QIK_SLOT_CONTENT - { - slot_id = EQikItemSlot1; - unique_handle = ECtlPicoAboutText; - } - }; -} - -RESOURCE TBUF r_pico_text_about -{ - buf= - "PicoDrive"\ - "

for UIQ3"\ - "

Version %S, by notaz."\ - "

Port based on UIQ2 version, which is based on PicoDrive 0.030 for Pocket PC by Dave"\ - "

Email: notasas@gmail.com"\ - "

Web: http://notaz.gp2x.de"\ - "

Dave's Web: http://www.finalburn.com"; -} - -/************************************** - * - * credits dialog - * - **************************************/ - -// A simple dialog shall use the QIK_DIALOG resource struct to -// define which UI configurations it supports. -RESOURCE QIK_DIALOG r_pico_credits -{ - title = "Credits and thanks"; - configurations = - { - QIK_DIALOG_CONFIGURATION - { - ui_config_mode = 0; - container = r_pico_credits_container; - command_list = r_pico_credits_commands; - } - }; - controls = r_pico_credits_controls; -} - -RESOURCE QIK_COMMAND_LIST r_pico_credits_commands -{ - items= - { - QIK_COMMAND - { - id = EEikCmdPicoAboutDoneCmd; - type = EQikCommandTypeDone; - text = "Done"; - } - }; -} - -// A collection of controls that can be used throughout the various -// view/container/building block structs by using the unique handle in -// QIK_CONTROL. So you can specify how the control should be created here and -// just reference to it from other places. -RESOURCE QIK_CONTROL_COLLECTION r_pico_credits_controls -{ - items = - { - QIK_CONTROL - { - unique_handle = ECtlPicoCreditsText; - type = EEikCtEdwin; - control = r_pico_credits_edwin; - itemflags = EQikCtrlFlagIsEditInPlace; - } - }; -} - -// the controls themselves -RESOURCE EDWIN r_pico_credits_edwin -{ - flags = EEikEdwinDisplayOnly|EEikEdwinReadOnly|EEikEdwinNoHorizScrolling|EEikEdwinDisableAutoCurEnd; - lines = 11; -} - -// Defines the content of the simple dialog and how they are laid out. -// Default layout manager is used for laying out the controls, which is a row -// layout. -RESOURCE QIK_CONTAINER_SETTINGS r_pico_credits_container -{ - controls = - { - QIK_CONTAINER_ITEM_CI_LI - { - type = EQikCtOnelineBuildingBlock; - control = r_pico_credits_bb1; - } - }; -} - -// Building block that contains the label. -RESOURCE QIK_SYSTEM_BUILDING_BLOCK r_pico_credits_bb1 -{ - content = - { - QIK_SLOT_CONTENT - { - slot_id = EQikItemSlot1; - unique_handle = ECtlPicoCreditsText; - } - }; -} - - -RESOURCE ARRAY r_pico_tbuf_credits -{ - items= - { - LBUF{txt="This emulator uses code from these people / projects:";}, - LBUF{txt="";}, - LBUF{txt="Dave";}, - LBUF{txt="- Cyclone 68000 core, Pico emulation library";}, - LBUF{txt="Homepage: http://www.finalburn.com/";}, - LBUF{txt="";}, - LBUF{txt="Reesy & FluBBa";}, - LBUF{txt="- DrZ80, the Z80 emulator written in ARM assembly.";}, - LBUF{txt="Homepage: http://reesy.gp32x.de/";}, - LBUF{txt="";}, - LBUF{txt="MultiArcadeMachineEmulator (MAME) development";}, - LBUF{txt="- software implementation of Yamaha FM sound generator and";}, - LBUF{txt="Texas Instruments SN76489 / SN76496 programmable tone / noise generator";}, - LBUF{txt="Homepage: http://www.mame.net/";}, - LBUF{txt="";}, - LBUF{txt="Helix community";}, - LBUF{txt="Helix mp3 decoder";}, - LBUF{txt="";}, - LBUF{txt="Additional thanks:";}, - LBUF{txt="- Charles MacDonald (http://cgfm2.emuviews.com/) for old but still very useful info about genesis hardware.";}, - LBUF{txt="- Stéphane Dallongeville for creating Gens and making it open-source.";}, - LBUF{txt="- Steve Snake for all that he has done for Genesis emulation scene.";}, - LBUF{txt="- Tasco Deluxe for his reverse engineering work on SVP and some mappers.";}, - LBUF{txt="- Bart Trzynadlowski for his SSFII and 68000 docs.";}, - LBUF{txt="- Haze for his research (http://haze.mameworld.info).";}, - LBUF{txt="- Lordus, Exophase and Rokas for various ideas.";}, - LBUF{txt="- Mark and Jean-loup for zlib library.";}, - LBUF{txt="- Peter van Sebille for his various open-source Symbian projects to learn from.";}, - LBUF{txt="- Steve Fischer for his open-source Motorola projects.";}, - LBUF{txt="- AnotherGuest for all his Symbian stuff and support.";}, - LBUF{txt="- Inder for the icons.";}, - LBUF{txt="- Anyone else I forgot. You know who you are.";} - }; -} - - -/************************************** - * - * debug dialog - * - **************************************/ - -RESOURCE QIK_DIALOG r_pico_debug -{ - title = "debug"; - configurations = - { - QIK_DIALOG_CONFIGURATION - { - ui_config_mode = 0; - container = r_pico_credits_container; // stuff from credits should fit - command_list = r_pico_credits_commands; - } - }; - controls = r_pico_credits_controls; -} - diff --git a/platform/uiq3/rsc/picodrive_loc.rss b/platform/uiq3/rsc/picodrive_loc.rss deleted file mode 100644 index 32b64753..00000000 --- a/platform/uiq3/rsc/picodrive_loc.rss +++ /dev/null @@ -1,56 +0,0 @@ -#include -#include - -#define EViewIdPrimaryView 1 - -// This file localise the applications icons and caption -RESOURCE LOCALISABLE_APP_INFO -{ - caption_and_icon = - { - CAPTION_AND_ICON_INFO - { - caption = "PicoDrive"; - // Icons are used to represent applications in the - // application launcher and application title bar. - // The number_of_icons value identifies how many icons - // that exist in the icon_file. - number_of_icons = 3; - // Using the application icons. - icon_file = "\\Resource\\Apps\\PicoDrive.mbm"; - } - }; - - view_list = - { - VIEW_DATA - { - uid=EViewIdPrimaryView; - screen_mode=0; - caption_and_icon = - { - CAPTION_AND_ICON_INFO - { - caption = "PicoDrive"; - number_of_icons = 3; - icon_file = "\\Resource\\Apps\\PicoDrive.mbm"; - } - }; - }, - - VIEW_DATA - { - uid=EViewIdPrimaryView; - screen_mode=EQikScreenModeSmallPortrait; - caption_and_icon = - { - CAPTION_AND_ICON_INFO - { - caption = "PicoDrive"; - number_of_icons = 3; - icon_file = "\\Resource\\Apps\\PicoDrive.mbm"; - } - }; - } - }; -} diff --git a/platform/uiq3/rsc/picodrive_reg.rss b/platform/uiq3/rsc/picodrive_reg.rss deleted file mode 100644 index d95f5157..00000000 --- a/platform/uiq3/rsc/picodrive_reg.rss +++ /dev/null @@ -1,17 +0,0 @@ -// All registration files need to #include appinfo.rh. -#include - -// All registration files must define UID2, which is always -// KUidAppRegistrationResourceFile, and UID3, which is the application's UID. -// ? UID2 KUidAppRegistrationResourceFile -// ? UID3 0xA00010F3 // application UID - -// Registration file need to containo an APP_REGISTRATION_INFO resource that -// minimally needs to provide the name of the application binary (using the -// app_file statement). -RESOURCE APP_REGISTRATION_INFO - { - app_file = "PicoDrive"; // filename of application binary (minus extension) - // Specify the location of the localisable icon/caption definition file - localisable_resource_file = "\\Resource\\Apps\\PicoDrive_loc"; - } diff --git a/platform/uiq3/uiq3.mak b/platform/uiq3/uiq3.mak deleted file mode 100644 index ddf2e846..00000000 --- a/platform/uiq3/uiq3.mak +++ /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 index 4388a018..00000000 --- a/platform/uiq3/version.h +++ /dev/null @@ -1,10 +0,0 @@ -// version number - -#ifndef __VERSION_H -#define __VERSION_H - -#define KPicoMajorVersionNumber 1 -#define KPicoMinorVersionNumber 51 -#define KPicoBuildNumber 0 - -#endif /* __VERSION_H */ -- 2.39.5