Previous 199869 Revisions Next

r40583 Wednesday 2nd September, 2015 at 21:30:15 UTC by Joakim Larsson Edström
New VME board: Mizar 8105, 68000@10Mhz with support for a 16Kb OS9 bootstrap
- Terminal interface hooked up to a UPD7201 that the board expects on the VME bus
[/trunk].gitignore
[3rdparty/googletest].travis.yml README.md travis.sh
[3rdparty/googletest/googlemock]CHANGES CMakeLists.txt CONTRIBUTORS LICENSE Makefile.am README.md configure.ac
[3rdparty/googletest/googlemock/build-aux].keep
[3rdparty/googletest/googlemock/docs]CheatSheet.md CookBook.md DesignDoc.md DevGuide.md Documentation.md ForDummies.md FrequentlyAskedQuestions.md KnownIssues.md
[3rdparty/googletest/googlemock/docs/v1_5]CheatSheet.md CookBook.md Documentation.md ForDummies.md FrequentlyAskedQuestions.md
[3rdparty/googletest/googlemock/docs/v1_6]CheatSheet.md CookBook.md Documentation.md ForDummies.md FrequentlyAskedQuestions.md
[3rdparty/googletest/googlemock/docs/v1_7]CheatSheet.md CookBook.md Documentation.md ForDummies.md FrequentlyAskedQuestions.md
[3rdparty/googletest/googlemock/include/gmock]gmock-actions.h gmock-cardinalities.h gmock-generated-actions.h gmock-generated-actions.h.pump gmock-generated-function-mockers.h gmock-generated-function-mockers.h.pump gmock-generated-matchers.h gmock-generated-matchers.h.pump gmock-generated-nice-strict.h gmock-generated-nice-strict.h.pump gmock-matchers.h gmock-more-actions.h gmock-more-matchers.h gmock-spec-builders.h gmock.h
[3rdparty/googletest/googlemock/include/gmock/internal]gmock-generated-internal-utils.h gmock-generated-internal-utils.h.pump gmock-internal-utils.h gmock-port.h
[3rdparty/googletest/googlemock/include/gmock/internal/custom]gmock-generated-actions.h gmock-generated-actions.h.pump gmock-matchers.h gmock-port.h
[3rdparty/googletest/googlemock/make]Makefile
[3rdparty/googletest/googlemock/msvc/2005]gmock.sln gmock.vcproj gmock_config.vsprops gmock_main.vcproj gmock_test.vcproj
[3rdparty/googletest/googlemock/msvc/2010]gmock.sln gmock.vcxproj gmock_config.props gmock_main.vcxproj gmock_test.vcxproj
[3rdparty/googletest/googlemock/scripts]fuse_gmock_files.py gmock-config.in gmock_doctor.py upload.py upload_gmock.py
[3rdparty/googletest/googlemock/scripts/generator]LICENSE README README.cppclean gmock_gen.py
[3rdparty/googletest/googlemock/scripts/generator/cpp]__init__.py ast.py gmock_class.py gmock_class_test.py keywords.py tokenize.py utils.py
[3rdparty/googletest/googlemock/src]gmock-all.cc gmock-cardinalities.cc gmock-internal-utils.cc gmock-matchers.cc gmock-spec-builders.cc gmock.cc gmock_main.cc
[3rdparty/googletest/googlemock/test]gmock-actions_test.cc gmock-cardinalities_test.cc gmock-generated-actions_test.cc gmock-generated-function-mockers_test.cc gmock-generated-internal-utils_test.cc gmock-generated-matchers_test.cc gmock-internal-utils_test.cc gmock-matchers_test.cc gmock-more-actions_test.cc gmock-nice-strict_test.cc gmock-port_test.cc gmock-spec-builders_test.cc gmock_all_test.cc gmock_ex_test.cc gmock_leak_test.py gmock_leak_test_.cc gmock_link2_test.cc gmock_link_test.cc gmock_link_test.h gmock_output_test.py gmock_output_test_.cc gmock_output_test_golden.txt gmock_stress_test.cc gmock_test.cc gmock_test_utils.py
[3rdparty/googletest/googletest]CHANGES CMakeLists.txt CONTRIBUTORS LICENSE Makefile.am README.md configure.ac
[3rdparty/googletest/googletest/build-aux].keep
[3rdparty/googletest/googletest/cmake]internal_utils.cmake
[3rdparty/googletest/googletest/codegear]gtest.cbproj gtest.groupproj gtest_all.cc gtest_link.cc gtest_main.cbproj gtest_unittest.cbproj
[3rdparty/googletest/googletest/docs]AdvancedGuide.md DevGuide.md Documentation.md FAQ.md Primer.md PumpManual.md Samples.md V1_5_AdvancedGuide.md V1_5_Documentation.md V1_5_FAQ.md V1_5_Primer.md V1_5_PumpManual.md V1_5_XcodeGuide.md V1_6_AdvancedGuide.md V1_6_Documentation.md V1_6_FAQ.md V1_6_Primer.md V1_6_PumpManual.md V1_6_Samples.md V1_6_XcodeGuide.md V1_7_AdvancedGuide.md V1_7_Documentation.md V1_7_FAQ.md V1_7_Primer.md V1_7_PumpManual.md V1_7_Samples.md V1_7_XcodeGuide.md XcodeGuide.md
[3rdparty/googletest/googletest/include/gtest]gtest-death-test.h gtest-message.h gtest-param-test.h gtest-param-test.h.pump gtest-printers.h gtest-spi.h gtest-test-part.h gtest-typed-test.h gtest.h gtest_pred_impl.h gtest_prod.h
[3rdparty/googletest/googletest/include/gtest/internal]gtest-death-test-internal.h gtest-filepath.h gtest-internal.h gtest-linked_ptr.h gtest-param-util-generated.h gtest-param-util-generated.h.pump gtest-param-util.h gtest-port-arch.h gtest-port.h gtest-string.h gtest-tuple.h gtest-tuple.h.pump gtest-type-util.h gtest-type-util.h.pump
[3rdparty/googletest/googletest/include/gtest/internal/custom]gtest-port.h gtest-printers.h gtest.h
[3rdparty/googletest/googletest/m4]acx_pthread.m4 gtest.m4
[3rdparty/googletest/googletest/make]Makefile
[3rdparty/googletest/googletest/msvc]gtest-md.sln gtest-md.vcproj gtest.sln gtest.vcproj gtest_main-md.vcproj gtest_main.vcproj gtest_prod_test-md.vcproj gtest_prod_test.vcproj gtest_unittest-md.vcproj gtest_unittest.vcproj
[3rdparty/googletest/googletest/samples]prime_tables.h sample1.cc sample1.h sample10_unittest.cc sample1_unittest.cc sample2.cc sample2.h sample2_unittest.cc sample3-inl.h sample3_unittest.cc sample4.cc sample4.h sample4_unittest.cc sample5_unittest.cc sample6_unittest.cc sample7_unittest.cc sample8_unittest.cc sample9_unittest.cc
[3rdparty/googletest/googletest/scripts]common.py fuse_gtest_files.py gen_gtest_pred_impl.py gtest-config.in pump.py release_docs.py upload.py upload_gtest.py
[3rdparty/googletest/googletest/scripts/test]Makefile
[3rdparty/googletest/googletest/src]gtest-all.cc gtest-death-test.cc gtest-filepath.cc gtest-internal-inl.h gtest-port.cc gtest-printers.cc gtest-test-part.cc gtest-typed-test.cc gtest.cc gtest_main.cc
[3rdparty/googletest/googletest/test]gtest-death-test_ex_test.cc gtest-death-test_test.cc gtest-filepath_test.cc gtest-linked_ptr_test.cc gtest-listener_test.cc gtest-message_test.cc gtest-options_test.cc gtest-param-test2_test.cc gtest-param-test_test.cc gtest-param-test_test.h gtest-port_test.cc gtest-printers_test.cc gtest-test-part_test.cc gtest-tuple_test.cc gtest-typed-test2_test.cc gtest-typed-test_test.cc gtest-typed-test_test.h gtest-unittest-api_test.cc gtest_all_test.cc gtest_break_on_failure_unittest.py gtest_break_on_failure_unittest_.cc gtest_catch_exceptions_test.py gtest_catch_exceptions_test_.cc gtest_color_test.py gtest_color_test_.cc gtest_env_var_test.py gtest_env_var_test_.cc gtest_environment_test.cc gtest_filter_unittest.py gtest_filter_unittest_.cc gtest_help_test.py gtest_help_test_.cc gtest_list_tests_unittest.py gtest_list_tests_unittest_.cc gtest_main_unittest.cc gtest_no_test_unittest.cc gtest_output_test.py gtest_output_test_.cc gtest_output_test_golden_lin.txt gtest_pred_impl_unittest.cc gtest_premature_exit_test.cc gtest_prod_test.cc gtest_repeat_test.cc gtest_shuffle_test.py gtest_shuffle_test_.cc gtest_sole_header_test.cc gtest_stress_test.cc gtest_test_utils.py gtest_throw_on_failure_ex_test.cc gtest_throw_on_failure_test.py gtest_throw_on_failure_test_.cc gtest_uninitialized_test.py gtest_uninitialized_test_.cc gtest_unittest.cc gtest_xml_outfile1_test_.cc gtest_xml_outfile2_test_.cc gtest_xml_outfiles_test.py gtest_xml_output_unittest.py gtest_xml_output_unittest_.cc gtest_xml_test_utils.py production.cc production.h
[3rdparty/googletest/googletest/xcode/Config]DebugProject.xcconfig FrameworkTarget.xcconfig General.xcconfig ReleaseProject.xcconfig StaticLibraryTarget.xcconfig TestTarget.xcconfig
[3rdparty/googletest/googletest/xcode/Resources]Info.plist
[3rdparty/googletest/googletest/xcode/Samples/FrameworkSample]Info.plist runtests.sh widget.cc widget.h widget_test.cc
[3rdparty/googletest/googletest/xcode/Samples/FrameworkSample/WidgetFramework.xcodeproj]project.pbxproj
[3rdparty/googletest/googletest/xcode/Scripts]runtests.sh versiongenerate.py
[3rdparty/googletest/googletest/xcode/gtest.xcodeproj]project.pbxproj
[3rdparty/unittest-cpp].gitattributes* .gitignore* .gitmodules* AUTHORS* CMakeLists.txt* ChangeLog* INSTALL* LICENSE* Makefile.am* README.md* UnitTest++* configure.ac*
[3rdparty/unittest-cpp/UnitTest++]AssertException.cpp* AssertException.h* CheckMacros.h* Checks.cpp* Checks.h* CompositeTestReporter.cpp* CompositeTestReporter.h* Config.h* CurrentTest.cpp* CurrentTest.h* DeferredTestReporter.cpp* DeferredTestReporter.h* DeferredTestResult.cpp* DeferredTestResult.h* ExceptionMacros.h* ExecuteTest.h* HelperMacros.h* Makefile.am* MemoryOutStream.cpp* MemoryOutStream.h* Posix* ReportAssert.cpp* ReportAssert.h* ReportAssertImpl.h* Test.cpp* Test.h* TestDetails.cpp* TestDetails.h* TestList.cpp* TestList.h* TestMacros.h* TestReporter.cpp* TestReporter.h* TestReporterStdout.cpp* TestReporterStdout.h* TestResults.cpp* TestResults.h* TestRunner.cpp* TestRunner.h* TestSuite.h* TimeConstraint.cpp* TimeConstraint.h* TimeHelpers.h* UnitTest++.h* UnitTestPP.h* Win32* XmlTestReporter.cpp* XmlTestReporter.h* unittestpp_vs2005.vcproj* unittestpp_vs2008.vcproj*
[3rdparty/unittest-cpp/UnitTest++/Posix]SignalTranslator.cpp* SignalTranslator.h* TimeHelpers.cpp* TimeHelpers.h*
[3rdparty/unittest-cpp/UnitTest++/Win32]TimeHelpers.cpp* TimeHelpers.h*
[3rdparty/unittest-cpp/builds].gitignore*
[3rdparty/unittest-cpp/docs]Building-Using-CMake.md* Home.md* Macro-Reference.md* Writing-More-Tests-With-the-Bowling-Game-Kata.md* Writing-and-Running-Your-First-Test.md*
[3rdparty/unittest-cpp/tests]Main.cpp* RecordingReporter.h* ScopedCurrentTest.h* TestAssertHandler.cpp* TestCheckMacros.cpp* TestChecks.cpp* TestCompositeTestReporter.cpp* TestCurrentTest.cpp* TestDeferredTestReporter.cpp* TestExceptions.cpp* TestMemoryOutStream.cpp* TestTest.cpp* TestTestList.cpp* TestTestMacros.cpp* TestTestResults.cpp* TestTestRunner.cpp* TestTestSuite.cpp* TestTimeConstraint.cpp* TestTimeConstraintMacro.cpp* TestUnitTestPP.cpp* TestXmlTestReporter.cpp*
[hash]a800_flop.xml c64_flop.xml megadriv.xml x1_cass.xml
[scripts]genie.lua
[scripts/src]3rdparty.lua tests.lua
[scripts/target/mame]mess.lua
[src/emu/bus/centronics]printer.c
[src/emu/bus/pc_kbd]iskr1030.c iskr1030.h
[src/emu/cpu/t11]t11.c t11.h
[src/emu/drivers]emudummy.c
[src/emu/machine]68230pit.c 68230pit.h at_keybc.c at_keybc.h
[src/emu/netlist]nl_base.h nl_setup.h
[src/emu/netlist/plib]pstring.c pstring.h
[src/emu/netlist/solver]nld_solver.h
[src/emu/sound]c352.c c352.h l7a1045_l6028_dsp_a.c l7a1045_l6028_dsp_a.h tms5110.c tms5110.h tms5220.c tms5220.h
[src/emu/video]poly.h polylgcy.h
[src/mame]arcade.lst mess.lst
[src/mame/audio]hng64.c
[src/mame/drivers]cps1.c deco32.c fcrash.c galastrm.c groundfx.c hng64.c lethalj.c midxunit.c model2.c model3.c namcofl.c namconb1.c namcond1.c namcos11.c namcos12.c namcos22.c namcos23.c quantum.c yunsun16.c zaccaria.c
[src/mame/includes]chihiro.h galastrm.h hng64.h model2.h model3.h
[src/mame/machine]hng64_net.c model3.c namco62.c namco62.h xbox.c
[src/mame/video]chihiro.c deco16ic.c galastrm.c hng64.c hng64_sprite.c midzeus2.c model2.c model2rd.inc model3.c namcos22.c
[src/mess/drivers]asst128.c at.c besta.c canon_s80.c dvk_kcgd.c force68k.c mc1000.c mk85.c mk90.c mzr8105.c* tispeak.c uknc.c
[src/mess/layout]fccpu1.lay
[src/osd/modules/debugger/win]debugviewinfo.c debugwininfo.c editwininfo.c
[src/osd/windows]input.c output.c window.c winmain.c winutil.c winutil.h
[tests]main.c
[tests/lib/util]corestr.c

trunk/.gitignore
r249094r249095
11*~
22/*
3/*/
4!/3rdparty/
5!/artwork/
6!/docs/
7!/hash/
8!/hlsl/
9!/keymaps/
10!/nl_examples/
11!/samples/
12!/scripts/
13!/src/
14!/tests/
15!/web/
3!/*/
164!/.gitattributes
175!/.gitignore
186!/.travis.yml
197!/makefile
20!/mame.doxygen
8!/mame.doxygen
219!/*.md
10/cfg
11/diff
12/ini
13/inp
14/nvram
15/obj
16/roms
17/snap
2218src/regtests/chdman/temp
2319src/regtests/jedutil/output
24*.pyc
No newline at end of file
20/sta
21*.pyc
22/build
23/documentation
No newline at end of file
trunk/3rdparty/unittest-cpp/.gitattributes
r0r249095
1* text=auto
2
3*.h text
4*.cpp text
5
6# VS 20xx files
7*.sln text eol=crlf
8*.vcproj text eol=crlf
9*.vcxproj text eol=crlf
10*.vcxproj.filters text eol=crlf
11
12# VC6 files
13*.dsw text eol=crlf
14*.dsp text eol=crlf
15
16# Other 'windows-specific' files
17*.bat text eol=crlf
No newline at end of file
trunk/3rdparty/unittest-cpp/.gitignore
r0r249095
1*.o
2*.a
3*.lo
4*.la
5
6# Visual Studio temp/user files
7*.user
8*.suo
9*.sdf
10*.opensdf
11*.ncb
12
13# Build output directories
14Release
15Debug
16MinSizeRel
17RelWithDebInfo
18ipch
19
20# files generated by autotools
21/aclocal.m4
22/autom4te.cache
23/config.guess
24/config.h
25/config.h.in
26/config.status
27/config.sub
28/configure
29/depcomp
30/install-sh
31/libtool
32/ltmain.sh
33/m4
34/missing
35/stamp-h*
36/test-driver
37/UnitTest++/TestUnitTest++
38Makefile
39Makefile.in
40.deps
41.libs
42*.log
43*.trs
trunk/3rdparty/unittest-cpp/.gitmodules
r0r249095
1[submodule "docs"]
2   path = docs
3   url = https://github.com/unittest-cpp/unittest-cpp.wiki.git
trunk/3rdparty/unittest-cpp/AUTHORS
r0r249095
1See README.md for the historic contributor list.
2
3The maintainer of UnitTest++ is Patrick Johnmeyer (pjohnmeyer@gmail.com).
trunk/3rdparty/unittest-cpp/CMakeLists.txt
r0r249095
1cmake_minimum_required(VERSION 2.8.1)
2project(UnitTest++)
3
4option(UTPP_USE_PLUS_SIGN "Set this to OFF is you with to use '-cpp' instead of '++' in lib/include paths" ON)
5
6# get the main sources
7file(GLOB headers_ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} UnitTest++/*.h)
8file(GLOB sources_ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} UnitTest++/*.cpp)
9source_group("" FILES ${headers_} ${sources_})
10
11# get platform specific sources
12if (WIN32)
13    add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
14    set(platformDir_ Win32)
15else()
16    set(platformDir_ Posix)
17endif(WIN32)
18
19file(GLOB platformHeaders_ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} UnitTest++/${platformDir_}/*.h)
20file(GLOB platformSources_ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} UnitTest++/${platformDir_}/*.cpp)
21source_group(${platformDir_} FILES ${platformHeaders_} ${platformSources_})
22
23# create the lib
24add_library(UnitTest++ STATIC ${headers_} ${sources_} ${platformHeaders_} ${platformSources_})
25
26if(${UTPP_USE_PLUS_SIGN})
27   set_target_properties(UnitTest++ PROPERTIES OUTPUT_NAME UnitTest++)
28endif()
29
30
31# build the test runner
32file(GLOB TEST_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} tests/*.cpp tests/*.h)
33source_group( "" FILES ${TEST_SRCS})
34add_executable(TestUnitTest++ ${TEST_SRCS})
35include_directories(.)
36
37if(${UTPP_USE_PLUS_SIGN})
38   set_target_properties(TestUnitTest++ PROPERTIES OUTPUT_NAME TestUnitTest++)
39endif()
40
41target_link_libraries(TestUnitTest++ UnitTest++)
42
43# run unit tests as post build step
44add_custom_command(TARGET TestUnitTest++
45   POST_BUILD COMMAND TestUnitTest++
46   COMMENT "Running unit tests")
47
48# add install targets
49# need a custom install path?
50# define CMAKE_INSTALL_PREFIX to change root folder
51if(${UTPP_USE_PLUS_SIGN})
52   set (UTPP_INSTALL_DESTINATION "include/UnitTest++")
53else()
54   set (UTPP_INSTALL_DESTINATION "include/UnitTestPP")
55endif()
56
57install(TARGETS UnitTest++ DESTINATION lib)
58install(FILES ${headers_} DESTINATION ${UTPP_INSTALL_DESTINATION})
59install(FILES ${platformHeaders_} DESTINATION ${UTPP_INSTALL_DESTINATION}/${platformDir_})
No newline at end of file
trunk/3rdparty/unittest-cpp/ChangeLog
r0r249095
1Installation Instructions
2*************************
3
4Copyright (C) 1994-1996, 1999-2002, 2004-2012 Free Software Foundation,
5Inc.
6
7   Copying and distribution of this file, with or without modification,
8are permitted in any medium without royalty provided the copyright
9notice and this notice are preserved.  This file is offered as-is,
10without warranty of any kind.
11
12Basic Installation
13==================
14
15   Briefly, the shell commands `./configure; make; make install' should
16configure, build, and install this package.  The following
17more-detailed instructions are generic; see the `README' file for
18instructions specific to this package.  Some packages provide this
19`INSTALL' file but do not implement all of the features documented
20below.  The lack of an optional feature in a given package is not
21necessarily a bug.  More recommendations for GNU packages can be found
22in *note Makefile Conventions: (standards)Makefile Conventions.
23
24   The `configure' shell script attempts to guess correct values for
25various system-dependent variables used during compilation.  It uses
26those values to create a `Makefile' in each directory of the package.
27It may also create one or more `.h' files containing system-dependent
28definitions.  Finally, it creates a shell script `config.status' that
29you can run in the future to recreate the current configuration, and a
30file `config.log' containing compiler output (useful mainly for
31debugging `configure').
32
33   It can also use an optional file (typically called `config.cache'
34and enabled with `--cache-file=config.cache' or simply `-C') that saves
35the results of its tests to speed up reconfiguring.  Caching is
36disabled by default to prevent problems with accidental use of stale
37cache files.
38
39   If you need to do unusual things to compile the package, please try
40to figure out how `configure' could check whether to do them, and mail
41diffs or instructions to the address given in the `README' so they can
42be considered for the next release.  If you are using the cache, and at
43some point `config.cache' contains results you don't want to keep, you
44may remove or edit it.
45
46   The file `configure.ac' (or `configure.in') is used to create
47`configure' by a program called `autoconf'.  You need `configure.ac' if
48you want to change it or regenerate `configure' using a newer version
49of `autoconf'.
50
51   The simplest way to compile this package is:
52
53  1. `cd' to the directory containing the package's source code and type
54     `./configure' to configure the package for your system.
55
56     Running `configure' might take a while.  While running, it prints
57     some messages telling which features it is checking for.
58
59  2. Type `make' to compile the package.
60
61  3. Optionally, type `make check' to run any self-tests that come with
62     the package, generally using the just-built uninstalled binaries.
63
64  4. Type `make install' to install the programs and any data files and
65     documentation.  When installing into a prefix owned by root, it is
66     recommended that the package be configured and built as a regular
67     user, and only the `make install' phase executed with root
68     privileges.
69
70  5. Optionally, type `make installcheck' to repeat any self-tests, but
71     this time using the binaries in their final installed location.
72     This target does not install anything.  Running this target as a
73     regular user, particularly if the prior `make install' required
74     root privileges, verifies that the installation completed
75     correctly.
76
77  6. You can remove the program binaries and object files from the
78     source code directory by typing `make clean'.  To also remove the
79     files that `configure' created (so you can compile the package for
80     a different kind of computer), type `make distclean'.  There is
81     also a `make maintainer-clean' target, but that is intended mainly
82     for the package's developers.  If you use it, you may have to get
83     all sorts of other programs in order to regenerate files that came
84     with the distribution.
85
86  7. Often, you can also type `make uninstall' to remove the installed
87     files again.  In practice, not all packages have tested that
88     uninstallation works correctly, even though it is required by the
89     GNU Coding Standards.
90
91  8. Some packages, particularly those that use Automake, provide `make
92     distcheck', which can by used by developers to test that all other
93     targets like `make install' and `make uninstall' work correctly.
94     This target is generally not run by end users.
95
96Compilers and Options
97=====================
98
99   Some systems require unusual options for compilation or linking that
100the `configure' script does not know about.  Run `./configure --help'
101for details on some of the pertinent environment variables.
102
103   You can give `configure' initial values for configuration parameters
104by setting variables in the command line or in the environment.  Here
105is an example:
106
107     ./configure CC=c99 CFLAGS=-g LIBS=-lposix
108
109   *Note Defining Variables::, for more details.
110
111Compiling For Multiple Architectures
112====================================
113
114   You can compile the package for more than one kind of computer at the
115same time, by placing the object files for each architecture in their
116own directory.  To do this, you can use GNU `make'.  `cd' to the
117directory where you want the object files and executables to go and run
118the `configure' script.  `configure' automatically checks for the
119source code in the directory that `configure' is in and in `..'.  This
120is known as a "VPATH" build.
121
122   With a non-GNU `make', it is safer to compile the package for one
123architecture at a time in the source code directory.  After you have
124installed the package for one architecture, use `make distclean' before
125reconfiguring for another architecture.
126
127   On MacOS X 10.5 and later systems, you can create libraries and
128executables that work on multiple system types--known as "fat" or
129"universal" binaries--by specifying multiple `-arch' options to the
130compiler but only a single `-arch' option to the preprocessor.  Like
131this:
132
133     ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
134                 CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
135                 CPP="gcc -E" CXXCPP="g++ -E"
136
137   This is not guaranteed to produce working output in all cases, you
138may have to build one architecture at a time and combine the results
139using the `lipo' tool if you have problems.
140
141Installation Names
142==================
143
144   By default, `make install' installs the package's commands under
145`/usr/local/bin', include files under `/usr/local/include', etc.  You
146can specify an installation prefix other than `/usr/local' by giving
147`configure' the option `--prefix=PREFIX', where PREFIX must be an
148absolute file name.
149
150   You can specify separate installation prefixes for
151architecture-specific files and architecture-independent files.  If you
152pass the option `--exec-prefix=PREFIX' to `configure', the package uses
153PREFIX as the prefix for installing programs and libraries.
154Documentation and other data files still use the regular prefix.
155
156   In addition, if you use an unusual directory layout you can give
157options like `--bindir=DIR' to specify different values for particular
158kinds of files.  Run `configure --help' for a list of the directories
159you can set and what kinds of files go in them.  In general, the
160default for these options is expressed in terms of `${prefix}', so that
161specifying just `--prefix' will affect all of the other directory
162specifications that were not explicitly provided.
163
164   The most portable way to affect installation locations is to pass the
165correct locations to `configure'; however, many packages provide one or
166both of the following shortcuts of passing variable assignments to the
167`make install' command line to change installation locations without
168having to reconfigure or recompile.
169
170   The first method involves providing an override variable for each
171affected directory.  For example, `make install
172prefix=/alternate/directory' will choose an alternate location for all
173directory configuration variables that were expressed in terms of
174`${prefix}'.  Any directories that were specified during `configure',
175but not in terms of `${prefix}', must each be overridden at install
176time for the entire installation to be relocated.  The approach of
177makefile variable overrides for each directory variable is required by
178the GNU Coding Standards, and ideally causes no recompilation.
179However, some platforms have known limitations with the semantics of
180shared libraries that end up requiring recompilation when using this
181method, particularly noticeable in packages that use GNU Libtool.
182
183   The second method involves providing the `DESTDIR' variable.  For
184example, `make install DESTDIR=/alternate/directory' will prepend
185`/alternate/directory' before all installation names.  The approach of
186`DESTDIR' overrides is not required by the GNU Coding Standards, and
187does not work on platforms that have drive letters.  On the other hand,
188it does better at avoiding recompilation issues, and works well even
189when some directory options were not specified in terms of `${prefix}'
190at `configure' time.
191
192Optional Features
193=================
194
195   If the package supports it, you can cause programs to be installed
196with an extra prefix or suffix on their names by giving `configure' the
197option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
198
199   Some packages pay attention to `--enable-FEATURE' options to
200`configure', where FEATURE indicates an optional part of the package.
201They may also pay attention to `--with-PACKAGE' options, where PACKAGE
202is something like `gnu-as' or `x' (for the X Window System).  The
203`README' should mention any `--enable-' and `--with-' options that the
204package recognizes.
205
206   For packages that use the X Window System, `configure' can usually
207find the X include and library files automatically, but if it doesn't,
208you can use the `configure' options `--x-includes=DIR' and
209`--x-libraries=DIR' to specify their locations.
210
211   Some packages offer the ability to configure how verbose the
212execution of `make' will be.  For these packages, running `./configure
213--enable-silent-rules' sets the default to minimal output, which can be
214overridden with `make V=1'; while running `./configure
215--disable-silent-rules' sets the default to verbose, which can be
216overridden with `make V=0'.
217
218Particular systems
219==================
220
221   On HP-UX, the default C compiler is not ANSI C compatible.  If GNU
222CC is not installed, it is recommended to use the following options in
223order to use an ANSI C compiler:
224
225     ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
226
227and if that doesn't work, install pre-built binaries of GCC for HP-UX.
228
229   HP-UX `make' updates targets which have the same time stamps as
230their prerequisites, which makes it generally unusable when shipped
231generated files such as `configure' are involved.  Use GNU `make'
232instead.
233
234   On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
235parse its `<wchar.h>' header file.  The option `-nodtk' can be used as
236a workaround.  If GNU CC is not installed, it is therefore recommended
237to try
238
239     ./configure CC="cc"
240
241and if that doesn't work, try
242
243     ./configure CC="cc -nodtk"
244
245   On Solaris, don't put `/usr/ucb' early in your `PATH'.  This
246directory contains several dysfunctional programs; working variants of
247these programs are available in `/usr/bin'.  So, if you need `/usr/ucb'
248in your `PATH', put it _after_ `/usr/bin'.
249
250   On Haiku, software installed for all users goes in `/boot/common',
251not `/usr/local'.  It is recommended to use the following options:
252
253     ./configure --prefix=/boot/common
254
255Specifying the System Type
256==========================
257
258   There may be some features `configure' cannot figure out
259automatically, but needs to determine by the type of machine the package
260will run on.  Usually, assuming the package is built to be run on the
261_same_ architectures, `configure' can figure that out, but if it prints
262a message saying it cannot guess the machine type, give it the
263`--build=TYPE' option.  TYPE can either be a short name for the system
264type, such as `sun4', or a canonical name which has the form:
265
266     CPU-COMPANY-SYSTEM
267
268where SYSTEM can have one of these forms:
269
270     OS
271     KERNEL-OS
272
273   See the file `config.sub' for the possible values of each field.  If
274`config.sub' isn't included in this package, then this package doesn't
275need to know the machine type.
276
277   If you are _building_ compiler tools for cross-compiling, you should
278use the option `--target=TYPE' to select the type of system they will
279produce code for.
280
281   If you want to _use_ a cross compiler, that generates code for a
282platform different from the build platform, you should specify the
283"host" platform (i.e., that on which the generated programs will
284eventually be run) with `--host=TYPE'.
285
286Sharing Defaults
287================
288
289   If you want to set default values for `configure' scripts to share,
290you can create a site shell script called `config.site' that gives
291default values for variables like `CC', `cache_file', and `prefix'.
292`configure' looks for `PREFIX/share/config.site' if it exists, then
293`PREFIX/etc/config.site' if it exists.  Or, you can set the
294`CONFIG_SITE' environment variable to the location of the site script.
295A warning: not all `configure' scripts look for a site script.
296
297Defining Variables
298==================
299
300   Variables not defined in a site shell script can be set in the
301environment passed to `configure'.  However, some packages may run
302configure again during the build, and the customized values of these
303variables may be lost.  In order to avoid this problem, you should set
304them in the `configure' command line, using `VAR=value'.  For example:
305
306     ./configure CC=/usr/local2/bin/gcc
307
308causes the specified `gcc' to be used as the C compiler (unless it is
309overridden in the site shell script).
310
311Unfortunately, this technique does not work for `CONFIG_SHELL' due to
312an Autoconf limitation.  Until the limitation is lifted, you can use
313this workaround:
314
315     CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
316
317`configure' Invocation
318======================
319
320   `configure' recognizes the following options to control how it
321operates.
322
323`--help'
324`-h'
325     Print a summary of all of the options to `configure', and exit.
326
327`--help=short'
328`--help=recursive'
329     Print a summary of the options unique to this package's
330     `configure', and exit.  The `short' variant lists options used
331     only in the top level, while the `recursive' variant lists options
332     also present in any nested packages.
333
334`--version'
335`-V'
336     Print the version of Autoconf used to generate the `configure'
337     script, and exit.
338
339`--cache-file=FILE'
340     Enable the cache: use and save the results of the tests in FILE,
341     traditionally `config.cache'.  FILE defaults to `/dev/null' to
342     disable caching.
343
344`--config-cache'
345`-C'
346     Alias for `--cache-file=config.cache'.
347
348`--quiet'
349`--silent'
350`-q'
351     Do not print messages saying which checks are being made.  To
352     suppress all normal output, redirect it to `/dev/null' (any error
353     messages will still be shown).
354
355`--srcdir=DIR'
356     Look for the package's source code in directory DIR.  Usually
357     `configure' can determine that directory automatically.
358
359`--prefix=DIR'
360     Use DIR as the installation prefix.  *note Installation Names::
361     for more details, including other options available for fine-tuning
362     the installation locations.
363
364`--no-create'
365`-n'
366     Run the configure checks, but stop before creating any output
367     files.
368
369`configure' also accepts some other, not widely useful, options.  Run
370`configure --help' for more details.
trunk/3rdparty/unittest-cpp/LICENSE
r0r249095
1Copyright (c) 2006 Noel Llopis and Charles Nicholson
2
3Permission is hereby granted, free of charge, to any person obtaining
4a copy of this software and associated documentation files (the
5"Software"), to deal in the Software without restriction, including
6without limitation the rights to use, copy, modify, merge, publish,
7distribute, sublicense, and/or sell copies of the Software, and to
8permit persons to whom the Software is furnished to do so, subject to
9the following conditions:
10
11The above copyright notice and this permission notice shall be included
12in all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
trunk/3rdparty/unittest-cpp/Makefile.am
r0r249095
1ACLOCAL_AMFLAGS = -I m4
2EXTRA_DIST = docs
3SUBDIRS = UnitTest++
trunk/3rdparty/unittest-cpp/README.md
r0r249095
1UnitTest++
2===========
3
4UnitTest++ is a lightweight unit testing framework for C++. It was designed to do test-driven development on a wide variety of platforms. Simplicity, portability, speed, and small footprint are all very important aspects of UnitTest++. UnitTest++ is ANSI portable C++ and makes minimal use of advanced library and languages features, which means it should be easily portable to just about any platform. Out of the box, the following platforms are supported:
5
6* Windows
7* Linux
8* Mac OS X
9
10Documentation
11--------------
12The full documentation for building and using UnitTest++ can be found on the [GitHub wiki page](https://github.com/unittest-cpp/unittest-cpp/wiki). The contents of this wiki are also included as a git submodule under the `docs` folder, so version-specific Markdown documentation is always available along with the download.
13
14Pre-requisites
15---------------
16While there are currently some bundled makefiles and projects, UnitTest++ is primarily built and supported using [CMake](http://cmake.org).
17
18Downloading
19------------
20### Latest (HEAD) ###
21
22Via git:
23
24    git clone https://github.com/unittest-cpp/unittest-cpp
25
26Via svn:
27
28    svn checkout https://github.com/unittest-cpp/unittest-cpp/trunk unittest-cpp
29
30### Latest release (v1.4) ###
31
32Via git:
33
34    git clone https://github.com/unittest-cpp/unittest-cpp
35    cd unittest-cpp
36    git checkout v1.4
37
38Via svn:
39
40    svn checkout https://github.com/unittest-cpp/unittest-cpp/tags/v1.4 unittest-cpp
41
42License
43---------
44*UnitTest++ is free software. You may copy, distribute, and modify it under
45the terms of the License contained in the file LICENSE distributed
46with this package. This license is the same as the MIT/X Consortium
47license.*
48
49Contributors
50--------------
51### [GitHub Contributor Graph](https://github.com/unittest-cpp/unittest-cpp/contributors) ###
52
53### Current Maintainers: ###
54* Patrick Johnmeyer (pjohnmeyer@gmail.com) @pjohnmeyer
55* Charles Nicholson (charles.nicholson@gmail.com) @charlesnicholson
56
57### Original Authors: ###
58* Noel Llopis (llopis@convexhull.com)
59* Charles Nicholson (charles.nicholson@gmail.com)
60
61### Contributors not included in github history ###
62* Jim Tilander
63* Kim Grasman
64* Jonathan Jansson
65* Dirck Blaskey
66* Rory Driscoll
67* Dan Lind
68* Matt Kimmel -- Submitted with permission from Blue Fang Games
69* Anthony Moralez
70* Jeff Dixon
71* Randy Coulman
72* Lieven van der Heide
73
74Historic release notes
75----------------------
76
77### Version 1.4 (2008-10-30) ###
78- CHECK macros work at arbitrary stack depth from inside TESTs.
79- Remove obsolete TEST_UTILITY macros
80- Predicated test execution (via TestRunner::RunTestsIf)
81- Better exception handling for fixture ctors/dtors.
82- VC6/7/8/9 support
83
84### Version 1.3 (2007-4-22) ###
85- Removed dynamic memory allocations (other than streams)
86- MinGW support
87- Consistent (native) line endings
88- Minor bug fixing
89
90### Version 1.2 (2006-10-29) ###
91- First pass at documentation.
92- More detailed error crash catching in fixtures.
93- Standard streams used for printing objects under check. This should allow the
94  use of standard class types such as std::string or other custom classes with
95  stream operators to ostream.
96- Standard streams can be optionally compiled off by defining UNITTEST_USE_CUSTOM_STREAMS
97  in Config.h
98- Added named test suites
99- Added CHECK_ARRAY2D_CLOSE
100- Posix library name is libUnitTest++.a now
101- Floating point numbers are postfixed with 'f' in the failure reports
102
103### Version 1.1 (2006-04-18) ###
104- CHECK macros do not have side effects even if one of the parameters changes state
105- Removed CHECK_ARRAY_EQUAL (too similar to CHECK_ARRAY_CLOSE)
106- Added local and global time constraints
107- Removed dependencies on strstream
108- Improved Posix signal to exception translator
109- Failing tests are added to Visual Studio's error list
110- Fixed Visual Studio projects to work with spaces in directories
111
112### Version 1.0 (2006-03-15) ###
113- Initial release
114
trunk/3rdparty/unittest-cpp/UnitTest++/AssertException.cpp
r0r249095
1#include "AssertException.h"
2
3#ifndef UNITTEST_NO_EXCEPTIONS
4
5namespace UnitTest {
6
7AssertException::AssertException()
8{
9}
10
11AssertException::~AssertException() throw()
12{
13}
14
15}
16
17#endif
trunk/3rdparty/unittest-cpp/UnitTest++/AssertException.h
r0r249095
1#ifndef UNITTEST_ASSERTEXCEPTION_H
2#define UNITTEST_ASSERTEXCEPTION_H
3
4#include "Config.h"
5#ifndef UNITTEST_NO_EXCEPTIONS
6
7#include "HelperMacros.h"
8#include <exception>
9
10namespace UnitTest {
11
12class UNITTEST_LINKAGE AssertException : public std::exception
13{
14public:
15    AssertException();
16    virtual ~AssertException() throw();
17};
18
19}
20
21#endif
22
23#endif
trunk/3rdparty/unittest-cpp/UnitTest++/CheckMacros.h
r0r249095
1#ifndef UNITTEST_CHECKMACROS_H
2#define UNITTEST_CHECKMACROS_H
3
4#include "HelperMacros.h"
5#include "ExceptionMacros.h"
6#include "Checks.h"
7#include "AssertException.h"
8#include "MemoryOutStream.h"
9#include "TestDetails.h"
10#include "CurrentTest.h"
11#include "ReportAssertImpl.h"
12
13#ifdef CHECK
14    #error UnitTest++ redefines CHECK
15#endif
16
17#ifdef CHECK_EQUAL
18   #error UnitTest++ redefines CHECK_EQUAL
19#endif
20
21#ifdef CHECK_CLOSE
22   #error UnitTest++ redefines CHECK_CLOSE
23#endif
24
25#ifdef CHECK_ARRAY_EQUAL
26   #error UnitTest++ redefines CHECK_ARRAY_EQUAL
27#endif
28
29#ifdef CHECK_ARRAY_CLOSE
30   #error UnitTest++ redefines CHECK_ARRAY_CLOSE
31#endif
32
33#ifdef CHECK_ARRAY2D_CLOSE
34   #error UnitTest++ redefines CHECK_ARRAY2D_CLOSE
35#endif
36
37#define CHECK(value) \
38   UNITTEST_MULTILINE_MACRO_BEGIN \
39   UT_TRY \
40      ({ \
41         if (!UnitTest::Check(value)) \
42            UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), #value); \
43      }) \
44      UT_CATCH (std::exception, e, \
45      { \
46         UnitTest::MemoryOutStream message; \
47         message << "Unhandled exception (" << e.what() << ") in CHECK(" #value ")"; \
48         UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \
49            message.GetText()); \
50      }) \
51      UT_CATCH_ALL \
52      ({ \
53         UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \
54            "Unhandled exception in CHECK(" #value ")"); \
55      }) \
56   UNITTEST_MULTILINE_MACRO_END
57
58#define CHECK_EQUAL(expected, actual) \
59   UNITTEST_MULTILINE_MACRO_BEGIN \
60        UT_TRY \
61      ({ \
62            UnitTest::CheckEqual(*UnitTest::CurrentTest::Results(), expected, actual, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \
63        }) \
64      UT_CATCH (std::exception, e, \
65      { \
66         UnitTest::MemoryOutStream message; \
67         message << "Unhandled exception (" << e.what() << ") in CHECK_EQUAL(" #expected ", " #actual ")"; \
68         UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \
69            message.GetText()); \
70      }) \
71        UT_CATCH_ALL \
72      ({ \
73            UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \
74                    "Unhandled exception in CHECK_EQUAL(" #expected ", " #actual ")"); \
75        }) \
76   UNITTEST_MULTILINE_MACRO_END
77
78#define CHECK_CLOSE(expected, actual, tolerance) \
79   UNITTEST_MULTILINE_MACRO_BEGIN \
80        UT_TRY \
81      ({ \
82            UnitTest::CheckClose(*UnitTest::CurrentTest::Results(), expected, actual, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \
83        }) \
84      UT_CATCH (std::exception, e, \
85      { \
86         UnitTest::MemoryOutStream message; \
87         message << "Unhandled exception (" << e.what() << ") in CHECK_CLOSE(" #expected ", " #actual ")"; \
88         UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \
89            message.GetText()); \
90      }) \
91        UT_CATCH_ALL \
92      ({ \
93            UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \
94                    "Unhandled exception in CHECK_CLOSE(" #expected ", " #actual ")"); \
95        }) \
96   UNITTEST_MULTILINE_MACRO_END
97
98#define CHECK_ARRAY_EQUAL(expected, actual, count) \
99   UNITTEST_MULTILINE_MACRO_BEGIN \
100        UT_TRY \
101      ({ \
102            UnitTest::CheckArrayEqual(*UnitTest::CurrentTest::Results(), expected, actual, count, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \
103        }) \
104       UT_CATCH (std::exception, e, \
105      { \
106         UnitTest::MemoryOutStream message; \
107         message << "Unhandled exception (" << e.what() << ") in CHECK_ARRAY_EQUAL(" #expected ", " #actual ")"; \
108         UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \
109            message.GetText()); \
110      }) \
111        UT_CATCH_ALL \
112      ({ \
113            UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \
114                    "Unhandled exception in CHECK_ARRAY_EQUAL(" #expected ", " #actual ")"); \
115        }) \
116   UNITTEST_MULTILINE_MACRO_END
117
118#define CHECK_ARRAY_CLOSE(expected, actual, count, tolerance) \
119   UNITTEST_MULTILINE_MACRO_BEGIN \
120        UT_TRY \
121      ({ \
122            UnitTest::CheckArrayClose(*UnitTest::CurrentTest::Results(), expected, actual, count, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \
123        }) \
124       UT_CATCH (std::exception, e, \
125      { \
126         UnitTest::MemoryOutStream message; \
127         message << "Unhandled exception (" << e.what() << ") in CHECK_ARRAY_CLOSE(" #expected ", " #actual ")"; \
128         UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \
129            message.GetText()); \
130      }) \
131        UT_CATCH_ALL \
132      ({ \
133            UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \
134                    "Unhandled exception in CHECK_ARRAY_CLOSE(" #expected ", " #actual ")"); \
135        }) \
136   UNITTEST_MULTILINE_MACRO_END
137
138#define CHECK_ARRAY2D_CLOSE(expected, actual, rows, columns, tolerance) \
139   UNITTEST_MULTILINE_MACRO_BEGIN \
140        UT_TRY \
141      ({ \
142            UnitTest::CheckArray2DClose(*UnitTest::CurrentTest::Results(), expected, actual, rows, columns, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \
143        }) \
144       UT_CATCH (std::exception, e, \
145      { \
146         UnitTest::MemoryOutStream message; \
147         message << "Unhandled exception (" << e.what() << ") in CHECK_ARRAY2D_CLOSE(" #expected ", " #actual ")"; \
148         UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \
149            message.GetText()); \
150      }) \
151        UT_CATCH_ALL \
152      ({ \
153            UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \
154                    "Unhandled exception in CHECK_ARRAY2D_CLOSE(" #expected ", " #actual ")"); \
155        }) \
156   UNITTEST_MULTILINE_MACRO_END
157
158
159// CHECK_THROW and CHECK_ASSERT only exist when UNITTEST_NO_EXCEPTIONS isn't defined (see config.h)
160#ifndef UNITTEST_NO_EXCEPTIONS
161#define CHECK_THROW(expression, ExpectedExceptionType) \
162   UNITTEST_MULTILINE_MACRO_BEGIN \
163        bool caught_ = false; \
164        try { expression; } \
165        catch (ExpectedExceptionType const&) { caught_ = true; } \
166      catch (...) {} \
167        if (!caught_) \
168           UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), "Expected exception: \"" #ExpectedExceptionType "\" not thrown"); \
169   UNITTEST_MULTILINE_MACRO_END
170
171
172#define CHECK_ASSERT(expression) \
173   UNITTEST_MULTILINE_MACRO_BEGIN \
174      UnitTest::Detail::ExpectAssert(true); \
175      CHECK_THROW(expression, UnitTest::AssertException); \
176      UnitTest::Detail::ExpectAssert(false); \
177   UNITTEST_MULTILINE_MACRO_END
178#endif
179#endif
trunk/3rdparty/unittest-cpp/UnitTest++/Checks.cpp
r0r249095
1#include "Checks.h"
2#include <cstring>
3
4namespace UnitTest {
5
6namespace {
7
8void CheckStringsEqual(TestResults& results, char const* expected, char const* actual,
9                       TestDetails const& details)
10{
11   using namespace std;
12
13    if ((expected && actual) ? strcmp(expected, actual) : (expected || actual))
14    {
15        UnitTest::MemoryOutStream stream;
16        stream << "Expected " << (expected ? expected : "<NULLPTR>") << " but was " << (actual ? actual : "<NULLPTR>");
17
18        results.OnTestFailure(details, stream.GetText());
19    }
20}
21
22}
23
24
25void CheckEqual(TestResults& results, char const* expected, char const* actual,
26                TestDetails const& details)
27{
28    CheckStringsEqual(results, expected, actual, details);
29}
30
31void CheckEqual(TestResults& results, char* expected, char* actual,
32                TestDetails const& details)
33{
34    CheckStringsEqual(results, expected, actual, details);
35}
36
37void CheckEqual(TestResults& results, char* expected, char const* actual,
38                TestDetails const& details)
39{
40    CheckStringsEqual(results, expected, actual, details);
41}
42
43void CheckEqual(TestResults& results, char const* expected, char* actual,
44                TestDetails const& details)
45{
46    CheckStringsEqual(results, expected, actual, details);
47}
48
49
50}
trunk/3rdparty/unittest-cpp/UnitTest++/Checks.h
r0r249095
1#ifndef UNITTEST_CHECKS_H
2#define UNITTEST_CHECKS_H
3
4#include "Config.h"
5#include "TestResults.h"
6#include "MemoryOutStream.h"
7
8namespace UnitTest {
9
10
11template< typename Value >
12bool Check(Value const value)
13{
14    return !!value; // doing double negative to avoid silly VS warnings
15}
16
17
18template< typename Expected, typename Actual >
19void CheckEqual(TestResults& results, Expected const& expected, Actual const& actual, TestDetails const& details)
20{
21    if (!(expected == actual))
22    {
23        UnitTest::MemoryOutStream stream;
24        stream << "Expected " << expected << " but was " << actual;
25
26        results.OnTestFailure(details, stream.GetText());
27    }
28}
29
30UNITTEST_LINKAGE void CheckEqual(TestResults& results, char const* expected, char const* actual, TestDetails const& details);
31
32UNITTEST_LINKAGE void CheckEqual(TestResults& results, char* expected, char* actual, TestDetails const& details);
33
34UNITTEST_LINKAGE void CheckEqual(TestResults& results, char* expected, char const* actual, TestDetails const& details);
35
36UNITTEST_LINKAGE void CheckEqual(TestResults& results, char const* expected, char* actual, TestDetails const& details);
37
38template< typename Expected, typename Actual, typename Tolerance >
39bool AreClose(Expected const& expected, Actual const& actual, Tolerance const& tolerance)
40{
41    return (actual >= (expected - tolerance)) && (actual <= (expected + tolerance));
42}
43
44template< typename Expected, typename Actual, typename Tolerance >
45void CheckClose(TestResults& results, Expected const& expected, Actual const& actual, Tolerance const& tolerance,
46                TestDetails const& details)
47{
48    if (!AreClose(expected, actual, tolerance))
49    {
50        UnitTest::MemoryOutStream stream;
51        stream << "Expected " << expected << " +/- " << tolerance << " but was " << actual;
52
53        results.OnTestFailure(details, stream.GetText());
54    }
55}
56
57
58template< typename Expected, typename Actual >
59void CheckArrayEqual(TestResults& results, Expected const& expected, Actual const& actual,
60                int const count, TestDetails const& details)
61{
62    bool equal = true;
63    for (int i = 0; i < count; ++i)
64        equal &= (expected[i] == actual[i]);
65
66    if (!equal)
67    {
68        UnitTest::MemoryOutStream stream;
69
70      stream << "Expected [ ";
71
72      for (int expectedIndex = 0; expectedIndex < count; ++expectedIndex)
73            stream << expected[expectedIndex] << " ";
74
75      stream << "] but was [ ";
76
77      for (int actualIndex = 0; actualIndex < count; ++actualIndex)
78            stream << actual[actualIndex] << " ";
79
80      stream << "]";
81
82        results.OnTestFailure(details, stream.GetText());
83    }
84}
85
86template< typename Expected, typename Actual, typename Tolerance >
87bool ArrayAreClose(Expected const& expected, Actual const& actual, int const count, Tolerance const& tolerance)
88{
89    bool equal = true;
90    for (int i = 0; i < count; ++i)
91        equal &= AreClose(expected[i], actual[i], tolerance);
92    return equal;
93}
94
95template< typename Expected, typename Actual, typename Tolerance >
96void CheckArrayClose(TestResults& results, Expected const& expected, Actual const& actual,
97                   int const count, Tolerance const& tolerance, TestDetails const& details)
98{
99    bool equal = ArrayAreClose(expected, actual, count, tolerance);
100
101    if (!equal)
102    {
103        UnitTest::MemoryOutStream stream;
104
105        stream << "Expected [ ";
106        for (int expectedIndex = 0; expectedIndex < count; ++expectedIndex)
107            stream << expected[expectedIndex] << " ";
108        stream << "] +/- " << tolerance << " but was [ ";
109
110      for (int actualIndex = 0; actualIndex < count; ++actualIndex)
111            stream << actual[actualIndex] << " ";
112        stream << "]";
113
114        results.OnTestFailure(details, stream.GetText());
115    }
116}
117
118template< typename Expected, typename Actual, typename Tolerance >
119void CheckArray2DClose(TestResults& results, Expected const& expected, Actual const& actual,
120                   int const rows, int const columns, Tolerance const& tolerance, TestDetails const& details)
121{
122    bool equal = true;
123    for (int i = 0; i < rows; ++i)
124        equal &= ArrayAreClose(expected[i], actual[i], columns, tolerance);
125
126    if (!equal)
127    {
128        UnitTest::MemoryOutStream stream;
129
130        stream << "Expected [ ";   
131
132      for (int expectedRow = 0; expectedRow < rows; ++expectedRow)
133        {
134            stream << "[ ";
135            for (int expectedColumn = 0; expectedColumn < columns; ++expectedColumn)
136                stream << expected[expectedRow][expectedColumn] << " ";
137            stream << "] ";
138        }
139
140      stream << "] +/- " << tolerance << " but was [ ";
141
142      for (int actualRow = 0; actualRow < rows; ++actualRow)
143        {
144            stream << "[ ";
145            for (int actualColumn = 0; actualColumn < columns; ++actualColumn)
146                stream << actual[actualRow][actualColumn] << " ";
147            stream << "] ";
148        }
149
150      stream << "]";
151
152        results.OnTestFailure(details, stream.GetText());
153    }
154}
155
156}
157
158#endif
trunk/3rdparty/unittest-cpp/UnitTest++/CompositeTestReporter.cpp
r0r249095
1#include "CompositeTestReporter.h"
2#include <cstddef>
3
4namespace UnitTest {
5
6CompositeTestReporter::CompositeTestReporter()
7   : m_reporterCount(0)
8{
9}
10
11int CompositeTestReporter::GetReporterCount() const
12{
13   return m_reporterCount;
14}
15
16bool CompositeTestReporter::AddReporter(TestReporter* reporter)
17{
18   if (m_reporterCount == kMaxReporters)
19      return false;
20
21   m_reporters[m_reporterCount++] = reporter;
22   return true;
23}
24
25bool CompositeTestReporter::RemoveReporter(TestReporter* reporter)
26{
27    for (int index = 0; index < m_reporterCount; ++index)
28    {
29        if (m_reporters[index] == reporter)
30        {
31            m_reporters[index] = m_reporters[m_reporterCount - 1];
32         --m_reporterCount;
33         return true;
34        }
35    }
36
37    return false;
38}
39
40void CompositeTestReporter::ReportFailure(TestDetails const& details, char const* failure)
41{
42    for (int index = 0; index < m_reporterCount; ++index)
43      m_reporters[index]->ReportFailure(details, failure);
44}
45
46void CompositeTestReporter::ReportTestStart(TestDetails const& test)
47{
48   for (int index = 0; index < m_reporterCount; ++index)
49      m_reporters[index]->ReportTestStart(test);
50}
51
52void CompositeTestReporter::ReportTestFinish(TestDetails const& test, float secondsElapsed)
53{
54   for (int index = 0; index < m_reporterCount; ++index)
55      m_reporters[index]->ReportTestFinish(test, secondsElapsed);
56}
57
58void CompositeTestReporter::ReportSummary(int totalTestCount,
59                                int failedTestCount,
60                                int failureCount,
61                                float secondsElapsed)
62{
63   for (int index = 0; index < m_reporterCount; ++index)
64      m_reporters[index]->ReportSummary(totalTestCount, failedTestCount, failureCount, secondsElapsed);
65}
66
67}
trunk/3rdparty/unittest-cpp/UnitTest++/CompositeTestReporter.h
r0r249095
1#ifndef UNITTEST_COMPOSITETESTREPORTER_H
2#define UNITTEST_COMPOSITETESTREPORTER_H
3
4#include "TestReporter.h"
5
6namespace UnitTest {
7
8class UNITTEST_LINKAGE CompositeTestReporter : public TestReporter
9{
10public:
11    CompositeTestReporter();
12
13   int GetReporterCount() const;
14    bool AddReporter(TestReporter* reporter);
15    bool RemoveReporter(TestReporter* reporter);
16
17    virtual void ReportTestStart(TestDetails const& test);
18    virtual void ReportFailure(TestDetails const& test, char const* failure);
19    virtual void ReportTestFinish(TestDetails const& test, float secondsElapsed);
20    virtual void ReportSummary(int totalTestCount, int failedTestCount, int failureCount, float secondsElapsed);
21
22private:
23   enum { kMaxReporters = 16 };
24   TestReporter* m_reporters[kMaxReporters];
25   int m_reporterCount;
26
27   // revoked
28   CompositeTestReporter(const CompositeTestReporter&);
29   CompositeTestReporter& operator =(const CompositeTestReporter&);
30};
31
32}
33
34#endif
trunk/3rdparty/unittest-cpp/UnitTest++/Config.h
r0r249095
1#ifndef UNITTEST_CONFIG_H
2#define UNITTEST_CONFIG_H
3
4// Standard defines documented here: http://predef.sourceforge.net
5
6#if defined(_MSC_VER)
7   #pragma warning(disable:4702) // unreachable code
8   #pragma warning(disable:4722) // destructor never returns, potential memory leak
9
10#if (_MSC_VER == 1200)  // VC6
11      #define UNITTEST_COMPILER_IS_MSVC6
12      #pragma warning(disable:4786)
13      #pragma warning(disable:4290)
14   #endif
15
16   #ifdef _USRDLL
17      #define UNITTEST_WIN32_DLL
18   #endif
19   #define UNITTEST_WIN32
20#endif
21
22#if defined(unix) || defined(__unix__) || defined(__unix) || defined(linux) || \
23    defined(__APPLE__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) || \
24    defined(__OS2__)
25    #define UNITTEST_POSIX
26#endif
27
28#if defined(__MINGW32__)
29    #define UNITTEST_MINGW
30#endif
31
32
33// By default, MemoryOutStream is implemented in terms of std::ostringstream.
34// This is useful if you are using the CHECK macros on objects that have something like this defined:
35// std::ostringstream& operator<<(std::ostringstream& s, const YourObject& value)
36//
37// On the other hand, it can be more expensive.
38// Un-comment this line to use the custom MemoryOutStream (no deps on std::ostringstream).
39
40// #define UNITTEST_USE_CUSTOM_STREAMS
41
42// Developer note: This dual-macro setup is to preserve compatibility with UnitTest++ 1.4 users
43// who may have used or defined UNITTEST_USE_CUSTOM_STREAMS outside of this configuration file, as
44// well as Google Code HEAD users that may have used or defined
45// UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM outside of this configuration file.
46#ifndef UNITTEST_USE_CUSTOM_STREAMS
47    #define UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM
48#endif
49
50// DeferredTestReporter uses the STL to collect test results for subsequent export by reporters like
51// XmlTestReporter.  If you don't want to use this functionality, uncomment this line and no STL
52// headers or code will be compiled into UnitTest++
53
54//#define UNITTEST_NO_DEFERRED_REPORTER
55
56
57// By default, asserts that you report via UnitTest::ReportAssert() abort the current test and
58// continue to the next one by throwing an exception, which unwinds the stack naturally, destroying
59// all auto variables on its way back down.  If you don't want to (or can't) use exceptions for your
60// platform/compiler, uncomment this line.  All exception code will be removed from UnitTest++,
61// assert recovery will be done via setjmp/longjmp, and NO correct stack unwinding will happen!
62
63//#define UNITTEST_NO_EXCEPTIONS
64
65
66// std namespace qualification: used for functions like strcpy that
67// may live in std:: namespace (cstring header).
68#if defined( UNITTEST_COMPILER_IS_MSVC6 )
69   #define UNIITEST_NS_QUAL_STD(x) x
70#else
71   #define UNIITEST_NS_QUAL_STD(x) ::std::x
72#endif
73
74#endif
trunk/3rdparty/unittest-cpp/UnitTest++/CurrentTest.cpp
r0r249095
1#include "CurrentTest.h"
2#include <cstddef>
3
4namespace UnitTest {
5
6UNITTEST_LINKAGE TestResults*& CurrentTest::Results()
7{
8   static TestResults* testResults = NULL;
9   return testResults;
10}
11
12UNITTEST_LINKAGE const TestDetails*& CurrentTest::Details()
13{
14   static const TestDetails* testDetails = NULL;
15   return testDetails;
16}
17
18}
trunk/3rdparty/unittest-cpp/UnitTest++/CurrentTest.h
r0r249095
1#ifndef UNITTEST_CURRENTTESTRESULTS_H
2#define UNITTEST_CURRENTTESTRESULTS_H
3
4#include "HelperMacros.h"
5
6namespace UnitTest {
7
8class TestResults;
9class TestDetails;
10
11namespace CurrentTest
12{
13   UNITTEST_LINKAGE TestResults*& Results();
14   UNITTEST_LINKAGE const TestDetails*& Details();
15}
16
17}
18
19#endif
trunk/3rdparty/unittest-cpp/UnitTest++/DeferredTestReporter.cpp
r0r249095
1#include "Config.h"
2#ifndef UNITTEST_NO_DEFERRED_REPORTER
3
4#include "DeferredTestReporter.h"
5#include "TestDetails.h"
6
7using namespace UnitTest;
8
9void DeferredTestReporter::ReportTestStart(TestDetails const& details)
10{
11    m_results.push_back(DeferredTestResult(details.suiteName, details.testName));
12}
13
14void DeferredTestReporter::ReportFailure(TestDetails const& details, char const* failure)
15{
16    DeferredTestResult& r = m_results.back();
17    r.failed = true;
18    r.failures.push_back(DeferredTestFailure(details.lineNumber, failure));
19    r.failureFile = details.filename;
20}
21
22void DeferredTestReporter::ReportTestFinish(TestDetails const&, float secondsElapsed)
23{
24    DeferredTestResult& r = m_results.back();
25    r.timeElapsed = secondsElapsed;
26}
27
28DeferredTestReporter::DeferredTestResultList& DeferredTestReporter::GetResults()
29{
30    return m_results;
31}
32
33#endif
trunk/3rdparty/unittest-cpp/UnitTest++/DeferredTestReporter.h
r0r249095
1#ifndef UNITTEST_DEFERREDTESTREPORTER_H
2#define UNITTEST_DEFERREDTESTREPORTER_H
3
4#include "Config.h"
5
6#ifndef UNITTEST_NO_DEFERRED_REPORTER
7
8#include "TestReporter.h"
9#include "DeferredTestResult.h"
10
11#include <vector>
12
13UNITTEST_STDVECTOR_LINKAGE(UnitTest::DeferredTestResult)
14
15namespace UnitTest
16{
17
18class UNITTEST_LINKAGE DeferredTestReporter : public TestReporter
19{
20public:
21    virtual void ReportTestStart(TestDetails const& details);
22    virtual void ReportFailure(TestDetails const& details, char const* failure);
23    virtual void ReportTestFinish(TestDetails const& details, float secondsElapsed);
24
25    typedef std::vector< DeferredTestResult > DeferredTestResultList;
26    DeferredTestResultList& GetResults();
27
28private:
29    DeferredTestResultList m_results;
30};
31
32}
33
34#endif
35#endif
trunk/3rdparty/unittest-cpp/UnitTest++/DeferredTestResult.cpp
r0r249095
1#include "Config.h"
2#ifndef UNITTEST_NO_DEFERRED_REPORTER
3
4#include "DeferredTestResult.h"
5#include <cstring>
6
7namespace UnitTest
8{
9
10DeferredTestFailure::DeferredTestFailure()
11   : lineNumber(-1)
12{
13   failureStr[0] = '\0';
14}
15
16DeferredTestFailure::DeferredTestFailure(int lineNumber_, const char* failureStr_)
17   : lineNumber(lineNumber_)
18{
19   UNIITEST_NS_QUAL_STD(strcpy)(failureStr, failureStr_);
20}
21
22DeferredTestResult::DeferredTestResult()
23   : suiteName("")
24   , testName("")
25   , failureFile("")
26   , timeElapsed(0.0f)
27   , failed(false)
28{
29}
30
31DeferredTestResult::DeferredTestResult(char const* suite, char const* test)
32   : suiteName(suite)
33   , testName(test)
34   , failureFile("")
35   , timeElapsed(0.0f)
36   , failed(false)
37{
38}
39
40DeferredTestResult::~DeferredTestResult()
41{
42}
43
44}
45
46#endif
trunk/3rdparty/unittest-cpp/UnitTest++/DeferredTestResult.h
r0r249095
1#ifndef UNITTEST_DEFERREDTESTRESULT_H
2#define UNITTEST_DEFERREDTESTRESULT_H
3
4#include "Config.h"
5#ifndef UNITTEST_NO_DEFERRED_REPORTER
6
7#include "HelperMacros.h"
8#include <string>
9#include <vector>
10
11namespace UnitTest
12{
13
14class UNITTEST_LINKAGE DeferredTestFailure
15{
16public:
17   DeferredTestFailure();
18   DeferredTestFailure(int lineNumber_, const char* failureStr_);
19
20   int lineNumber;
21   char failureStr[1024];
22};
23
24}
25
26UNITTEST_STDVECTOR_LINKAGE(UnitTest::DeferredTestFailure)
27
28namespace UnitTest
29{
30
31class UNITTEST_LINKAGE DeferredTestResult
32{
33public:
34   DeferredTestResult();
35    DeferredTestResult(char const* suite, char const* test);
36    ~DeferredTestResult();
37
38    std::string suiteName;
39    std::string testName;
40    std::string failureFile;
41
42    typedef std::vector< DeferredTestFailure > FailureVec;
43    FailureVec failures;
44
45    float timeElapsed;
46   bool failed;
47};
48
49}
50
51#endif
52#endif
trunk/3rdparty/unittest-cpp/UnitTest++/ExceptionMacros.h
r0r249095
1#ifndef UNITTEST_EXCEPTIONMACROS_H
2#define UNITTEST_EXCEPTIONMACROS_H
3
4#include "Config.h"
5
6#ifndef UNITTEST_NO_EXCEPTIONS
7   #define UT_TRY(x) try x
8   #define UT_THROW(x) throw x
9   #define UT_CATCH(ExceptionType, ExceptionName, CatchBody) catch(ExceptionType& ExceptionName) CatchBody
10   #define UT_CATCH_ALL(CatchBody) catch(...) CatchBody
11#else
12   #define UT_TRY(x) x
13   #define UT_THROW(x)
14   #define UT_CATCH(ExceptionType, ExceptionName, CatchBody)
15   #define UT_CATCH_ALL(CatchBody)
16#endif
17
18#endif
trunk/3rdparty/unittest-cpp/UnitTest++/ExecuteTest.h
r0r249095
1#ifndef UNITTEST_EXECUTE_TEST_H
2#define UNITTEST_EXECUTE_TEST_H
3
4#include "Config.h"
5#include "ExceptionMacros.h"
6#include "TestDetails.h"
7#include "TestResults.h"
8#include "MemoryOutStream.h"
9#include "AssertException.h"
10#include "CurrentTest.h"
11
12#ifdef UNITTEST_NO_EXCEPTIONS
13   #include "ReportAssertImpl.h"
14#endif
15
16#ifdef UNITTEST_POSIX
17   #include "Posix/SignalTranslator.h"
18#endif
19
20namespace UnitTest {
21
22template< typename T >
23void ExecuteTest(T& testObject, TestDetails const& details, bool isMockTest)
24{
25   if (isMockTest == false)
26      CurrentTest::Details() = &details;
27
28#ifdef UNITTEST_NO_EXCEPTIONS
29   if (UNITTEST_SET_ASSERT_JUMP_TARGET() == 0)
30   {
31#endif
32#ifndef UNITTEST_POSIX
33      UT_TRY({ testObject.RunImpl(); })
34#else
35      UT_TRY
36      ({
37         UNITTEST_THROW_SIGNALS_POSIX_ONLY
38         testObject.RunImpl();
39      })
40#endif
41      UT_CATCH(AssertException, e, { (void)e; })
42      UT_CATCH(std::exception, e,
43      {
44         MemoryOutStream stream;
45         stream << "Unhandled exception: " << e.what();
46         CurrentTest::Results()->OnTestFailure(details, stream.GetText());
47      })
48      UT_CATCH_ALL
49      ({
50         CurrentTest::Results()->OnTestFailure(details, "Unhandled exception: test crashed");
51      })
52#ifdef UNITTEST_NO_EXCEPTIONS
53   }
54#endif
55}
56
57}
58
59#endif
trunk/3rdparty/unittest-cpp/UnitTest++/HelperMacros.h
r0r249095
1#ifndef UNITTEST_HELPERMACROS_H
2#define UNITTEST_HELPERMACROS_H
3
4#include "Config.h"
5
6#define UNITTEST_MULTILINE_MACRO_BEGIN do {
7
8#if defined(UNITTEST_WIN32) && !defined(UNITTEST_COMPILER_IS_MSVC6)
9   #define UNITTEST_MULTILINE_MACRO_END \
10      } __pragma(warning(push)) __pragma(warning(disable:4127)) while (0) __pragma(warning(pop))
11#else
12   #define UNITTEST_MULTILINE_MACRO_END } while(0)
13#endif
14
15
16#ifdef UNITTEST_WIN32_DLL
17   #define UNITTEST_IMPORT __declspec(dllimport)
18   #define UNITTEST_EXPORT   __declspec(dllexport)
19
20   #ifdef UNITTEST_DLL_EXPORT
21      #define UNITTEST_LINKAGE UNITTEST_EXPORT
22      #define UNITTEST_IMPEXP_TEMPLATE
23   #else
24      #define UNITTEST_LINKAGE UNITTEST_IMPORT
25      #define UNITTEST_IMPEXP_TEMPLATE extern
26   #endif
27
28   #define UNITTEST_STDVECTOR_LINKAGE(T) \
29      __pragma(warning(push)) \
30      __pragma(warning(disable:4231)) \
31      UNITTEST_IMPEXP_TEMPLATE template class UNITTEST_LINKAGE std::allocator< T >; \
32      UNITTEST_IMPEXP_TEMPLATE template class UNITTEST_LINKAGE std::vector< T >; \
33      __pragma(warning(pop))
34#else
35   #define UNITTEST_IMPORT
36   #define UNITTEST_EXPORT
37   #define UNITTEST_LINKAGE
38   #define UNITTEST_IMPEXP_TEMPLATE
39   #define UNITTEST_STDVECTOR_LINKAGE(T)
40#endif
41
42#ifdef UNITTEST_WIN32
43   #define UNITTEST_JMPBUF jmp_buf
44   #define UNITTEST_SETJMP setjmp
45   #define UNITTEST_LONGJMP longjmp
46#elif defined UNITTEST_POSIX
47   #define UNITTEST_JMPBUF std::jmp_buf
48   #define UNITTEST_SETJMP setjmp
49   #define UNITTEST_LONGJMP std::longjmp
50#endif
51
52#endif
trunk/3rdparty/unittest-cpp/UnitTest++/Makefile.am
r0r249095
1lib_LTLIBRARIES = libUnitTest++.la
2pkgincludedir = $(includedir)/UnitTest++
3nobase_pkginclude_HEADERS = UnitTest++.h UnitTestPP.h Config.h HelperMacros.h Test.h TestDetails.h TestList.h TestSuite.h TestResults.h TestMacros.h CheckMacros.h TestRunner.h TimeConstraint.h ExecuteTest.h AssertException.h MemoryOutStream.h CurrentTest.h Posix/SignalTranslator.h Checks.h TimeHelpers.h Posix/TimeHelpers.h ExceptionMacros.h ReportAssert.h ReportAssertImpl.h TestReporter.h TestReporterStdout.h CompositeTestReporter.h DeferredTestReporter.h DeferredTestResult.h
4libUnitTest___la_SOURCES = AssertException.cpp Test.cpp Checks.cpp TestRunner.cpp TestResults.cpp TestReporter.cpp TestReporterStdout.cpp ReportAssert.cpp TestList.cpp TimeConstraint.cpp TestDetails.cpp MemoryOutStream.cpp DeferredTestReporter.cpp DeferredTestResult.cpp XmlTestReporter.cpp CurrentTest.cpp Posix/SignalTranslator.cpp Posix/TimeHelpers.cpp CompositeTestReporter.cpp
5libUnitTest___la_LDFLAGS = -version-number @LIBUNITTEST_SO_VERSION@
6check_PROGRAMS = TestUnitTest++
7TestUnitTest___SOURCES = $(top_srcdir)/tests/Main.cpp $(top_srcdir)/tests/TestAssertHandler.cpp $(top_srcdir)/tests/TestCheckMacros.cpp $(top_srcdir)/tests/TestChecks.cpp $(top_srcdir)/tests/TestCompositeTestReporter.cpp $(top_srcdir)/tests/TestCurrentTest.cpp $(top_srcdir)/tests/TestDeferredTestReporter.cpp $(top_srcdir)/tests/TestExceptions.cpp $(top_srcdir)/tests/TestMemoryOutStream.cpp $(top_srcdir)/tests/TestTest.cpp $(top_srcdir)/tests/TestTestList.cpp $(top_srcdir)/tests/TestTestMacros.cpp $(top_srcdir)/tests/TestTestResults.cpp $(top_srcdir)/tests/TestTestRunner.cpp $(top_srcdir)/tests/TestTestSuite.cpp $(top_srcdir)/tests/TestTimeConstraint.cpp $(top_srcdir)/tests/TestTimeConstraintMacro.cpp $(top_srcdir)/tests/TestUnitTestPP.cpp $(top_srcdir)/tests/TestXmlTestReporter.cpp
8TestUnitTest___LDADD = libUnitTest++.la
9TESTS = TestUnitTest++
trunk/3rdparty/unittest-cpp/UnitTest++/MemoryOutStream.cpp
r0r249095
1#include "MemoryOutStream.h"
2
3#ifdef UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM
4
5namespace UnitTest {
6
7char const* MemoryOutStream::GetText() const
8{
9   m_text = this->str();
10   return m_text.c_str();
11}
12
13void MemoryOutStream::Clear()
14{
15   this->str(std::string());
16   m_text = this->str();
17}
18
19#ifdef UNITTEST_COMPILER_IS_MSVC6
20
21#define snprintf _snprintf
22
23template<typename ValueType>
24std::ostream& FormatToStream(std::ostream& stream, char const* format, ValueType const& value)
25{
26   using namespace std;
27   
28   const size_t BUFFER_SIZE=32;
29   char txt[BUFFER_SIZE];
30   snprintf(txt, BUFFER_SIZE, format, value);
31   return stream << txt;
32}
33
34std::ostream& operator<<(std::ostream& stream, __int64 const n)
35{
36   return FormatToStream(stream, "%I64d", n);
37}
38
39std::ostream& operator<<(std::ostream& stream, unsigned __int64 const n)
40{
41   return FormatToStream(stream, "%I64u", n);
42}
43
44#endif
45
46}
47
48#else
49
50#include <cstring>
51#include <cstdio>
52
53#if _MSC_VER
54#define snprintf _snprintf
55#endif
56
57namespace UnitTest {
58
59namespace {
60
61template<typename ValueType>
62void FormatToStream(MemoryOutStream& stream, char const* format, ValueType const& value)
63{
64   using namespace std;
65
66    const size_t BUFFER_SIZE=32;
67    char txt[BUFFER_SIZE];
68    snprintf(txt, BUFFER_SIZE, format, value);
69    stream << txt;
70}
71
72int RoundUpToMultipleOfPow2Number (int n, int pow2Number)
73{
74    return (n + (pow2Number - 1)) & ~(pow2Number - 1);
75}
76
77}
78
79
80MemoryOutStream::MemoryOutStream(int const size)
81    : m_capacity (0)
82    , m_buffer (0)
83
84{
85    GrowBuffer(size);
86}
87
88MemoryOutStream::~MemoryOutStream()
89{
90    delete [] m_buffer;
91}
92
93void MemoryOutStream::Clear()
94{
95   m_buffer[0] = '\0';
96}
97
98char const* MemoryOutStream::GetText() const
99{
100    return m_buffer;
101}
102
103MemoryOutStream& MemoryOutStream::operator <<(char const* txt)
104{
105   using namespace std;
106
107    int const bytesLeft = m_capacity - (int)strlen(m_buffer);
108    int const bytesRequired = (int)strlen(txt) + 1;
109
110    if (bytesRequired > bytesLeft)
111    {
112        int const requiredCapacity = bytesRequired + m_capacity - bytesLeft;
113        GrowBuffer(requiredCapacity);
114    }
115
116    strcat(m_buffer, txt);
117    return *this;
118}
119
120MemoryOutStream& MemoryOutStream::operator <<(int const n)
121{
122    FormatToStream(*this, "%i", n);
123    return *this;
124}
125
126MemoryOutStream& MemoryOutStream::operator <<(long const n)
127{
128    FormatToStream(*this, "%li", n);
129    return *this;
130}
131
132MemoryOutStream& MemoryOutStream::operator <<(unsigned long const n)
133{
134    FormatToStream(*this, "%lu", n);
135    return *this;
136}
137
138#ifdef UNITTEST_COMPILER_IS_MSVC6
139MemoryOutStream& MemoryOutStream::operator <<(__int64 const n)
140#else
141MemoryOutStream& MemoryOutStream::operator <<(long long const n)
142#endif
143{
144#ifdef UNITTEST_WIN32
145   FormatToStream(*this, "%I64d", n);
146#else
147   FormatToStream(*this, "%lld", n);
148#endif
149
150   return *this;
151}
152
153#ifdef UNITTEST_COMPILER_IS_MSVC6
154MemoryOutStream& MemoryOutStream::operator <<(unsigned __int64 const n)
155#else
156MemoryOutStream& MemoryOutStream::operator <<(unsigned long long const n)
157#endif
158{
159#ifdef UNITTEST_WIN32
160   FormatToStream(*this, "%I64u", n);
161#else
162   FormatToStream(*this, "%llu", n);
163#endif
164
165   return *this;
166}
167
168MemoryOutStream& MemoryOutStream::operator <<(float const f)
169{
170    FormatToStream(*this, "%0.6f", f);
171    return *this;   
172}
173
174MemoryOutStream& MemoryOutStream::operator <<(void const* p)
175{
176    FormatToStream(*this, "%p", p);
177    return *this;   
178}
179
180MemoryOutStream& MemoryOutStream::operator <<(unsigned int const s)
181{
182    FormatToStream(*this, "%u", s);
183    return *this;   
184}
185
186MemoryOutStream& MemoryOutStream::operator <<(double const d)
187{
188   FormatToStream(*this, "%0.6f", d);
189   return *this;
190}
191
192int MemoryOutStream::GetCapacity() const
193{
194    return m_capacity;
195}
196
197
198void MemoryOutStream::GrowBuffer(int const desiredCapacity)
199{
200    int const newCapacity = RoundUpToMultipleOfPow2Number(desiredCapacity, GROW_CHUNK_SIZE);
201
202   using namespace std;
203
204    char* buffer = new char[newCapacity];
205    if (m_buffer)
206        strcpy(buffer, m_buffer);
207    else
208        strcpy(buffer, "");
209
210    delete [] m_buffer;
211    m_buffer = buffer;
212    m_capacity = newCapacity;
213}
214
215}
216
217
218#endif
trunk/3rdparty/unittest-cpp/UnitTest++/MemoryOutStream.h
r0r249095
1#ifndef UNITTEST_MEMORYOUTSTREAM_H
2#define UNITTEST_MEMORYOUTSTREAM_H
3
4#include "Config.h"
5#include "HelperMacros.h"
6
7#ifdef UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM
8
9#include <sstream>
10
11namespace UnitTest
12{
13
14class UNITTEST_LINKAGE MemoryOutStream : public std::ostringstream
15{
16public:
17    MemoryOutStream() {}
18    ~MemoryOutStream() {}
19   void Clear();
20   char const* GetText() const;
21
22private:
23    MemoryOutStream(MemoryOutStream const&);
24    void operator =(MemoryOutStream const&);
25
26    mutable std::string m_text;
27};
28
29#ifdef UNITTEST_COMPILER_IS_MSVC6
30std::ostream& operator<<(std::ostream& stream, __int64 const n);
31std::ostream& operator<<(std::ostream& stream, unsigned __int64 const n);
32#endif
33
34}
35
36#else
37
38#include <cstddef>
39
40#ifdef UNITTEST_COMPILER_IS_MSVC6
41namespace std {}
42#endif
43
44namespace UnitTest
45{
46
47class UNITTEST_LINKAGE MemoryOutStream
48{
49public:
50    explicit MemoryOutStream(int const size = 256);
51    ~MemoryOutStream();
52
53   void Clear();
54    char const* GetText() const;
55
56    MemoryOutStream& operator <<(char const* txt);
57    MemoryOutStream& operator <<(int n);
58    MemoryOutStream& operator <<(long n);
59    MemoryOutStream& operator <<(unsigned long n);
60#ifdef UNITTEST_COMPILER_IS_MSVC6
61    MemoryOutStream& operator <<(__int64 n);
62    MemoryOutStream& operator <<(unsigned __int64 n);
63#else
64    MemoryOutStream& operator <<(long long n);
65    MemoryOutStream& operator <<(unsigned long long n);
66#endif
67   MemoryOutStream& operator <<(float f);
68    MemoryOutStream& operator <<(double d);
69    MemoryOutStream& operator <<(void const* p);
70    MemoryOutStream& operator <<(unsigned int s);
71
72    enum { GROW_CHUNK_SIZE = 32 };
73    int GetCapacity() const;
74
75private:
76    void operator= (MemoryOutStream const&);
77    void GrowBuffer(int capacity);
78
79    int m_capacity;
80    char* m_buffer;
81};
82
83}
84
85#endif
86
87#endif
trunk/3rdparty/unittest-cpp/UnitTest++/Posix/SignalTranslator.cpp
r0r249095
1#include "SignalTranslator.h"
2
3namespace UnitTest {
4
5sigjmp_buf* SignalTranslator::s_jumpTarget = 0;
6
7namespace {
8
9void SignalHandler(int sig)
10{
11    siglongjmp(*SignalTranslator::s_jumpTarget, sig );
12}
13
14}
15
16
17SignalTranslator::SignalTranslator()
18{
19    m_oldJumpTarget = s_jumpTarget;
20    s_jumpTarget = &m_currentJumpTarget;
21
22    struct sigaction action;
23    action.sa_flags = 0;
24    action.sa_handler = SignalHandler;
25    sigemptyset( &action.sa_mask );
26
27    sigaction( SIGSEGV, &action, &m_old_SIGSEGV_action );
28    sigaction( SIGFPE , &action, &m_old_SIGFPE_action  );
29    sigaction( SIGTRAP, &action, &m_old_SIGTRAP_action );
30    sigaction( SIGBUS , &action, &m_old_SIGBUS_action  );
31    sigaction( SIGILL , &action, &m_old_SIGBUS_action  );
32}
33
34SignalTranslator::~SignalTranslator()
35{
36    sigaction( SIGILL , &m_old_SIGBUS_action , 0 );
37    sigaction( SIGBUS , &m_old_SIGBUS_action , 0 );
38    sigaction( SIGTRAP, &m_old_SIGTRAP_action, 0 );
39    sigaction( SIGFPE , &m_old_SIGFPE_action , 0 );
40    sigaction( SIGSEGV, &m_old_SIGSEGV_action, 0 );
41
42    s_jumpTarget = m_oldJumpTarget;
43}
44
45
46}
trunk/3rdparty/unittest-cpp/UnitTest++/Posix/SignalTranslator.h
r0r249095
1#ifndef UNITTEST_SIGNALTRANSLATOR_H
2#define UNITTEST_SIGNALTRANSLATOR_H
3
4#include <setjmp.h>
5#include <signal.h>
6
7namespace UnitTest {
8
9class SignalTranslator
10{
11public:
12    SignalTranslator();
13    ~SignalTranslator();
14
15    static sigjmp_buf* s_jumpTarget;
16
17private:
18    sigjmp_buf m_currentJumpTarget;
19    sigjmp_buf* m_oldJumpTarget;
20
21    struct sigaction m_old_SIGFPE_action;
22    struct sigaction m_old_SIGTRAP_action;
23    struct sigaction m_old_SIGSEGV_action;
24    struct sigaction m_old_SIGBUS_action;
25    //struct sigaction m_old_SIGABRT_action;
26    //struct sigaction m_old_SIGALRM_action;
27};
28
29#if !defined (__GNUC__)
30    #define UNITTEST_EXTENSION
31#else
32    #define UNITTEST_EXTENSION __extension__
33#endif
34
35#define UNITTEST_THROW_SIGNALS_POSIX_ONLY \
36   UnitTest::SignalTranslator sig; \
37   if (UNITTEST_EXTENSION sigsetjmp(*UnitTest::SignalTranslator::s_jumpTarget, 1) != 0) \
38        throw ("Unhandled system exception");
39
40}
41
42#endif
trunk/3rdparty/unittest-cpp/UnitTest++/Posix/TimeHelpers.cpp
r0r249095
1#include "TimeHelpers.h"
2#include <unistd.h>
3
4namespace UnitTest {
5
6Timer::Timer()
7{
8    m_startTime.tv_sec = 0;
9    m_startTime.tv_usec = 0;
10}
11
12void Timer::Start()
13{
14    gettimeofday(&m_startTime, 0);
15}
16
17double Timer::GetTimeInMs() const
18{
19    struct timeval currentTime;
20    gettimeofday(&currentTime, 0);
21
22   double const dsecs = currentTime.tv_sec - m_startTime.tv_sec;
23    double const dus = currentTime.tv_usec - m_startTime.tv_usec;
24
25   return (dsecs * 1000.0) + (dus / 1000.0);
26}
27
28void TimeHelpers::SleepMs(int ms)
29{
30    usleep(ms * 1000);
31}
32
33}
trunk/3rdparty/unittest-cpp/UnitTest++/Posix/TimeHelpers.h
r0r249095
1#ifndef UNITTEST_TIMEHELPERS_H
2#define UNITTEST_TIMEHELPERS_H
3
4#include <sys/time.h>
5
6namespace UnitTest {
7
8class Timer
9{
10public:
11    Timer();
12    void Start();
13    double GetTimeInMs() const;   
14
15private:
16    struct timeval m_startTime;   
17};
18
19
20namespace TimeHelpers
21{
22   void SleepMs(int ms);
23}
24
25
26}
27
28#endif
trunk/3rdparty/unittest-cpp/UnitTest++/ReportAssert.cpp
r0r249095
1#include "ReportAssert.h"
2#include "ReportAssertImpl.h"
3#include "AssertException.h"
4#include "CurrentTest.h"
5#include "TestResults.h"
6#include "TestDetails.h"
7
8#ifdef UNITTEST_NO_EXCEPTIONS
9   #include "ReportAssertImpl.h"
10#endif
11
12namespace UnitTest {
13
14namespace
15{
16   bool& AssertExpectedFlag()
17   {
18      static bool s_assertExpected = false;
19      return s_assertExpected;
20   }
21}
22
23UNITTEST_LINKAGE void ReportAssert(char const* description, char const* filename, int lineNumber)
24{
25   Detail::ReportAssertEx(CurrentTest::Results(), CurrentTest::Details(),
26                     description, filename, lineNumber);
27}
28
29namespace Detail {
30
31#ifdef UNITTEST_NO_EXCEPTIONS
32UNITTEST_JMPBUF* GetAssertJmpBuf()
33{
34   static UNITTEST_JMPBUF s_jmpBuf;
35   return &s_jmpBuf;
36}
37#endif
38
39UNITTEST_LINKAGE void ReportAssertEx(TestResults* testResults,
40                            const TestDetails* testDetails,
41                            char const* description,
42                            char const* filename,
43                            int lineNumber)
44{
45   if (AssertExpectedFlag() == false)
46   {
47      TestDetails assertDetails(testDetails->testName, testDetails->suiteName, filename, lineNumber);
48      testResults->OnTestFailure(assertDetails, description);
49   }
50
51   ExpectAssert(false);
52
53#ifndef UNITTEST_NO_EXCEPTIONS
54   throw AssertException();
55#else
56   UNITTEST_JUMP_TO_ASSERT_JUMP_TARGET();
57#endif
58}
59
60UNITTEST_LINKAGE void ExpectAssert(bool expected)
61{
62   AssertExpectedFlag() = expected;
63}
64
65UNITTEST_LINKAGE bool AssertExpected()
66{
67   return AssertExpectedFlag();
68}
69
70}}
trunk/3rdparty/unittest-cpp/UnitTest++/ReportAssert.h
r0r249095
1#ifndef UNITTEST_ASSERT_H
2#define UNITTEST_ASSERT_H
3
4#include "HelperMacros.h"
5
6namespace UnitTest {
7
8UNITTEST_LINKAGE void ReportAssert(char const* description, char const* filename, int lineNumber);
9
10}
11
12#endif
trunk/3rdparty/unittest-cpp/UnitTest++/ReportAssertImpl.h
r0r249095
1#ifndef UNITTEST_REPORTASSERTIMPL_H
2#define UNITTEST_REPORTASSERTIMPL_H
3
4#include "Config.h"
5#include "HelperMacros.h"
6
7#ifdef UNITTEST_NO_EXCEPTIONS
8   #include <csetjmp>
9#endif
10
11namespace UnitTest {
12
13class TestResults;
14class TestDetails;
15
16namespace Detail {
17
18UNITTEST_LINKAGE void ExpectAssert(bool expected);
19
20UNITTEST_LINKAGE void ReportAssertEx(TestResults* testResults,
21                            const TestDetails* testDetails,
22                            char const* description,
23                            char const* filename,
24                            int lineNumber);
25
26UNITTEST_LINKAGE bool AssertExpected();
27
28#ifdef UNITTEST_NO_EXCEPTIONS
29   UNITTEST_LINKAGE UNITTEST_JMPBUF* GetAssertJmpBuf();
30
31   #ifdef UNITTEST_WIN32
32      #define UNITTEST_SET_ASSERT_JUMP_TARGET() \
33         __pragma(warning(push)) __pragma(warning(disable:4611)) \
34         UNITTEST_SETJMP(*UnitTest::Detail::GetAssertJmpBuf()) \
35         __pragma(warning(pop))
36   #else
37      #define UNITTEST_SET_ASSERT_JUMP_TARGET() UNITTEST_SETJMP(*UnitTest::Detail::GetAssertJmpBuf())
38   #endif
39
40   #define UNITTEST_JUMP_TO_ASSERT_JUMP_TARGET() UNITTEST_LONGJMP(*UnitTest::Detail::GetAssertJmpBuf(), 1)
41#endif
42
43}
44}
45
46#endif
trunk/3rdparty/unittest-cpp/UnitTest++/Test.cpp
r0r249095
1#include "Config.h"
2#include "Test.h"
3#include "TestList.h"
4#include "TestResults.h"
5#include "AssertException.h"
6#include "MemoryOutStream.h"
7#include "ExecuteTest.h"
8
9#ifdef UNITTEST_POSIX
10    #include "Posix/SignalTranslator.h"
11#endif
12
13namespace UnitTest {
14
15TestList& Test::GetTestList()
16{
17    static TestList s_list;
18    return s_list;
19}
20
21Test::Test(char const* testName, char const* suiteName, char const* filename, int lineNumber)
22    : m_details(testName, suiteName, filename, lineNumber)
23    , m_nextTest(0)
24   , m_isMockTest(false)
25{
26}
27
28Test::~Test()
29{
30}
31
32void Test::Run()
33{
34   ExecuteTest(*this, m_details, m_isMockTest);
35}
36
37void Test::RunImpl() const
38{
39}
40
41}
trunk/3rdparty/unittest-cpp/UnitTest++/Test.h
r0r249095
1#ifndef UNITTEST_TEST_H
2#define UNITTEST_TEST_H
3
4#include "TestDetails.h"
5
6namespace UnitTest {
7
8class TestResults;
9class TestList;
10
11class UNITTEST_LINKAGE Test
12{
13public:
14    explicit Test(char const* testName, char const* suiteName = "DefaultSuite", char const* filename = "", int lineNumber = 0);
15    virtual ~Test();
16    void Run();
17
18    TestDetails const m_details;
19    Test* m_nextTest;
20
21   mutable bool m_isMockTest;
22
23    static TestList& GetTestList();
24
25    virtual void RunImpl() const;
26
27private:
28   Test(Test const&);
29    Test& operator =(Test const&);
30};
31
32
33}
34
35#endif
trunk/3rdparty/unittest-cpp/UnitTest++/TestDetails.cpp
r0r249095
1#include "TestDetails.h"
2
3namespace UnitTest {
4
5TestDetails::TestDetails(char const* testName_, char const* suiteName_, char const* filename_, int lineNumber_)
6    : suiteName(suiteName_)
7    , testName(testName_)
8    , filename(filename_)
9    , lineNumber(lineNumber_)
10    , timeConstraintExempt(false)
11{
12}
13
14TestDetails::TestDetails(const TestDetails& details, int lineNumber_)
15    : suiteName(details.suiteName)
16    , testName(details.testName)
17    , filename(details.filename)
18    , lineNumber(lineNumber_)
19    , timeConstraintExempt(details.timeConstraintExempt)
20{
21}
22
23
24}
trunk/3rdparty/unittest-cpp/UnitTest++/TestDetails.h
r0r249095
1#ifndef UNITTEST_TESTDETAILS_H
2#define UNITTEST_TESTDETAILS_H
3
4#include "HelperMacros.h"
5
6namespace UnitTest {
7
8class UNITTEST_LINKAGE TestDetails
9{
10public:
11    TestDetails(char const* testName, char const* suiteName, char const* filename, int lineNumber);
12    TestDetails(const TestDetails& details, int lineNumber);
13
14    char const* const suiteName;
15    char const* const testName;
16    char const* const filename;
17    int const lineNumber;
18    mutable bool timeConstraintExempt;
19
20    TestDetails(TestDetails const&); // Why is it public? --> http://gcc.gnu.org/bugs.html#cxx_rvalbind
21private:
22    TestDetails& operator=(TestDetails const&);
23};
24
25}
26
27#endif
trunk/3rdparty/unittest-cpp/UnitTest++/TestList.cpp
r0r249095
1#include "TestList.h"
2#include "Test.h"
3
4#include <cassert>
5
6namespace UnitTest {
7
8TestList::TestList()
9    : m_head(0)
10    , m_tail(0)
11{
12}
13
14void TestList::Add(Test* test)
15{
16    if (m_tail == 0)
17    {
18        assert(m_head == 0);
19        m_head = test;
20        m_tail = test;
21    }
22    else
23    {
24        m_tail->m_nextTest = test;
25        m_tail = test;
26    }
27}
28
29Test* TestList::GetHead() const
30{
31    return m_head;
32}
33
34ListAdder::ListAdder(TestList& list, Test* test)
35{
36    list.Add(test);
37}
38
39}
trunk/3rdparty/unittest-cpp/UnitTest++/TestList.h
r0r249095
1#ifndef UNITTEST_TESTLIST_H
2#define UNITTEST_TESTLIST_H
3
4#include "HelperMacros.h"
5
6namespace UnitTest {
7
8class Test;
9
10class UNITTEST_LINKAGE TestList
11{
12public:
13    TestList();
14    void Add (Test* test);
15
16    Test* GetHead() const;
17
18private:
19    Test* m_head;
20    Test* m_tail;
21};
22
23
24class UNITTEST_LINKAGE ListAdder
25{
26public:
27    ListAdder(TestList& list, Test* test);
28};
29
30}
31
32
33#endif
trunk/3rdparty/unittest-cpp/UnitTest++/TestMacros.h
r0r249095
1#ifndef UNITTEST_TESTMACROS_H
2#define UNITTEST_TESTMACROS_H
3
4#include "Config.h"
5#include "TestSuite.h"
6#include "ExceptionMacros.h"
7#include "ExecuteTest.h"
8#include "AssertException.h"
9#include "TestDetails.h"
10#include "MemoryOutStream.h"
11
12#ifndef UNITTEST_POSIX
13   #define UNITTEST_THROW_SIGNALS_POSIX_ONLY
14#else
15   #include "Posix/SignalTranslator.h"
16#endif
17
18#ifdef TEST
19    #error UnitTest++ redefines TEST
20#endif
21
22#ifdef TEST_EX
23   #error UnitTest++ redefines TEST_EX
24#endif
25
26#ifdef TEST_FIXTURE_EX
27   #error UnitTest++ redefines TEST_FIXTURE_EX
28#endif
29
30#define SUITE(Name)                                                         \
31   namespace Suite##Name {                                                        \
32        namespace UnitTestSuite {                                           \
33            inline char const* GetSuiteName () {                            \
34                return #Name ;                                              \
35            }                                                               \
36        }                                                                   \
37    }                                                                       \
38   namespace Suite##Name
39
40#define TEST_EX(Name, List)                                                \
41    class Test##Name : public UnitTest::Test                               \
42    {                                                                      \
43    public:                                                                \
44      Test##Name() : Test(#Name, UnitTestSuite::GetSuiteName(), __FILE__, __LINE__) {}  \
45    private:                                                               \
46        virtual void RunImpl() const;   \
47    } test##Name##Instance;                                                \
48                                                         \
49    UnitTest::ListAdder adder##Name (List, &test##Name##Instance);         \
50                                                         \
51    void Test##Name::RunImpl() const
52
53
54#define TEST(Name) TEST_EX(Name, UnitTest::Test::GetTestList())
55
56
57#define TEST_FIXTURE_EX(Fixture, Name, List)                                         \
58    class Fixture##Name##Helper : public Fixture                            \
59   {                                                             \
60   public:                                                          \
61        explicit Fixture##Name##Helper(UnitTest::TestDetails const& details) : m_details(details) {} \
62        void RunImpl();                           \
63        UnitTest::TestDetails const& m_details;                                      \
64    private:                                                                         \
65        Fixture##Name##Helper(Fixture##Name##Helper const&);                         \
66        Fixture##Name##Helper& operator =(Fixture##Name##Helper const&);             \
67    };                                                                               \
68                                                                \
69    class Test##Fixture##Name : public UnitTest::Test                                \
70    {                                                                                \
71    public:                                                                          \
72       Test##Fixture##Name() : Test(#Name, UnitTestSuite::GetSuiteName(), __FILE__, __LINE__) {} \
73    private:                                                                         \
74        virtual void RunImpl() const;             \
75    } test##Fixture##Name##Instance;                                                 \
76                                                                \
77    UnitTest::ListAdder adder##Fixture##Name (List, &test##Fixture##Name##Instance); \
78                                                                \
79    void Test##Fixture##Name::RunImpl() const    \
80   {                                                             \
81      volatile bool ctorOk = false;                                     \
82      UT_TRY \
83      ({ \
84         Fixture##Name##Helper fixtureHelper(m_details);                      \
85         ctorOk = true;                                              \
86         UnitTest::ExecuteTest(fixtureHelper, m_details, false);                \
87      }) \
88      UT_CATCH (UnitTest::AssertException, e, \
89      { \
90         (void)e;   \
91      }) \
92      UT_CATCH (std::exception, e, \
93      { \
94         UnitTest::MemoryOutStream stream;                                        \
95         stream << "Unhandled exception: " << e.what();                      \
96         UnitTest::CurrentTest::Results()->OnTestFailure(m_details, stream.GetText());             \
97      }) \
98      UT_CATCH_ALL \
99      ({ \
100         if (ctorOk)                                                 \
101         {                                                       \
102               UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(m_details, __LINE__),    \
103               "Unhandled exception while destroying fixture " #Fixture);       \
104         }                                                       \
105         else                                                    \
106         {                                                       \
107            UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(m_details, __LINE__),   \
108               "Unhandled exception while constructing fixture " #Fixture);         \
109         }                                                       \
110      }) \
111    }                                                                                \
112    void Fixture##Name##Helper::RunImpl()
113
114#define TEST_FIXTURE(Fixture,Name) TEST_FIXTURE_EX(Fixture, Name, UnitTest::Test::GetTestList())
115
116
117#endif
trunk/3rdparty/unittest-cpp/UnitTest++/TestReporter.cpp
r0r249095
1#include "TestReporter.h"
2
3namespace UnitTest {
4
5TestReporter::~TestReporter()
6{
7}
8
9}
trunk/3rdparty/unittest-cpp/UnitTest++/TestReporter.h
r0r249095
1#ifndef UNITTEST_TESTREPORTER_H
2#define UNITTEST_TESTREPORTER_H
3
4#include "HelperMacros.h"
5
6namespace UnitTest {
7
8class TestDetails;
9
10class UNITTEST_LINKAGE TestReporter
11{
12public:
13    virtual ~TestReporter();
14
15    virtual void ReportTestStart(TestDetails const& test) = 0;
16    virtual void ReportFailure(TestDetails const& test, char const* failure) = 0;
17    virtual void ReportTestFinish(TestDetails const& test, float secondsElapsed) = 0;
18    virtual void ReportSummary(int totalTestCount, int failedTestCount, int failureCount, float secondsElapsed) = 0;
19};
20
21}
22#endif
trunk/3rdparty/unittest-cpp/UnitTest++/TestReporterStdout.cpp
r0r249095
1#include "TestReporterStdout.h"
2#include <cstdio>
3
4#include "TestDetails.h"
5
6// cstdio doesn't pull in namespace std on VC6, so we do it here.
7#if defined(UNITTEST_WIN32) && (_MSC_VER == 1200)
8   namespace std {}
9#endif
10
11namespace UnitTest {
12
13void TestReporterStdout::ReportFailure(TestDetails const& details, char const* failure)
14{
15    using namespace std;
16#if defined(__APPLE__) || defined(__GNUG__)
17    char const* const errorFormat = "%s:%d:%d: error: Failure in %s: %s\n";
18    fprintf(stderr, errorFormat, details.filename, details.lineNumber, 1, details.testName, failure);
19#else
20    char const* const errorFormat = "%s(%d): error: Failure in %s: %s\n";
21    fprintf(stderr, errorFormat, details.filename, details.lineNumber, details.testName, failure);
22#endif
23}
24
25void TestReporterStdout::ReportTestStart(TestDetails const& /*test*/)
26{
27}
28
29void TestReporterStdout::ReportTestFinish(TestDetails const& /*test*/, float)
30{
31}
32
33void TestReporterStdout::ReportSummary(int const totalTestCount, int const failedTestCount,
34                                       int const failureCount, float const secondsElapsed)
35{
36   using namespace std;
37
38    if (failureCount > 0)
39        printf("FAILURE: %d out of %d tests failed (%d failures).\n", failedTestCount, totalTestCount, failureCount);
40    else
41        printf("Success: %d tests passed.\n", totalTestCount);
42
43    printf("Test time: %.2f seconds.\n", secondsElapsed);
44}
45
46}
trunk/3rdparty/unittest-cpp/UnitTest++/TestReporterStdout.h
r0r249095
1#ifndef UNITTEST_TESTREPORTERSTDOUT_H
2#define UNITTEST_TESTREPORTERSTDOUT_H
3
4#include "TestReporter.h"
5
6namespace UnitTest {
7
8class UNITTEST_LINKAGE TestReporterStdout : public TestReporter
9{
10private:
11    virtual void ReportTestStart(TestDetails const& test);
12    virtual void ReportFailure(TestDetails const& test, char const* failure);
13    virtual void ReportTestFinish(TestDetails const& test, float secondsElapsed);
14    virtual void ReportSummary(int totalTestCount, int failedTestCount, int failureCount, float secondsElapsed);
15};
16
17}
18
19#endif
trunk/3rdparty/unittest-cpp/UnitTest++/TestResults.cpp
r0r249095
1#include "TestResults.h"
2#include "TestReporter.h"
3
4#include "TestDetails.h"
5
6namespace UnitTest {
7
8TestResults::TestResults(TestReporter* testReporter)
9    : m_testReporter(testReporter)
10    , m_totalTestCount(0)
11    , m_failedTestCount(0)
12    , m_failureCount(0)
13    , m_currentTestFailed(false)
14{
15}
16
17void TestResults::OnTestStart(TestDetails const& test)
18{
19    ++m_totalTestCount;
20    m_currentTestFailed = false;
21    if (m_testReporter)
22        m_testReporter->ReportTestStart(test);
23}
24
25void TestResults::OnTestFailure(TestDetails const& test, char const* failure)
26{
27    ++m_failureCount;
28    if (!m_currentTestFailed)
29    {
30        ++m_failedTestCount;
31        m_currentTestFailed = true;
32    }
33
34    if (m_testReporter)
35        m_testReporter->ReportFailure(test, failure);
36}
37
38void TestResults::OnTestFinish(TestDetails const& test, float secondsElapsed)
39{
40    if (m_testReporter)
41        m_testReporter->ReportTestFinish(test, secondsElapsed);
42}
43
44int TestResults::GetTotalTestCount() const
45{
46    return m_totalTestCount;
47}
48
49int TestResults::GetFailedTestCount() const
50{
51    return m_failedTestCount;
52}
53
54int TestResults::GetFailureCount() const
55{
56    return m_failureCount;
57}
58
59
60}
trunk/3rdparty/unittest-cpp/UnitTest++/TestResults.h
r0r249095
1#ifndef UNITTEST_TESTRESULTS_H
2#define UNITTEST_TESTRESULTS_H
3
4#include "HelperMacros.h"
5
6namespace UnitTest {
7
8class TestReporter;
9class TestDetails;
10
11class UNITTEST_LINKAGE TestResults
12{
13public:
14    explicit TestResults(TestReporter* reporter = 0);
15
16    void OnTestStart(TestDetails const& test);
17    void OnTestFailure(TestDetails const& test, char const* failure);
18    void OnTestFinish(TestDetails const& test, float secondsElapsed);
19
20    int GetTotalTestCount() const;
21    int GetFailedTestCount() const;
22    int GetFailureCount() const;
23
24private:
25    TestReporter* m_testReporter;
26    int m_totalTestCount;
27    int m_failedTestCount;
28    int m_failureCount;
29
30    bool m_currentTestFailed;
31
32    TestResults(TestResults const&);
33    TestResults& operator =(TestResults const&);
34};
35
36}
37
38#endif
trunk/3rdparty/unittest-cpp/UnitTest++/TestRunner.cpp
r0r249095
1#include "TestRunner.h"
2#include "TestResults.h"
3#include "TestReporter.h"
4#include "TestReporterStdout.h"
5#include "TimeHelpers.h"
6#include "MemoryOutStream.h"
7
8#include <cstring>
9
10
11namespace UnitTest {
12
13int RunAllTests()
14{
15   TestReporterStdout reporter;
16   TestRunner runner(reporter);
17   return runner.RunTestsIf(Test::GetTestList(), NULL, True(), 0);
18}
19
20
21TestRunner::TestRunner(TestReporter& reporter)
22   : m_reporter(&reporter)
23   , m_result(new TestResults(&reporter))
24   , m_timer(new Timer)
25{
26   m_timer->Start();
27}
28
29TestRunner::~TestRunner()
30{
31   delete m_result;
32   delete m_timer;
33}
34
35TestResults* TestRunner::GetTestResults()
36{
37   return m_result;
38}
39
40int TestRunner::Finish() const
41{
42    float const secondsElapsed = static_cast<float>(m_timer->GetTimeInMs() / 1000.0);
43    m_reporter->ReportSummary(m_result->GetTotalTestCount(),
44                       m_result->GetFailedTestCount(),
45                       m_result->GetFailureCount(),
46                       secondsElapsed);
47   
48   return m_result->GetFailureCount();
49}
50
51bool TestRunner::IsTestInSuite(const Test* const curTest, char const* suiteName) const
52{
53   using namespace std;
54   return (suiteName == NULL) || !strcmp(curTest->m_details.suiteName, suiteName);
55}
56
57void TestRunner::RunTest(TestResults* const result, Test* const curTest, int const maxTestTimeInMs) const
58{
59   if (curTest->m_isMockTest == false)
60      CurrentTest::Results() = result;
61
62   Timer testTimer;
63   testTimer.Start();
64
65   result->OnTestStart(curTest->m_details);
66
67   curTest->Run();
68
69   double const testTimeInMs = testTimer.GetTimeInMs();
70   if (maxTestTimeInMs > 0 && testTimeInMs > maxTestTimeInMs && !curTest->m_details.timeConstraintExempt)
71   {
72       MemoryOutStream stream;
73       stream << "Global time constraint failed. Expected under " << maxTestTimeInMs <<
74               "ms but took " << testTimeInMs << "ms.";
75
76       result->OnTestFailure(curTest->m_details, stream.GetText());
77   }
78
79   result->OnTestFinish(curTest->m_details, static_cast< float >(testTimeInMs / 1000.0));
80}
81
82}
trunk/3rdparty/unittest-cpp/UnitTest++/TestRunner.h
r0r249095
1#ifndef UNITTEST_TESTRUNNER_H
2#define UNITTEST_TESTRUNNER_H
3
4#include "Test.h"
5#include "TestList.h"
6#include "CurrentTest.h"
7
8namespace UnitTest {
9
10class TestReporter;
11class TestResults;
12class Timer;
13
14UNITTEST_LINKAGE int RunAllTests();
15
16struct True
17{
18   bool operator()(const Test* const) const
19   {
20      return true;   
21   }
22};
23
24class UNITTEST_LINKAGE TestRunner
25{
26public:
27   explicit TestRunner(TestReporter& reporter);
28   ~TestRunner();
29
30   template< class Predicate >
31   int RunTestsIf(TestList const& list, char const* suiteName,
32               const Predicate& predicate, int maxTestTimeInMs) const
33   {
34       Test* curTest = list.GetHead();
35
36       while (curTest != 0)
37       {
38          if (IsTestInSuite(curTest, suiteName) && predicate(curTest))
39            RunTest(m_result, curTest, maxTestTimeInMs);
40
41         curTest = curTest->m_nextTest;
42       }
43
44       return Finish();
45   }   
46
47   TestResults* GetTestResults();
48
49private:
50   TestReporter* m_reporter;
51   TestResults* m_result;
52   Timer* m_timer;
53
54   int Finish() const;
55   bool IsTestInSuite(const Test* const curTest, char const* suiteName) const;
56   void RunTest(TestResults* const result, Test* const curTest, int const maxTestTimeInMs) const;
57};
58
59}
60
61#endif
trunk/3rdparty/unittest-cpp/UnitTest++/TestSuite.h
r0r249095
1#ifndef UNITTEST_TESTSUITE_H
2#define UNITTEST_TESTSUITE_H
3
4namespace UnitTestSuite
5{
6    inline char const* GetSuiteName ()
7    {
8        return "DefaultSuite";
9    }
10}
11
12#endif
trunk/3rdparty/unittest-cpp/UnitTest++/TimeConstraint.cpp
r0r249095
1#include "TimeConstraint.h"
2#include "TestResults.h"
3#include "MemoryOutStream.h"
4#include "CurrentTest.h"
5
6namespace UnitTest {
7
8
9TimeConstraint::TimeConstraint(int ms, TestDetails const& details)
10   : m_details(details)
11    , m_maxMs(ms)
12{
13    m_timer.Start();
14}
15
16TimeConstraint::~TimeConstraint()
17{
18    double const totalTimeInMs = m_timer.GetTimeInMs();
19    if (totalTimeInMs > m_maxMs)
20    {
21        MemoryOutStream stream;
22        stream << "Time constraint failed. Expected to run test under " << m_maxMs <<
23                  "ms but took " << totalTimeInMs << "ms.";
24
25      CurrentTest::Results()->OnTestFailure(m_details, stream.GetText());
26    }
27}
28
29}
trunk/3rdparty/unittest-cpp/UnitTest++/TimeConstraint.h
r0r249095
1#ifndef UNITTEST_TIMECONSTRAINT_H
2#define UNITTEST_TIMECONSTRAINT_H
3
4#include "TimeHelpers.h"
5#include "HelperMacros.h"
6
7namespace UnitTest {
8
9class TestResults;
10class TestDetails;
11
12class UNITTEST_LINKAGE TimeConstraint
13{
14public:
15    TimeConstraint(int ms, TestDetails const& details);
16    ~TimeConstraint();
17
18private:
19    void operator=(TimeConstraint const&);
20   TimeConstraint(TimeConstraint const&);
21
22   Timer m_timer;
23    TestDetails const& m_details;
24   int const m_maxMs;
25};
26
27#define UNITTEST_TIME_CONSTRAINT(ms) \
28   UnitTest::TimeConstraint unitTest__timeConstraint__(ms, UnitTest::TestDetails(m_details, __LINE__))
29
30#define UNITTEST_TIME_CONSTRAINT_EXEMPT() \
31   UNITTEST_MULTILINE_MACRO_BEGIN \
32   m_details.timeConstraintExempt = true; \
33   UNITTEST_MULTILINE_MACRO_END
34
35}
36
37#endif
trunk/3rdparty/unittest-cpp/UnitTest++/TimeHelpers.h
r0r249095
1#include "Config.h"
2
3#if defined UNITTEST_POSIX
4    #include "Posix/TimeHelpers.h"
5#else
6    #include "Win32/TimeHelpers.h"
7#endif
trunk/3rdparty/unittest-cpp/UnitTest++/UnitTest++.h
r0r249095
1#include "UnitTestPP.h"
No newline at end of file
trunk/3rdparty/unittest-cpp/UnitTest++/UnitTestPP.h
r0r249095
1#ifndef UNITTESTPP_H
2#define UNITTESTPP_H
3
4#include "Config.h"
5#include "TestMacros.h"
6#include "CheckMacros.h"
7#include "TestRunner.h"
8#include "TimeConstraint.h"
9#include "ReportAssert.h"
10
11#endif
trunk/3rdparty/unittest-cpp/UnitTest++/Win32/TimeHelpers.cpp
r0r249095
1#include "TimeHelpers.h"
2
3#define WIN32_LEAN_AND_MEAN
4#include <windows.h>
5
6namespace UnitTest {
7
8Timer::Timer()
9   : m_threadHandle(::GetCurrentThread())
10   , m_startTime(0)
11{
12#if defined(UNITTEST_WIN32) && (_MSC_VER == 1200) // VC6 doesn't have DWORD_PTR
13   typedef unsigned long DWORD_PTR;
14#endif
15
16   DWORD_PTR systemMask;
17   ::GetProcessAffinityMask(GetCurrentProcess(), &m_processAffinityMask, &systemMask);
18   ::SetThreadAffinityMask(m_threadHandle, 1);
19   ::QueryPerformanceFrequency(reinterpret_cast< LARGE_INTEGER* >(&m_frequency));
20   ::SetThreadAffinityMask(m_threadHandle, m_processAffinityMask);
21}
22
23void Timer::Start()
24{
25   m_startTime = GetTime();
26}
27
28double Timer::GetTimeInMs() const
29{
30   __int64 const elapsedTime = GetTime() - m_startTime;
31   double const seconds = double(elapsedTime) / double(m_frequency);
32   return seconds * 1000.0;
33}
34
35__int64 Timer::GetTime() const
36{
37   LARGE_INTEGER curTime;
38   ::SetThreadAffinityMask(m_threadHandle, 1);
39   ::QueryPerformanceCounter(&curTime);
40   ::SetThreadAffinityMask(m_threadHandle, m_processAffinityMask);
41   return curTime.QuadPart;
42}
43
44void TimeHelpers::SleepMs(int ms)
45{
46   ::Sleep(ms);
47}
48
49}
trunk/3rdparty/unittest-cpp/UnitTest++/Win32/TimeHelpers.h
r0r249095
1#ifndef UNITTEST_TIMEHELPERS_H
2#define UNITTEST_TIMEHELPERS_H
3
4#include "../Config.h"
5#include "../HelperMacros.h"
6
7#ifdef UNITTEST_MINGW
8    #ifndef __int64
9        #define __int64 long long
10    #endif
11#endif
12
13namespace UnitTest {
14
15class UNITTEST_LINKAGE Timer
16{
17public:
18    Timer();
19   void Start();
20   double GetTimeInMs() const;   
21
22private:
23    __int64 GetTime() const;
24
25    void* m_threadHandle;
26
27#if defined(_WIN64)
28    unsigned __int64 m_processAffinityMask;
29#else
30    unsigned long m_processAffinityMask;
31#endif
32
33   __int64 m_startTime;
34   __int64 m_frequency;
35};
36
37
38namespace TimeHelpers
39{
40   UNITTEST_LINKAGE void SleepMs(int ms);
41}
42
43}
44
45#endif
trunk/3rdparty/unittest-cpp/UnitTest++/XmlTestReporter.cpp
r0r249095
1#include "Config.h"
2#ifndef UNITTEST_NO_DEFERRED_REPORTER
3
4#include "XmlTestReporter.h"
5
6#include <iostream>
7#include <sstream>
8#include <string>
9
10using std::string;
11using std::ostringstream;
12using std::ostream;
13
14namespace {
15
16void ReplaceChar(string& str, char c, string const& replacement)
17{
18    for (size_t pos = str.find(c); pos != string::npos; pos = str.find(c, pos + 1))
19        str.replace(pos, 1, replacement);
20}
21
22string XmlEscape(string const& value)
23{
24    string escaped = value;
25
26    ReplaceChar(escaped, '&', "&amp;");
27    ReplaceChar(escaped, '<', "&lt;");
28    ReplaceChar(escaped, '>', "&gt;");
29    ReplaceChar(escaped, '\'', "&apos;");
30    ReplaceChar(escaped, '\"', "&quot;");
31 
32    return escaped;
33}
34
35string BuildFailureMessage(string const& file, int line, string const& message)
36{
37    ostringstream failureMessage;
38    failureMessage << file << "(" << line << ") : " << message;
39    return failureMessage.str();
40}
41
42}
43
44namespace UnitTest {
45
46XmlTestReporter::XmlTestReporter(ostream& ostream)
47    : m_ostream(ostream)
48{
49}
50
51void XmlTestReporter::ReportSummary(int totalTestCount, int failedTestCount,
52                                    int failureCount, float secondsElapsed)
53{
54    AddXmlElement(m_ostream, NULL);
55
56    BeginResults(m_ostream, totalTestCount, failedTestCount, failureCount, secondsElapsed);
57
58    DeferredTestResultList const& results = GetResults();
59    for (DeferredTestResultList::const_iterator i = results.begin(); i != results.end(); ++i)
60    {
61        BeginTest(m_ostream, *i);
62
63        if (i->failed)
64            AddFailure(m_ostream, *i);
65
66        EndTest(m_ostream, *i);
67    }
68
69    EndResults(m_ostream);
70}
71
72void XmlTestReporter::AddXmlElement(ostream& os, char const* encoding)
73{
74    os << "<?xml version=\"1.0\"";
75
76    if (encoding != NULL)
77        os << " encoding=\"" << encoding << "\"";
78
79    os << "?>";
80}
81
82void XmlTestReporter::BeginResults(std::ostream& os, int totalTestCount, int failedTestCount,
83                                   int failureCount, float secondsElapsed)
84{
85   os << "<unittest-results"
86       << " tests=\"" << totalTestCount << "\""
87       << " failedtests=\"" << failedTestCount << "\""
88       << " failures=\"" << failureCount << "\""
89       << " time=\"" << secondsElapsed << "\""
90       << ">";
91}
92
93void XmlTestReporter::EndResults(std::ostream& os)
94{
95    os << "</unittest-results>";
96}
97
98void XmlTestReporter::BeginTest(std::ostream& os, DeferredTestResult const& result)
99{
100    os << "<test"
101        << " suite=\"" << result.suiteName << "\""
102        << " name=\"" << result.testName << "\""
103        << " time=\"" << result.timeElapsed << "\"";
104}
105
106void XmlTestReporter::EndTest(std::ostream& os, DeferredTestResult const& result)
107{
108    if (result.failed)
109        os << "</test>";
110    else
111        os << "/>";
112}
113
114void XmlTestReporter::AddFailure(std::ostream& os, DeferredTestResult const& result)
115{
116    os << ">"; // close <test> element
117
118    for (DeferredTestResult::FailureVec::const_iterator it = result.failures.begin();
119         it != result.failures.end();
120         ++it)
121    {
122      string const escapedMessage = XmlEscape(std::string(it->failureStr));
123        string const message = BuildFailureMessage(result.failureFile, it->lineNumber, escapedMessage);
124
125        os << "<failure" << " message=\"" << message << "\"" << "/>";
126    }
127}
128
129}
130
131#endif
trunk/3rdparty/unittest-cpp/UnitTest++/XmlTestReporter.h
r0r249095
1#ifndef UNITTEST_XMLTESTREPORTER_H
2#define UNITTEST_XMLTESTREPORTER_H
3
4#include "Config.h"
5#ifndef UNITTEST_NO_DEFERRED_REPORTER
6
7#include "DeferredTestReporter.h"
8
9#include <iosfwd>
10
11namespace UnitTest
12{
13
14class UNITTEST_LINKAGE XmlTestReporter : public DeferredTestReporter
15{
16public:
17    explicit XmlTestReporter(std::ostream& ostream);
18
19    virtual void ReportSummary(int totalTestCount, int failedTestCount, int failureCount, float secondsElapsed);
20
21private:
22    XmlTestReporter(XmlTestReporter const&);
23    XmlTestReporter& operator=(XmlTestReporter const&);
24
25    void AddXmlElement(std::ostream& os, char const* encoding);
26    void BeginResults(std::ostream& os, int totalTestCount, int failedTestCount, int failureCount, float secondsElapsed);
27    void EndResults(std::ostream& os);
28    void BeginTest(std::ostream& os, DeferredTestResult const& result);
29    void AddFailure(std::ostream& os, DeferredTestResult const& result);
30    void EndTest(std::ostream& os, DeferredTestResult const& result);
31
32    std::ostream& m_ostream;
33};
34
35}
36
37#endif
38#endif
trunk/3rdparty/unittest-cpp/UnitTest++/unittestpp_vs2005.vcproj
r0r249095
1<?xml version="1.0" encoding="Windows-1252"?>
2<VisualStudioProject
3   ProjectType="Visual C++"
4   Version="8.00"
5   Name="unittestpp_vs2005"
6   ProjectGUID="{64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}"
7   RootNamespace="unittestpp"
8   Keyword="Win32Proj"
9   >
10   <Platforms>
11      <Platform
12         Name="Win32"
13      />
14   </Platforms>
15   <ToolFiles>
16   </ToolFiles>
17   <Configurations>
18      <Configuration
19         Name="win32_static_vc80_md_debug|Win32"
20         OutputDirectory="$(SolutionDir)lib\$(ConfigurationName)"
21         IntermediateDirectory="$(SolutionDir)obj\$(ProjectName)\$(ConfigurationName)"
22         ConfigurationType="4"
23         CharacterSet="1"
24         >
25         <Tool
26            Name="VCPreBuildEventTool"
27         />
28         <Tool
29            Name="VCCustomBuildTool"
30         />
31         <Tool
32            Name="VCXMLDataGeneratorTool"
33         />
34         <Tool
35            Name="VCWebServiceProxyGeneratorTool"
36         />
37         <Tool
38            Name="VCMIDLTool"
39         />
40         <Tool
41            Name="VCCLCompilerTool"
42            Optimization="0"
43            PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE"
44            MinimalRebuild="true"
45            ExceptionHandling="2"
46            BasicRuntimeChecks="3"
47            RuntimeLibrary="3"
48            UsePrecompiledHeader="0"
49            WarningLevel="4"
50            Detect64BitPortabilityProblems="true"
51            DebugInformationFormat="3"
52         />
53         <Tool
54            Name="VCManagedResourceCompilerTool"
55         />
56         <Tool
57            Name="VCResourceCompilerTool"
58         />
59         <Tool
60            Name="VCPreLinkEventTool"
61         />
62         <Tool
63            Name="VCLibrarianTool"
64            OutputFile="$(OutDir)\unittestpp.lib"
65         />
66         <Tool
67            Name="VCALinkTool"
68         />
69         <Tool
70            Name="VCXDCMakeTool"
71         />
72         <Tool
73            Name="VCBscMakeTool"
74         />
75         <Tool
76            Name="VCFxCopTool"
77         />
78         <Tool
79            Name="VCPostBuildEventTool"
80         />
81      </Configuration>
82      <Configuration
83         Name="win32_static_vc80_md_release|Win32"
84         OutputDirectory="$(SolutionDir)lib\$(ConfigurationName)"
85         IntermediateDirectory="$(SolutionDir)obj\$(ProjectName)\$(ConfigurationName)"
86         ConfigurationType="4"
87         CharacterSet="1"
88         WholeProgramOptimization="0"
89         >
90         <Tool
91            Name="VCPreBuildEventTool"
92         />
93         <Tool
94            Name="VCCustomBuildTool"
95         />
96         <Tool
97            Name="VCXMLDataGeneratorTool"
98         />
99         <Tool
100            Name="VCWebServiceProxyGeneratorTool"
101         />
102         <Tool
103            Name="VCMIDLTool"
104         />
105         <Tool
106            Name="VCCLCompilerTool"
107            Optimization="3"
108            PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE"
109            ExceptionHandling="2"
110            RuntimeLibrary="2"
111            UsePrecompiledHeader="0"
112            WarningLevel="4"
113            Detect64BitPortabilityProblems="true"
114            DebugInformationFormat="3"
115         />
116         <Tool
117            Name="VCManagedResourceCompilerTool"
118         />
119         <Tool
120            Name="VCResourceCompilerTool"
121         />
122         <Tool
123            Name="VCPreLinkEventTool"
124         />
125         <Tool
126            Name="VCLibrarianTool"
127            OutputFile="$(OutDir)\unittestpp.lib"
128         />
129         <Tool
130            Name="VCALinkTool"
131         />
132         <Tool
133            Name="VCXDCMakeTool"
134         />
135         <Tool
136            Name="VCBscMakeTool"
137         />
138         <Tool
139            Name="VCFxCopTool"
140         />
141         <Tool
142            Name="VCPostBuildEventTool"
143         />
144      </Configuration>
145      <Configuration
146         Name="win32_dll_vc80_debug|Win32"
147         OutputDirectory="$(SolutionDir)bin\$(ConfigurationName)"
148         IntermediateDirectory="$(SolutionDir)obj\$(ProjectName)\$(ConfigurationName)"
149         ConfigurationType="2"
150         CharacterSet="1"
151         >
152         <Tool
153            Name="VCPreBuildEventTool"
154         />
155         <Tool
156            Name="VCCustomBuildTool"
157         />
158         <Tool
159            Name="VCXMLDataGeneratorTool"
160         />
161         <Tool
162            Name="VCWebServiceProxyGeneratorTool"
163         />
164         <Tool
165            Name="VCMIDLTool"
166         />
167         <Tool
168            Name="VCCLCompilerTool"
169            Optimization="0"
170            PreprocessorDefinitions="WIN32;_DEBUG;_USRDLL;_CRT_SECURE_NO_DEPRECATE;UNITTEST_DLL_EXPORT"
171            MinimalRebuild="true"
172            ExceptionHandling="2"
173            BasicRuntimeChecks="3"
174            RuntimeLibrary="3"
175            UsePrecompiledHeader="0"
176            WarningLevel="4"
177            Detect64BitPortabilityProblems="true"
178            DebugInformationFormat="3"
179         />
180         <Tool
181            Name="VCManagedResourceCompilerTool"
182         />
183         <Tool
184            Name="VCResourceCompilerTool"
185         />
186         <Tool
187            Name="VCPreLinkEventTool"
188         />
189         <Tool
190            Name="VCLinkerTool"
191            OutputFile="$(OutDir)\unittestpp.dll"
192            GenerateDebugInformation="true"
193         />
194         <Tool
195            Name="VCALinkTool"
196         />
197         <Tool
198            Name="VCManifestTool"
199         />
200         <Tool
201            Name="VCXDCMakeTool"
202         />
203         <Tool
204            Name="VCBscMakeTool"
205         />
206         <Tool
207            Name="VCFxCopTool"
208         />
209         <Tool
210            Name="VCAppVerifierTool"
211         />
212         <Tool
213            Name="VCWebDeploymentTool"
214         />
215         <Tool
216            Name="VCPostBuildEventTool"
217         />
218      </Configuration>
219      <Configuration
220         Name="win32_dll_vc80_release|Win32"
221         OutputDirectory="$(SolutionDir)bin\$(ConfigurationName)"
222         IntermediateDirectory="$(SolutionDir)obj\$(ProjectName)\$(ConfigurationName)"
223         ConfigurationType="2"
224         CharacterSet="1"
225         WholeProgramOptimization="0"
226         >
227         <Tool
228            Name="VCPreBuildEventTool"
229         />
230         <Tool
231            Name="VCCustomBuildTool"
232         />
233         <Tool
234            Name="VCXMLDataGeneratorTool"
235         />
236         <Tool
237            Name="VCWebServiceProxyGeneratorTool"
238         />
239         <Tool
240            Name="VCMIDLTool"
241         />
242         <Tool
243            Name="VCCLCompilerTool"
244            Optimization="3"
245            PreprocessorDefinitions="WIN32;NDEBUG;_USRDLL;_CRT_SECURE_NO_DEPRECATE;UNITTEST_DLL_EXPORT"
246            ExceptionHandling="2"
247            RuntimeLibrary="2"
248            UsePrecompiledHeader="0"
249            WarningLevel="4"
250            Detect64BitPortabilityProblems="true"
251            DebugInformationFormat="3"
252         />
253         <Tool
254            Name="VCManagedResourceCompilerTool"
255         />
256         <Tool
257            Name="VCResourceCompilerTool"
258         />
259         <Tool
260            Name="VCPreLinkEventTool"
261         />
262         <Tool
263            Name="VCLinkerTool"
264            OutputFile="$(OutDir)\unittestpp.dll"
265            GenerateDebugInformation="true"
266         />
267         <Tool
268            Name="VCALinkTool"
269         />
270         <Tool
271            Name="VCManifestTool"
272         />
273         <Tool
274            Name="VCXDCMakeTool"
275         />
276         <Tool
277            Name="VCBscMakeTool"
278         />
279         <Tool
280            Name="VCFxCopTool"
281         />
282         <Tool
283            Name="VCAppVerifierTool"
284         />
285         <Tool
286            Name="VCWebDeploymentTool"
287         />
288         <Tool
289            Name="VCPostBuildEventTool"
290         />
291      </Configuration>
292      <Configuration
293         Name="win32_static_vc80_mt_debug|Win32"
294         OutputDirectory="$(SolutionDir)lib\$(ConfigurationName)"
295         IntermediateDirectory="$(SolutionDir)obj\$(ProjectName)\$(ConfigurationName)"
296         ConfigurationType="4"
297         CharacterSet="1"
298         >
299         <Tool
300            Name="VCPreBuildEventTool"
301         />
302         <Tool
303            Name="VCCustomBuildTool"
304         />
305         <Tool
306            Name="VCXMLDataGeneratorTool"
307         />
308         <Tool
309            Name="VCWebServiceProxyGeneratorTool"
310         />
311         <Tool
312            Name="VCMIDLTool"
313         />
314         <Tool
315            Name="VCCLCompilerTool"
316            Optimization="0"
317            PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE"
318            MinimalRebuild="true"
319            ExceptionHandling="2"
320            BasicRuntimeChecks="3"
321            RuntimeLibrary="1"
322            UsePrecompiledHeader="0"
323            WarningLevel="4"
324            Detect64BitPortabilityProblems="true"
325            DebugInformationFormat="3"
326         />
327         <Tool
328            Name="VCManagedResourceCompilerTool"
329         />
330         <Tool
331            Name="VCResourceCompilerTool"
332         />
333         <Tool
334            Name="VCPreLinkEventTool"
335         />
336         <Tool
337            Name="VCLibrarianTool"
338            OutputFile="$(OutDir)\unittestpp.lib"
339         />
340         <Tool
341            Name="VCALinkTool"
342         />
343         <Tool
344            Name="VCXDCMakeTool"
345         />
346         <Tool
347            Name="VCBscMakeTool"
348         />
349         <Tool
350            Name="VCFxCopTool"
351         />
352         <Tool
353            Name="VCPostBuildEventTool"
354         />
355      </Configuration>
356      <Configuration
357         Name="win32_static_vc80_mt_release|Win32"
358         OutputDirectory="$(SolutionDir)lib\$(ConfigurationName)"
359         IntermediateDirectory="$(SolutionDir)obj\$(ProjectName)\$(ConfigurationName)"
360         ConfigurationType="4"
361         CharacterSet="1"
362         WholeProgramOptimization="0"
363         >
364         <Tool
365            Name="VCPreBuildEventTool"
366         />
367         <Tool
368            Name="VCCustomBuildTool"
369         />
370         <Tool
371            Name="VCXMLDataGeneratorTool"
372         />
373         <Tool
374            Name="VCWebServiceProxyGeneratorTool"
375         />
376         <Tool
377            Name="VCMIDLTool"
378         />
379         <Tool
380            Name="VCCLCompilerTool"
381            Optimization="3"
382            PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE"
383            ExceptionHandling="2"
384            RuntimeLibrary="0"
385            UsePrecompiledHeader="0"
386            WarningLevel="4"
387            Detect64BitPortabilityProblems="true"
388            DebugInformationFormat="3"
389         />
390         <Tool
391            Name="VCManagedResourceCompilerTool"
392         />
393         <Tool
394            Name="VCResourceCompilerTool"
395         />
396         <Tool
397            Name="VCPreLinkEventTool"
398         />
399         <Tool
400            Name="VCLibrarianTool"
401            OutputFile="$(OutDir)\unittestpp.lib"
402         />
403         <Tool
404            Name="VCALinkTool"
405         />
406         <Tool
407            Name="VCXDCMakeTool"
408         />
409         <Tool
410            Name="VCBscMakeTool"
411         />
412         <Tool
413            Name="VCFxCopTool"
414         />
415         <Tool
416            Name="VCPostBuildEventTool"
417         />
418      </Configuration>
419   </Configurations>
420   <References>
421   </References>
422   <Files>
423      <Filter
424         Name="Win32"
425         >
426         <File
427            RelativePath=".\Win32\TimeHelpers.cpp"
428            >
429         </File>
430         <File
431            RelativePath=".\Win32\TimeHelpers.h"
432            >
433         </File>
434      </Filter>
435      <File
436         RelativePath=".\AssertException.cpp"
437         >
438      </File>
439      <File
440         RelativePath=".\AssertException.h"
441         >
442      </File>
443      <File
444         RelativePath=".\CheckMacros.h"
445         >
446      </File>
447      <File
448         RelativePath=".\Checks.cpp"
449         >
450      </File>
451      <File
452         RelativePath=".\Checks.h"
453         >
454      </File>
455      <File
456         RelativePath=".\CompositeTestReporter.cpp"
457         >
458      </File>
459      <File
460         RelativePath=".\CompositeTestReporter.h"
461         >
462      </File>
463      <File
464         RelativePath="..\config.h"
465         >
466      </File>
467      <File
468         RelativePath=".\CurrentTest.cpp"
469         >
470      </File>
471      <File
472         RelativePath=".\CurrentTest.h"
473         >
474      </File>
475      <File
476         RelativePath=".\DeferredTestReporter.cpp"
477         >
478      </File>
479      <File
480         RelativePath=".\DeferredTestReporter.h"
481         >
482      </File>
483      <File
484         RelativePath=".\DeferredTestResult.cpp"
485         >
486      </File>
487      <File
488         RelativePath=".\DeferredTestResult.h"
489         >
490      </File>
491      <File
492         RelativePath=".\ExceptionMacros.h"
493         >
494      </File>
495      <File
496         RelativePath=".\ExecuteTest.h"
497         >
498      </File>
499      <File
500         RelativePath=".\HelperMacros.h"
501         >
502      </File>
503      <File
504         RelativePath=".\MemoryOutStream.cpp"
505         >
506      </File>
507      <File
508         RelativePath=".\MemoryOutStream.h"
509         >
510      </File>
511      <File
512         RelativePath=".\ReportAssert.cpp"
513         >
514      </File>
515      <File
516         RelativePath=".\ReportAssert.h"
517         >
518      </File>
519      <File
520         RelativePath=".\ReportAssertImpl.h"
521         >
522      </File>
523      <File
524         RelativePath=".\Test.cpp"
525         >
526      </File>
527      <File
528         RelativePath=".\Test.h"
529         >
530      </File>
531      <File
532         RelativePath=".\TestDetails.cpp"
533         >
534      </File>
535      <File
536         RelativePath=".\TestDetails.h"
537         >
538      </File>
539      <File
540         RelativePath=".\TestList.cpp"
541         >
542      </File>
543      <File
544         RelativePath=".\TestList.h"
545         >
546      </File>
547      <File
548         RelativePath=".\TestMacros.h"
549         >
550      </File>
551      <File
552         RelativePath=".\TestReporter.cpp"
553         >
554      </File>
555      <File
556         RelativePath=".\TestReporter.h"
557         >
558      </File>
559      <File
560         RelativePath=".\TestReporterStdout.cpp"
561         >
562      </File>
563      <File
564         RelativePath=".\TestReporterStdout.h"
565         >
566      </File>
567      <File
568         RelativePath=".\TestResults.cpp"
569         >
570      </File>
571      <File
572         RelativePath=".\TestResults.h"
573         >
574      </File>
575      <File
576         RelativePath=".\TestRunner.cpp"
577         >
578      </File>
579      <File
580         RelativePath=".\TestRunner.h"
581         >
582      </File>
583      <File
584         RelativePath=".\TestSuite.h"
585         >
586      </File>
587      <File
588         RelativePath=".\TimeConstraint.cpp"
589         >
590      </File>
591      <File
592         RelativePath=".\TimeConstraint.h"
593         >
594      </File>
595      <File
596         RelativePath=".\TimeHelpers.h"
597         >
598      </File>
599      <File
600         RelativePath="..\unittestpp.h"
601         >
602      </File>
603      <File
604         RelativePath=".\XmlTestReporter.cpp"
605         >
606      </File>
607      <File
608         RelativePath=".\XmlTestReporter.h"
609         >
610      </File>
611   </Files>
612   <Globals>
613   </Globals>
614</VisualStudioProject>
trunk/3rdparty/unittest-cpp/UnitTest++/unittestpp_vs2008.vcproj
r0r249095
1<?xml version="1.0" encoding="Windows-1252"?>
2<VisualStudioProject
3   ProjectType="Visual C++"
4   Version="9.00"
5   Name="unittestpp_vs2008"
6   ProjectGUID="{64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}"
7   RootNamespace="unittestpp"
8   Keyword="Win32Proj"
9   TargetFrameworkVersion="131072"
10   >
11   <Platforms>
12      <Platform
13         Name="Win32"
14      />
15   </Platforms>
16   <ToolFiles>
17   </ToolFiles>
18   <Configurations>
19      <Configuration
20         Name="win32_static_vc90_md_debug|Win32"
21         OutputDirectory="$(SolutionDir)lib\$(ConfigurationName)"
22         IntermediateDirectory="$(SolutionDir)obj\$(ProjectName)\$(ConfigurationName)"
23         ConfigurationType="4"
24         CharacterSet="1"
25         >
26         <Tool
27            Name="VCPreBuildEventTool"
28         />
29         <Tool
30            Name="VCCustomBuildTool"
31         />
32         <Tool
33            Name="VCXMLDataGeneratorTool"
34         />
35         <Tool
36            Name="VCWebServiceProxyGeneratorTool"
37         />
38         <Tool
39            Name="VCMIDLTool"
40         />
41         <Tool
42            Name="VCCLCompilerTool"
43            Optimization="0"
44            PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE"
45            MinimalRebuild="true"
46            ExceptionHandling="2"
47            BasicRuntimeChecks="3"
48            RuntimeLibrary="3"
49            UsePrecompiledHeader="0"
50            WarningLevel="4"
51            DebugInformationFormat="3"
52         />
53         <Tool
54            Name="VCManagedResourceCompilerTool"
55         />
56         <Tool
57            Name="VCResourceCompilerTool"
58         />
59         <Tool
60            Name="VCPreLinkEventTool"
61         />
62         <Tool
63            Name="VCLibrarianTool"
64            OutputFile="$(OutDir)\unittestpp.lib"
65         />
66         <Tool
67            Name="VCALinkTool"
68         />
69         <Tool
70            Name="VCXDCMakeTool"
71         />
72         <Tool
73            Name="VCBscMakeTool"
74         />
75         <Tool
76            Name="VCFxCopTool"
77         />
78         <Tool
79            Name="VCPostBuildEventTool"
80         />
81      </Configuration>
82      <Configuration
83         Name="win32_static_vc90_md_release|Win32"
84         OutputDirectory="$(SolutionDir)lib\$(ConfigurationName)"
85         IntermediateDirectory="$(SolutionDir)obj\$(ProjectName)\$(ConfigurationName)"
86         ConfigurationType="4"
87         CharacterSet="1"
88         WholeProgramOptimization="0"
89         >
90         <Tool
91            Name="VCPreBuildEventTool"
92         />
93         <Tool
94            Name="VCCustomBuildTool"
95         />
96         <Tool
97            Name="VCXMLDataGeneratorTool"
98         />
99         <Tool
100            Name="VCWebServiceProxyGeneratorTool"
101         />
102         <Tool
103            Name="VCMIDLTool"
104         />
105         <Tool
106            Name="VCCLCompilerTool"
107            Optimization="3"
108            PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE"
109            ExceptionHandling="2"
110            RuntimeLibrary="2"
111            UsePrecompiledHeader="0"
112            WarningLevel="4"
113            DebugInformationFormat="3"
114         />
115         <Tool
116            Name="VCManagedResourceCompilerTool"
117         />
118         <Tool
119            Name="VCResourceCompilerTool"
120         />
121         <Tool
122            Name="VCPreLinkEventTool"
123         />
124         <Tool
125            Name="VCLibrarianTool"
126            OutputFile="$(OutDir)\unittestpp.lib"
127         />
128         <Tool
129            Name="VCALinkTool"
130         />
131         <Tool
132            Name="VCXDCMakeTool"
133         />
134         <Tool
135            Name="VCBscMakeTool"
136         />
137         <Tool
138            Name="VCFxCopTool"
139         />
140         <Tool
141            Name="VCPostBuildEventTool"
142         />
143      </Configuration>
144      <Configuration
145         Name="win32_dll_vc90_debug|Win32"
146         OutputDirectory="$(SolutionDir)bin\$(ConfigurationName)"
147         IntermediateDirectory="$(SolutionDir)obj\$(ProjectName)\$(ConfigurationName)"
148         ConfigurationType="2"
149         CharacterSet="1"
150         >
151         <Tool
152            Name="VCPreBuildEventTool"
153         />
154         <Tool
155            Name="VCCustomBuildTool"
156         />
157         <Tool
158            Name="VCXMLDataGeneratorTool"
159         />
160         <Tool
161            Name="VCWebServiceProxyGeneratorTool"
162         />
163         <Tool
164            Name="VCMIDLTool"
165         />
166         <Tool
167            Name="VCCLCompilerTool"
168            Optimization="0"
169            PreprocessorDefinitions="WIN32;_DEBUG;_USRDLL;_CRT_SECURE_NO_DEPRECATE;UNITTEST_DLL_EXPORT"
170            MinimalRebuild="true"
171            ExceptionHandling="2"
172            BasicRuntimeChecks="3"
173            RuntimeLibrary="3"
174            UsePrecompiledHeader="0"
175            WarningLevel="4"
176            DebugInformationFormat="3"
177         />
178         <Tool
179            Name="VCManagedResourceCompilerTool"
180         />
181         <Tool
182            Name="VCResourceCompilerTool"
183         />
184         <Tool
185            Name="VCPreLinkEventTool"
186         />
187         <Tool
188            Name="VCLinkerTool"
189            OutputFile="$(OutDir)\unittestpp.dll"
190            GenerateDebugInformation="true"
191            RandomizedBaseAddress="1"
192            DataExecutionPrevention="0"
193         />
194         <Tool
195            Name="VCALinkTool"
196         />
197         <Tool
198            Name="VCManifestTool"
199         />
200         <Tool
201            Name="VCXDCMakeTool"
202         />
203         <Tool
204            Name="VCBscMakeTool"
205         />
206         <Tool
207            Name="VCFxCopTool"
208         />
209         <Tool
210            Name="VCAppVerifierTool"
211         />
212         <Tool
213            Name="VCPostBuildEventTool"
214         />
215      </Configuration>
216      <Configuration
217         Name="win32_dll_vc90_release|Win32"
218         OutputDirectory="$(SolutionDir)bin\$(ConfigurationName)"
219         IntermediateDirectory="$(SolutionDir)obj\$(ProjectName)\$(ConfigurationName)"
220         ConfigurationType="2"
221         CharacterSet="1"
222         WholeProgramOptimization="0"
223         >
224         <Tool
225            Name="VCPreBuildEventTool"
226         />
227         <Tool
228            Name="VCCustomBuildTool"
229         />
230         <Tool
231            Name="VCXMLDataGeneratorTool"
232         />
233         <Tool
234            Name="VCWebServiceProxyGeneratorTool"
235         />
236         <Tool
237            Name="VCMIDLTool"
238         />
239         <Tool
240            Name="VCCLCompilerTool"
241            Optimization="3"
242            PreprocessorDefinitions="WIN32;NDEBUG;_USRDLL;_CRT_SECURE_NO_DEPRECATE;UNITTEST_DLL_EXPORT"
243            ExceptionHandling="2"
244            RuntimeLibrary="2"
245            UsePrecompiledHeader="0"
246            WarningLevel="4"
247            DebugInformationFormat="3"
248         />
249         <Tool
250            Name="VCManagedResourceCompilerTool"
251         />
252         <Tool
253            Name="VCResourceCompilerTool"
254         />
255         <Tool
256            Name="VCPreLinkEventTool"
257         />
258         <Tool
259            Name="VCLinkerTool"
260            OutputFile="$(OutDir)\unittestpp.dll"
261            GenerateDebugInformation="true"
262            RandomizedBaseAddress="1"
263            DataExecutionPrevention="0"
264         />
265         <Tool
266            Name="VCALinkTool"
267         />
268         <Tool
269            Name="VCManifestTool"
270         />
271         <Tool
272            Name="VCXDCMakeTool"
273         />
274         <Tool
275            Name="VCBscMakeTool"
276         />
277         <Tool
278            Name="VCFxCopTool"
279         />
280         <Tool
281            Name="VCAppVerifierTool"
282         />
283         <Tool
284            Name="VCPostBuildEventTool"
285         />
286      </Configuration>
287      <Configuration
288         Name="win32_static_vc90_mt_debug|Win32"
289         OutputDirectory="$(SolutionDir)lib\$(ConfigurationName)"
290         IntermediateDirectory="$(SolutionDir)obj\$(ProjectName)\$(ConfigurationName)"
291         ConfigurationType="4"
292         CharacterSet="1"
293         >
294         <Tool
295            Name="VCPreBuildEventTool"
296         />
297         <Tool
298            Name="VCCustomBuildTool"
299         />
300         <Tool
301            Name="VCXMLDataGeneratorTool"
302         />
303         <Tool
304            Name="VCWebServiceProxyGeneratorTool"
305         />
306         <Tool
307            Name="VCMIDLTool"
308         />
309         <Tool
310            Name="VCCLCompilerTool"
311            Optimization="0"
312            PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE"
313            MinimalRebuild="true"
314            ExceptionHandling="2"
315            BasicRuntimeChecks="3"
316            RuntimeLibrary="1"
317            UsePrecompiledHeader="0"
318            WarningLevel="4"
319            DebugInformationFormat="3"
320         />
321         <Tool
322            Name="VCManagedResourceCompilerTool"
323         />
324         <Tool
325            Name="VCResourceCompilerTool"
326         />
327         <Tool
328            Name="VCPreLinkEventTool"
329         />
330         <Tool
331            Name="VCLibrarianTool"
332            OutputFile="$(OutDir)\unittestpp.lib"
333         />
334         <Tool
335            Name="VCALinkTool"
336         />
337         <Tool
338            Name="VCXDCMakeTool"
339         />
340         <Tool
341            Name="VCBscMakeTool"
342         />
343         <Tool
344            Name="VCFxCopTool"
345         />
346         <Tool
347            Name="VCPostBuildEventTool"
348         />
349      </Configuration>
350      <Configuration
351         Name="win32_static_vc90_mt_release|Win32"
352         OutputDirectory="$(SolutionDir)lib\$(ConfigurationName)"
353         IntermediateDirectory="$(SolutionDir)obj\$(ProjectName)\$(ConfigurationName)"
354         ConfigurationType="4"
355         CharacterSet="1"
356         WholeProgramOptimization="0"
357         >
358         <Tool
359            Name="VCPreBuildEventTool"
360         />
361         <Tool
362            Name="VCCustomBuildTool"
363         />
364         <Tool
365            Name="VCXMLDataGeneratorTool"
366         />
367         <Tool
368            Name="VCWebServiceProxyGeneratorTool"
369         />
370         <Tool
371            Name="VCMIDLTool"
372         />
373         <Tool
374            Name="VCCLCompilerTool"
375            Optimization="3"
376            PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE"
377            ExceptionHandling="2"
378            RuntimeLibrary="0"
379            UsePrecompiledHeader="0"
380            WarningLevel="4"
381            DebugInformationFormat="3"
382         />
383         <Tool
384            Name="VCManagedResourceCompilerTool"
385         />
386         <Tool
387            Name="VCResourceCompilerTool"
388         />
389         <Tool
390            Name="VCPreLinkEventTool"
391         />
392         <Tool
393            Name="VCLibrarianTool"
394            OutputFile="$(OutDir)\unittestpp.lib"
395         />
396         <Tool
397            Name="VCALinkTool"
398         />
399         <Tool
400            Name="VCXDCMakeTool"
401         />
402         <Tool
403            Name="VCBscMakeTool"
404         />
405         <Tool
406            Name="VCFxCopTool"
407         />
408         <Tool
409            Name="VCPostBuildEventTool"
410         />
411      </Configuration>
412   </Configurations>
413   <References>
414   </References>
415   <Files>
416      <Filter
417         Name="Win32"
418         >
419         <File
420            RelativePath=".\Win32\TimeHelpers.cpp"
421            >
422         </File>
423         <File
424            RelativePath=".\Win32\TimeHelpers.h"
425            >
426         </File>
427      </Filter>
428      <File
429         RelativePath=".\AssertException.cpp"
430         >
431      </File>
432      <File
433         RelativePath=".\AssertException.h"
434         >
435      </File>
436      <File
437         RelativePath=".\CheckMacros.h"
438         >
439      </File>
440      <File
441         RelativePath=".\Checks.cpp"
442         >
443      </File>
444      <File
445         RelativePath=".\Checks.h"
446         >
447      </File>
448      <File
449         RelativePath=".\CompositeTestReporter.cpp"
450         >
451      </File>
452      <File
453         RelativePath=".\CompositeTestReporter.h"
454         >
455      </File>
456      <File
457         RelativePath="..\config.h"
458         >
459      </File>
460      <File
461         RelativePath=".\CurrentTest.cpp"
462         >
463      </File>
464      <File
465         RelativePath=".\CurrentTest.h"
466         >
467      </File>
468      <File
469         RelativePath=".\DeferredTestReporter.cpp"
470         >
471      </File>
472      <File
473         RelativePath=".\DeferredTestReporter.h"
474         >
475      </File>
476      <File
477         RelativePath=".\DeferredTestResult.cpp"
478         >
479      </File>
480      <File
481         RelativePath=".\DeferredTestResult.h"
482         >
483      </File>
484      <File
485         RelativePath=".\ExceptionMacros.h"
486         >
487      </File>
488      <File
489         RelativePath=".\ExecuteTest.h"
490         >
491      </File>
492      <File
493         RelativePath=".\HelperMacros.h"
494         >
495      </File>
496      <File
497         RelativePath=".\MemoryOutStream.cpp"
498         >
499      </File>
500      <File
501         RelativePath=".\MemoryOutStream.h"
502         >
503      </File>
504      <File
505         RelativePath=".\ReportAssert.cpp"
506         >
507      </File>
508      <File
509         RelativePath=".\ReportAssert.h"
510         >
511      </File>
512      <File
513         RelativePath=".\ReportAssertImpl.h"
514         >
515      </File>
516      <File
517         RelativePath=".\Test.cpp"
518         >
519      </File>
520      <File
521         RelativePath=".\Test.h"
522         >
523      </File>
524      <File
525         RelativePath=".\TestDetails.cpp"
526         >
527      </File>
528      <File
529         RelativePath=".\TestDetails.h"
530         >
531      </File>
532      <File
533         RelativePath=".\TestList.cpp"
534         >
535      </File>
536      <File
537         RelativePath=".\TestList.h"
538         >
539      </File>
540      <File
541         RelativePath=".\TestMacros.h"
542         >
543      </File>
544      <File
545         RelativePath=".\TestReporter.cpp"
546         >
547      </File>
548      <File
549         RelativePath=".\TestReporter.h"
550         >
551      </File>
552      <File
553         RelativePath=".\TestReporterStdout.cpp"
554         >
555      </File>
556      <File
557         RelativePath=".\TestReporterStdout.h"
558         >
559      </File>
560      <File
561         RelativePath=".\TestResults.cpp"
562         >
563      </File>
564      <File
565         RelativePath=".\TestResults.h"
566         >
567      </File>
568      <File
569         RelativePath=".\TestRunner.cpp"
570         >
571      </File>
572      <File
573         RelativePath=".\TestRunner.h"
574         >
575      </File>
576      <File
577         RelativePath=".\TestSuite.h"
578         >
579      </File>
580      <File
581         RelativePath=".\TimeConstraint.cpp"
582         >
583      </File>
584      <File
585         RelativePath=".\TimeConstraint.h"
586         >
587      </File>
588      <File
589         RelativePath=".\TimeHelpers.h"
590         >
591      </File>
592      <File
593         RelativePath="..\unittestpp.h"
594         >
595      </File>
596      <File
597         RelativePath=".\XmlTestReporter.cpp"
598         >
599      </File>
600      <File
601         RelativePath=".\XmlTestReporter.h"
602         >
603      </File>
604   </Files>
605   <Globals>
606   </Globals>
607</VisualStudioProject>
trunk/3rdparty/unittest-cpp/builds/.gitignore
r0r249095
1# Ignore everything in this directory
2*
3# Except this file
4!.gitignore
trunk/3rdparty/unittest-cpp/configure.ac
r0r249095
1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ([2.69])
5AC_INIT([UnitTest++], [1.4.1], [pjohnmeyer@gmail.com])
6AC_CONFIG_SRCDIR([UnitTest++/TestDetails.cpp])
7AC_CONFIG_MACRO_DIR([m4])
8AC_CONFIG_HEADERS([config.h])
9
10AM_INIT_AUTOMAKE([foreign])
11LT_INIT()
12
13AC_SUBST([LIBUNITTEST_SO_VERSION], [1:4:1])
14
15# Checks for programs.
16AC_PROG_CXX
17AC_PROG_CC
18
19# Checks for libraries.
20
21# Checks for header files.
22AC_CHECK_HEADERS([sys/time.h unistd.h setjmp.h signal.h cassert cstddef cstdio cstring exception iosfwd iostream sstream string vector])
23
24# Checks for typedefs, structures, and compiler characteristics.
25AC_CHECK_HEADER_STDBOOL
26AC_C_INLINE
27AC_TYPE_SIZE_T
28
29# Checks for library functions.
30AC_CHECK_FUNCS([gettimeofday strstr])
31
32AC_CONFIG_FILES([Makefile
33       UnitTest++/Makefile])
34AC_OUTPUT
trunk/3rdparty/unittest-cpp/docs/Building-Using-CMake.md
r0r249095
1While there are some bundled makefiles and projects, UnitTest++ is primarily built and supported using [CMake](http://cmake.org). This guide assumes you have already downloaded and installed CMake, and that you have already downloaded the UnitTest++ source.
2
3
4In Two Easy Steps
5-------------------
6
7Once you've obtained the UnitTest++ source, you can use the empty 'builds' folder as a place to put your cmake-generated project files. The valid "generators" differ per platform; you can run `cmake --help` to see which ones are supported on your platform.
8
9    cd path/to/unittest-cpp/builds
10    cmake -G "<Choose a valid generator>" ../
11    cmake --build ./
12
13This will build the library and the self-tests, and also run the self-tests.
14
15Then, if you already understand what CMake does (or are just reckless), and you'd like to run the install step:
16
17    cmake --build ./ --target install
18
19This will install the headers and built libs to the `CMAKE_INSTALL_PREFIX`. Note this might require a `sudo` in *nix or an Administrative Command Prompt on Windows depending on your system configuration.
trunk/3rdparty/unittest-cpp/docs/Home.md
r0r249095
1UnitTest++ is a lightweight unit testing framework for C++.
2
3It was designed to do test-driven development on a wide variety of platforms. The primary drivers are four-fold:
4
5* Simplicity
6* Portability
7* Speed (both compilation and runtime)
8* Small footprint
9
10Documentation
11-------------
12
13[[Building Using CMake]]
14
15[[Writing and Running Your First Test]]
16
17[[Writing More Tests With the Bowling Game Kata]]
18
19[[Macro Reference]]
20
trunk/3rdparty/unittest-cpp/docs/Macro-Reference.md
r0r249095
1Suites
2--------
3`SUITE(Name)`: Organizes your tests into suites (groups). Tests can be added to suites across multiple test source files. e.g.:
4
5```cpp
6SUITE(MySuite)
7{
8   // tests go here
9}
10```
11
12Tests
13-------
14`TEST(Name)`: Creates a single test case. All checks in a test will be run using the standard runners, unless an exception is thrown or an early return is introduced.
15
16```cpp
17TEST(MyTest)
18{
19   // checks go here
20}
21```
22
23`TEST_FIXTURE(FixtureClass, TestName)`: Creates a single test case using a fixture. The FixtureClass is default instantiated before the test is run, then the test runs with access to anything `public` or `protected` in the fixture. Useful for sharing setup / teardown code.
24
25```cpp
26class MyFixture
27{
28public:
29   MyFixture() { // setup goes here }
30   ~MyFixture() { // teardown goes here }
31};
32
33TEST_FIXTURE(MyFixture, MyFixtureTest)
34{
35   // checks go here
36}
37```
38
39Checks
40--------
41`CHECK(statement)`: Verifies the statement evaluates to true (not necessary boolean true / false).
42
43```cpp
44CHECK(true); // passes
45CHECK(1 == 2); // fails
46CHECK(0); // fails
47```
48
49`CHECK_EQUAL(expected, actual)`: Verifies that the actual value matches the expected. Note that conversions can occur. Requires `operator==` for the types of `expected` and `actual`, and requires the ability for both types to be streamed to `UnitTest::MemoryOutStream` using `operator<<`.
50
51```cpp
52CHECK_EQUAL(1, 1); // passes
53CHECK_EQUAL("123", std::string("123")); //passes
54CHECK_EQUAL((1.0 / 40.0), 0.025000000000000001); // passes... wait what? be careful with floating point types!
55```
56
57`CHECK_CLOSE(expected, actual, tolerance)`: Verifies that the actual value is within +/- tolerance of the expected value. This has the same requirements of the types involved as `CHECK_EQUAL`.
58
59```cpp
60CHECK_CLOSE(0.025000000000000002, (1.0 / 40.0), 0.000000000000000001); // passes
61CHECK_CLOSE(0.025, (1.0 / 40.0), 0.000000000000000001); // also passes
62CHECK_CLOSE(0.025000000000000020, (1.0 / 40.0), 0.000000000000000001); // fails
63```
64
65`CHECK_THROW(expression, ExpectedExceptionType)`: Verifies that the expression throws an exception that is polymorphically of the ExpectedExceptionType.
66
67`CHECK_ARRAY_EQUAL(expected, actual, count)`: Like `CHECK_EQUAL`, but for arrays and containers that support random access (`operator[]`). `count` is the number of items in the array.
68
69`CHECK_ARRAY_CLOSE(expected, actual, count, tolerance)`: Like `CHECK_CLOSE`, but for arrays and containers that support random access (`operator[]`). `count` is the number of items in the array.
70
71`CHECK_ARRAY2D_CLOSE(expected, actual, rows, columns, tolerance)`: Like `CHECK_ARRAY_CLOSE` but for two-dimensional arrays.
72
73
trunk/3rdparty/unittest-cpp/docs/Writing-More-Tests-With-the-Bowling-Game-Kata.md
r0r249095
1The Bowling Game Kata refers to a test-driven development practice exercise recommended by Robert C. Martin or, as he is often referred to, Uncle Bob. You can find his version of it here: <http://butunclebob.com/ArticleS.UncleBob.TheBowlingGameKata>
2
3We will progress through the exercise similarly to the Java version, using UnitTest++. To summarize, our goal is to create a class `Game` that has two methods:
4
5* `roll(pins : int)` which is called each time the ball is rolled; `pins` is the number of pins knocked down.
6* `score() : int` is called at the end of the game, returning the total score.
7
8For simplicity's sake, I will be putting the `Game` class and the test cases in a single file.
9
10The First Test
11----------------
12In our first test, we'll verify that a gutter game (20 gutter balls) scores a total of zero. First we create our Game class and our test suite:
13
14```cpp
15#include "UnitTest++/UnitTest++.h"
16
17class Game
18{
19};
20
21SUITE(BowlingGameTest)
22{
23    TEST(GutterGame)
24    {
25        Game g;
26    }
27}
28```
29
30The `SUITE` macro introduces a bundled set of tests. While not strictly required by UnitTest++, suites can be used to annotate and organize your tests, and to selectively run them. The `TEST` macro, as previous introduced, is the actual test case; right now it isn't asserting anything. Let's add the actual test.
31
32```cpp
33SUITE(BowlingGameTest)
34{
35    TEST(GutterGame)
36    {
37        Game g;
38       
39        for (int i = 0; i < 20; ++i)
40        {
41            g.roll(0);
42        }
43       
44        CHECK_EQUAL(0, g.score());
45    }
46}
47```
48
49This will fail to compile until we add the requisite methods to game, so let's do that:
50
51```cpp
52class Game
53{
54public:
55    void roll(int pins)
56    {
57    }
58   
59    int score() const
60    {
61        return -1;
62    }
63};
64```
65
66Now we build and run and we have a failure:
67
68    TheFirstTest.cpp:27:1: error: Failure in GutterGame: Expected 0 but was -1
69    FAILURE: 1 out of 1 tests failed (1 failures).
70
71Now, obviously we know more about our final implementation than this, but for now we can "fake it" to make the build succeed by changing score to return 0. We end up with the full code below:
72
73```cpp
74#include "UnitTest++/UnitTest++.h"
75
76class Game
77{
78public:
79    void roll(int pins)
80    {
81    }
82   
83    int score() const
84    {
85        return 0;
86    }
87};
88
89SUITE(BowlingGameTest)
90{
91    TEST(GutterGame)
92    {
93        Game g;
94       
95        for (int i = 0; i < 20; ++i)
96        {
97            g.roll(0);
98        }
99       
100        CHECK_EQUAL(0, g.score());
101    }
102}
103```
104
105The test passes and we're ready to move on to [[Writing More Tests With the Bowling Game Kata: Test Two]].
trunk/3rdparty/unittest-cpp/docs/Writing-and-Running-Your-First-Test.md
r0r249095
1Let's assume that, whatever compiler / IDE / build system you're using, you know how to include the headers and libraries built in [Building UnitTest++ using CMake](wiki/Building-UnitTest++-With-CMake). There are too many build systems to cover here, and is not the purpose of this guide.
2
3Examples
4
5Creating Your Test Executable Main
6------------------------------------
7
8The most basic main function you can write that will run your unit tests will look something like this:
9
10```cpp
11// main.cpp -- take 1
12#include "UnitTest++/UnitTest++.h"
13
14int main(int, const char *[])
15{
16   return UnitTest::RunAllTests();
17}
18```
19
20If this compiles and links, you can now run and you should get output resembling this:
21
22```
23Success: 0 tests passed.
24Test time: 0.00 seconds.
25```
26
27Adding a Sanity Test
28----------------------
29If you ran the self-tests bundled with UnitTest++, we should be pretty comfortable that everything is working okay at this point. However, the next thing I usually like to do is add a "sanity test".
30
31```cpp
32// main.cpp -- take 2
33#include "UnitTest++/UnitTest++.h"
34
35TEST(Sanity)
36{
37   CHECK_EQUAL(1, 1);
38}
39
40int main(int, const char *[])
41{
42   return UnitTest::RunAllTests();
43}
44```
45
46The `TEST` token is a C-style macro that introduces a test case named 'Sanity'. The `CHECK_EQUAL` token is, similarly, a macro. In this case it is asserting that, for the test to pass, 1 must be equal to 1. Running this test program should output:
47
48```
49Success: 1 tests passed.
50Test time: 0.00 seconds.
51```
52
53If you want to doubly check the sanity of things, we can make our test fail by changing `CHECK_EQUAL(1, 1)` to `CHECK_EQUAL(1, 2)`. Run this and you should now see something like this:
54
55```
56main.cpp:6:1: error: Failure in Sanity: Expected 1 but was 2
57FAILURE: 1 out of 1 tests failed (1 failures).
58Test time: 0.00 seconds.
59```
60
61The exact output will vary somewhat based on your environment. What is perhaps most important, however, is that the OS exit code will be non-zero, indicating a failure to your toolchain. `UnitTest::RunAllTests()` returns the number of failures that occurred during the run.
62
63Next Steps
64------------
65If you're comfortable with the concepts of unit testing in general, you can probably go on now to the [[Macro Reference]] to learn about the CHECK and TEST macros available to you. However, if you'd like a more detailed guide to using UnitTest++, especially in the context of test-driven development, you might want to go on to [[Writing More Tests With the Bowling Game Kata]].
No newline at end of file
trunk/3rdparty/unittest-cpp/tests/Main.cpp
r0r249095
1#include "UnitTest++/UnitTestPP.h"
2
3int main(int, char const *[])
4{
5    return UnitTest::RunAllTests();
6}
trunk/3rdparty/unittest-cpp/tests/RecordingReporter.h
r0r249095
1#ifndef UNITTEST_RECORDINGREPORTER_H
2#define UNITTEST_RECORDINGREPORTER_H
3
4#include "UnitTest++/TestReporter.h"
5#include <cstring>
6
7#include "UnitTest++/TestDetails.h"
8
9struct RecordingReporter : public UnitTest::TestReporter
10{
11private:
12    enum { kMaxStringLength = 256 };
13
14public:
15    RecordingReporter()
16        : testRunCount(0)
17        , testFailedCount(0)
18        , lastFailedLine(0)
19        , testFinishedCount(0)
20        , lastFinishedTestTime(0)
21        , summaryTotalTestCount(0)
22        , summaryFailedTestCount(0)
23        , summaryFailureCount(0)
24        , summarySecondsElapsed(0)
25    {
26        lastStartedSuite[0] = '\0';
27        lastStartedTest[0] = '\0';
28        lastFailedFile[0] = '\0';
29        lastFailedSuite[0] = '\0';
30        lastFailedTest[0] = '\0';
31        lastFailedMessage[0] = '\0';
32        lastFinishedSuite[0] = '\0';
33        lastFinishedTest[0] = '\0';
34    }
35
36    virtual void ReportTestStart(UnitTest::TestDetails const& test)
37    {
38      using namespace std;
39
40        ++testRunCount;
41        strcpy(lastStartedSuite, test.suiteName);
42        strcpy(lastStartedTest, test.testName);
43    }
44
45    virtual void ReportFailure(UnitTest::TestDetails const& test, char const* failure)
46    {
47      using namespace std;
48
49      ++testFailedCount;
50        strcpy(lastFailedFile, test.filename);
51        lastFailedLine = test.lineNumber;
52        strcpy(lastFailedSuite, test.suiteName);
53        strcpy(lastFailedTest, test.testName);
54        strcpy(lastFailedMessage, failure);
55    }
56
57    virtual void ReportTestFinish(UnitTest::TestDetails const& test, float testDuration)
58    {
59      using namespace std;
60
61      ++testFinishedCount;
62        strcpy(lastFinishedSuite, test.suiteName);
63        strcpy(lastFinishedTest, test.testName);
64        lastFinishedTestTime = testDuration;
65    }
66
67    virtual void ReportSummary(int totalTestCount, int failedTestCount, int failureCount, float secondsElapsed)
68    {
69        summaryTotalTestCount = totalTestCount;
70        summaryFailedTestCount = failedTestCount;
71        summaryFailureCount = failureCount;
72        summarySecondsElapsed = secondsElapsed;
73    }
74
75    int testRunCount;
76    char lastStartedSuite[kMaxStringLength];
77    char lastStartedTest[kMaxStringLength];
78
79    int testFailedCount;
80    char lastFailedFile[kMaxStringLength];
81    int lastFailedLine;
82    char lastFailedSuite[kMaxStringLength];
83    char lastFailedTest[kMaxStringLength];
84    char lastFailedMessage[kMaxStringLength];
85
86    int testFinishedCount;
87    char lastFinishedSuite[kMaxStringLength];
88    char lastFinishedTest[kMaxStringLength];
89    float lastFinishedTestTime;
90
91    int summaryTotalTestCount;
92    int summaryFailedTestCount;
93    int summaryFailureCount;
94    float summarySecondsElapsed;
95};
96
97
98#endif
trunk/3rdparty/unittest-cpp/tests/ScopedCurrentTest.h
r0r249095
1#ifndef UNITTEST_SCOPEDCURRENTTEST_H
2#define UNITTEST_SCOPEDCURRENTTEST_H
3
4#include "UnitTest++/CurrentTest.h"
5#include <cstddef>
6
7class ScopedCurrentTest
8{
9public:
10   ScopedCurrentTest()
11      : m_oldTestResults(UnitTest::CurrentTest::Results())
12      , m_oldTestDetails(UnitTest::CurrentTest::Details())
13   {
14   }
15
16   explicit ScopedCurrentTest(UnitTest::TestResults& newResults, const UnitTest::TestDetails* newDetails = NULL)
17      : m_oldTestResults(UnitTest::CurrentTest::Results())
18      , m_oldTestDetails(UnitTest::CurrentTest::Details())
19   {
20      UnitTest::CurrentTest::Results() = &newResults;
21
22      if (newDetails != NULL)
23         UnitTest::CurrentTest::Details() = newDetails;
24   }
25
26   ~ScopedCurrentTest()
27   {
28      UnitTest::CurrentTest::Results() = m_oldTestResults;
29      UnitTest::CurrentTest::Details() = m_oldTestDetails;
30   }
31
32private:
33   UnitTest::TestResults* m_oldTestResults;
34   const UnitTest::TestDetails* m_oldTestDetails;
35};
36
37#endif
trunk/3rdparty/unittest-cpp/tests/TestAssertHandler.cpp
r0r249095
1#include "UnitTest++/Config.h"
2#include "UnitTest++/UnitTestPP.h"
3
4#include "UnitTest++/ReportAssert.h"
5#include "UnitTest++/ReportAssertImpl.h"
6#include "UnitTest++/AssertException.h"
7
8#include "RecordingReporter.h"
9#include <csetjmp>
10
11using namespace UnitTest;
12
13namespace {
14
15TEST(CanSetAssertExpected)
16{
17   Detail::ExpectAssert(true);
18   CHECK(Detail::AssertExpected());
19
20   Detail::ExpectAssert(false);
21   CHECK(!Detail::AssertExpected());
22}
23
24#ifndef UNITTEST_NO_EXCEPTIONS
25
26TEST(ReportAssertThrowsAssertException)
27{
28    bool caught = false;
29
30    try
31    {
32      TestResults testResults;
33      TestDetails testDetails("", "", "", 0);
34        Detail::ReportAssertEx(&testResults, &testDetails, "", "", 0);
35    }
36    catch(AssertException const&)
37    {
38        caught = true;
39    }
40
41    CHECK(true == caught);
42}
43
44TEST(ReportAssertClearsExpectAssertFlag)
45{
46   RecordingReporter reporter;
47   TestResults testResults(&reporter);
48   TestDetails testDetails("", "", "", 0);
49
50   try
51   {
52      Detail::ExpectAssert(true);
53      Detail::ReportAssertEx(&testResults, &testDetails, "", "", 0);
54   }
55   catch(AssertException const&)
56   {
57   }
58
59   CHECK(Detail::AssertExpected() == false);
60   CHECK_EQUAL(0, reporter.testFailedCount);
61}
62
63TEST(ReportAssertWritesFailureToResultsAndDetailsWhenAssertIsNotExpected)
64{
65    const int lineNumber = 12345;
66    const char* description = "description";
67    const char* filename = "filename";
68
69   RecordingReporter reporter;
70   TestResults testResults(&reporter);
71   TestDetails testDetails("", "", "", 0);
72
73    try
74    {
75        Detail::ReportAssertEx(&testResults, &testDetails, description, filename, lineNumber);
76    }
77    catch(AssertException const&)
78    {
79    }
80
81   CHECK_EQUAL(description, reporter.lastFailedMessage);
82   CHECK_EQUAL(filename, reporter.lastFailedFile);
83   CHECK_EQUAL(lineNumber, reporter.lastFailedLine);
84}
85
86TEST(ReportAssertReportsNoErrorsWhenAssertIsExpected)
87{
88   Detail::ExpectAssert(true);
89
90   RecordingReporter reporter;
91   TestResults testResults(&reporter);
92   TestDetails testDetails("", "", "", 0);
93
94   try
95   {
96      Detail::ReportAssertEx(&testResults, &testDetails, "", "", 0);
97   }
98   catch(AssertException const&)
99   {
100   }
101
102   CHECK_EQUAL(0, reporter.testFailedCount);
103}
104
105TEST(CheckAssertMacroSetsAssertExpectationToFalseAfterRunning)
106{
107   Detail::ExpectAssert(true);
108   CHECK_ASSERT(ReportAssert("", "", 0));
109   CHECK(!Detail::AssertExpected());
110   Detail::ExpectAssert(false);
111}
112
113#else
114
115TEST(SetAssertJumpTargetReturnsFalseWhenSettingJumpTarget)
116{
117   CHECK(UNITTEST_SET_ASSERT_JUMP_TARGET() == false);
118}
119
120TEST(JumpToAssertJumpTarget_JumpsToSetPoint_ReturnsTrue)
121{
122   const volatile bool taken = !!UNITTEST_SET_ASSERT_JUMP_TARGET();
123
124   volatile bool set = false;
125   if (taken == false)
126   {
127      UNITTEST_JUMP_TO_ASSERT_JUMP_TARGET();
128      set = true;
129   }
130
131   CHECK(set == false);
132}
133
134#endif
135
136}
trunk/3rdparty/unittest-cpp/tests/TestCheckMacros.cpp
r0r249095
1#include "UnitTest++/UnitTestPP.h"
2#include "UnitTest++/CurrentTest.h"
3#include "RecordingReporter.h"
4#include "ScopedCurrentTest.h"
5
6using namespace std;
7
8namespace {
9
10TEST(CheckSucceedsOnTrue)
11{
12    bool failure = true;
13    {
14        RecordingReporter reporter;
15        UnitTest::TestResults testResults(&reporter);
16
17      ScopedCurrentTest scopedResults(testResults);
18      CHECK(true);
19
20      failure = (testResults.GetFailureCount() > 0);
21    }
22
23    CHECK(!failure);
24}
25
26TEST(CheckFailsOnFalse)
27{
28    bool failure = false;
29    {
30        RecordingReporter reporter;
31        UnitTest::TestResults testResults(&reporter);
32      ScopedCurrentTest scopedResults(testResults);
33        CHECK(false);
34        failure = (testResults.GetFailureCount() > 0);
35    }
36
37    CHECK(failure);
38}
39
40TEST(FailureReportsCorrectTestName)
41{
42    RecordingReporter reporter;
43    {
44        UnitTest::TestResults testResults(&reporter);
45      ScopedCurrentTest scopedResults(testResults);
46        CHECK(false);
47    }
48
49    CHECK_EQUAL(m_details.testName, reporter.lastFailedTest);
50}
51
52TEST(CheckFailureIncludesCheckContents)
53{
54    RecordingReporter reporter;
55    {
56        UnitTest::TestResults testResults(&reporter);
57      ScopedCurrentTest scopedResults(testResults);
58        const bool yaddayadda = false;
59        CHECK(yaddayadda);
60    }
61
62    CHECK(strstr(reporter.lastFailedMessage, "yaddayadda"));
63}
64
65TEST(CheckEqualSucceedsOnEqual)
66{
67    bool failure = true;
68    {
69        RecordingReporter reporter;
70        UnitTest::TestResults testResults(&reporter);
71      ScopedCurrentTest scopedResults(testResults);
72        CHECK_EQUAL(1, 1);
73        failure = (testResults.GetFailureCount() > 0);
74    }
75
76    CHECK(!failure);
77}
78
79TEST(CheckEqualFailsOnNotEqual)
80{
81    bool failure = false;
82    {
83        RecordingReporter reporter;
84        UnitTest::TestResults testResults(&reporter);
85      ScopedCurrentTest scopedResults(testResults);
86        CHECK_EQUAL(1, 2);
87        failure = (testResults.GetFailureCount() > 0);
88    }
89
90    CHECK(failure);
91}
92
93TEST(CheckEqualFailureContainsCorrectDetails)
94{
95    int line = 0;
96    RecordingReporter reporter;
97    {
98        UnitTest::TestResults testResults(&reporter);
99      UnitTest::TestDetails const testDetails("testName", "suiteName", "filename", -1);
100      ScopedCurrentTest scopedResults(testResults, &testDetails);
101
102      CHECK_EQUAL(1, 123);    line = __LINE__;
103    }
104
105    CHECK_EQUAL("testName", reporter.lastFailedTest);
106    CHECK_EQUAL("suiteName", reporter.lastFailedSuite);
107    CHECK_EQUAL("filename", reporter.lastFailedFile);
108    CHECK_EQUAL(line, reporter.lastFailedLine);
109}
110
111int g_sideEffect = 0;
112int FunctionWithSideEffects()
113{
114    ++g_sideEffect;
115    return 1;
116}
117
118TEST(CheckEqualDoesNotHaveSideEffectsWhenPassing)
119{
120    g_sideEffect = 0;
121    {
122        UnitTest::TestResults testResults;
123      ScopedCurrentTest scopedResults(testResults);
124        CHECK_EQUAL(1, FunctionWithSideEffects());
125    }
126    CHECK_EQUAL(1, g_sideEffect);
127}
128
129TEST(CheckEqualDoesNotHaveSideEffectsWhenFailing)
130{
131    g_sideEffect = 0;
132    {
133        UnitTest::TestResults testResults;
134      ScopedCurrentTest scopedResults(testResults);
135        CHECK_EQUAL(2, FunctionWithSideEffects());
136    }
137    CHECK_EQUAL(1, g_sideEffect);
138}
139
140
141TEST(CheckCloseSucceedsOnEqual)
142{
143    bool failure = true;
144    {
145        RecordingReporter reporter;
146        UnitTest::TestResults testResults(&reporter);
147      ScopedCurrentTest scopedResults(testResults);
148        CHECK_CLOSE (1.0f, 1.001f, 0.01f);
149        failure = (testResults.GetFailureCount() > 0);
150    }
151
152    CHECK(!failure);
153}
154
155TEST(CheckCloseFailsOnNotEqual)
156{
157    bool failure = false;
158    {
159        RecordingReporter reporter;
160        UnitTest::TestResults testResults(&reporter);
161      ScopedCurrentTest scopedResults(testResults);
162        CHECK_CLOSE (1.0f, 1.1f, 0.01f);
163        failure = (testResults.GetFailureCount() > 0);
164    }
165
166    CHECK(failure);
167}
168
169TEST(CheckCloseFailureContainsCorrectDetails)
170{
171    int line = 0;
172    RecordingReporter reporter;
173    {
174        UnitTest::TestResults testResults(&reporter);
175      UnitTest::TestDetails testDetails("test", "suite", "filename", -1);
176      ScopedCurrentTest scopedResults(testResults, &testDetails);
177
178      CHECK_CLOSE (1.0f, 1.1f, 0.01f);    line = __LINE__;
179    }
180
181    CHECK_EQUAL("test", reporter.lastFailedTest);
182    CHECK_EQUAL("suite", reporter.lastFailedSuite);
183    CHECK_EQUAL("filename", reporter.lastFailedFile);
184    CHECK_EQUAL(line, reporter.lastFailedLine);
185}
186
187TEST(CheckCloseDoesNotHaveSideEffectsWhenPassing)
188{
189    g_sideEffect = 0;
190    {
191        UnitTest::TestResults testResults;
192      ScopedCurrentTest scopedResults(testResults);
193        CHECK_CLOSE (1, FunctionWithSideEffects(), 0.1f);
194    }
195    CHECK_EQUAL(1, g_sideEffect);
196}
197
198TEST(CheckCloseDoesNotHaveSideEffectsWhenFailing)
199{
200    g_sideEffect = 0;
201    {
202        UnitTest::TestResults testResults;
203      ScopedCurrentTest scopedResults(testResults);
204        CHECK_CLOSE (2, FunctionWithSideEffects(), 0.1f);
205    }
206    CHECK_EQUAL(1, g_sideEffect);
207}
208
209TEST(CheckArrayCloseSucceedsOnEqual)
210{
211    bool failure = true;
212    {
213        RecordingReporter reporter;
214        UnitTest::TestResults testResults(&reporter);
215      ScopedCurrentTest scopedResults(testResults);
216        const float data[4] = { 0, 1, 2, 3 };
217        CHECK_ARRAY_CLOSE (data, data, 4, 0.01f);
218        failure = (testResults.GetFailureCount() > 0);
219    }
220
221    CHECK(!failure);
222}
223
224TEST(CheckArrayCloseFailsOnNotEqual)
225{
226    bool failure = false;
227    {
228        RecordingReporter reporter;
229        UnitTest::TestResults testResults(&reporter);
230      ScopedCurrentTest scopedResults(testResults);
231
232      int const data1[4] = { 0, 1, 2, 3 };
233        int const data2[4] = { 0, 1, 3, 3 };
234      CHECK_ARRAY_CLOSE (data1, data2, 4, 0.01f);
235
236      failure = (testResults.GetFailureCount() > 0);
237    }
238
239    CHECK(failure);
240}
241
242TEST(CheckArrayCloseFailureIncludesCheckExpectedAndActual)
243{
244    RecordingReporter reporter;
245    {
246        UnitTest::TestResults testResults(&reporter);
247      ScopedCurrentTest scopedResults(testResults);
248
249      int const data1[4] = { 0, 1, 2, 3 };
250        int const data2[4] = { 0, 1, 3, 3 };
251        CHECK_ARRAY_CLOSE (data1, data2, 4, 0.01f);
252    }
253
254    CHECK(strstr(reporter.lastFailedMessage, "xpected [ 0 1 2 3 ]"));
255    CHECK(strstr(reporter.lastFailedMessage, "was [ 0 1 3 3 ]"));
256}
257
258TEST(CheckArrayCloseFailureContainsCorrectDetails)
259{
260    int line = 0;
261    RecordingReporter reporter;
262    {
263        UnitTest::TestResults testResults(&reporter);
264      UnitTest::TestDetails testDetails("arrayCloseTest", "arrayCloseSuite", "filename", -1);
265      ScopedCurrentTest scopedResults(testResults, &testDetails);
266
267      int const data1[4] = { 0, 1, 2, 3 };
268        int const data2[4] = { 0, 1, 3, 3 };
269        CHECK_ARRAY_CLOSE (data1, data2, 4, 0.01f);     line = __LINE__;
270    }
271
272    CHECK_EQUAL("arrayCloseTest", reporter.lastFailedTest);
273    CHECK_EQUAL("arrayCloseSuite", reporter.lastFailedSuite);
274    CHECK_EQUAL("filename", reporter.lastFailedFile);
275    CHECK_EQUAL(line, reporter.lastFailedLine);
276}
277
278TEST(CheckArrayCloseFailureIncludesTolerance)
279{
280    RecordingReporter reporter;
281    {
282        UnitTest::TestResults testResults(&reporter);
283      ScopedCurrentTest scopedResults(testResults);
284
285      float const data1[4] = { 0, 1, 2, 3 };
286        float const data2[4] = { 0, 1, 3, 3 };
287        CHECK_ARRAY_CLOSE (data1, data2, 4, 0.01f);
288    }
289
290    CHECK(strstr(reporter.lastFailedMessage, "0.01"));
291}
292
293TEST(CheckArrayEqualSuceedsOnEqual)
294{
295    bool failure = true;
296    {
297        RecordingReporter reporter;
298        UnitTest::TestResults testResults(&reporter);
299      ScopedCurrentTest scopedResults(testResults);
300
301      const float data[4] = { 0, 1, 2, 3 };
302        CHECK_ARRAY_EQUAL (data, data, 4);
303
304      failure = (testResults.GetFailureCount() > 0);
305    }
306
307    CHECK(!failure);
308}
309
310TEST(CheckArrayEqualFailsOnNotEqual)
311{
312    bool failure = false;
313    {
314        RecordingReporter reporter;
315        UnitTest::TestResults testResults(&reporter);
316      ScopedCurrentTest scopedResults(testResults);
317
318      int const data1[4] = { 0, 1, 2, 3 };
319        int const data2[4] = { 0, 1, 3, 3 };
320        CHECK_ARRAY_EQUAL (data1, data2, 4);
321
322      failure = (testResults.GetFailureCount() > 0);
323    }
324
325    CHECK(failure);
326}
327
328TEST(CheckArrayEqualFailureIncludesCheckExpectedAndActual)
329{
330    RecordingReporter reporter;
331    {
332        UnitTest::TestResults testResults(&reporter);
333      ScopedCurrentTest scopedResults(testResults);
334
335      int const data1[4] = { 0, 1, 2, 3 };
336        int const data2[4] = { 0, 1, 3, 3 };
337        CHECK_ARRAY_EQUAL (data1, data2, 4);
338    }
339
340    CHECK(strstr(reporter.lastFailedMessage, "xpected [ 0 1 2 3 ]"));
341    CHECK(strstr(reporter.lastFailedMessage, "was [ 0 1 3 3 ]"));
342}
343
344TEST(CheckArrayEqualFailureContainsCorrectInfo)
345{
346    int line = 0;
347    RecordingReporter reporter;
348    {
349        UnitTest::TestResults testResults(&reporter);
350      ScopedCurrentTest scopedResults(testResults);
351
352      int const data1[4] = { 0, 1, 2, 3 };
353        int const data2[4] = { 0, 1, 3, 3 };
354        CHECK_ARRAY_EQUAL (data1, data2, 4);     line = __LINE__;
355    }
356
357    CHECK_EQUAL("CheckArrayEqualFailureContainsCorrectInfo", reporter.lastFailedTest);
358    CHECK_EQUAL(__FILE__, reporter.lastFailedFile);
359    CHECK_EQUAL(line, reporter.lastFailedLine);
360}
361
362float const* FunctionWithSideEffects2()
363{
364    ++g_sideEffect;
365    static float const data[] = {1,2,3,4};
366    return data;
367}
368
369TEST(CheckArrayCloseDoesNotHaveSideEffectsWhenPassing)
370{
371    g_sideEffect = 0;
372    {
373        UnitTest::TestResults testResults;
374      ScopedCurrentTest scopedResults(testResults);
375
376      const float data[] = { 0, 1, 2, 3 };
377        CHECK_ARRAY_CLOSE (data, FunctionWithSideEffects2(), 4, 0.01f);
378    }
379    CHECK_EQUAL(1, g_sideEffect);
380}
381
382TEST(CheckArrayCloseDoesNotHaveSideEffectsWhenFailing)
383{
384    g_sideEffect = 0;
385    {
386        UnitTest::TestResults testResults;
387      ScopedCurrentTest scopedResults(testResults);
388
389      const float data[] = { 0, 1, 3, 3 };
390        CHECK_ARRAY_CLOSE (data, FunctionWithSideEffects2(), 4, 0.01f);
391    }
392
393   CHECK_EQUAL(1, g_sideEffect);
394}
395
396TEST(CheckArray2DCloseSucceedsOnEqual)
397{
398    bool failure = true;
399    {
400        RecordingReporter reporter;
401        UnitTest::TestResults testResults(&reporter);
402      ScopedCurrentTest scopedResults(testResults);
403
404      const float data[2][2] = { {0, 1}, {2, 3} };
405        CHECK_ARRAY2D_CLOSE (data, data, 2, 2, 0.01f);
406
407      failure = (testResults.GetFailureCount() > 0);
408    }
409
410    CHECK(!failure);
411}
412
413TEST(CheckArray2DCloseFailsOnNotEqual)
414{
415    bool failure = false;
416    {
417        RecordingReporter reporter;
418        UnitTest::TestResults testResults(&reporter);
419      ScopedCurrentTest scopedResults(testResults);
420
421      int const data1[2][2] = { {0, 1}, {2, 3} };
422        int const data2[2][2] = { {0, 1}, {3, 3} };
423        CHECK_ARRAY2D_CLOSE (data1, data2, 2, 2, 0.01f);
424
425      failure = (testResults.GetFailureCount() > 0);
426    }
427
428    CHECK(failure);
429}
430
431TEST(CheckArray2DCloseFailureIncludesCheckExpectedAndActual)
432{
433    RecordingReporter reporter;
434    {
435        UnitTest::TestResults testResults(&reporter);
436      ScopedCurrentTest scopedResults(testResults);
437
438      int const data1[2][2] = { {0, 1}, {2, 3} };
439        int const data2[2][2] = { {0, 1}, {3, 3} };
440
441      CHECK_ARRAY2D_CLOSE (data1, data2, 2, 2, 0.01f);
442    }
443
444    CHECK(strstr(reporter.lastFailedMessage, "xpected [ [ 0 1 ] [ 2 3 ] ]"));
445    CHECK(strstr(reporter.lastFailedMessage, "was [ [ 0 1 ] [ 3 3 ] ]"));
446}
447
448TEST(CheckArray2DCloseFailureContainsCorrectDetails)
449{
450    int line = 0;
451    RecordingReporter reporter;
452    {
453        UnitTest::TestResults testResults(&reporter);
454      UnitTest::TestDetails testDetails("array2DCloseTest", "array2DCloseSuite", "filename", -1);
455      ScopedCurrentTest scopedResults(testResults, &testDetails);
456
457      int const data1[2][2] = { {0, 1}, {2, 3} };
458        int const data2[2][2] = { {0, 1}, {3, 3} };
459      CHECK_ARRAY2D_CLOSE (data1, data2, 2, 2, 0.01f);     line = __LINE__;
460    }
461
462    CHECK_EQUAL("array2DCloseTest", reporter.lastFailedTest);
463    CHECK_EQUAL("array2DCloseSuite", reporter.lastFailedSuite);
464    CHECK_EQUAL("filename", reporter.lastFailedFile);
465    CHECK_EQUAL(line, reporter.lastFailedLine);
466}
467
468TEST(CheckArray2DCloseFailureIncludesTolerance)
469{
470    RecordingReporter reporter;
471    {
472        UnitTest::TestResults testResults(&reporter);
473      ScopedCurrentTest scopedResults(testResults);
474
475      float const data1[2][2] = { {0, 1}, {2, 3} };
476        float const data2[2][2] = { {0, 1}, {3, 3} };
477        CHECK_ARRAY2D_CLOSE (data1, data2, 2, 2, 0.01f);
478    }
479
480    CHECK(strstr(reporter.lastFailedMessage, "0.01"));
481}
482
483float const* const* FunctionWithSideEffects3()
484{
485    ++g_sideEffect;
486    static float const data1[] = {0,1};
487    static float const data2[] = {2,3};
488    static const float* const data[] = {data1, data2};
489    return data;
490}
491
492TEST(CheckArray2DCloseDoesNotHaveSideEffectsWhenPassing)
493{
494    g_sideEffect = 0;
495    {
496        UnitTest::TestResults testResults;
497      ScopedCurrentTest scopedResults(testResults);
498
499      const float data[2][2] = { {0, 1}, {2, 3} };
500        CHECK_ARRAY2D_CLOSE (data, FunctionWithSideEffects3(), 2, 2, 0.01f);
501    }
502    CHECK_EQUAL(1, g_sideEffect);
503}
504
505TEST(CheckArray2DCloseDoesNotHaveSideEffectsWhenFailing)
506{
507    g_sideEffect = 0;
508    {
509        UnitTest::TestResults testResults;
510      ScopedCurrentTest scopedResults(testResults);
511
512      const float data[2][2] = { {0, 1}, {3, 3} };
513        CHECK_ARRAY2D_CLOSE (data, FunctionWithSideEffects3(), 2, 2, 0.01f);
514    }
515    CHECK_EQUAL(1, g_sideEffect);
516}
517
518}
trunk/3rdparty/unittest-cpp/tests/TestChecks.cpp
r0r249095
1#include "UnitTest++/UnitTestPP.h"
2#include "RecordingReporter.h"
3
4#include <cstring>
5
6using namespace UnitTest;
7
8
9namespace {
10
11
12TEST(CheckEqualWithUnsignedLong)
13{
14    TestResults results;
15    unsigned long something = 2;
16    CHECK_EQUAL(something, something);
17}
18
19TEST(CheckEqualsWithStringsFailsOnDifferentStrings)
20{
21    char txt1[] = "Hello";
22    char txt2[] = "Hallo";
23    TestResults results;
24    CheckEqual(results, txt1, txt2, TestDetails("", "", "", 0));
25    CHECK_EQUAL(1, results.GetFailureCount());
26}
27
28char txt1[] = "Hello"; // non-const on purpose so no folding of duplicate data
29char txt2[] = "Hello";
30
31TEST(CheckEqualsWithStringsWorksOnContentsNonConstNonConst)
32{
33    char const* const p1 = txt1;
34    char const* const p2 = txt2;
35    TestResults results;
36    CheckEqual(results, p1, p2, TestDetails("", "", "", 0));
37    CHECK_EQUAL(0, results.GetFailureCount());
38}
39
40TEST(CheckEqualsWithStringsWorksOnContentsConstConst)
41{
42    char* const p1 = txt1;
43    char* const p2 = txt2;
44    TestResults results;
45    CheckEqual(results, p1, p2, TestDetails("", "", "", 0));
46    CHECK_EQUAL(0, results.GetFailureCount());
47}
48
49TEST(CheckEqualsWithStringsWorksOnContentsNonConstConst)
50{
51    char* const p1 = txt1;
52    char const* const p2 = txt2;
53    TestResults results;
54    CheckEqual(results, p1, p2, TestDetails("", "", "", 0));
55    CHECK_EQUAL(0, results.GetFailureCount());
56}
57
58TEST(CheckEqualsWithStringsWorksOnContentsConstNonConst)
59{
60    char const* const p1 = txt1;
61    char* const p2 = txt2;
62    TestResults results;
63    CheckEqual(results, p1, p2, TestDetails("", "", "", 0));
64    CHECK_EQUAL(0, results.GetFailureCount());
65}
66
67TEST(CheckEqualsWithStringsWorksOnContentsWithALiteral)
68{
69    char const* const p1 = txt1;
70    TestResults results;
71    CheckEqual(results, "Hello", p1, TestDetails("", "", "", 0));
72    CHECK_EQUAL(0, results.GetFailureCount());
73}
74
75TEST(CheckEqualsWithStringsWorksOnNullExpected)
76{
77    char const* const expected = "hi";
78    char const* const actual = NULL;
79    TestResults results;
80    CheckEqual(results, expected, actual, TestDetails("", "", "", 0));
81    CHECK_EQUAL (1, results.GetFailureCount());
82}
83
84TEST(CheckEqualsWithStringsWorksOnNullActual)
85{
86    char const* const expected = NULL;
87    char const* const actual = "hi";
88    TestResults results;
89    CheckEqual(results, expected, actual, TestDetails("", "", "", 0));
90    CHECK_EQUAL (1, results.GetFailureCount());
91}
92
93TEST(CheckEqualsWithStringsWorksOnNullExpectedAndActual)
94{
95    char const* const expected = NULL;
96    char const* const actual = NULL;
97    TestResults results;
98    CheckEqual(results, expected, actual, TestDetails("", "", "", 0));
99    CHECK_EQUAL (0, results.GetFailureCount());
100}
101
102TEST(CheckEqualFailureIncludesCheckExpectedAndActual)
103{
104    RecordingReporter reporter;
105    TestResults results(&reporter);
106    const int something = 2;
107    CheckEqual(results, 1, something, TestDetails("", "", "", 0));
108
109   using namespace std;
110    CHECK(strstr(reporter.lastFailedMessage, "xpected 1"));
111    CHECK(strstr(reporter.lastFailedMessage, "was 2"));
112}
113
114TEST(CheckEqualFailureIncludesDetails)
115{
116    RecordingReporter reporter;
117    TestResults results(&reporter);
118    TestDetails const details("mytest", "mysuite", "file.h", 101);
119
120    CheckEqual(results, 1, 2, details);
121
122    CHECK_EQUAL("mytest", reporter.lastFailedTest);
123    CHECK_EQUAL("mysuite", reporter.lastFailedSuite);
124    CHECK_EQUAL("file.h", reporter.lastFailedFile);
125    CHECK_EQUAL(101, reporter.lastFailedLine);
126}
127
128TEST(CheckCloseTrue)
129{
130    TestResults results;
131    CheckClose(results, 3.001f, 3.0f, 0.1f, TestDetails("", "", "", 0));
132    CHECK_EQUAL(0, results.GetFailureCount());
133}
134
135TEST(CheckCloseFalse)
136{
137    TestResults results;
138    CheckClose(results, 3.12f, 3.0f, 0.1f, TestDetails("", "", "", 0));
139    CHECK_EQUAL(1, results.GetFailureCount());
140}
141
142TEST(CheckCloseWithZeroEpsilonWorksForSameNumber)
143{
144    TestResults results;
145    CheckClose(results, 0.1f, 0.1f, 0, TestDetails("", "", "", 0));
146    CHECK_EQUAL(0, results.GetFailureCount());
147}
148
149TEST(CheckCloseWithNaNFails)
150{
151   const unsigned int bitpattern = 0xFFFFFFFF;
152   float nan;
153   UNIITEST_NS_QUAL_STD(memcpy)(&nan, &bitpattern, sizeof(bitpattern));
154
155   TestResults results;
156    CheckClose(results, 3.0f, nan, 0.1f, TestDetails("", "", "", 0));
157    CHECK_EQUAL(1, results.GetFailureCount());
158}
159
160TEST(CheckCloseWithNaNAgainstItselfFails)
161{
162   const unsigned int bitpattern = 0xFFFFFFFF;
163   float nan;
164   UNIITEST_NS_QUAL_STD(memcpy)(&nan, &bitpattern, sizeof(bitpattern));
165
166    TestResults results;
167    CheckClose(results, nan, nan, 0.1f, TestDetails("", "", "", 0));
168    CHECK_EQUAL(1, results.GetFailureCount());
169}
170
171TEST(CheckCloseFailureIncludesCheckExpectedAndActual)
172{
173    RecordingReporter reporter;
174    TestResults results(&reporter);
175    const float expected = 0.9f;
176    const float actual = 1.1f;
177    CheckClose(results, expected, actual, 0.01f, TestDetails("", "", "", 0));
178
179   using namespace std;
180    CHECK(strstr(reporter.lastFailedMessage, "xpected 0.9"));
181    CHECK(strstr(reporter.lastFailedMessage, "was 1.1"));
182}
183
184TEST(CheckCloseFailureIncludesTolerance)
185{
186    RecordingReporter reporter;
187    TestResults results(&reporter);
188    CheckClose(results, 2, 3, 0.01f, TestDetails("", "", "", 0));
189
190   using namespace std;
191    CHECK(strstr(reporter.lastFailedMessage, "0.01"));
192}
193
194TEST(CheckCloseFailureIncludesDetails)
195{
196    RecordingReporter reporter;
197    TestResults results(&reporter);
198    TestDetails const details("mytest", "mysuite", "header.h", 10);
199
200    CheckClose(results, 2, 3, 0.01f, details);
201
202    CHECK_EQUAL("mytest", reporter.lastFailedTest);
203    CHECK_EQUAL("mysuite", reporter.lastFailedSuite);
204    CHECK_EQUAL("header.h", reporter.lastFailedFile);
205    CHECK_EQUAL(10, reporter.lastFailedLine);
206}
207
208
209TEST(CheckArrayEqualTrue)
210{
211    TestResults results;
212
213    int const array[3] = { 1, 2, 3 };
214    CheckArrayEqual(results, array, array, 3, TestDetails("", "", "", 0));
215    CHECK_EQUAL(0, results.GetFailureCount());
216}
217
218TEST(CheckArrayEqualFalse)
219{
220    TestResults results;
221
222    int const array1[3] = { 1, 2, 3 };
223    int const array2[3] = { 1, 2, 2 };
224    CheckArrayEqual(results, array1, array2, 3, TestDetails("", "", "", 0));
225    CHECK_EQUAL(1, results.GetFailureCount());
226}
227
228TEST(CheckArrayCloseTrue)
229{
230    TestResults results;
231
232    float const array1[3] = { 1.0f, 1.5f, 2.0f };
233    float const array2[3] = { 1.01f, 1.51f, 2.01f };
234    CheckArrayClose(results, array1, array2, 3, 0.02f, TestDetails("", "", "", 0));
235    CHECK_EQUAL(0, results.GetFailureCount());
236}
237
238TEST(CheckArrayCloseFalse)
239{
240    TestResults results;
241
242    float const array1[3] = { 1.0f, 1.5f, 2.0f };
243    float const array2[3] = { 1.01f, 1.51f, 2.01f };
244    CheckArrayClose(results, array1, array2, 3, 0.001f, TestDetails("", "", "", 0));
245    CHECK_EQUAL(1, results.GetFailureCount());
246}
247
248TEST(CheckArrayCloseFailureIncludesDetails)
249{
250    RecordingReporter reporter;
251    TestResults results(&reporter);
252    TestDetails const details("arrayCloseTest", "arrayCloseSuite", "file", 1337);
253
254    float const array1[3] = { 1.0f, 1.5f, 2.0f };
255    float const array2[3] = { 1.01f, 1.51f, 2.01f };
256    CheckArrayClose(results, array1, array2, 3, 0.001f, details);
257
258    CHECK_EQUAL("arrayCloseTest", reporter.lastFailedTest);
259    CHECK_EQUAL("arrayCloseSuite", reporter.lastFailedSuite);
260    CHECK_EQUAL("file", reporter.lastFailedFile);
261    CHECK_EQUAL(1337, reporter.lastFailedLine);
262}
263
264
265TEST(CheckArray2DCloseTrue)
266{
267    TestResults results;
268
269    float const array1[3][3] = { { 1.0f, 1.5f, 2.0f },
270                                 { 2.0f, 2.5f, 3.0f },
271                                 { 3.0f, 3.5f, 4.0f } };
272    float const array2[3][3] = { { 1.01f, 1.51f, 2.01f },
273                                 { 2.01f, 2.51f, 3.01f },
274                                 { 3.01f, 3.51f, 4.01f } };
275    CheckArray2DClose(results, array1, array2, 3, 3, 0.02f, TestDetails("", "", "", 0));
276    CHECK_EQUAL(0, results.GetFailureCount());
277}
278
279TEST(CheckArray2DCloseFalse)
280{
281    TestResults results;
282
283    float const array1[3][3] = { { 1.0f, 1.5f, 2.0f },
284                                 { 2.0f, 2.5f, 3.0f },
285                                 { 3.0f, 3.5f, 4.0f } };
286    float const array2[3][3] = { { 1.01f, 1.51f, 2.01f },
287                                 { 2.01f, 2.51f, 3.01f },
288                                 { 3.01f, 3.51f, 4.01f } };
289    CheckArray2DClose(results, array1, array2, 3, 3, 0.001f, TestDetails("", "", "", 0));
290    CHECK_EQUAL(1, results.GetFailureCount());
291}
292
293TEST(CheckCloseWithDoublesSucceeds)
294{
295    CHECK_CLOSE(0.5, 0.5, 0.0001);
296}
297
298TEST(CheckArray2DCloseFailureIncludesDetails)
299{
300    RecordingReporter reporter;
301    TestResults results(&reporter);
302    TestDetails const details("array2DCloseTest", "array2DCloseSuite", "file", 1234);
303
304    float const array1[3][3] = { { 1.0f, 1.5f, 2.0f },
305                                 { 2.0f, 2.5f, 3.0f },
306                                 { 3.0f, 3.5f, 4.0f } };
307    float const array2[3][3] = { { 1.01f, 1.51f, 2.01f },
308                                 { 2.01f, 2.51f, 3.01f },
309                                 { 3.01f, 3.51f, 4.01f } };
310    CheckArray2DClose(results, array1, array2, 3, 3, 0.001f, details);
311
312    CHECK_EQUAL("array2DCloseTest", reporter.lastFailedTest);
313    CHECK_EQUAL("array2DCloseSuite", reporter.lastFailedSuite);
314    CHECK_EQUAL("file", reporter.lastFailedFile);
315    CHECK_EQUAL(1234, reporter.lastFailedLine);
316}
317
318}
trunk/3rdparty/unittest-cpp/tests/TestCompositeTestReporter.cpp
r0r249095
1#include "UnitTest++/UnitTestPP.h"
2#include "UnitTest++/CompositeTestReporter.h"
3
4using namespace UnitTest;
5
6namespace {
7
8TEST(ZeroReportersByDefault)
9{
10   CHECK_EQUAL(0, CompositeTestReporter().GetReporterCount());
11}
12
13struct MockReporter : TestReporter
14{
15   MockReporter()
16      : testStartCalled(false)
17      , testStartDetails(NULL)
18      , failureCalled(false)
19      , failureDetails(NULL)
20      , failureStr(NULL)
21      , testFinishCalled(false)
22      , testFinishDetails(NULL)
23      , testFinishSecondsElapsed(-1.0f)
24      , summaryCalled(false)
25      , summaryTotalTestCount(-1)
26      , summaryFailureCount(-1)
27      , summarySecondsElapsed(-1.0f)
28   {
29   }
30
31   virtual void ReportTestStart(TestDetails const& test)
32   {
33      testStartCalled = true;
34      testStartDetails = &test;
35   }
36
37   virtual void ReportFailure(TestDetails const& test, char const* failure)
38   {
39      failureCalled = true;
40      failureDetails = &test;
41      failureStr = failure;
42   }
43
44   virtual void ReportTestFinish(TestDetails const& test, float secondsElapsed)
45   {
46      testFinishCalled = true;
47      testFinishDetails = &test;
48      testFinishSecondsElapsed = secondsElapsed;
49   }
50
51   virtual void ReportSummary(int totalTestCount,
52                        int failedTestCount,
53                        int failureCount,
54                        float secondsElapsed)
55   {
56      summaryCalled = true;
57      summaryTotalTestCount = totalTestCount;
58      summaryFailedTestCount = failedTestCount;
59      summaryFailureCount = failureCount;
60      summarySecondsElapsed = secondsElapsed;
61   }
62
63   bool testStartCalled;
64   TestDetails const* testStartDetails;
65
66   bool failureCalled;
67   TestDetails const* failureDetails;
68   const char* failureStr;
69
70   bool testFinishCalled;
71   TestDetails const* testFinishDetails;
72   float testFinishSecondsElapsed;
73
74   bool summaryCalled;
75   int summaryTotalTestCount;
76   int summaryFailedTestCount;
77   int summaryFailureCount;
78   float summarySecondsElapsed;
79};
80
81TEST(AddReporter)
82{
83   MockReporter r;
84   CompositeTestReporter c;
85
86   CHECK(c.AddReporter(&r));
87   CHECK_EQUAL(1, c.GetReporterCount());
88}
89
90TEST(RemoveReporter)
91{
92   MockReporter r;
93   CompositeTestReporter c;
94
95   c.AddReporter(&r);
96   CHECK(c.RemoveReporter(&r));
97   CHECK_EQUAL(0, c.GetReporterCount());
98}
99
100struct Fixture
101{
102   Fixture()
103   {
104      c.AddReporter(&r0);
105      c.AddReporter(&r1);
106   }
107
108   MockReporter r0, r1;
109   CompositeTestReporter c;
110};
111
112TEST_FIXTURE(Fixture, ReportTestStartCallsReportTestStartOnAllAggregates)
113{
114   TestDetails t("", "", "", 0);
115   c.ReportTestStart(t);
116
117   CHECK(r0.testStartCalled);
118   CHECK_EQUAL(&t, r0.testStartDetails);
119   CHECK(r1.testStartCalled);
120   CHECK_EQUAL(&t, r1.testStartDetails);
121}
122
123TEST_FIXTURE(Fixture, ReportFailureCallsReportFailureOnAllAggregates)
124{
125   TestDetails t("", "", "", 0);
126   const char* failStr = "fail";
127   c.ReportFailure(t, failStr);
128
129   CHECK(r0.failureCalled);
130   CHECK_EQUAL(&t, r0.failureDetails);
131   CHECK_EQUAL(failStr, r0.failureStr);
132
133   CHECK(r1.failureCalled);
134   CHECK_EQUAL(&t, r1.failureDetails);
135   CHECK_EQUAL(failStr, r1.failureStr);
136}
137
138TEST_FIXTURE(Fixture, ReportTestFinishCallsReportTestFinishOnAllAggregates)
139{
140   TestDetails t("", "", "", 0);
141   const float s = 1.2345f;
142   c.ReportTestFinish(t, s);
143
144   CHECK(r0.testFinishCalled);
145   CHECK_EQUAL(&t, r0.testFinishDetails);
146   CHECK_CLOSE(s, r0.testFinishSecondsElapsed, 0.00001f);
147
148   CHECK(r1.testFinishCalled);
149   CHECK_EQUAL(&t, r1.testFinishDetails);
150   CHECK_CLOSE(s, r1.testFinishSecondsElapsed, 0.00001f);
151}
152
153TEST_FIXTURE(Fixture, ReportSummaryCallsReportSummaryOnAllAggregates)
154{
155   TestDetails t("", "", "", 0);
156   const int testCount = 3;
157   const int failedTestCount = 4;
158   const int failureCount = 5;
159   const float secondsElapsed = 3.14159f;
160
161   c.ReportSummary(testCount, failedTestCount, failureCount, secondsElapsed);
162
163   CHECK(r0.summaryCalled);
164   CHECK_EQUAL(testCount, r0.summaryTotalTestCount);
165   CHECK_EQUAL(failedTestCount, r0.summaryFailedTestCount);
166   CHECK_EQUAL(failureCount, r0.summaryFailureCount);
167   CHECK_CLOSE(secondsElapsed, r0.summarySecondsElapsed, 0.00001f);
168
169   CHECK(r1.summaryCalled);
170   CHECK_EQUAL(testCount, r1.summaryTotalTestCount);
171   CHECK_EQUAL(failedTestCount, r1.summaryFailedTestCount);
172   CHECK_EQUAL(failureCount, r1.summaryFailureCount);
173   CHECK_CLOSE(secondsElapsed, r1.summarySecondsElapsed, 0.00001f);
174}
175
176}
trunk/3rdparty/unittest-cpp/tests/TestCurrentTest.cpp
r0r249095
1#include "UnitTest++/UnitTestPP.h"
2#include "UnitTest++/CurrentTest.h"
3#include "ScopedCurrentTest.h"
4
5namespace
6{
7
8TEST(CanSetandGetDetails)
9{
10   bool ok = false;
11   {
12      ScopedCurrentTest scopedTest;
13
14      const UnitTest::TestDetails* details = reinterpret_cast< const UnitTest::TestDetails* >(12345);
15      UnitTest::CurrentTest::Details() = details;
16
17      ok = (UnitTest::CurrentTest::Details() == details);
18   }
19
20   CHECK(ok);
21}
22
23TEST(CanSetAndGetResults)
24{
25   bool ok = false;
26   {
27      ScopedCurrentTest scopedTest;
28
29      UnitTest::TestResults results;
30      UnitTest::CurrentTest::Results() = &results;
31
32      ok = (UnitTest::CurrentTest::Results() == &results);
33   }
34
35   CHECK(ok);
36}
37
38}
trunk/3rdparty/unittest-cpp/tests/TestDeferredTestReporter.cpp
r0r249095
1#include "UnitTest++/Config.h"
2
3#ifndef UNITTEST_NO_DEFERRED_REPORTER
4
5#include "UnitTest++/UnitTestPP.h"
6#include "UnitTest++/DeferredTestReporter.h"
7#include <cstring>
8
9namespace UnitTest
10{
11
12namespace
13{
14
15#ifndef UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM
16   MemoryOutStream& operator <<(MemoryOutStream& lhs, const std::string& rhs)
17   {
18      lhs << rhs.c_str();
19      return lhs;
20   }
21#endif
22
23struct MockDeferredTestReporter : public DeferredTestReporter
24{
25    virtual void ReportSummary(int, int, int, float)
26    {
27    }
28};
29
30struct DeferredTestReporterFixture
31{
32    DeferredTestReporterFixture()
33        : testName("UniqueTestName")
34        , testSuite("UniqueTestSuite")
35        , fileName("filename.h")
36        , lineNumber(12)
37        , details(testName.c_str(), testSuite.c_str(), fileName.c_str(), lineNumber)
38    {
39    }
40
41    MockDeferredTestReporter reporter;
42    std::string const testName;
43    std::string const testSuite;
44    std::string const fileName;
45    int const lineNumber;
46    TestDetails const details;
47};
48
49TEST_FIXTURE(DeferredTestReporterFixture, ReportTestStartCreatesANewDeferredTest)
50{
51    reporter.ReportTestStart(details);
52    CHECK_EQUAL(1, (int)reporter.GetResults().size());
53}
54
55TEST_FIXTURE(DeferredTestReporterFixture, ReportTestStartCapturesTestNameAndSuite)
56{
57    reporter.ReportTestStart(details);
58
59    DeferredTestResult const& result = reporter.GetResults().at(0);
60    CHECK_EQUAL(testName.c_str(), result.testName.c_str());
61    CHECK_EQUAL(testSuite.c_str(), result.suiteName.c_str());
62}
63
64TEST_FIXTURE(DeferredTestReporterFixture, ReportTestEndCapturesTestTime)
65{
66    float const elapsed = 123.45f;
67    reporter.ReportTestStart(details);
68    reporter.ReportTestFinish(details, elapsed);
69
70    DeferredTestResult const& result = reporter.GetResults().at(0);
71    CHECK_CLOSE(elapsed, result.timeElapsed, 0.0001f);
72}
73
74TEST_FIXTURE(DeferredTestReporterFixture, ReportFailureSavesFailureDetails)
75{
76    char const* failure = "failure";
77
78    reporter.ReportTestStart(details);
79    reporter.ReportFailure(details, failure);
80
81    DeferredTestResult const& result = reporter.GetResults().at(0);
82    CHECK(result.failed == true);
83    CHECK_EQUAL(fileName.c_str(), result.failureFile.c_str());
84}
85
86TEST_FIXTURE(DeferredTestReporterFixture, ReportFailureSavesFailureDetailsForMultipleFailures)
87{
88    char const* failure1 = "failure 1";
89    char const* failure2 = "failure 2";
90
91    reporter.ReportTestStart(details);
92    reporter.ReportFailure(details, failure1);
93    reporter.ReportFailure(details, failure2);
94
95    DeferredTestResult const& result = reporter.GetResults().at(0);
96    CHECK_EQUAL(2, (int)result.failures.size());
97    CHECK_EQUAL(failure1, result.failures[0].failureStr);
98    CHECK_EQUAL(failure2, result.failures[1].failureStr);
99}
100
101TEST_FIXTURE(DeferredTestReporterFixture, DeferredTestReporterTakesCopyOfFailureMessage)
102{
103    reporter.ReportTestStart(details);
104
105    char failureMessage[128];
106    char const* goodStr = "Real failure message";
107    char const* badStr = "Bogus failure message";
108   
109   using namespace std;
110
111    strcpy(failureMessage, goodStr);
112    reporter.ReportFailure(details, failureMessage);
113    strcpy(failureMessage, badStr);
114
115    DeferredTestResult const& result = reporter.GetResults().at(0);
116    DeferredTestFailure const& failure = result.failures.at(0);
117    CHECK_EQUAL(goodStr, failure.failureStr);
118}
119
120}}
121
122#endif
trunk/3rdparty/unittest-cpp/tests/TestExceptions.cpp
r0r249095
1#include "UnitTest++/Config.h"
2#ifndef UNITTEST_NO_EXCEPTIONS
3
4#include "UnitTest++/UnitTestPP.h"
5#include "UnitTest++/CurrentTest.h"
6#include "RecordingReporter.h"
7#include "ScopedCurrentTest.h"
8
9#include <stdexcept>
10
11using namespace std;
12
13namespace {
14
15int ThrowingFunction()
16{
17    throw "Doh";
18}
19
20int ThrowingStdExceptionFunction()
21{
22    throw std::logic_error("Doh");
23}
24
25SUITE(CheckExceptionTests)
26{
27    struct CheckFixture
28    {
29        CheckFixture()
30          : reporter()
31          , testResults(&reporter)
32        {
33        }
34
35        void PerformCheckWithNonStdThrow()
36        {
37            ScopedCurrentTest scopedResults(testResults);
38            CHECK(ThrowingFunction() == 1);
39        }
40
41        void PerformCheckWithStdThrow()
42        {
43            ScopedCurrentTest scopedResults(testResults);
44            CHECK(ThrowingStdExceptionFunction() == 1);
45        }
46
47        RecordingReporter reporter;
48        UnitTest::TestResults testResults;
49    };
50
51    TEST_FIXTURE(CheckFixture, CheckFailsOnException)
52    {
53        PerformCheckWithNonStdThrow();
54        CHECK(testResults.GetFailureCount() > 0);
55    }
56
57    TEST_FIXTURE(CheckFixture, CheckFailsOnStdException)
58    {
59        PerformCheckWithStdThrow();
60        CHECK(testResults.GetFailureCount() > 0);
61    }
62
63    TEST_FIXTURE(CheckFixture, CheckFailureBecauseOfExceptionIncludesCheckContents)
64    {
65        PerformCheckWithNonStdThrow();
66        CHECK(strstr(reporter.lastFailedMessage, "ThrowingFunction() == 1"));
67    }
68
69    TEST_FIXTURE(CheckFixture, CheckFailureBecauseOfStdExceptionIncludesCheckContents)
70    {
71        PerformCheckWithStdThrow();
72        CHECK(strstr(reporter.lastFailedMessage, "ThrowingStdExceptionFunction() == 1"));
73    }
74
75    TEST_FIXTURE(CheckFixture, CheckFailureBecauseOfStandardExceptionIncludesWhat)
76    {
77        PerformCheckWithStdThrow();
78        CHECK(strstr(reporter.lastFailedMessage, "exception (Doh)"));
79    }
80}
81
82SUITE(CheckEqualExceptionTests)
83{
84    struct CheckEqualFixture
85    {
86        CheckEqualFixture()
87          : reporter()
88          , testResults(&reporter)
89          , line(-1)
90        {
91        }
92
93        void PerformCheckWithNonStdThrow()
94        {
95            UnitTest::TestDetails const testDetails("testName", "suiteName", "filename", -1);
96            ScopedCurrentTest scopedResults(testResults, &testDetails);
97            CHECK_EQUAL(ThrowingFunction(), 123); line = __LINE__;
98        }
99
100        void PerformCheckWithStdThrow()
101        {
102            UnitTest::TestDetails const testDetails("testName", "suiteName", "filename", -1);
103            ScopedCurrentTest scopedResults(testResults, &testDetails);
104            CHECK_EQUAL(ThrowingStdExceptionFunction(), 123); line = __LINE__;
105        }
106
107        RecordingReporter reporter;
108        UnitTest::TestResults testResults;
109        int line;
110    };
111
112    TEST_FIXTURE(CheckEqualFixture, CheckEqualFailsOnException)
113    {
114        PerformCheckWithNonStdThrow();
115        CHECK(testResults.GetFailureCount() > 0);
116    }
117
118    TEST_FIXTURE(CheckEqualFixture, CheckEqualFailsOnStdException)
119    {
120        PerformCheckWithStdThrow();
121        CHECK(testResults.GetFailureCount() > 0);   
122    }
123
124    TEST_FIXTURE(CheckEqualFixture, CheckEqualFailureBecauseOfExceptionContainsCorrectDetails)
125    {
126        PerformCheckWithNonStdThrow();
127
128        CHECK_EQUAL("testName", reporter.lastFailedTest);
129        CHECK_EQUAL("suiteName", reporter.lastFailedSuite);
130        CHECK_EQUAL("filename", reporter.lastFailedFile);
131        CHECK_EQUAL(line, reporter.lastFailedLine);
132    }
133
134    TEST_FIXTURE(CheckEqualFixture, CheckEqualFailureBecauseOfStdExceptionContainsCorrectDetails)
135    {
136        PerformCheckWithStdThrow();
137
138        CHECK_EQUAL("testName", reporter.lastFailedTest);
139        CHECK_EQUAL("suiteName", reporter.lastFailedSuite);
140        CHECK_EQUAL("filename", reporter.lastFailedFile);
141        CHECK_EQUAL(line, reporter.lastFailedLine);
142    }
143
144    TEST_FIXTURE(CheckEqualFixture, CheckEqualFailureBecauseOfExceptionIncludesCheckContents)
145    {
146        PerformCheckWithNonStdThrow();
147
148        CHECK(strstr(reporter.lastFailedMessage, "ThrowingFunction()"));
149        CHECK(strstr(reporter.lastFailedMessage, "123"));
150    }
151
152    TEST_FIXTURE(CheckEqualFixture, CheckEqualFailureBecauseOfStdExceptionIncludesCheckContents)
153    {
154        PerformCheckWithStdThrow();
155
156        CHECK(strstr(reporter.lastFailedMessage, "ThrowingStdExceptionFunction()"));
157        CHECK(strstr(reporter.lastFailedMessage, "123"));
158    }
159
160    TEST_FIXTURE(CheckEqualFixture, CheckEqualFailureBecauseOfStandardExceptionIncludesWhat)
161    {
162        PerformCheckWithStdThrow();
163
164        CHECK(strstr(reporter.lastFailedMessage, "exception (Doh)"));
165    }
166}
167
168SUITE(CheckCloseExceptionTests)
169{
170    struct CheckCloseFixture
171    {
172        CheckCloseFixture()
173          : reporter()
174          , testResults(&reporter)
175          , line(-1)
176        {
177        }
178
179        void PerformCheckWithNonStdThrow()
180        {
181            UnitTest::TestDetails const testDetails("closeTest", "closeSuite", "filename", -1);
182            ScopedCurrentTest scopedResults(testResults, &testDetails);
183            CHECK_CLOSE(static_cast<float>(ThrowingFunction()), 1.0001f, 0.1f); line = __LINE__;
184        }
185
186        void PerformCheckWithStdThrow()
187        {
188            UnitTest::TestDetails const testDetails("closeTest", "closeSuite", "filename", -1);
189            ScopedCurrentTest scopedResults(testResults, &testDetails);
190            CHECK_CLOSE(static_cast<float>(ThrowingStdExceptionFunction()), 1.0001f, 0.1f); line = __LINE__;
191        }
192
193        RecordingReporter reporter;
194        UnitTest::TestResults testResults;
195        int line;
196    };
197
198    TEST_FIXTURE(CheckCloseFixture, CheckCloseFailsOnException)
199    {
200        PerformCheckWithNonStdThrow();
201
202        CHECK(testResults.GetFailureCount() > 0);
203    }
204
205    TEST_FIXTURE(CheckCloseFixture, CheckCloseFailsOnStdException)
206    {
207        PerformCheckWithStdThrow();
208
209        CHECK(testResults.GetFailureCount() > 0);
210    }
211
212    TEST_FIXTURE(CheckCloseFixture, CheckCloseFailureBecauseOfExceptionContainsCorrectDetails)
213    {
214        PerformCheckWithNonStdThrow();
215
216        CHECK_EQUAL("closeTest", reporter.lastFailedTest);
217        CHECK_EQUAL("closeSuite", reporter.lastFailedSuite);
218        CHECK_EQUAL("filename", reporter.lastFailedFile);
219        CHECK_EQUAL(line, reporter.lastFailedLine);
220    }
221
222    TEST_FIXTURE(CheckCloseFixture, CheckCloseFailureBecauseOfStdExceptionContainsCorrectDetails)
223    {
224        PerformCheckWithStdThrow();
225
226        CHECK_EQUAL("closeTest", reporter.lastFailedTest);
227        CHECK_EQUAL("closeSuite", reporter.lastFailedSuite);
228        CHECK_EQUAL("filename", reporter.lastFailedFile);
229        CHECK_EQUAL(line, reporter.lastFailedLine);
230    }
231
232    TEST_FIXTURE(CheckCloseFixture, CheckCloseFailureBecauseOfExceptionIncludesCheckContents)
233    {
234        PerformCheckWithNonStdThrow();
235
236        CHECK(strstr(reporter.lastFailedMessage, "static_cast<float>(ThrowingFunction())"));
237        CHECK(strstr(reporter.lastFailedMessage, "1.0001f"));
238    }
239
240    TEST_FIXTURE(CheckCloseFixture, CheckCloseFailureBecauseOfStdExceptionIncludesCheckContents)
241    {
242        PerformCheckWithStdThrow();
243
244        CHECK(strstr(reporter.lastFailedMessage, "static_cast<float>(ThrowingStdExceptionFunction())"));
245        CHECK(strstr(reporter.lastFailedMessage, "1.0001f"));
246    }
247
248    TEST_FIXTURE(CheckCloseFixture, CheckCloseFailureBecauseOfStandardExceptionIncludesWhat)
249    {
250        PerformCheckWithStdThrow();
251
252        CHECK(strstr(reporter.lastFailedMessage, "exception (Doh)"));
253    }
254}
255
256class ThrowingObject
257{
258public:
259    float operator[](int) const
260    {
261        throw "Test throw";
262    }
263};
264
265class StdThrowingObject
266{
267public:
268    float operator[](int) const
269    {
270        throw std::runtime_error("Test throw");
271    }
272};
273
274SUITE(CheckArrayCloseExceptionTests)
275{
276    struct CheckArrayCloseFixture
277    {
278        CheckArrayCloseFixture()
279          : reporter()
280          , testResults(&reporter)
281          , line(-1)
282        {
283        }
284
285        void PerformCheckWithNonStdThrow()
286        {
287            UnitTest::TestDetails const testDetails("arrayCloseTest", "arrayCloseSuite", "filename", -1);
288            ScopedCurrentTest scopedResults(testResults, &testDetails);
289            int const data[4] = { 0, 1, 2, 3 };
290            CHECK_ARRAY_CLOSE(data, ThrowingObject(), 4, 0.01f); line = __LINE__;
291        }
292
293        void PerformCheckWithStdThrow()
294        {
295            UnitTest::TestDetails const testDetails("arrayCloseTest", "arrayCloseSuite", "filename", -1);
296            ScopedCurrentTest scopedResults(testResults, &testDetails);
297            int const data[4] = { 0, 1, 2, 3 };
298            CHECK_ARRAY_CLOSE(data, StdThrowingObject(), 4, 0.01f); line = __LINE__;
299        }
300
301        RecordingReporter reporter;
302        UnitTest::TestResults testResults;
303        int line;
304    };
305
306    TEST_FIXTURE(CheckArrayCloseFixture, CheckFailureBecauseOfExceptionContainsCorrectDetails)
307    {
308        PerformCheckWithNonStdThrow();
309
310        CHECK_EQUAL("arrayCloseTest", reporter.lastFailedTest);
311        CHECK_EQUAL("arrayCloseSuite", reporter.lastFailedSuite);
312        CHECK_EQUAL("filename", reporter.lastFailedFile);
313        CHECK_EQUAL(line, reporter.lastFailedLine);
314    }
315
316    TEST_FIXTURE(CheckArrayCloseFixture, CheckFailureBecauseOfStdExceptionContainsCorrectDetails)
317    {
318        PerformCheckWithStdThrow();
319
320        CHECK_EQUAL("arrayCloseTest", reporter.lastFailedTest);
321        CHECK_EQUAL("arrayCloseSuite", reporter.lastFailedSuite);
322        CHECK_EQUAL("filename", reporter.lastFailedFile);
323        CHECK_EQUAL(line, reporter.lastFailedLine);
324    }
325
326    TEST_FIXTURE(CheckArrayCloseFixture, CheckFailsOnException)
327    {
328        PerformCheckWithNonStdThrow();
329
330        CHECK(testResults.GetFailureCount() > 0);
331    }
332
333    TEST_FIXTURE(CheckArrayCloseFixture, CheckFailsOnStdException)
334    {
335        PerformCheckWithStdThrow();
336
337        CHECK(testResults.GetFailureCount() > 0);
338    }
339
340    TEST_FIXTURE(CheckArrayCloseFixture, CheckFailureOnExceptionIncludesCheckContents)
341    {
342        PerformCheckWithNonStdThrow();
343
344        CHECK(strstr(reporter.lastFailedMessage, "data"));
345        CHECK(strstr(reporter.lastFailedMessage, "ThrowingObject()"));
346    }
347
348    TEST_FIXTURE(CheckArrayCloseFixture, CheckFailureOnStdExceptionIncludesCheckContents)
349    {
350        PerformCheckWithStdThrow();
351
352        CHECK(strstr(reporter.lastFailedMessage, "data"));
353        CHECK(strstr(reporter.lastFailedMessage, "StdThrowingObject()"));
354    }
355
356    TEST_FIXTURE(CheckArrayCloseFixture, CheckFailureOnStdExceptionIncludesWhat)
357    {
358        PerformCheckWithStdThrow();
359
360        CHECK(strstr(reporter.lastFailedMessage, "exception (Test throw)"));
361    }
362}
363
364SUITE(CheckArrayEqualExceptionTests)
365{
366    struct CheckArrayEqualFixture
367    {
368        CheckArrayEqualFixture()
369        : reporter()
370        , testResults(&reporter)
371        , line(-1)
372        {
373        }
374
375        void PerformCheckWithNonStdThrow()
376        {
377            UnitTest::TestDetails const testDetails("arrayEqualTest", "arrayEqualSuite", "filename", -1);
378            ScopedCurrentTest scopedResults(testResults, &testDetails);
379            int const data[4] = { 0, 1, 2, 3 };
380            CHECK_ARRAY_EQUAL(data, ThrowingObject(), 4); line = __LINE__;
381        }
382
383        void PerformCheckWithStdThrow()
384        {
385            UnitTest::TestDetails const testDetails("arrayEqualTest", "arrayEqualSuite", "filename", -1);
386            ScopedCurrentTest scopedResults(testResults, &testDetails);
387            int const data[4] = { 0, 1, 2, 3 };
388            CHECK_ARRAY_EQUAL(data, StdThrowingObject(), 4); line = __LINE__;
389        }
390
391        RecordingReporter reporter;
392        UnitTest::TestResults testResults;
393        int line;
394    };
395
396    TEST_FIXTURE(CheckArrayEqualFixture, CheckFailureBecauseOfExceptionContainsCorrectDetails)
397    {
398        PerformCheckWithNonStdThrow();
399
400        CHECK_EQUAL("arrayEqualTest", reporter.lastFailedTest);
401        CHECK_EQUAL("arrayEqualSuite", reporter.lastFailedSuite);
402        CHECK_EQUAL("filename", reporter.lastFailedFile);
403        CHECK_EQUAL(line, reporter.lastFailedLine);
404    }
405
406    TEST_FIXTURE(CheckArrayEqualFixture, CheckFailureBecauseOfStdExceptionContainsCorrectDetails)
407    {
408        PerformCheckWithStdThrow();
409
410        CHECK_EQUAL("arrayEqualTest", reporter.lastFailedTest);
411        CHECK_EQUAL("arrayEqualSuite", reporter.lastFailedSuite);
412        CHECK_EQUAL("filename", reporter.lastFailedFile);
413        CHECK_EQUAL(line, reporter.lastFailedLine);
414    }
415
416    TEST_FIXTURE(CheckArrayEqualFixture, CheckFailsOnException)
417    {
418        PerformCheckWithNonStdThrow();
419
420        CHECK(testResults.GetFailureCount() > 0);
421    }
422
423    TEST_FIXTURE(CheckArrayEqualFixture, CheckFailsOnStdException)
424    {
425        PerformCheckWithStdThrow();
426
427        CHECK(testResults.GetFailureCount() > 0);
428    }
429
430    TEST_FIXTURE(CheckArrayEqualFixture, CheckFailureOnExceptionIncludesCheckContents)
431    {
432        PerformCheckWithNonStdThrow();
433
434        CHECK(strstr(reporter.lastFailedMessage, "data"));
435        CHECK(strstr(reporter.lastFailedMessage, "ThrowingObject()"));
436    }
437
438    TEST_FIXTURE(CheckArrayEqualFixture, CheckFailureOnStdExceptionIncludesCheckContents)
439    {
440        PerformCheckWithStdThrow();
441
442        CHECK(strstr(reporter.lastFailedMessage, "data"));
443        CHECK(strstr(reporter.lastFailedMessage, "StdThrowingObject()"));
444    }
445
446    TEST_FIXTURE(CheckArrayEqualFixture, CheckFailureOnStdExceptionIncludesWhat)
447    {
448        PerformCheckWithStdThrow();
449
450        CHECK(strstr(reporter.lastFailedMessage, "exception (Test throw)"));
451    }
452}
453
454SUITE(CheckArray2DExceptionTests)
455{
456    class ThrowingObject2D
457    {
458    public:
459        float* operator[](int) const
460        {
461            throw "Test throw";
462        }
463    };
464
465    class StdThrowingObject2D
466    {
467    public:
468        float* operator[](int) const
469        {
470            throw std::runtime_error("Test throw");
471        }
472    };
473
474    struct CheckArray2DCloseFixture
475    {
476        CheckArray2DCloseFixture()
477          : reporter()
478          , testResults(&reporter)
479          , line(-1)
480        {
481        }
482
483        void PerformCheckWithNonStdThrow()
484        {
485            UnitTest::TestDetails const testDetails("array2DCloseTest", "array2DCloseSuite", "filename", -1);
486            ScopedCurrentTest scopedResults(testResults, &testDetails);
487            const float data[2][2] = { {0, 1}, {2, 3} };
488            CHECK_ARRAY2D_CLOSE(data, ThrowingObject2D(), 2, 2, 0.01f); line = __LINE__;
489        }
490
491        void PerformCheckWithStdThrow()
492        {
493            UnitTest::TestDetails const testDetails("array2DCloseTest", "array2DCloseSuite", "filename", -1);
494            ScopedCurrentTest scopedResults(testResults, &testDetails);
495            const float data[2][2] = { {0, 1}, {2, 3} };
496            CHECK_ARRAY2D_CLOSE(data, StdThrowingObject2D(), 2, 2, 0.01f); line = __LINE__;
497        }
498
499        RecordingReporter reporter;
500        UnitTest::TestResults testResults;
501        int line;
502    };
503
504    TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailureBecauseOfExceptionContainsCorrectDetails)
505    {
506        PerformCheckWithNonStdThrow();
507
508        CHECK_EQUAL("array2DCloseTest", reporter.lastFailedTest);
509        CHECK_EQUAL("array2DCloseSuite", reporter.lastFailedSuite);
510        CHECK_EQUAL("filename", reporter.lastFailedFile);
511        CHECK_EQUAL(line, reporter.lastFailedLine);
512    }
513
514    TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailureBecauseOfStdExceptionContainsCorrectDetails)
515    {
516        PerformCheckWithStdThrow();
517
518        CHECK_EQUAL("array2DCloseTest", reporter.lastFailedTest);
519        CHECK_EQUAL("array2DCloseSuite", reporter.lastFailedSuite);
520        CHECK_EQUAL("filename", reporter.lastFailedFile);
521        CHECK_EQUAL(line, reporter.lastFailedLine);
522    }
523
524    TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailsOnException)
525    {
526        PerformCheckWithNonStdThrow();
527
528        CHECK(testResults.GetFailureCount() > 0);
529    }
530
531    TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailsOnStdException)
532    {
533        PerformCheckWithStdThrow();
534
535        CHECK(testResults.GetFailureCount() > 0);
536    }
537
538    TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailureOnExceptionIncludesCheckContents)
539    {
540        PerformCheckWithNonStdThrow();
541
542        CHECK(strstr(reporter.lastFailedMessage, "data"));
543        CHECK(strstr(reporter.lastFailedMessage, "ThrowingObject2D()"));
544    }
545
546    TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailureOnStdExceptionIncludesCheckContents)
547    {
548        PerformCheckWithStdThrow();
549
550        CHECK(strstr(reporter.lastFailedMessage, "data"));
551        CHECK(strstr(reporter.lastFailedMessage, "StdThrowingObject2D()"));
552    }
553
554    TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailureOnStdExceptionIncludesWhat)
555    {
556        PerformCheckWithStdThrow();
557
558        CHECK(strstr(reporter.lastFailedMessage, "exception (Test throw)"));
559    }
560}
561}
562
563#endif
trunk/3rdparty/unittest-cpp/tests/TestMemoryOutStream.cpp
r0r249095
1#include "UnitTest++/UnitTestPP.h"
2
3#include "UnitTest++/MemoryOutStream.h"
4#include <cstring>
5#include <cstdlib>
6#include <climits>
7#include <cfloat>
8
9using namespace UnitTest;
10using namespace std;
11
12namespace {
13
14const char* const maxSignedIntegralStr(size_t nBytes)
15{
16    switch(nBytes)
17    {
18        case 8:
19            return "9223372036854775807";
20        case 4:
21            return "2147483647";
22        case 2:
23            return "32767";
24        case 1:
25            return "127";
26        default:
27            return "Unsupported signed integral size";
28    }
29}
30
31const char* const minSignedIntegralStr(size_t nBytes)
32{
33    switch(nBytes)
34    {
35        case 8:
36            return "-9223372036854775808";
37        case 4:
38            return "-2147483648";
39        case 2:
40            return "-32768";
41        case 1:
42            return "-128";
43        default:
44            return "Unsupported signed integral size";
45    }
46}
47
48const char* const maxUnsignedIntegralStr(size_t nBytes)
49{
50    switch(nBytes)
51    {
52        case 8:
53            return "18446744073709551615";
54        case 4:
55            return "4294967295";
56        case 2:
57            return "65535";
58        case 1:
59            return "255";
60        default:
61            return "Unsupported signed integral size";
62    }
63}
64
65TEST(DefaultIsEmptyString)
66{
67    MemoryOutStream const stream;
68    CHECK(stream.GetText() != 0);
69    CHECK_EQUAL("", stream.GetText());
70}
71
72TEST(StreamingTextCopiesCharacters)
73{
74    MemoryOutStream stream;
75    stream << "Lalala";
76    CHECK_EQUAL("Lalala", stream.GetText());
77}
78
79TEST(StreamingMultipleTimesConcatenatesResult)
80{
81    MemoryOutStream stream;
82    stream << "Bork" << "Foo" << "Bar";
83    CHECK_EQUAL("BorkFooBar", stream.GetText());
84}
85
86TEST(StreamingIntWritesCorrectCharacters)
87{
88    MemoryOutStream stream;
89    stream << (int)123;
90    CHECK_EQUAL("123", stream.GetText());
91}
92
93TEST(StreaminMaxIntWritesCorrectCharacters)
94{
95    MemoryOutStream stream;
96    stream << INT_MAX;
97    CHECK_EQUAL(maxSignedIntegralStr(sizeof(int)), stream.GetText());   
98}
99
100TEST(StreamingMinIntWritesCorrectCharacters)
101{
102    MemoryOutStream stream;
103    stream << INT_MIN;
104    CHECK_EQUAL(minSignedIntegralStr(sizeof(int)), stream.GetText());
105}
106
107TEST(StreamingUnsignedIntWritesCorrectCharacters)
108{
109    MemoryOutStream stream;
110    stream << (unsigned int)123;
111    CHECK_EQUAL("123", stream.GetText());
112}
113
114TEST(StreamingMaxUnsignedIntWritesCorrectCharacters)
115{
116    MemoryOutStream stream;
117    stream << (unsigned int)UINT_MAX;
118    CHECK_EQUAL(maxUnsignedIntegralStr(sizeof(unsigned int)), stream.GetText());
119}
120
121TEST(StreamingMinUnsignedIntWritesCorrectCharacters)
122{
123    MemoryOutStream stream;
124    stream << (unsigned int)0;
125    CHECK_EQUAL("0", stream.GetText());
126}
127
128TEST(StreamingLongWritesCorrectCharacters)
129{
130    MemoryOutStream stream;
131    stream << (long)(-123);
132    CHECK_EQUAL("-123", stream.GetText());
133}
134
135TEST(StreamingMaxLongWritesCorrectCharacters)
136{
137    MemoryOutStream stream;
138    stream << (long)(LONG_MAX);
139    CHECK_EQUAL(maxSignedIntegralStr(sizeof(long)), stream.GetText());
140}
141
142TEST(StreamingMinLongWritesCorrectCharacters)
143{
144    MemoryOutStream stream;
145    stream << (long)(LONG_MIN);
146    CHECK_EQUAL(minSignedIntegralStr(sizeof(long)), stream.GetText());
147}
148
149TEST(StreamingUnsignedLongWritesCorrectCharacters)
150{
151    MemoryOutStream stream;
152    stream << (unsigned long)123;
153    CHECK_EQUAL("123", stream.GetText());
154}
155
156TEST(StreamingMaxUnsignedLongWritesCorrectCharacters)
157{
158    MemoryOutStream stream;
159    stream << (unsigned long)ULONG_MAX;
160    CHECK_EQUAL(maxUnsignedIntegralStr(sizeof(unsigned long)), stream.GetText());
161}
162
163TEST(StreamingMinUnsignedLongWritesCorrectCharacters)
164{
165    MemoryOutStream stream;
166    stream << (unsigned long)0ul;
167    CHECK_EQUAL("0", stream.GetText());
168}
169
170TEST(StreamingLongLongWritesCorrectCharacters)
171{
172   MemoryOutStream stream;
173#ifdef UNITTEST_COMPILER_IS_MSVC6
174   stream << (__int64)-12345i64;
175#else
176   stream << (long long)-12345ll;
177#endif
178   CHECK_EQUAL("-12345", stream.GetText());
179}
180
181#ifdef LLONG_MAX
182TEST(StreamingMaxLongLongWritesCorrectCharacters)
183{
184    MemoryOutStream stream;
185    stream << (long long)LLONG_MAX;
186    CHECK_EQUAL(maxSignedIntegralStr(sizeof(long long)), stream.GetText());
187}
188#endif
189
190#ifdef LLONG_MIN
191TEST(StreamingMinLongLongWritesCorrectCharacters)
192{
193    MemoryOutStream stream;
194    stream << (long long)LLONG_MIN;
195    CHECK_EQUAL(minSignedIntegralStr(sizeof(long long)), stream.GetText());
196}
197#endif
198
199TEST(StreamingUnsignedLongLongWritesCorrectCharacters)
200{
201   MemoryOutStream stream;
202#ifdef UNITTEST_COMPILER_IS_MSVC6
203   stream << (unsigned __int64)85899ui64;
204#else
205   stream << (unsigned long long)85899ull;
206#endif
207   CHECK_EQUAL("85899", stream.GetText());
208}
209
210#ifdef ULLONG_MAX
211TEST(StreamingMaxUnsignedLongLongWritesCorrectCharacters)
212{
213    MemoryOutStream stream;
214    stream << (unsigned long long)ULLONG_MAX;
215    CHECK_EQUAL(maxUnsignedIntegralStr(sizeof(unsigned long long)), stream.GetText());
216}
217#endif
218
219TEST(StreamingMinUnsignedLongLongWritesCorrectCharacters)
220{
221    MemoryOutStream stream;
222#ifdef UNITTEST_COMPILER_IS_MSVC6
223    stream << (unsigned __int64)0ui64;
224#else
225    stream << (unsigned long long)0ull;
226#endif
227    CHECK_EQUAL("0", stream.GetText());
228}
229
230TEST(StreamingFloatWritesCorrectCharacters)
231{
232    MemoryOutStream stream;
233    stream << 3.1415f;
234   CHECK(strstr(stream.GetText(), "3.1415"));
235}
236
237TEST(StreamingDoubleWritesCorrectCharacters)
238{
239   MemoryOutStream stream;
240   stream << 3.1415;
241   CHECK(strstr(stream.GetText(), "3.1415"));
242}
243
244TEST(StreamingPointerWritesCorrectCharacters)
245{
246    MemoryOutStream stream;
247    int* p = (int*)0x1234;
248    stream << p;
249    CHECK(strstr(stream.GetText(), "1234"));
250}
251
252TEST(StreamingSizeTWritesCorrectCharacters)
253{
254    MemoryOutStream stream;
255    size_t const s = 53124;
256    stream << s;
257    CHECK_EQUAL("53124", stream.GetText());
258}
259
260TEST(ClearEmptiesMemoryOutStreamContents)
261{
262   MemoryOutStream stream;
263   stream << "Hello world";
264   stream.Clear();
265   CHECK_EQUAL("", stream.GetText());
266}
267
268#ifndef UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM
269
270TEST(StreamInitialCapacityIsCorrect)
271{
272    MemoryOutStream stream(MemoryOutStream::GROW_CHUNK_SIZE);
273    CHECK_EQUAL((int)MemoryOutStream::GROW_CHUNK_SIZE, stream.GetCapacity());
274}
275
276TEST(StreamInitialCapacityIsMultipleOfGrowChunkSize)
277{
278    MemoryOutStream stream(MemoryOutStream::GROW_CHUNK_SIZE + 1);
279    CHECK_EQUAL((int)MemoryOutStream::GROW_CHUNK_SIZE * 2, stream.GetCapacity());
280}
281
282
283TEST(ExceedingCapacityGrowsBuffer)
284{
285    MemoryOutStream stream(MemoryOutStream::GROW_CHUNK_SIZE);
286    stream << "012345678901234567890123456789";
287    char const* const oldBuffer = stream.GetText();
288    stream << "0123456789";
289    CHECK(oldBuffer != stream.GetText());
290}
291
292TEST(ExceedingCapacityGrowsBufferByGrowChunk)
293{
294    MemoryOutStream stream(MemoryOutStream::GROW_CHUNK_SIZE);
295    stream << "0123456789012345678901234567890123456789";
296    CHECK_EQUAL(MemoryOutStream::GROW_CHUNK_SIZE * 2, stream.GetCapacity());
297}
298
299TEST(WritingStringLongerThanCapacityFitsInNewBuffer)
300{
301    MemoryOutStream stream(8);
302    stream << "0123456789ABCDEF";
303    CHECK_EQUAL("0123456789ABCDEF", stream.GetText());
304}
305
306TEST(WritingIntLongerThanCapacityFitsInNewBuffer)
307{
308    MemoryOutStream stream(8);
309    stream << "aaaa" << 123456;
310    CHECK_EQUAL("aaaa123456", stream.GetText());
311}
312
313TEST(WritingFloatLongerThanCapacityFitsInNewBuffer)
314{
315    MemoryOutStream stream(8);
316    stream << "aaaa" << 123456.0f;
317    CHECK_EQUAL("aaaa123456.000000", stream.GetText());
318}
319
320TEST(WritingSizeTLongerThanCapacityFitsInNewBuffer)
321{
322    MemoryOutStream stream(8);
323    stream << "aaaa" << size_t(32145);
324    CHECK_EQUAL("aaaa32145", stream.GetText());
325}
326
327TEST(VerifyLargeDoubleCanBeStreamedWithoutCrashing)
328{
329    MemoryOutStream stream(8);
330    stream << DBL_MAX;
331    CHECK(true);
332}
333
334#endif
335
336}
trunk/3rdparty/unittest-cpp/tests/TestTest.cpp
r0r249095
1#include "UnitTest++/UnitTestPP.h"
2#include "UnitTest++/TestReporter.h"
3#include "UnitTest++/TimeHelpers.h"
4#include "ScopedCurrentTest.h"
5
6using namespace UnitTest;
7
8namespace {
9
10TEST(PassingTestHasNoFailures)
11{
12    class PassingTest : public Test
13    {
14    public:
15        PassingTest() : Test("passing") {}
16        virtual void RunImpl() const
17        {
18            CHECK(true);
19        }
20    };
21
22    TestResults results;
23   {
24      ScopedCurrentTest scopedResults(results);
25      PassingTest().Run();
26   }
27
28    CHECK_EQUAL(0, results.GetFailureCount());
29}
30
31
32TEST(FailingTestHasFailures)
33{
34    class FailingTest : public Test
35    {
36    public:
37        FailingTest() : Test("failing") {}
38        virtual void RunImpl() const
39        {
40            CHECK(false);
41        }
42    };
43
44    TestResults results;
45   {
46      ScopedCurrentTest scopedResults(results);
47      FailingTest().Run();
48   }
49
50    CHECK_EQUAL(1, results.GetFailureCount());
51}
52
53#ifndef UNITTEST_NO_EXCEPTIONS
54TEST(ThrowingTestsAreReportedAsFailures)
55{
56    class CrashingTest : public Test
57    {
58    public:
59        CrashingTest() : Test("throwing") {}
60        virtual void RunImpl() const
61        {
62            throw "Blah";
63        }
64    };
65 
66    TestResults results;
67   {
68      ScopedCurrentTest scopedResult(results);
69      CrashingTest().Run();
70   }
71
72   CHECK_EQUAL(1, results.GetFailureCount());
73}
74
75#if !defined(UNITTEST_MINGW) && !defined(UNITTEST_WIN32)
76// Skip this test in debug because some debuggers don't like it.
77#if defined(NDEBUG)
78TEST(CrashingTestsAreReportedAsFailures)
79{
80    class CrashingTest : public Test
81    {
82    public:
83        CrashingTest() : Test("crashing") {}
84        virtual void RunImpl() const
85        {
86
87            reinterpret_cast< void (*)() >(0)();
88        }
89    };
90
91    TestResults results;
92   {
93      ScopedCurrentTest scopedResult(results);
94      CrashingTest().Run();
95   }
96
97   CHECK_EQUAL(1, results.GetFailureCount());
98}
99#endif
100#endif
101#endif
102
103TEST(TestWithUnspecifiedSuiteGetsDefaultSuite)
104{
105    Test test("test");
106    CHECK(test.m_details.suiteName != NULL);
107    CHECK_EQUAL("DefaultSuite", test.m_details.suiteName);
108}
109
110TEST(TestReflectsSpecifiedSuiteName)
111{
112    Test test("test", "testSuite");
113    CHECK(test.m_details.suiteName != NULL);
114    CHECK_EQUAL("testSuite", test.m_details.suiteName);
115}
116
117void Fail()
118{
119   CHECK(false);
120}
121
122TEST(OutOfCoreCHECKMacrosCanFailTests)
123{
124   TestResults results;
125   {
126      ScopedCurrentTest scopedResult(results);
127      Fail();
128   }
129
130   CHECK_EQUAL(1, results.GetFailureCount());
131}
132
133}
trunk/3rdparty/unittest-cpp/tests/TestTestList.cpp
r0r249095
1#include "UnitTest++/UnitTestPP.h"
2#include "UnitTest++/TestList.h"
3
4using namespace UnitTest;
5
6namespace {
7
8
9TEST(TestListIsEmptyByDefault)
10{
11    TestList list;
12    CHECK(list.GetHead() == 0);
13}
14
15TEST(AddingTestSetsHeadToTest)
16{
17    Test test("test");
18    TestList list;
19    list.Add(&test);
20
21    CHECK(list.GetHead() == &test);
22    CHECK(test.m_nextTest == 0);
23}
24
25TEST(AddingSecondTestAddsItToEndOfList)
26{
27    Test test1("test1");
28    Test test2("test2");
29
30    TestList list;
31    list.Add(&test1);
32    list.Add(&test2);
33
34    CHECK(list.GetHead() == &test1);
35    CHECK(test1.m_nextTest == &test2);
36    CHECK(test2.m_nextTest == 0);
37}
38
39TEST(ListAdderAddsTestToList)
40{
41    TestList list;
42
43    Test test("");   
44    ListAdder adder(list, &test);
45
46    CHECK(list.GetHead() == &test);
47    CHECK(test.m_nextTest == 0);
48}
49
50}
trunk/3rdparty/unittest-cpp/tests/TestTestMacros.cpp
r0r249095
1#include "UnitTest++/UnitTestPP.h"
2#include "UnitTest++/TestMacros.h"
3#include "UnitTest++/TestList.h"
4#include "UnitTest++/TestResults.h"
5#include "UnitTest++/TestReporter.h"
6#include "UnitTest++/ReportAssert.h"
7#include "RecordingReporter.h"
8#include "ScopedCurrentTest.h"
9
10using namespace UnitTest;
11using namespace std;
12
13namespace {
14
15TestList list1;
16TEST_EX(DummyTest, list1)
17{
18}
19
20TEST (TestsAreAddedToTheListThroughMacro)
21{
22    CHECK(list1.GetHead() != 0);
23    CHECK(list1.GetHead()->m_nextTest == 0);
24}
25
26#ifndef UNITTEST_NO_EXCEPTIONS
27
28struct ThrowingThingie
29{
30    ThrowingThingie() : dummy(false)
31    {
32        if (!dummy)
33            throw "Oops";
34    }
35
36    bool dummy;
37};
38
39TestList list2;
40TEST_FIXTURE_EX(ThrowingThingie, DummyTestName, list2)
41{
42}
43
44TEST (ExceptionsInFixtureAreReportedAsHappeningInTheFixture)
45{
46    RecordingReporter reporter;
47    TestResults result(&reporter);
48   {
49      ScopedCurrentTest scopedResults(result);
50      list2.GetHead()->Run();
51   }
52
53    CHECK(strstr(reporter.lastFailedMessage, "xception"));
54    CHECK(strstr(reporter.lastFailedMessage, "fixture"));
55    CHECK(strstr(reporter.lastFailedMessage, "ThrowingThingie"));
56}
57
58#endif
59
60struct DummyFixture
61{
62    int x;
63};
64
65// We're really testing the macros so we just want them to compile and link
66SUITE(TestSuite1)
67{
68   TEST(SimilarlyNamedTestsInDifferentSuitesWork)
69   {
70   }
71
72   TEST_FIXTURE(DummyFixture, SimilarlyNamedFixtureTestsInDifferentSuitesWork)
73   {
74   }
75}
76
77SUITE(TestSuite2)
78{
79   TEST(SimilarlyNamedTestsInDifferentSuitesWork)
80   {
81   }
82
83   TEST_FIXTURE(DummyFixture,SimilarlyNamedFixtureTestsInDifferentSuitesWork)
84   {
85   }
86}
87
88TestList macroTestList1;
89TEST_EX(MacroTestHelper1, macroTestList1)
90{
91}
92
93TEST(TestAddedWithTEST_EXMacroGetsDefaultSuite)
94{
95    CHECK(macroTestList1.GetHead() != NULL);
96    CHECK_EQUAL ("MacroTestHelper1", macroTestList1.GetHead()->m_details.testName);
97    CHECK_EQUAL ("DefaultSuite", macroTestList1.GetHead()->m_details.suiteName);
98}
99
100TestList macroTestList2;
101TEST_FIXTURE_EX(DummyFixture, MacroTestHelper2, macroTestList2)
102{
103}
104
105TEST(TestAddedWithTEST_FIXTURE_EXMacroGetsDefaultSuite)
106{
107    CHECK(macroTestList2.GetHead() != NULL);
108    CHECK_EQUAL ("MacroTestHelper2", macroTestList2.GetHead()->m_details.testName);
109    CHECK_EQUAL ("DefaultSuite", macroTestList2.GetHead()->m_details.suiteName);
110}
111
112#ifndef UNITTEST_NO_EXCEPTIONS
113
114struct FixtureCtorThrows
115{
116   FixtureCtorThrows()   { throw "exception"; }
117};
118
119TestList throwingFixtureTestList1;
120TEST_FIXTURE_EX(FixtureCtorThrows, FixtureCtorThrowsTestName, throwingFixtureTestList1)
121{
122}
123
124TEST(FixturesWithThrowingCtorsAreFailures)
125{
126   CHECK(throwingFixtureTestList1.GetHead() != NULL);
127   RecordingReporter reporter;
128   TestResults result(&reporter);
129   {
130      ScopedCurrentTest scopedResult(result);
131      throwingFixtureTestList1.GetHead()->Run();
132   }
133
134   int const failureCount = result.GetFailedTestCount();
135   CHECK_EQUAL(1, failureCount);
136   CHECK(strstr(reporter.lastFailedMessage, "while constructing fixture"));
137}
138
139struct FixtureDtorThrows
140{
141   ~FixtureDtorThrows() { throw "exception"; }
142};
143
144TestList throwingFixtureTestList2;
145TEST_FIXTURE_EX(FixtureDtorThrows, FixtureDtorThrowsTestName, throwingFixtureTestList2)
146{
147}
148
149TEST(FixturesWithThrowingDtorsAreFailures)
150{
151   CHECK(throwingFixtureTestList2.GetHead() != NULL);
152
153   RecordingReporter reporter;
154   TestResults result(&reporter);
155   {
156      ScopedCurrentTest scopedResult(result);
157      throwingFixtureTestList2.GetHead()->Run();
158   }
159
160   int const failureCount = result.GetFailedTestCount();
161   CHECK_EQUAL(1, failureCount);
162   CHECK(strstr(reporter.lastFailedMessage, "while destroying fixture"));
163}
164
165const int FailingLine = 123;
166
167struct FixtureCtorAsserts
168{
169   FixtureCtorAsserts()
170   {
171      UnitTest::ReportAssert("assert failure", "file", FailingLine);
172   }
173};
174
175TestList ctorAssertFixtureTestList;
176TEST_FIXTURE_EX(FixtureCtorAsserts, CorrectlyReportsAssertFailureInCtor, ctorAssertFixtureTestList)
177{
178}
179
180TEST(CorrectlyReportsFixturesWithCtorsThatAssert)
181{
182   RecordingReporter reporter;
183   TestResults result(&reporter);
184   {
185      ScopedCurrentTest scopedResults(result);
186      ctorAssertFixtureTestList.GetHead()->Run();
187   }
188
189   const int failureCount = result.GetFailedTestCount();
190   CHECK_EQUAL(1, failureCount);
191   CHECK_EQUAL(FailingLine, reporter.lastFailedLine);
192   CHECK(strstr(reporter.lastFailedMessage, "assert failure"));
193}
194
195#endif
196
197}
198
199// We're really testing if it's possible to use the same suite in two files
200// to compile and link successfuly (TestTestSuite.cpp has suite with the same name)
201// Note: we are outside of the anonymous namespace
202SUITE(SameTestSuite)
203{
204   TEST(DummyTest1)
205   {
206   }
207}
208
209#define CUR_TEST_NAME CurrentTestDetailsContainCurrentTestInfo
210#define INNER_STRINGIFY(X) #X
211#define STRINGIFY(X) INNER_STRINGIFY(X)
212
213TEST(CUR_TEST_NAME)
214{
215   const UnitTest::TestDetails* details = CurrentTest::Details();
216   CHECK_EQUAL(STRINGIFY(CUR_TEST_NAME), details->testName);
217}
218
219#undef CUR_TEST_NAME
220#undef INNER_STRINGIFY
221#undef STRINGIFY
trunk/3rdparty/unittest-cpp/tests/TestTestResults.cpp
r0r249095
1#include "UnitTest++/UnitTestPP.h"
2#include "UnitTest++/TestResults.h"
3#include "RecordingReporter.h"
4
5using namespace UnitTest;
6
7namespace {
8
9TestDetails const details("testname", "suitename", "filename", 123);
10
11
12TEST(StartsWithNoTestsRun)
13{
14    TestResults results;
15    CHECK_EQUAL (0, results.GetTotalTestCount());
16}
17
18TEST(RecordsNumbersOfTests)
19{
20    TestResults results;
21    results.OnTestStart(details);
22    results.OnTestStart(details);
23    results.OnTestStart(details);
24    CHECK_EQUAL(3, results.GetTotalTestCount());
25}
26
27TEST(StartsWithNoTestsFailing)
28{
29    TestResults results;
30    CHECK_EQUAL (0, results.GetFailureCount());
31}
32
33TEST(RecordsNumberOfFailures)
34{
35    TestResults results;
36    results.OnTestFailure(details, "");
37    results.OnTestFailure(details, "");
38    CHECK_EQUAL(2, results.GetFailureCount());
39}
40
41TEST(RecordsNumberOfFailedTests)
42{
43    TestResults results;
44
45    results.OnTestStart(details);
46    results.OnTestFailure(details, "");
47    results.OnTestFinish(details, 0);
48
49    results.OnTestStart(details);
50    results.OnTestFailure(details, "");
51    results.OnTestFailure(details, "");
52    results.OnTestFailure(details, "");
53    results.OnTestFinish(details, 0);
54
55    CHECK_EQUAL (2, results.GetFailedTestCount());
56}
57
58TEST(NotifiesReporterOfTestStartWithCorrectInfo)
59{
60    RecordingReporter reporter;
61    TestResults results(&reporter);
62    results.OnTestStart(details);
63
64    CHECK_EQUAL (1, reporter.testRunCount);
65    CHECK_EQUAL ("suitename", reporter.lastStartedSuite);
66    CHECK_EQUAL ("testname", reporter.lastStartedTest);
67}
68
69TEST(NotifiesReporterOfTestFailureWithCorrectInfo)
70{
71    RecordingReporter reporter;
72    TestResults results(&reporter);
73
74    results.OnTestFailure(details, "failurestring");
75    CHECK_EQUAL (1, reporter.testFailedCount);
76    CHECK_EQUAL ("filename", reporter.lastFailedFile);
77    CHECK_EQUAL (123, reporter.lastFailedLine);
78    CHECK_EQUAL ("suitename", reporter.lastFailedSuite);
79    CHECK_EQUAL ("testname", reporter.lastFailedTest);
80    CHECK_EQUAL ("failurestring", reporter.lastFailedMessage);
81}
82
83TEST(NotifiesReporterOfCheckFailureWithCorrectInfo)
84{
85    RecordingReporter reporter;
86    TestResults results(&reporter);
87
88    results.OnTestFailure(details, "failurestring");
89    CHECK_EQUAL (1, reporter.testFailedCount);
90
91    CHECK_EQUAL ("filename", reporter.lastFailedFile);
92    CHECK_EQUAL (123, reporter.lastFailedLine);
93    CHECK_EQUAL ("testname", reporter.lastFailedTest);
94    CHECK_EQUAL ("suitename", reporter.lastFailedSuite);
95    CHECK_EQUAL ("failurestring", reporter.lastFailedMessage);
96}
97
98TEST(NotifiesReporterOfTestEnd)
99{
100    RecordingReporter reporter;
101    TestResults results(&reporter);
102
103    results.OnTestFinish(details, 0.1234f);
104    CHECK_EQUAL (1, reporter.testFinishedCount);
105    CHECK_EQUAL ("testname", reporter.lastFinishedTest);
106    CHECK_EQUAL ("suitename", reporter.lastFinishedSuite);
107    CHECK_CLOSE (0.1234f, reporter.lastFinishedTestTime, 0.0001f);
108}
109
110
111}
trunk/3rdparty/unittest-cpp/tests/TestTestRunner.cpp
r0r249095
1#include "UnitTest++/UnitTestPP.h"
2#include "RecordingReporter.h"
3#include "UnitTest++/ReportAssert.h"
4#include "UnitTest++/TestList.h"
5#include "UnitTest++/TimeHelpers.h"
6#include "UnitTest++/TimeConstraint.h"
7#include "UnitTest++/ReportAssertImpl.h"
8
9using namespace UnitTest;
10
11namespace
12{
13   
14    struct MockTest : public Test
15    {
16        MockTest(char const* testName, bool const success_, bool const assert_, int const count_ = 1)
17        : Test(testName)
18        , success(success_)
19        , asserted(assert_)
20        , count(count_)
21        {
22        }
23       
24        virtual void RunImpl() const
25        {
26            TestResults& testResults_ = *CurrentTest::Results();
27
28            for (int i=0; i < count; ++i)
29            {
30                if (asserted)
31                {
32                    ReportAssert("desc", "file", 0);
33                }
34                else if (!success)
35                {
36                    testResults_.OnTestFailure(m_details, "message");
37                }
38            }
39        }
40       
41        bool const success;
42        bool const asserted;
43        int const count;
44    };
45   
46    struct FixtureBase
47    {
48        FixtureBase()
49        : runner(reporter)
50        {
51        }
52
53        template <class Predicate>
54        int RunTestsIf(TestList const& list, char const* suiteName,
55                       const Predicate& predicate, int maxTestTimeInMs)
56        {
57            TestResults* oldResults = CurrentTest::Results();
58            const TestDetails* oldDetails = CurrentTest::Details();
59            int result = runner.RunTestsIf(list, suiteName, predicate, maxTestTimeInMs);
60            CurrentTest::Results() = oldResults;
61            CurrentTest::Details() = oldDetails;
62            return result;
63        }
64
65        TestRunner runner;
66        RecordingReporter reporter;
67    };
68   
69    struct TestRunnerFixture : public FixtureBase
70    {
71        TestList list;
72    };
73   
74    TEST_FIXTURE(TestRunnerFixture, TestStartIsReportedCorrectly)
75    {
76        MockTest test("goodtest", true, false);
77        list.Add(&test);
78       
79        RunTestsIf(list, NULL, True(), 0);
80        CHECK_EQUAL(1, reporter.testRunCount);
81        CHECK_EQUAL("goodtest", reporter.lastStartedTest);
82    }
83   
84    TEST_FIXTURE(TestRunnerFixture, TestFinishIsReportedCorrectly)
85    {
86        MockTest test("goodtest", true, false);
87        list.Add(&test);
88       
89        RunTestsIf(list, NULL, True(), 0);
90        CHECK_EQUAL(1, reporter.testFinishedCount);
91        CHECK_EQUAL("goodtest", reporter.lastFinishedTest);
92    }
93   
94    class SlowTest : public Test
95    {
96    public:
97        SlowTest()
98        : Test("slow", "somesuite", "filename", 123)
99        {
100        }
101       
102        virtual void RunImpl() const
103        {
104            TimeHelpers::SleepMs(20);
105        }
106    };
107   
108    TEST_FIXTURE(TestRunnerFixture, TestFinishIsCalledWithCorrectTime)
109    {
110        SlowTest test;
111        list.Add(&test);
112       
113        RunTestsIf(list, NULL, True(), 0);
114        CHECK(reporter.lastFinishedTestTime >= 0.005f && reporter.lastFinishedTestTime <= 0.050f);
115    }
116   
117    TEST_FIXTURE(TestRunnerFixture, FailureCountIsZeroWhenNoTestsAreRun)
118    {
119        CHECK_EQUAL(0, RunTestsIf(list, NULL, True(), 0));
120        CHECK_EQUAL(0, reporter.testRunCount);
121        CHECK_EQUAL(0, reporter.testFailedCount);
122    }
123   
124    TEST_FIXTURE(TestRunnerFixture, CallsReportFailureOncePerFailingTest)
125    {
126        MockTest test1("test", false, false);
127        list.Add(&test1);
128        MockTest test2("test", true, false);
129        list.Add(&test2);
130        MockTest test3("test", false, false);
131        list.Add(&test3);
132       
133        CHECK_EQUAL(2, RunTestsIf(list, NULL, True(), 0));
134        CHECK_EQUAL(2, reporter.testFailedCount);
135    }
136   
137    TEST_FIXTURE(TestRunnerFixture, TestsThatAssertAreReportedAsFailing)
138    {
139        MockTest test("test", true, true);
140        list.Add(&test);
141       
142        RunTestsIf(list, NULL, True(), 0);
143        CHECK_EQUAL(1, reporter.testFailedCount);
144    }
145   
146   
147    TEST_FIXTURE(TestRunnerFixture, ReporterNotifiedOfTestCount)
148    {
149        MockTest test1("test", true, false);
150        MockTest test2("test", true, false);
151        MockTest test3("test", true, false);
152        list.Add(&test1);
153        list.Add(&test2);
154        list.Add(&test3);
155       
156        RunTestsIf(list, NULL, True(), 0);
157        CHECK_EQUAL(3, reporter.summaryTotalTestCount);
158    }
159   
160    TEST_FIXTURE(TestRunnerFixture, ReporterNotifiedOfFailedTests)
161    {
162        MockTest test1("test", false, false, 2);
163        MockTest test2("test", true, false);
164        MockTest test3("test", false, false, 3);
165        list.Add(&test1);
166        list.Add(&test2);
167        list.Add(&test3);
168       
169        RunTestsIf(list, NULL, True(), 0);
170        CHECK_EQUAL(2, reporter.summaryFailedTestCount);
171    }
172   
173    TEST_FIXTURE(TestRunnerFixture, ReporterNotifiedOfFailures)
174    {
175        MockTest test1("test", false, false, 2);
176        MockTest test2("test", true, false);
177        MockTest test3("test", false, false, 3);
178        list.Add(&test1);
179        list.Add(&test2);
180        list.Add(&test3);
181       
182        RunTestsIf(list, NULL, True(), 0);
183        CHECK_EQUAL(5, reporter.summaryFailureCount);
184    }
185   
186    TEST_FIXTURE(TestRunnerFixture, SlowTestPassesForHighTimeThreshold)
187    {
188        SlowTest test;
189        list.Add(&test);
190       
191        RunTestsIf(list, NULL, True(), 0);
192        CHECK_EQUAL(0, reporter.testFailedCount);
193    }
194   
195    TEST_FIXTURE(TestRunnerFixture, SlowTestFailsForLowTimeThreshold)
196    {
197        SlowTest test;
198        list.Add(&test);
199       
200        RunTestsIf(list, NULL, True(), 3);
201        CHECK_EQUAL(1, reporter.testFailedCount);
202    }
203   
204    TEST_FIXTURE(TestRunnerFixture, SlowTestHasCorrectFailureInformation)
205    {
206        SlowTest test;
207        list.Add(&test);
208       
209        RunTestsIf(list, NULL, True(), 3);
210       
211        using namespace std;
212       
213        CHECK_EQUAL(test.m_details.testName, reporter.lastFailedTest);
214        CHECK(strstr(test.m_details.filename, reporter.lastFailedFile));
215        CHECK_EQUAL(test.m_details.lineNumber, reporter.lastFailedLine);
216       
217        CHECK(strstr(reporter.lastFailedMessage, "Global time constraint failed"));
218        CHECK(strstr(reporter.lastFailedMessage, "3ms"));
219    }
220   
221    TEST_FIXTURE(TestRunnerFixture, SlowTestWithTimeExemptionPasses)
222    {
223        class SlowExemptedTest : public Test
224        {
225        public:
226            SlowExemptedTest() : Test("slowexempted", "", 0) {}
227            virtual void RunImpl() const
228            {
229                UNITTEST_TIME_CONSTRAINT_EXEMPT();
230                TimeHelpers::SleepMs(20);
231            }
232        };
233       
234        SlowExemptedTest test;
235        list.Add(&test);
236       
237        RunTestsIf(list, NULL, True(), 3);
238        CHECK_EQUAL(0, reporter.testFailedCount);
239    }
240   
241    struct TestSuiteFixture : FixtureBase
242    {
243        TestSuiteFixture()
244        : test1("TestInDefaultSuite")
245        , test2("TestInOtherSuite", "OtherSuite")
246        , test3("SecondTestInDefaultSuite")
247        {
248            list.Add(&test1);
249            list.Add(&test2);
250        }
251       
252        Test test1;
253        Test test2;
254        Test test3;
255        TestList list;
256    };
257   
258    TEST_FIXTURE(TestSuiteFixture, TestRunnerRunsAllSuitesIfNullSuiteIsPassed)
259    {
260        RunTestsIf(list, NULL, True(), 0);
261        CHECK_EQUAL(2, reporter.summaryTotalTestCount);
262    }
263   
264    TEST_FIXTURE(TestSuiteFixture,TestRunnerRunsOnlySpecifiedSuite)
265    {
266        RunTestsIf(list, "OtherSuite", True(), 0);
267        CHECK_EQUAL(1, reporter.summaryTotalTestCount);
268        CHECK_EQUAL("TestInOtherSuite", reporter.lastFinishedTest);
269    }
270   
271    struct RunTestIfNameIs
272    {
273        RunTestIfNameIs(char const* name_)
274        : name(name_)
275        {
276        }
277       
278        bool operator()(const Test* const test) const
279        {
280            using namespace std;
281            return (0 == strcmp(test->m_details.testName, name));
282        }
283       
284        char const* name;
285    };
286   
287    TEST(TestMockPredicateBehavesCorrectly)
288    {
289        RunTestIfNameIs predicate("pass");
290       
291        Test pass("pass");
292        Test fail("fail");
293       
294        CHECK(predicate(&pass));
295        CHECK(!predicate(&fail));   
296    }
297   
298    TEST_FIXTURE(TestRunnerFixture, TestRunnerRunsTestsThatPassPredicate)
299    {
300        Test should_run("goodtest");
301        list.Add(&should_run);
302       
303        Test should_not_run("badtest");
304        list.Add(&should_not_run);
305       
306        RunTestsIf(list, NULL, RunTestIfNameIs("goodtest"), 0);
307        CHECK_EQUAL(1, reporter.testRunCount);
308        CHECK_EQUAL("goodtest", reporter.lastStartedTest);
309    }
310   
311    TEST_FIXTURE(TestRunnerFixture, TestRunnerOnlyRunsTestsInSpecifiedSuiteAndThatPassPredicate)
312    {
313        Test runningTest1("goodtest", "suite");
314        Test skippedTest2("goodtest");
315        Test skippedTest3("badtest", "suite");
316        Test skippedTest4("badtest");
317       
318        list.Add(&runningTest1);
319        list.Add(&skippedTest2);
320        list.Add(&skippedTest3);
321        list.Add(&skippedTest4);
322       
323        RunTestsIf(list, "suite", RunTestIfNameIs("goodtest"), 0);
324       
325        CHECK_EQUAL(1, reporter.testRunCount);
326        CHECK_EQUAL("goodtest", reporter.lastStartedTest);
327        CHECK_EQUAL("suite", reporter.lastStartedSuite);
328    }
329   
330}
No newline at end of file
trunk/3rdparty/unittest-cpp/tests/TestTestSuite.cpp
r0r249095
1#include "UnitTest++/UnitTestPP.h"
2
3// We're really testing if it's possible to use the same suite in two files
4// to compile and link successfuly (TestTestSuite.cpp has suite with the same name)
5// Note: we are outside of the anonymous namespace
6SUITE(SameTestSuite)
7{
8    TEST(DummyTest2)
9    {
10    }
11}
12
trunk/3rdparty/unittest-cpp/tests/TestTimeConstraint.cpp
r0r249095
1#include "UnitTest++/UnitTestPP.h"
2#include "UnitTest++/TestResults.h"
3#include "UnitTest++/TimeHelpers.h"
4#include "RecordingReporter.h"
5#include "ScopedCurrentTest.h"
6
7using namespace UnitTest;
8
9namespace
10{
11
12TEST(TimeConstraintSucceedsWithFastTest)
13{
14    TestResults result;
15    {
16      ScopedCurrentTest scopedResult(result);
17        TimeConstraint t(200, TestDetails("", "", "", 0));
18        TimeHelpers::SleepMs(5);
19    }
20    CHECK_EQUAL(0, result.GetFailureCount());
21}
22
23TEST(TimeConstraintFailsWithSlowTest)
24{
25    TestResults result;
26    {
27      ScopedCurrentTest scopedResult(result);
28        TimeConstraint t(10, TestDetails("", "", "", 0));
29        TimeHelpers::SleepMs(20);
30    }
31    CHECK_EQUAL(1, result.GetFailureCount());
32}
33
34TEST(TimeConstraintFailureIncludesCorrectData)
35{
36    RecordingReporter reporter;
37    TestResults result(&reporter);
38    {
39      ScopedCurrentTest scopedResult(result);
40
41      TestDetails const details("testname", "suitename", "filename", 10);
42        TimeConstraint t(10, details);
43        TimeHelpers::SleepMs(20);
44    }
45
46   using namespace std;
47
48   CHECK(strstr(reporter.lastFailedFile, "filename"));
49    CHECK_EQUAL(10, reporter.lastFailedLine);
50    CHECK(strstr(reporter.lastFailedTest, "testname"));
51}
52
53TEST(TimeConstraintFailureIncludesTimeoutInformation)
54{
55    RecordingReporter reporter;
56    TestResults result(&reporter);
57    {
58      ScopedCurrentTest scopedResult(result);
59        TimeConstraint t(10, TestDetails("", "", "", 0));
60        TimeHelpers::SleepMs(20);
61    }
62
63   using namespace std;
64
65   CHECK(strstr(reporter.lastFailedMessage, "ime constraint"));
66    CHECK(strstr(reporter.lastFailedMessage, "under 10ms"));
67}
68
69}
trunk/3rdparty/unittest-cpp/tests/TestTimeConstraintMacro.cpp
r0r249095
1#include "UnitTest++/UnitTestPP.h"
2#include "UnitTest++/TimeHelpers.h"
3
4#include "RecordingReporter.h"
5#include "ScopedCurrentTest.h"
6
7namespace {
8
9TEST(TimeConstraintMacroQualifiesNamespace)
10{
11    // If this compiles without a "using namespace UnitTest;", all is well.
12    UNITTEST_TIME_CONSTRAINT(1);
13}
14
15TEST(TimeConstraintMacroUsesCorrectInfo)
16{
17    int testLine = 0;
18    RecordingReporter reporter;
19
20    {
21      UnitTest::TestResults testResults(&reporter);
22      ScopedCurrentTest scopedResults(testResults);
23
24      UNITTEST_TIME_CONSTRAINT(10);  testLine = __LINE__;
25      UnitTest::TimeHelpers::SleepMs(20);
26    }
27
28    using namespace std;
29
30    CHECK_EQUAL(1, reporter.testFailedCount);
31    CHECK(strstr(reporter.lastFailedFile, __FILE__));
32    CHECK_EQUAL(testLine, reporter.lastFailedLine);
33    CHECK(strstr(reporter.lastFailedTest, "TimeConstraintMacroUsesCorrectInfo"));
34}
35
36TEST(TimeConstraintMacroComparesAgainstPreciseActual)
37{
38    int testLine = 0;
39    RecordingReporter reporter;
40
41   {
42      UnitTest::TestResults testResults(&reporter);
43      ScopedCurrentTest scopedResults(testResults);
44
45      UNITTEST_TIME_CONSTRAINT(1);  testLine = __LINE__;
46
47      // start a new timer and run until we're as little over the 1 msec
48      // threshold as we can achieve; this should guarantee that the "test"
49      // runs in some very small amount of time > 1 msec
50      UnitTest::Timer myTimer;
51      myTimer.Start();
52
53      while (myTimer.GetTimeInMs() < 1.001)
54         UnitTest::TimeHelpers::SleepMs(0);
55   }
56
57    using namespace std;
58
59    CHECK_EQUAL(1, reporter.testFailedCount);
60    CHECK(strstr(reporter.lastFailedFile, __FILE__));
61    CHECK_EQUAL(testLine, reporter.lastFailedLine);
62    CHECK(strstr(reporter.lastFailedTest, "TimeConstraintMacroComparesAgainstPreciseActual"));
63}
64
65struct EmptyFixture {};
66
67TEST_FIXTURE(EmptyFixture, TimeConstraintMacroWorksInFixtures)
68{
69    int testLine = 0;
70    RecordingReporter reporter;
71
72    {
73      UnitTest::TestResults testResults(&reporter);
74      ScopedCurrentTest scopedResults(testResults);
75
76      UNITTEST_TIME_CONSTRAINT(10);  testLine = __LINE__;
77      UnitTest::TimeHelpers::SleepMs(20);
78    }
79
80    using namespace std;
81
82    CHECK_EQUAL(1, reporter.testFailedCount);
83    CHECK(strstr(reporter.lastFailedFile, __FILE__));
84    CHECK_EQUAL(testLine, reporter.lastFailedLine);
85    CHECK(strstr(reporter.lastFailedTest, "TimeConstraintMacroWorksInFixtures"));
86}
87
88}
trunk/3rdparty/unittest-cpp/tests/TestUnitTestPP.cpp
r0r249095
1#include "UnitTest++/UnitTestPP.h"
2#include "ScopedCurrentTest.h"
3
4// These are sample tests that show the different features of the framework
5
6namespace {
7
8TEST(ValidCheckSucceeds)
9{
10    bool const b = true;
11    CHECK(b);
12}
13
14TEST(CheckWorksWithPointers)
15{
16    void* p = (void *)0x100;
17    CHECK(p);
18    CHECK(p != 0);
19}
20
21TEST(ValidCheckEqualSucceeds)
22{
23    int const x = 3;
24    int const y = 3;
25    CHECK_EQUAL(x, y);
26}
27
28TEST(CheckEqualWorksWithPointers)
29{
30    void* p = (void *)0;
31    CHECK_EQUAL((void*)0, p);
32}
33
34TEST(ValidCheckCloseSucceeds)
35{
36    CHECK_CLOSE(2.0f, 2.001f, 0.01f);
37    CHECK_CLOSE(2.001f, 2.0f, 0.01f);
38}
39
40TEST(ArrayCloseSucceeds)
41{
42    float const a1[] = {1, 2, 3};
43    float const a2[] = {1, 2.01f, 3};
44    CHECK_ARRAY_CLOSE(a1, a2, 3, 0.1f);
45}
46
47#ifndef UNITTEST_NO_EXCEPTIONS
48
49TEST(CheckThrowMacroSucceedsOnCorrectException)
50{
51    struct TestException {};
52    CHECK_THROW(throw TestException(), TestException);
53}
54
55TEST(CheckAssertSucceeds)
56{
57    CHECK_ASSERT(UnitTest::ReportAssert("desc", "file", 0));
58}
59
60TEST(CheckThrowMacroFailsOnMissingException)
61{
62    class NoThrowTest : public UnitTest::Test
63    {
64    public:
65        NoThrowTest() : Test("nothrow") {}
66        void DontThrow() const
67        {
68        }
69
70        virtual void RunImpl() const
71        {
72            CHECK_THROW(DontThrow(), int);
73        }
74    };
75
76    UnitTest::TestResults results;
77   {
78      ScopedCurrentTest scopedResults(results);
79
80      NoThrowTest test;
81      test.Run();
82   }
83
84   CHECK_EQUAL(1, results.GetFailureCount());
85}
86
87TEST(CheckThrowMacroFailsOnWrongException)
88{
89    class WrongThrowTest : public UnitTest::Test
90    {
91    public:
92        WrongThrowTest() : Test("wrongthrow") {}
93        virtual void RunImpl() const
94        {
95            CHECK_THROW(throw "oops", int);
96        }
97    };
98
99    UnitTest::TestResults results;
100   {
101      ScopedCurrentTest scopedResults(results);
102
103      WrongThrowTest test;
104      test.Run();
105   }
106
107   CHECK_EQUAL(1, results.GetFailureCount());
108}
109
110#endif
111
112struct SimpleFixture
113{
114    SimpleFixture()
115    {
116        ++instanceCount;
117    }
118    ~SimpleFixture()
119    {
120        --instanceCount;
121    }
122
123    static int instanceCount;
124};
125
126int SimpleFixture::instanceCount = 0;
127
128TEST_FIXTURE(SimpleFixture, DefaultFixtureCtorIsCalled)
129{
130    CHECK(SimpleFixture::instanceCount > 0);
131}
132
133TEST_FIXTURE(SimpleFixture, OnlyOneFixtureAliveAtATime)
134{
135    CHECK_EQUAL(1, SimpleFixture::instanceCount);
136}
137
138void CheckBool(const bool b)
139{
140   CHECK(b);
141}
142
143TEST(CanCallCHECKOutsideOfTestFunction)
144{
145   CheckBool(true);
146}
147
148}
trunk/3rdparty/unittest-cpp/tests/TestXmlTestReporter.cpp
r0r249095
1#include "UnitTest++/Config.h"
2#ifndef UNITTEST_NO_DEFERRED_REPORTER
3
4#include "UnitTest++/UnitTestPP.h"
5#include "UnitTest++/XmlTestReporter.h"
6
7#include <sstream>
8
9using namespace UnitTest;
10using std::ostringstream;
11
12namespace
13{
14
15#ifndef UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM
16
17// Overload to let MemoryOutStream accept std::string
18MemoryOutStream& operator<<(MemoryOutStream& s, const std::string& value)
19{
20    s << value.c_str();
21    return s;
22}
23
24#endif
25
26struct XmlTestReporterFixture
27{
28    XmlTestReporterFixture()
29        : reporter(output)
30    {
31    }
32
33    ostringstream output;
34    XmlTestReporter reporter;
35};
36
37TEST_FIXTURE(XmlTestReporterFixture, MultipleCharactersAreEscaped)
38{
39    TestDetails const details("TestName", "suite", "filename.h", 4321);
40
41    reporter.ReportTestStart(details);
42    reporter.ReportFailure(details, "\"\"\'\'&&<<>>");
43    reporter.ReportTestFinish(details, 0.1f);
44    reporter.ReportSummary(1, 2, 3, 0.1f);
45
46    char const* expected =
47        "<?xml version=\"1.0\"?>"
48        "<unittest-results tests=\"1\" failedtests=\"2\" failures=\"3\" time=\"0.1\">"
49        "<test suite=\"suite\" name=\"TestName\" time=\"0.1\">"
50        "<failure message=\"filename.h(4321) : "
51        "&quot;&quot;&apos;&apos;&amp;&amp;&lt;&lt;&gt;&gt;\"/>"
52        "</test>"
53        "</unittest-results>";
54
55    CHECK_EQUAL(expected, output.str().c_str());
56}
57
58TEST_FIXTURE(XmlTestReporterFixture, OutputIsCachedUntilReportSummaryIsCalled)
59{
60    TestDetails const details("", "", "", 0);
61
62    reporter.ReportTestStart(details);
63    reporter.ReportFailure(details, "message");
64    reporter.ReportTestFinish(details, 1.0F);
65    CHECK(output.str().empty());
66
67    reporter.ReportSummary(1, 1, 1, 1.0f);
68    CHECK(!output.str().empty());
69}
70
71TEST_FIXTURE(XmlTestReporterFixture, EmptyReportSummaryFormat)
72{
73    reporter.ReportSummary(0, 0, 0, 0.1f);
74
75    const char *expected =
76      "<?xml version=\"1.0\"?>"
77      "<unittest-results tests=\"0\" failedtests=\"0\" failures=\"0\" time=\"0.1\">"
78      "</unittest-results>";
79
80    CHECK_EQUAL(expected, output.str().c_str());
81}
82
83TEST_FIXTURE(XmlTestReporterFixture, SingleSuccessfulTestReportSummaryFormat)
84{
85    TestDetails const details("TestName", "DefaultSuite", "", 0);
86
87    reporter.ReportTestStart(details);
88    reporter.ReportSummary(1, 0, 0, 0.1f);
89
90    const char *expected =
91      "<?xml version=\"1.0\"?>"
92      "<unittest-results tests=\"1\" failedtests=\"0\" failures=\"0\" time=\"0.1\">"
93      "<test suite=\"DefaultSuite\" name=\"TestName\" time=\"0\"/>"
94      "</unittest-results>";
95
96    CHECK_EQUAL(expected, output.str().c_str());
97}
98
99TEST_FIXTURE(XmlTestReporterFixture, SingleFailedTestReportSummaryFormat)
100{
101    TestDetails const details("A Test", "suite", "A File", 4321);
102
103    reporter.ReportTestStart(details);
104    reporter.ReportFailure(details, "A Failure");
105    reporter.ReportSummary(1, 1, 1, 0.1f);
106
107    const char *expected =
108        "<?xml version=\"1.0\"?>"
109        "<unittest-results tests=\"1\" failedtests=\"1\" failures=\"1\" time=\"0.1\">"
110        "<test suite=\"suite\" name=\"A Test\" time=\"0\">"
111        "<failure message=\"A File(4321) : A Failure\"/>"
112        "</test>"
113        "</unittest-results>";
114
115    CHECK_EQUAL(expected, output.str().c_str());
116}
117
118TEST_FIXTURE(XmlTestReporterFixture, FailureMessageIsXMLEscaped)
119{
120    TestDetails const details("TestName", "suite", "filename.h", 4321);
121
122    reporter.ReportTestStart(details);
123    reporter.ReportFailure(details, "\"\'&<>");
124    reporter.ReportTestFinish(details, 0.1f);
125    reporter.ReportSummary(1, 1, 1, 0.1f);
126
127    char const* expected =
128        "<?xml version=\"1.0\"?>"
129        "<unittest-results tests=\"1\" failedtests=\"1\" failures=\"1\" time=\"0.1\">"
130        "<test suite=\"suite\" name=\"TestName\" time=\"0.1\">"
131        "<failure message=\"filename.h(4321) : &quot;&apos;&amp;&lt;&gt;\"/>"
132        "</test>"
133        "</unittest-results>";
134
135    CHECK_EQUAL(expected, output.str().c_str());
136}
137
138TEST_FIXTURE(XmlTestReporterFixture, OneFailureAndOneSuccess)
139{
140    TestDetails const failedDetails("FailedTest", "suite", "fail.h", 1);
141    reporter.ReportTestStart(failedDetails);
142    reporter.ReportFailure(failedDetails, "expected 1 but was 2");
143    reporter.ReportTestFinish(failedDetails, 0.1f);
144
145    TestDetails const succeededDetails("SucceededTest", "suite", "", 0);
146    reporter.ReportTestStart(succeededDetails);
147    reporter.ReportTestFinish(succeededDetails, 1.0f);
148    reporter.ReportSummary(2, 1, 1, 1.1f);
149
150    char const* expected =
151        "<?xml version=\"1.0\"?>"
152        "<unittest-results tests=\"2\" failedtests=\"1\" failures=\"1\" time=\"1.1\">"
153        "<test suite=\"suite\" name=\"FailedTest\" time=\"0.1\">"
154        "<failure message=\"fail.h(1) : expected 1 but was 2\"/>"
155        "</test>"
156        "<test suite=\"suite\" name=\"SucceededTest\" time=\"1\"/>"
157        "</unittest-results>";
158
159    CHECK_EQUAL(expected, output.str().c_str());
160}
161
162TEST_FIXTURE(XmlTestReporterFixture, MultipleFailures)
163{
164    TestDetails const failedDetails1("FailedTest", "suite", "fail.h", 1);
165    TestDetails const failedDetails2("FailedTest", "suite", "fail.h", 31);
166
167    reporter.ReportTestStart(failedDetails1);
168    reporter.ReportFailure(failedDetails1, "expected 1 but was 2");
169    reporter.ReportFailure(failedDetails2, "expected one but was two");
170    reporter.ReportTestFinish(failedDetails1, 0.1f);
171
172    reporter.ReportSummary(1, 1, 2, 1.1f);
173
174    char const* expected =
175        "<?xml version=\"1.0\"?>"
176        "<unittest-results tests=\"1\" failedtests=\"1\" failures=\"2\" time=\"1.1\">"
177        "<test suite=\"suite\" name=\"FailedTest\" time=\"0.1\">"
178        "<failure message=\"fail.h(1) : expected 1 but was 2\"/>"
179        "<failure message=\"fail.h(31) : expected one but was two\"/>"
180        "</test>"
181        "</unittest-results>";
182
183    CHECK_EQUAL(expected, output.str().c_str());
184}
185
186}
187
188#endif
trunk/hash/a800_flop.xml
r249094r249095
2424      </part>
2525   </software>
2626
27   <software name="elktrgld">
28      <!-- Flippy disk, c64 version on side A -->
29      <description>Elektra Glide</description>
30      <year>1986</year>
31      <publisher>Mastertronic</publisher>
32      <info name="serial" value="64712" />
3327
34      <part name="flop1" interface="floppy_5_25">
35         <dataarea name="flop" size="92160">
36            <rom name="elektraglide.xfd" size="92160" crc="96185b1c" sha1="fb9825a432b83a2a7e623a2f617d0fa11de08158" offset="0" />
37         </dataarea>
38      </part>
39   </software>
40
41   <software name="koalapnt">
42      <!-- Flippy disk, c64 version on side A -->
43      <description>KoalaPainter (Light Pen)</description>
44      <year>1984</year>
45      <publisher>Koala Technologies</publisher>
46      <info name="serial" value="00626-001" />
47
48      <part name="flop1" interface="floppy_5_25">
49         <dataarea name="flop" size="92160">
50            <rom name="koalapainter.xfd" size="92160" crc="f1447be4" sha1="834d906748f9f4f089912289ab592cf091456d49" offset="0" />
51         </dataarea>
52      </part>
53   </software>
54
5528</softwarelist>
trunk/hash/c64_flop.xml
r249094r249095
602602      </part>
603603   </software>
604604
605   <software name="elktrgld">
606      <!-- Flippy disk, a800 version on side B -->
607      <description>Elektra Glide</description>
608      <year>1986</year>
609      <publisher>Mastertronic</publisher>
610      <info name="serial" value="64712" />
611
612      <part name="flop1" interface="floppy_5_25">
613         <dataarea name="flop" size="287512">
614            <rom name="elektraglide.g64" size="287512" crc="ccb7b7c1" sha1="699bc6111a0f3c26d61c63f7b23eeb7462649461" offset="0" />
615         </dataarea>
616      </part>
617   </software>
618
619   <software name="koalapnt">
620      <!-- Flippy disk, a800 version on side B -->
621      <description>KoalaPainter (Light Pen)</description>
622      <year>1984</year>
623      <publisher>Koala Technologies</publisher>
624      <info name="serial" value="00626-001" />
625
626      <part name="flop1" interface="floppy_5_25">
627         <dataarea name="flop" size="287512">
628            <rom name="koalapainter.g64" size="287512" crc="56f06305" sha1="a4bb43f8f46c3e733e4a2ab7f6cdfa8483159df5" offset="0" />
629         </dataarea>
630      </part>
631   </software>
632
633605   <!-- Test/Demo disks -->
634606
635607   <software name="1541demo">
trunk/hash/megadriv.xml
r249094r249095
1620416204      <info name="release" value="19920710"/>
1620516205      <info name="alt_title" value="炎の闘球児 ドッジ弾平"/>
1620616206      <part name="cart" interface="megadriv_cart">
16207         <feature name="slot" value="rom_eeprom"/>
1620816207         <dataarea name="rom" width="16" endianness="big" size="524288">
1620916208            <rom name="mpr-14856.bin" size="524288" crc="630f07c6" sha1="ebdf20fd8aaeb3c7ec97302089b3330265118cf0" offset="0x000000"/>
1621016209         </dataarea>
r249094r249095
1827118270      <info name="release" value="19941021"/>
1827218271      <info name="alt_title" value="ロックマン メガワールド"/>
1827318272      <part name="cart" interface="megadriv_cart">
18274         <feature name="slot" value="rom_sram"/>
1827518273         <dataarea name="rom" width="16" endianness="big" size="2097152">
1827618274            <rom name="rockman mega world (jpn) (alt).bin" size="2097152" crc="85c956ef" sha1="a435ac53589a29dbb655662c942daab425d3f6bd" offset="0x000000"/>
1827718275         </dataarea>
18278         <dataarea name="sram" size="16384">
18279         </dataarea>
1828018276      </part>
1828118277   </software>
1828218278
r249094r249095
2036620362      <info name="release" value="19911205"/>
2036720363      <info name="alt_title" value="忍者武雷伝説"/>
2036820364      <part name="cart" interface="megadriv_cart">
20369         <feature name="slot" value="rom_eeprom"/>
2037020365         <dataarea name="rom" width="16" endianness="big" size="1048576">
2037120366            <rom name="ninja burai densetsu (jpn).bin" size="1048576" crc="a8d828a0" sha1="9cc3419ca7ecaf0d106aa896ffc0266c7145fff7" offset="0x000000"/>
2037220367         </dataarea>
trunk/hash/x1_cass.xml
r249094r249095
1212
1313<softwarelist name="x1_cass" description="Sharp X1 cassettes">
1414
15   <software name="alamein">
16      <description>El Alamein</description>
17      <year>1983</year>
18      <publisher>ポニカ (Pony Canyon)</publisher>
19      <info name="alt_title" value="エル・アラメイン"/>
20      <info name="usage" value="In BASIC, type LOAD and then RUN"/>
21      <sharedfeat name="requirement" value="x1_flop:tapbas"/>
22      <part name="cass" interface="x1_cass">
23         <dataarea name="side1" size="12742140">
24            <rom name="alamein.wav" size="12742140" crc="04e00f60" sha1="42f3ef356fdb67ddd0fbdb57e473c23d267f9bf4" offset="0" />
25         </dataarea>
26      </part>
27   </software>
28   
2915   <software name="blckonyx" supported="no">
3016      <description>The Black Onyx</description>
3117      <year>1985</year>
r249094r249095
9076         </dataarea>
9177      </part>
9278   </software>
93   
94   <software name="cball">
95      <description>Cannon Ball</description>
96      <year>1983</year>
97      <publisher>ハドソン (Hudson Soft)</publisher>
98      <info name="alt_title" value="キャノンボール"/>
99      <part name="cass" interface="x1_cass">
100         <dataarea name="side1" size="4857558">
101            <rom name="cball.wav" size="4857558" crc="4405cf21" sha1="769a43d97f69b5d72347ca8b72547e464b9d059b" offset="0" />
102         </dataarea>
103      </part>
104   </software>
10579
10680   <software name="cprowsp">
10781      <description>Champion ProWres Special</description>
r249094r249095
322296         </dataarea>
323297      </part>
324298   </software>
325   
326   <software name="machgjoe">
327      <description>Ginkou Goutou - Machinegun Joe vs. the Mafia</description>
328      <year>1983</year>
329      <publisher>ハドソン (Hudson Soft)</publisher>
330      <info name="alt_title" value="銀行強盗 マシンガンジョー VS ザ・マフィア"/>
331      <part name="cass" interface="x1_cass">
332         <dataarea name="side1" size="15591932">
333            <rom name="machgjoe.wav" size="15591932" crc="3769199a" sha1="81614c317f432055f2c5fdcce51438de9fbdad7f" offset="0" />
334         </dataarea>
335      </part>
336   </software>
337299
338300   <software name="mappy">
339301      <description>Mappy</description>
trunk/scripts/genie.lua
r249094r249095
10611061      "-std=gnu++98",
10621062   }
10631063   archivesplit_size "20"
1064   if os.getenv("EMSCRIPTEN") then
1065      includedirs {
1066         os.getenv("EMSCRIPTEN") .. "/system/lib/libcxxabi/include"
1067      }
1068   end
10691064
10701065configuration { "android*" }
10711066   buildoptions {
trunk/scripts/src/3rdparty.lua
r249094r249095
795795end
796796     
797797--------------------------------------------------
798-- GoogleTest library objects
798-- UnitTest++ library objects
799799--------------------------------------------------
800800
801project "gtest"
802   uuid "fa306a8d-fb10-4d4a-9d2e-fdb9076407b4"
801project "unittest-cpp"
802   uuid "717d39e5-b6ff-4507-a092-c27c05b60ab5"
803803   kind "StaticLib"
804804
805   configuration { "gmake" }
806      buildoptions {
807         "-Wno-undef",
808         "-Wno-unused-variable",
805   files {     
806      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/AssertException.cpp",
807      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/AssertException.h",
808      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/CheckMacros.h",
809      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/Checks.cpp",
810      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/Checks.h",
811      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/CompositeTestReporter.cpp",
812      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/CompositeTestReporter.h",
813      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/Config.h",
814      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/CurrentTest.cpp",
815      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/CurrentTest.h",
816      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/DeferredTestReporter.cpp",
817      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/DeferredTestReporter.h",
818      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/DeferredTestResult.cpp",
819      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/DeferredTestResult.h",
820      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/ExceptionMacros.h",
821      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/ExecuteTest.h",
822      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/HelperMacros.h",
823      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/MemoryOutStream.cpp",
824      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/MemoryOutStream.h",
825      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/ReportAssert.cpp",
826      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/ReportAssert.h",
827      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/ReportAssertImpl.h",
828      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/Test.cpp",
829      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/Test.h",
830      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/TestDetails.cpp",
831      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/TestDetails.h",
832      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/TestList.cpp",
833      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/TestList.h",
834      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/TestMacros.h",
835      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/TestReporter.cpp",
836      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/TestReporter.h",
837      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/TestReporterStdout.cpp",
838      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/TestReporterStdout.h",
839      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/TestResults.cpp",
840      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/TestResults.h",
841      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/TestRunner.cpp",
842      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/TestRunner.h",
843      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/TestSuite.h",
844      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/TimeConstraint.cpp",
845      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/TimeConstraint.h",
846      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/TimeHelpers.h",
847      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/UnitTest++.h",
848      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/UnitTestPP.h",
849      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/XmlTestReporter.cpp",
850      MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/XmlTestReporter.h",
851   }
852
853   if _OPTIONS["targetos"]~="windows" then
854      files {
855         MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/Posix/SignalTranslator.cpp",
856         MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/Posix/SignalTranslator.h",
857         MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/Posix/TimeHelpers.cpp",
858         MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/Posix/TimeHelpers.h",
809859      }
860   end
810861
811   configuration { }
812
813   includedirs {
814      MAME_DIR .. "3rdparty/googletest/googletest/include",
815      MAME_DIR .. "3rdparty/googletest/googletest",
816   }   
817   files {     
818      MAME_DIR .. "3rdparty/googletest/googletest/src/gtest-all.cc",
819   }
862   if _OPTIONS["targetos"]=="windows" then
863      files {
864         MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/Win32/TimeHelpers.cpp",
865         MAME_DIR .. "3rdparty/unittest-cpp/UnitTest++/Win32/TimeHelpers.h",
866      }
867   end
trunk/scripts/src/tests.lua
r249094r249095
2121   targetdir(MAME_DIR)
2222end
2323
24configuration { "gmake" }
25   buildoptions {
26      "-Wno-undef",
27   }
28
29configuration { }
30
3124links {
32   "gtest",
25   "unittest-cpp",
3326   "utils",
3427   "expat",
3528   "zlib",
r249094r249095
3730}
3831
3932includedirs {
40   MAME_DIR .. "3rdparty/googletest/googletest/include",
33   MAME_DIR .. "3rdparty/unittest-cpp",
4134   MAME_DIR .. "src/osd",
4235   MAME_DIR .. "src/lib/util",
4336}
trunk/scripts/target/mame/mess.lua
r249094r249095
762762      "mit",
763763      "mits",
764764      "mitsubishi",
765      "mizar",
765766      "morrow",
766767      "mos",
767768      "motorola",
r249094r249095
12321233}
12331234
12341235createMESSProjects(_target, _subtarget, "canon")
1235files {             
1236   MAME_DIR .. "src/mess/drivers/cat.c",       
1237   MAME_DIR .. "src/mess/drivers/x07.c",       
1238   MAME_DIR .. "src/mess/drivers/canon_s80.c",
1236files {
1237   MAME_DIR .. "src/mess/drivers/cat.c",
1238   MAME_DIR .. "src/mess/drivers/x07.c",
12391239}
12401240
12411241createMESSProjects(_target, _subtarget, "cantab")
r249094r249095
14431443   MAME_DIR .. "src/mess/drivers/bk.c",
14441444   MAME_DIR .. "src/mess/machine/bk.c",
14451445   MAME_DIR .. "src/mess/video/bk.c",
1446   MAME_DIR .. "src/mess/drivers/dvk_kcgd.c",
14471446   MAME_DIR .. "src/mess/drivers/dvk_ksm.c",
14481447   MAME_DIR .. "src/mess/machine/ms7004.c",
14491448   MAME_DIR .. "src/mess/drivers/mk85.c",
r249094r249095
17961795   MAME_DIR .. "src/mess/drivers/multi16.c",
17971796}
17981797
1798createMESSProjects(_target, _subtarget, "mizar")
1799files {         
1800   MAME_DIR .. "src/mess/drivers/mzr8105.c", 
1801}
1802
17991803createMESSProjects(_target, _subtarget, "morrow")
18001804files {
18011805   MAME_DIR .. "src/mess/drivers/microdec.c",
trunk/src/emu/bus/centronics/printer.c
r249094r249095
9999   output_busy(m_busy);
100100   output_fault(1);
101101   output_ack(1);
102   output_select(1);
103102}
104103
105104/*-------------------------------------------------
trunk/src/emu/bus/pc_kbd/iskr1030.c
r249094r249095
4242
4343ROM_START( iskr_1030_keyboard )
4444   ROM_REGION( 0x800, I8048_TAG, 0 )
45   // XXX add P/N etc
4546   ROM_LOAD( "i1030.bin", 0x000, 0x800, CRC(7cac9c4b) SHA1(03959d3350e012ebfe61cee9c062b6c1fdd8766e) )
4647ROM_END
4748
r249094r249095
6162//-------------------------------------------------
6263
6364static ADDRESS_MAP_START( iskr_1030_keyboard_io, AS_IO, 8, iskr_1030_keyboard_device )
64   AM_RANGE(0x00, 0xFF) AM_READWRITE(ram_r, ram_w)
65   AM_RANGE(0x00, 0xFF) AM_RAM
6566   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(p1_r, p1_w)
6667   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(p2_w)
68//  AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(t0_r)
6769   AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(t1_r)
6870ADDRESS_MAP_END
6971
r249094r249095
7375//-------------------------------------------------
7476
7577static MACHINE_CONFIG_FRAGMENT( iskr_1030_keyboard )
76   MCFG_CPU_ADD(I8048_TAG, I8048, XTAL_5MHz)
78   // XXX check
79   MCFG_CPU_ADD(I8048_TAG, I8048, MCS48_LC_CLOCK(IND_U(47), CAP_P(20.7)))
7780   MCFG_CPU_IO_MAP(iskr_1030_keyboard_io)
7881MACHINE_CONFIG_END
7982
r249094r249095
9598
9699INPUT_PORTS_START( iskr_1030_keyboard )
97100   PORT_START("MD00")
98   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD )
99   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD )
100   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD )
101   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD )
101   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
102   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(TAB))
103   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A')
104   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z')
105   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?59?") // 0x59 = Inf
106   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD))
107   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
108   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
102109
103110   PORT_START("MD01")
104   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD )
105   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD )
106   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD )
107   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD )
111   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC))
112   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q')
113   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S')
114   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X')
115   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
116   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7 Home") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD))
117   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
118   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
108119
109120   PORT_START("MD02")
110   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD )
111   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD )
112   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD )
113   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD )
121   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!')
122   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W')
123   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D')
124   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C')
125   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RCONTROL) // 0x5a = R/L (R)
126   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8 " UTF8_UP) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD))
127   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
128   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
114129
115130   PORT_START("MD03")
116   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD )
117   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD )
118   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD )
119   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD )
131   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@')
132   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E')
133   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F')
134   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V')
135   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) // 0x5b = Rus
136   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9 PgUp") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD))
137   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
138   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
120139
121140   PORT_START("MD04")
122   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD )
123   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD )
124   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD )
125   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD )
141   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#')
142   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R')
143   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G')
144   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B')
145   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1))
146   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4 " UTF8_LEFT) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD))
147   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
148   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
126149
127150   PORT_START("MD05")
128   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD )
129   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD )
130   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD )
131   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD )
151   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$')
152   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T')
153   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H')
154   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N')
155   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2))
156   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD))
157   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
158   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
132159
133160   PORT_START("MD06")
134   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD )
135   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD )
136   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD )
137   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD )
161   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%')
162   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y')
163   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J')
164   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M')
165   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3))
166   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6 " UTF8_RIGHT) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD))
167   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
168   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
138169
139170   PORT_START("MD07")
140   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD )
141   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD )
142   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD )
143   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD )
171   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^')
172   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U')
173   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K')
174   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~')
175   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4))
176   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1 End") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD))
177   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
178   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
144179
145180   PORT_START("MD08")
146   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD )
147   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD )
148   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD )
149   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD )
181   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&')
182   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I')
183   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L')
184   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?2a?")
185   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5))
186   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2 " UTF8_DOWN) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD))
187   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
188   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
150189
151190   PORT_START("MD09")
152   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD )
153   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD )
154   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD )
155   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD )
191   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*')
192   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O')
193   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{')
194   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?5c?") // 0x5c = YO
195   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6))
196   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3 PgDn") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD))
197   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
198   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
156199
157200   PORT_START("MD10")
158   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD )
159   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD )
160   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD )
161   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD )
201   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(')
202   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P')
203   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}')
204   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<')
205   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7))
206   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0 Ins") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD))
207   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
208   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
162209
163210   PORT_START("MD11")
164   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD )
165   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD )
166   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD )
167   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD )
211   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')')
212   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?36?")
213   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':')
214   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>')
215   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8))
216   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad . Del") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD))
217   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
218   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
168219
169220   PORT_START("MD12")
170   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD )
171   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD )
172   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD )
173   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD )
221   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_')
222   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?3a?")
223   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"')
224   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) // 0x55
225   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9))
226   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD))
227   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
228   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
174229
175230   PORT_START("MD13")
176   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD )
177   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD )
178   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD )
179   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD )
231   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+')
232   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?')
233   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
234   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) // 0x56
235   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10))
236   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
237   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
238   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
180239
181240   PORT_START("MD14")
182   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD )
183   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD )
184   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD )
185   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD )
241   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|')
242   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PRTSCR)
243   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT))
244   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) // 0x57 = Lat
245   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK))
246   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
247   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
248   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
186249
187250   PORT_START("MD15")
188   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD )
189   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD )
190   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD )
191   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD )
192
193   PORT_START("MD16")
194   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD )
195   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD )
196   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD )
197   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD )
198
199   PORT_START("MD17")
200   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD )
201   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD )
202   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD )
203   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD )
204
205   PORT_START("MD18")
206   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD )
207   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD )
208   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD )
209   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD )
210
211   PORT_START("MD19")
212   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD )
213   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD )
214   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD )
215   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD )
216
217   PORT_START("MD20")
218   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD )
219   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD )
220   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD )
221   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD )
222
223   PORT_START("MD21")
224   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD )
225   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD )
226   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD )
227   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD )
228
229   PORT_START("MD22")
230   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD )
231   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD )
232   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD )
233   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD )
234
235   PORT_START("MD23")
236   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD )
237   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD )
238   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD )
239   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD )
251   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
252   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2)
253   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) // 0x54
254   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RALT) // 0x58 = R/L (L)
255   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Scroll Lock Break") PORT_CODE(KEYCODE_SCRLOCK) PORT_CHAR(UCHAR_MAMEKEY(SCRLOCK))
256   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
257   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
258   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
240259INPUT_PORTS_END
241260
242261
r249094r249095
279298      m_md13(*this, "MD13"),
280299      m_md14(*this, "MD14"),
281300      m_md15(*this, "MD15"),
282      m_md16(*this, "MD16"),
283      m_md17(*this, "MD17"),
284      m_md18(*this, "MD18"),
285      m_md19(*this, "MD19"),
286      m_md20(*this, "MD20"),
287      m_md21(*this, "MD21"),
288      m_md22(*this, "MD22"),
289      m_md23(*this, "MD23"),
290301      m_p1(0),
291302      m_p2(0),
292303      m_q(0)
r249094r249095
302313{
303314   set_pc_kbdc_device();
304315
305   m_ram.resize(0x100);
306   save_item(NAME(m_ram));
307
308   save_item(NAME(m_bus));
316   // state saving
309317   save_item(NAME(m_p1));
310318   save_item(NAME(m_p2));
311319   save_item(NAME(m_q));
r249094r249095
343351
344352
345353//-------------------------------------------------
346//  t1_r -
354//  t0_r - XXX ENT0 CLK
347355//-------------------------------------------------
348356
349READ8_MEMBER( iskr_1030_keyboard_device::t1_r )
357READ8_MEMBER( iskr_1030_keyboard_device::t0_r )
350358{
351   UINT8 data = data_signal();
352   UINT8 bias = m_p1 & 15;
353
354   if (!BIT(m_p1, 7)) {
355      DBG_LOG(2,0,( "%s: t1_r (l) %d\n", tag(), data));
356      return data;
357   }
358
359   if (bias) {
360      DBG_LOG(2,0,( "%s: t1_r (b) %d\n", tag(), bias));
361      return 1;
362   }
363
364   data = 0;
365   switch (m_bus >> 2)
366   {
367   case  0<<1: data = m_md00->read(); break;
368   case  1<<1: data = m_md01->read(); break;
369   case  2<<1: data = m_md02->read(); break;
370   case  3<<1: data = m_md03->read(); break;
371   case  4<<1: data = m_md04->read(); break;
372   case  5<<1: data = m_md05->read(); break;
373   case  6<<1: data = m_md06->read(); break;
374   case  7<<1: data = m_md07->read(); break;
375   case  8<<1: data = m_md08->read(); break;
376   case  9<<1: data = m_md09->read(); break;
377   case 10<<1: data = m_md10->read(); break;
378   case 11<<1: data = m_md11->read(); break;
379   case  (0<<1)+1: data = m_md12->read(); break;
380   case  (1<<1)+1: data = m_md13->read(); break;
381   case  (2<<1)+1: data = m_md14->read(); break;
382   case  (3<<1)+1: data = m_md15->read(); break;
383   case  (4<<1)+1: data = m_md16->read(); break;
384   case  (5<<1)+1: data = m_md17->read(); break;
385   case  (6<<1)+1: data = m_md18->read(); break;
386   case  (7<<1)+1: data = m_md19->read(); break;
387   case  (8<<1)+1: data = m_md20->read(); break;
388   case  (9<<1)+1: data = m_md21->read(); break;
389   case (10<<1)+1: data = m_md22->read(); break;
390   case (11<<1)+1: data = m_md23->read(); break;
391   }
392   data = BIT(data, m_bus&3);
393
394   DBG_LOG(2,0,( "%s: t1_r (k r%d c%d) %d\n", tag(), m_bus&3, m_bus>>2, data));
395   return data;
359   return 0;
360//  return clock_signal();
396361}
397362
398363
399364//-------------------------------------------------
400//  ram_w -
365//  t1_r - OK
401366//-------------------------------------------------
402367
403WRITE8_MEMBER( iskr_1030_keyboard_device::ram_w )
368READ8_MEMBER( iskr_1030_keyboard_device::t1_r )
404369{
405   DBG_LOG(2,0,( "%s: ram_w[%02x] <- %02x\n", tag(), offset, data));
370   UINT8 data = data_signal();
406371
407   m_bus = offset;
408   m_ram[offset] = data;
409}
372   DBG_LOG(2,0,( "%s: t1_r %d\n", tag(), data));
410373
411
412//-------------------------------------------------
413//  ram_r -
414//-------------------------------------------------
415
416READ8_MEMBER( iskr_1030_keyboard_device::ram_r )
417{
418   DBG_LOG(2,0,( "%s: ram_r[%02x] = %02x\n", tag(), offset, m_ram[offset]));
419   
420   return m_ram[offset];
374   return data;
421375}
422376
423377
r249094r249095
428382READ8_MEMBER( iskr_1030_keyboard_device::p1_r )
429383{
430384   /*
385
431386       bit     description
432387
433388       0       -REQ IN
r249094r249095
438393       5
439394       6
440395       7
396
441397   */
442398
443399   UINT8 data = 0;
r249094r249095
457413   /*
458414       bit     description
459415
460       0       ...
461       1       ...
462       2       ...
463       3       (not connected)
464       4       SPEAKER
465       5       LED RUS/LAT
466       6       LED NLK
467       7       LED CLK
416       0
417       1
418       2
419       3
420       4
421       5       LED XXX
422       6       LED XXX
423       7       LED XXX
468424   */
469425   DBG_LOG(1,0,( "%s: p2_w %02x\n", tag(), data));
470426
471   m_p2 = data;
427   m_p1 = data;
472428}
473429
474430
r249094r249095
486442       2       XXX
487443       3       XXX
488444       4       CLOCK out
489       5       DATA out
445       5       DATA out (inverted!)
490446       6       XXX
491       7       POLL GATE
447       7       XXX
492448   */
449   DBG_LOG(1,0,( "%s: p1_w %02x (clk %d data %d)\n", tag(), data, BIT(data, 4), BIT(data, 5)));
493450
494   m_p1 = data;
495
496   DBG_LOG(1,0,( "%s: p1_w %02x (c %d d %d bias %d)\n", tag(), data, BIT(data, 4), BIT(data, 5), data&15));
497
498451   m_pc_kbdc->data_write_from_kb(BIT(data, 5));
499452   m_pc_kbdc->clock_write_from_kb(BIT(data, 4));
500453}
trunk/src/emu/bus/pc_kbd/iskr1030.h
r249094r249095
3636   virtual machine_config_constructor device_mconfig_additions() const;
3737   virtual ioport_constructor device_input_ports() const;
3838
39   DECLARE_READ8_MEMBER( ram_r );
40   DECLARE_WRITE8_MEMBER( ram_w );
4139   DECLARE_READ8_MEMBER( p1_r );
4240   DECLARE_WRITE8_MEMBER( p1_w );
4341   DECLARE_WRITE8_MEMBER( p2_w );
42   DECLARE_READ8_MEMBER( t0_r );
4443   DECLARE_READ8_MEMBER( t1_r );
4544
4645protected:
r249094r249095
7069   required_ioport m_md13;
7170   required_ioport m_md14;
7271   required_ioport m_md15;
73   required_ioport m_md16;
74   required_ioport m_md17;
75   required_ioport m_md18;
76   required_ioport m_md19;
77   required_ioport m_md20;
78   required_ioport m_md21;
79   required_ioport m_md22;
80   required_ioport m_md23;
8172
82   dynamic_buffer m_ram;
83   UINT8 m_bus;
8473   UINT8 m_p1;
8574   UINT8 m_p2;
8675   int m_q;
trunk/src/emu/cpu/t11/t11.c
r249094r249095
3636
3737
3838const device_type T11 = &device_creator<t11_device>;
39const device_type K1801VM2 = &device_creator<k1801vm2_device>;
4039
4140
42k1801vm2_device::k1801vm2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
43   : t11_device(mconfig, K1801VM2, "K1801VM2", tag, owner, clock, "k1801vm2", __FILE__)
44{
45}
46
47t11_device::t11_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
48   : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source)
49   , m_program_config("program", ENDIANNESS_LITTLE, 16, 16, 0)
50   , c_initial_mode(0)
51{
52   m_is_octal = true;
53   memset(m_reg, 0x00, sizeof(m_reg));
54   memset(&m_psw, 0x00, sizeof(m_psw));
55}
56
5741t11_device::t11_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
5842   : cpu_device(mconfig, T11, "T11", tag, owner, clock, "t11", __FILE__)
5943   , m_program_config("program", ENDIANNESS_LITTLE, 16, 16, 0)
r249094r249095
310294   }
311295}
312296
313void k1801vm2_device::state_string_export(const device_state_entry &entry, std::string &str)
314{
315   switch (entry.index())
316   {
317      case STATE_GENFLAGS:
318         strprintf(str, "%c%c%c%c%c%c%c%c%c",
319            m_psw.b.l & 0x100 ? 'H':'.',
320            m_psw.b.l & 0x80 ? 'P':'.',
321            m_psw.b.l & 0x40 ? '?':'.',
322            m_psw.b.l & 0x20 ? '?':'.',
323            m_psw.b.l & 0x10 ? 'T':'.',
324            m_psw.b.l & 0x08 ? 'N':'.',
325            m_psw.b.l & 0x04 ? 'Z':'.',
326            m_psw.b.l & 0x02 ? 'V':'.',
327            m_psw.b.l & 0x01 ? 'C':'.'
328         );
329         break;
330   }
331}
332297
333
334298/*************************************
335299 *
336300 *  CPU reset
r249094r249095
362326   m_wait_state = 0;
363327}
364328
365void k1801vm2_device::device_reset()
366{
367   t11_device::device_reset();
368   
369   PC = RWORD(c_initial_mode);
370   PSW = RWORD(c_initial_mode+2);
371}
372329
373330
374331/*************************************
trunk/src/emu/cpu/t11/t11.h
r249094r249095
3737public:
3838   // construction/destruction
3939   t11_device(const machine_config &mconfig, const char *_tag, device_t *_owner, UINT32 _clock);
40   t11_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
4140
4241   // static configuration helpers
4342   static void set_initial_mode(device_t &device, const UINT16 mode) { downcast<t11_device &>(device).c_initial_mode = mode; }
r249094r249095
6665   virtual UINT32 disasm_max_opcode_bytes() const { return 6; }
6766   virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options);
6867
69protected:
68private:
7069   address_space_config m_program_config;
7170
7271   UINT16 c_initial_mode;
r249094r249095
11341133   void sub_ixd_ixd(UINT16 op);
11351134};
11361135
1137class k1801vm2_device : public t11_device
1138{
1139public:
1140   // construction/destruction
1141   k1801vm2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
11421136
1143protected:
1144   // device-level overrides
1145   virtual void device_reset();
1146
1147   // device_state_interface overrides
1148   void state_string_export(const device_state_entry &entry, std::string &str);
1149};
1150
1151
11521137extern const device_type T11;
1153extern const device_type K1801VM2;
11541138
11551139
11561140#endif /* __T11_H__ */
trunk/src/emu/drivers/emudummy.c
r249094r249095
3333ROM_END
3434
3535
36GAME( 1900, __dummy, 0, __dummy, 0, driver_device, 0, ROT0, "(none)", "Dummy", MACHINE_NO_SOUND )
36GAME( 1900, __dummy, 0, __dummy, 0, driver_device, 0, ROT0, "(none)", "Dummy", GAME_NO_SOUND )
trunk/src/emu/machine/68230pit.c
r249094r249095
11// license:BSD-3-Clause
22// copyright-holders:Joakim Larsson Edstr??m
33/**********************************************************************
4*
5*   Motorola MC68230 PI/T Parallell Interface and Timer
6*
7*  Revisions
8*  2015-07-15 JLE initial
9*
10*  Todo
11*  - Add clock and timers
12*  - Add all missing registers
13*  - Add configuration
14**********************************************************************/
154
16#include "68230pit.h"
5    Motorola MC68230 PI/T Parallell Interface and Timer
176
18#define LOG(x) /* x */
7Revisions
8 2015-07-15 JLE initial
199
20//**************************************************************************
21//  DEVICE TYPE DEFINITIONS
22//**************************************************************************
10Todo
11 - Add clock and timers
12 - Add all missing registers
13 - Add configuration
14**********************************************************************/
2315
24const device_type PIT68230 = &device_creator<pit68230_device>;
16/*
17Force CPU-1 init sequence
180801EA 0E0000 W 0000 PGCR  data_w: 0000 -> 0000 & 00ff
190801EA 0E0002 W 0000 PSRR  data_w: 0000 -> 0001 & 00ff
200801EA 0E0004 W FFFF PADDR data_w: 00ff -> 0002 & 00ff
210801EA 0E0006 W 0000 PBDDR data_w: 0000 -> 0003 & 00ff
220801F0 0E000C W 6060 PACR  data_w: 0060 -> 0006 & 00ff
230801F6 0E000E W A0A0 PBCR  data_w: 00a0 -> 0007 & 00ff
240801FC 0E0000 W 3030 PGCR  data_w: 0030 -> 0000 & 00ff
25080202 0E000E W A8A8 PBCR  data_w: 00a8 -> 0007 & 00ff
26080210 0E000E W A0A0 PBCR  data_w: 00a0 -> 0007 & 00ff
2527
26//-------------------------------------------------
27//  pit68230_device - constructors
28//-------------------------------------------------
29pit68230_device::pit68230_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant, const char *shortname, const char *source)
30        : device_t (mconfig, type, name, tag, owner, clock, shortname, source),
31        device_execute_interface (mconfig, *this)
32        , m_icount (0)
33        , m_write_pa (*this)
34        , m_write_h2 (*this)
35{
36}
28Force CPU-1 after one keypress in terminal
29081DC0 0E000C W 6868 PACR
30081DC8 0E000C W 6060 PACR
31*/
3732
3833
39pit68230_device::pit68230_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
40        : device_t (mconfig, PIT68230, "PIT68230", tag, owner, clock, "pit68230", __FILE__),
41        device_execute_interface (mconfig, *this)
42        , m_icount (0)
43        , m_write_pa (*this)
44        , m_write_h2 (*this)
45{
46}
34#include "emu.h"
35#include "68230pit.h"
4736
48//-------------------------------------------------
49//  device_start - device-specific startup
50//-------------------------------------------------
51void pit68230_device::device_start ()
52{
53        LOG (logerror ("PIT68230 device started\n"));
54        m_icountptr = &m_icount;
37/***************************************************************************
38    IMPLEMENTATION
39***************************************************************************/
5540
56        // resolve callbacks
57        m_write_pa.resolve_safe ();
58        m_write_h2.resolve_safe ();
59}
41// device type definition
42const device_type PIT68230 = &device_creator<pit68230_device>;
6043
6144//-------------------------------------------------
62//  device_reset - device-specific reset
45//  pit68230_device - constructor
6346//-------------------------------------------------
64void pit68230_device::device_reset ()
47
48pit68230_device::pit68230_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
49      : device_t(mconfig, PIT68230, "Motorola 68230 PI/T", tag, owner, clock, "pit68230", __FILE__)
6550{
66        LOG (logerror ("PIT68230 device reseted\n"));
67        m_pgcr = 0;
68        m_psrr = 0;
69        m_paddr = 0;
70        m_pbddr = 0;
71        m_pcddr = 0;
72        m_pacr = 0; m_write_h2 (m_pacr);
73        m_pbcr = 0;
74        m_padr = 0; m_write_pa ((offs_t)0, m_padr); // TODO: check PADDR
75        m_pbdr = 0;
76        m_psr = 0;
7751}
7852
79//-------------------------------------------------
80//  device_timer - handler timer events
81//-------------------------------------------------
82void pit68230_device::device_timer (emu_timer &timer, device_timer_id id, INT32 param, void *ptr)
53void pit68230_device::device_start()
8354{
55   printf("PIT68230 device started\n");
8456}
8557
86void pit68230_device::h1_set (UINT8 state)
58void pit68230_device::device_reset()
8759{
88        LOG (logerror ("h1_set %d @ m_psr %2x => ", state, m_psr));
89        if (state) m_psr |= 1; else m_psr &= ~1;
90        LOG (logerror ("%02x %lld\n", m_psr, machine ().firstcpu->total_cycles ()));
60   printf("PIT68230 device reseted\n");
61   m_pgcr = 0;
62   m_psrr = 0;
63   m_paddr = 0;
64   m_pbddr = 0;
65   m_pcddr = 0;
66   m_pacr = 0;
67   m_pbcr = 0;
68   m_padr = 0;
69   m_pbdr = 0;
70   m_psr = 0;
9171}
9272
93void pit68230_device::portb_setbit (UINT8 bit, UINT8 state)
73WRITE8_MEMBER( pit68230_device::data_w )
9474{
95        LOG (logerror ("portb_setbit %d/%d @ m_pbdr %2x => ", bit, state, m_pbdr));
96        if (state) m_pbdr |= (1 << bit); else m_pbdr &= ~(1 << bit);
97        LOG (logerror ("%02x %lld\n", m_pbdr, machine ().firstcpu->total_cycles ()));
75   printf("data_w: %04x -> ", data);
76   switch (offset)
77   {
78   case PIT_68230_PGCR:
79   printf("PGCR");
80   m_pgcr = data;
81   break;
82   case PIT_68230_PSRR:
83   printf("PSRR");
84   m_psrr = data;
85   break;
86   case PIT_68230_PADDR:
87   printf("PADDR");
88   m_paddr = data;
89   break;
90   case PIT_68230_PBDDR:
91   printf("PBDDR");
92   m_pbddr = data;
93   break;
94   case PIT_68230_PACR:
95   printf("PACR");
96   m_pacr = data;
97   break;
98   case PIT_68230_PBCR:
99   printf("PBCR");
100   m_pbcr = data;
101   break;
102   case PIT_68230_PADR:
103   printf("PADR");
104   m_padr = data;
105   break;
106   case PIT_68230_PSR:
107   printf("PSR");
108   m_padr = data;
109   break;
110   default:
111   printf("unhandled register %02x", offset);
112   }
113   printf("\n");
98114}
99115
100//-------------------------------------------------
101//  execute_run -
102//-------------------------------------------------
103void pit68230_device::execute_run ()
116READ8_MEMBER( pit68230_device::data_r )
104117{
105        do {
106                synchronize ();
118   UINT8 data = 0;
107119
108                m_icount--;
109        } while (m_icount > 0);
110}
120   printf("data_r: ");
121   switch (offset)
122   {
123   case PIT_68230_PGCR:
124   printf("PGCR");
125   data = m_pgcr;
126   break;
127   case PIT_68230_PSRR:
128   printf("PSRR");
129   data = m_psrr;
130   break;
131   case PIT_68230_PADDR:
132   printf("PADDR");
133   data = m_paddr;
134   break;
135   case PIT_68230_PBDDR:
136   printf("PBDDR");
137   data = m_pbddr;
138   break;
139   case PIT_68230_PACR:
140   printf("PACR");
141   data = m_pacr;
142   break;
143   case PIT_68230_PBCR:
144   printf("PBCR");
145   data = m_pbcr;
146   break;
147   case PIT_68230_PADR:
148   printf("PADR");
149   data = m_padr;
150   break;
151   case PIT_68230_PBDR:
152   /* 4.6.2. PORT B DATA REGISTER (PBDR). The port B data register is a holding register for moving data
153to and from port B pins. The port B data direction register determines whether each pin is an input (zero)
154or an output (one). This register is readable and writable at all times. Depending on the chosen mode/submode,
155reading or writing may affect the double-buffered handshake mechanism. The port B data register is not affected
156by the assertion of the RESET pin. PB0-PB7 sits on pins 17-24 on a 48 pin DIP package */
157   printf("PBDR");
158   data = m_pbdr;
159   //    data = (m_pbdr & 0xfc) | 1; // CPU-1 centronics interface expects to see 2 lowest bits equal 1 for printer
160   break;
161   case PIT_68230_PSR:
162   printf("PSR");
163   data = m_psr;
164   //    data = m_psr | 1; // CPU-1 centronics interface expects status to be non zero
165   break;
166   default:
167   printf("unhandled register %02x", offset);
168   data = 0;
169   }
170   printf("\n");
111171
112LOG (static INT32 ow_cnt = 0);
113LOG (static INT32 ow_data = 0);
114LOG (static INT32 ow_ofs = 0);
115
116WRITE8_MEMBER (pit68230_device::write){
117        switch (offset) {
118        case PIT_68230_PGCR:
119                m_pgcr = data;
120                break;
121
122        case PIT_68230_PSRR:
123                m_psrr = data;
124                break;
125
126        case PIT_68230_PADDR:
127                m_paddr = data;
128                break;
129
130        case PIT_68230_PBDDR:
131                m_pbddr = data;
132                break;
133
134        case PIT_68230_PCDDR:
135                m_pcddr = data;
136                break;
137
138        case PIT_68230_PACR:
139                m_pacr = data;
140                // callbacks
141                /*PACR in Mode 0
142                 * 5 43  H2 Control in Submode 00 && 01
143                 * ------------------------------------
144                 * 0 XX  Input pin  - edge-sensitive status input, H2S is set on an asserted edge.
145                 * 1 00  Output pin - negated, H2S is always clear.
146                 * 1 01  Output pin - asserted, H2S is always clear.
147                 * 1 10  Output pin - interlocked input handshake protocol, H2S is always clear.
148                 * 1 11  Output pin - pulsed input handshake protocol, H2S is always clear.
149                 *
150                 * 5 43  H2 Control in Submode 1x
151                 * ------------------------------------
152                 * 0 XX  Input pin  - edge-sensitive status input, H2S is set on an asserted edge.
153                 * 1 X0  Output pin - negated, H2S is always cleared.
154                 * 1 X1  Output pin - asserted, H2S is always cleared.
155                 */
156                m_write_h2 (m_pacr & 0x08 ? 1 : 0); // TODO: Check mode and submodes
157                break;
158
159        case PIT_68230_PBCR:
160                m_pbcr = data;
161                break;
162
163        case PIT_68230_PADR:
164                m_padr = data;
165                // callbacks
166                m_write_pa ((offs_t)0, m_padr); // TODO: check PADDR
167                break;
168
169        case PIT_68230_PSR:
170                m_psr = data;
171                break;
172
173        default:
174                LOG (logerror ("unhandled register %02x", offset));
175        }
176
177        LOG (if (offset != ow_ofs || data != ow_data || ow_cnt >= 1000) {
178                logerror ("\npit68230_device::write: previous identical operation performed %02x times\n", ow_cnt);
179                ow_cnt = 0;
180                ow_data = data;
181                ow_ofs = offset;
182                logerror ("pit68230_device::write: offset=%02x data=%02x %lld\n", ow_ofs, ow_data, machine ().firstcpu->total_cycles ());
183        }
184                else
185                        ow_cnt++; )
172   return data;
186173}
187
188LOG (static INT32 or_cnt = 0);
189LOG (static INT32 or_data = 0);
190LOG (static INT32 or_ofs = 0);
191
192READ8_MEMBER (pit68230_device::read){
193        UINT8 data = 0;
194
195        switch (offset) {
196        case PIT_68230_PGCR:
197                data = m_pgcr;
198                break;
199
200        case PIT_68230_PSRR:
201                data = m_psrr;
202                break;
203
204        case PIT_68230_PADDR:
205                data = m_paddr;
206                break;
207
208        case PIT_68230_PBDDR:
209                data = m_pbddr;
210                break;
211
212        case PIT_68230_PCDDR:
213                data = m_pcddr;
214                break;
215
216        case PIT_68230_PACR:
217                data = m_pacr;
218                break;
219
220        case PIT_68230_PBCR:
221                data = m_pbcr;
222                break;
223
224        case PIT_68230_PADR:
225                data = m_padr;
226                break;
227
228        case PIT_68230_PBDR:
229                /* 4.6.2. PORT B DATA REGISTER (PBDR). The port B data register is a holding
230                 * register for moving data to and from port B pins. The port B data direction
231                 * register determines whether each pin is an input (zero) or an output (one).
232                 * This register is readable and writable at all times. Depending on the chosen
233                 * mode/submode, reading or writing may affect the double-buffered handshake
234                 * mechanism. The port B data register is not affected by the assertion of the
235                 * RESET pin. PB0-PB7 sits on pins 17-24 on a 48 pin DIP package */
236                data = m_pbdr;
237                break;
238
239        case PIT_68230_PSR:
240                /* 4.8. PORT STATUS REGISTER (PSR) The port status register contains information about
241                 * handshake pin activity. Bits 7-4 show the instantaneous level of the respective handshake
242                 * pin, and are independent of the handshake pin sense bits in the port general control
243                 * register. Bits 3-0 are the respective status bits referred to throughout this document.
244                 * Their interpretation depends on the programmed mode/submode of the PI/T. For bits
245                 * 3-0 a one is the active or asserted state. */
246                data = m_psr;
247                break;
248
249        default:
250                LOG (logerror ("unhandled register %02x", offset));
251                data = 0;
252        }
253
254        LOG (if (offset != or_ofs || data != or_data || or_cnt >= 1000) {
255                logerror ("\npit68230_device::read: previous identical operation performed %02x times\n", or_cnt);
256                or_cnt = 0;
257                or_data = data;
258                or_ofs = offset;
259                logerror ("pit68230_device::read: offset=%02x data=%02x %lld\n", or_ofs, or_data, machine ().firstcpu->total_cycles ());
260        }
261                else
262                        or_cnt++; )
263
264        return data;
265}
trunk/src/emu/machine/68230pit.h
r249094r249095
11// license:BSD-3-Clause
22// copyright-holders:Joakim Larsson Edstr??m
33/**********************************************************************
4*
5*   Motorola MC68230 PI/T Parallell Interface and Timer
6*
7*                           _____   _____
8*                   D5   1 |*    \_/     | 48  D4
9*                   D6   2 |             | 47  D3
10*                   D7   3 |             | 46  D2
11*                  PA0   4 |             | 45  D1
12*                  PA1   5 |             | 44  D0
13*                  PA2   6 |             | 43  R/W*
14*                  PA3   7 |             | 42  DTACK*
15*                  PA4   8 |             | 41  CS*
16*                  PA5   9 |             | 40  CLK
17*                  PA6  10 |             | 39  RESET*
18*                  PA7  11 |             | 38  VSS
19*                  Vcc  12 |   TS68230   | 37  PC7/TIACK*
20*                   H1  13 |   SC87845   | 36  PC6/PIACK*
21*                   H2  14 |             | 35  PC5/PIRQ*
22*                   H3  15 |             | 34  PC4/DMAREQ*
23*                   H4  16 |             | 33  PC3/TOUT
24*                  PB0  17 |             | 32  PC2/TIN
25*                  PB1  18 |             | 31  PC1
26*                  PB2  19 |             | 30  PC0
27*                  PB3  20 |             | 29  RS1
28*                  PB4  21 |             | 28  RS2
29*                  PB5  22 |             | 27  RS3
30*                  PB6  23 |             | 26  RS4
31*                  PB7  24 |_____________| 25  RS5
32*
33**********************************************************************/
344
5    Motorola MC68230 PI/T Parallell Interface and Timer
6
7**********************************************************************/
358#pragma once
369
3710#ifndef __68230PIT_H__
r249094r249095
3912
4013#include "emu.h"
4114
42//**************************************************************************
43//  INTERFACE CONFIGURATION MACROS
44//**************************************************************************
45
46#define MCFG_PIT68230_PA_OUTPUT_CALLBACK(_write) \
47        devcb = &pit68230_device::set_pa_wr_callback (*device, DEVCB_ ## _write);
48
49#define MCFG_PIT68230_PB_OUTPUT_CALLBACK(_write) \
50        devcb = &pit68230_device::set_pb_wr_callback (*device, DEVCB_ ## _write);
51
52#define MCFG_PIT68230_H2_CALLBACK(_write) \
53        devcb = &pit68230_device::set_h2_wr_callback (*device, DEVCB_ ## _write);
54
5515/*-----------------------------------------------------------------------
56 * Registers                RS1-RS5   R/W Description
57 * -------------------------------------------------------------------------*/
16  Registers                RS1-RS5   R/W Description
17-------------------------------------------------------------------------*/
5818#define PIT_68230_PGCR        0x00 /* RW Port General Control register   */
5919#define PIT_68230_PSRR        0x01 /* RW Port Service Request register   */
6020#define PIT_68230_PADDR       0x02 /* RW Port A Data Direction register  */
r249094r249095
8242//**************************************************************************
8343//  TYPE DEFINITIONS
8444//**************************************************************************
85class pit68230_device :  public device_t, public device_execute_interface
45class pit68230_device :  public device_t
8646{
8747public:
88// construction/destruction
89pit68230_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant, const char *shortname, const char *source);
90pit68230_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
91template<class _Object> static devcb_base &set_pa_wr_callback (device_t &device, _Object object)
92{
93        return downcast<pit68230_device &>(device).m_write_pa.set_callback (object);
94}
95template<class _Object> static devcb_base &set_h2_wr_callback (device_t &device, _Object object)
96{
97        return downcast<pit68230_device &>(device).m_write_h2.set_callback (object);
98}
48   // construction/destruction
49   pit68230_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
50   DECLARE_WRITE8_MEMBER( data_w );
51   DECLARE_READ8_MEMBER( data_r );
9952
100DECLARE_WRITE8_MEMBER (write);
101DECLARE_READ8_MEMBER (read);
102
103void h1_set (UINT8 state);
104void portb_setbit (UINT8 bit, UINT8 state);
105
10653protected:
107// device-level overrides
108virtual void device_start ();
109virtual void device_reset ();
110virtual void device_timer (emu_timer &timer, device_timer_id id, int param, void *ptr);
111virtual void execute_run ();
112int m_icount;
113devcb_write8 m_write_pa;
114devcb_write_line m_write_h2;
54   // device-level overrides
55   virtual void device_start();
56   virtual void device_reset();
11557
116// peripheral ports
117UINT8 m_pgcr;           // Port General Control register
118UINT8 m_psrr;           // Port Service Request register
119UINT8 m_paddr;          // Port A Data Direction register
120UINT8 m_pbddr;          // Port B Data Direction register
121UINT8 m_pcddr;          // Port C Data Direction register
122UINT8 m_pacr;           // Port A Control register
123UINT8 m_pbcr;           // Port B Control register
124UINT8 m_padr;           // Port A Data register
125UINT8 m_pbdr;           // Port B Data register
126UINT8 m_psr;            // Port Status Register
58private:
59      UINT8  m_pgcr;  // Port General Control register
60   UINT8  m_psrr;  // Port Service Request register
61   UINT8  m_paddr; // Port A Data Direction register
62   UINT8  m_pbddr; // Port B Data Direction register
63   UINT8  m_pcddr; // Port C Data Direction register
64   UINT8  m_pacr;  // Port A Control register
65   UINT8  m_pbcr;  // Port B Control register
66   UINT8  m_padr;  // Port A Data register
67   UINT8  m_pbdr;  // Port B Data register
68   UINT8  m_psr;   // Port Status Register
12769};
12870
71
12972// device type definition
13073extern const device_type PIT68230;
131#endif /* __68230PIT_H__ */
74
75#endif // __68230PIT__
trunk/src/emu/machine/at_keybc.c
r249094r249095
2424   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READ( p1_r)
2525   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE(p2_r, p2_w)
2626ADDRESS_MAP_END
27
28static INPUT_PORTS_START( at_keybc )
29   PORT_START("DSW")
30   PORT_BIT(     0xbf, 0xbf, IPT_UNUSED )
31   PORT_DIPNAME( 0x40, 0x40, "Display switch")
32   PORT_DIPSETTING(    0x40, "Monochrome adapter" )
33   PORT_DIPSETTING(    0x00, "Color/Graphics adapter" )
34INPUT_PORTS_END
35
3627// machine fragment
3728static MACHINE_CONFIG_FRAGMENT( at_keybc )
3829   MCFG_CPU_ADD("at_keybc", I8042, DERIVED_CLOCK(1,1))
r249094r249095
8172}
8273
8374//-------------------------------------------------
84//  input_ports - device-specific input ports
85//-------------------------------------------------
86
87ioport_constructor at_keyboard_controller_device::device_input_ports() const
88{
89   return INPUT_PORTS_NAME( at_keybc );
90}
91
92//-------------------------------------------------
9375//  machine_config_additions - return a pointer to
9476//  the device's machine fragment
9577//-------------------------------------------------
r249094r249095
157139*/
158140READ8_MEMBER( at_keyboard_controller_device::p1_r )
159141{
160   return ioport("DSW")->read();
142   return 0xbf;
161143}
162144
163145READ8_MEMBER( at_keyboard_controller_device::p2_r )
trunk/src/emu/machine/at_keybc.h
r249094r249095
7979   virtual void device_reset();
8080
8181   virtual const rom_entry *device_rom_region() const;
82   virtual ioport_constructor device_input_ports() const;
8382   virtual machine_config_constructor device_mconfig_additions() const;
8483
8584private:
trunk/src/emu/netlist/nl_base.h
r249094r249095
12331233      pnamedlist_t<core_device_t *> m_started_devices;
12341234   #endif
12351235
1236   ATTR_COLD plog_base<NL_DEBUG> &log() { return m_log; }
12371236   ATTR_COLD const plog_base<NL_DEBUG> &log() const { return m_log; }
12381237
12391238   protected:
trunk/src/emu/netlist/nl_setup.h
r249094r249095
198198
199199      void model_parse(const pstring &model, model_map_t &map);
200200
201      plog_base<NL_DEBUG> &log() { return netlist().log(); }
202201      const plog_base<NL_DEBUG> &log() const { return netlist().log(); }
203202
204203   protected:
trunk/src/emu/netlist/plib/pstring.c
r249094r249095
1414
1515#include "pstring.h"
1616#include "palloc.h"
17#include "plists.h"
1817
1918template<>
2019pstr_t pstring_t<putf8_traits>::m_zero = pstr_t(0);
r249094r249095
306305// static stuff ...
307306// ----------------------------------------------------------------------------------------
308307
309/*
310 * Cached allocation of string memory
311 *
312 * This improves startup performance by 30%.
313 */
314
315#if 1
316
317static pstack_t<pstr_t *> *stk = NULL;
318
319static inline unsigned countleadbits(unsigned x)
320{
321#ifndef count_leading_zeros
322   unsigned msk;
323   unsigned ret;
324   if (x < 0x100)
325   {
326      msk = 0x80;
327      ret = 24;
328   }
329   else if (x < 0x10000)
330   {
331      msk = 0x8000;
332      ret = 16;
333   }
334   else if (x < 0x1000000)
335   {
336      msk = 0x800000;
337      ret = 8;
338   }
339   else
340   {
341      msk = 0x80000000;
342      ret = 0;
343   }
344   while ((msk & x) == 0 && ret < 31)
345   {
346      msk = msk >> 1;
347      ret++;
348   }
349   return ret;
350#else
351   return count_leading_zeros(x);
352#endif
353}
354
355308template<typename F>
356309void pstring_t<F>::sfree(pstr_t *s)
357310{
358311   s->m_ref_count--;
359312   if (s->m_ref_count == 0 && s != &m_zero)
360313   {
361      if (stk != NULL)
362      {
363         unsigned sn= ((32 - countleadbits(s->len())) + 1) / 2;
364         stk[sn].push(s);
365      }
366      else
367         pfree_array(((char *)s));
368      //_mm_free(((char *)s));
369   }
370}
371
372template<typename F>
373pstr_t *pstring_t<F>::salloc(int n)
374{
375   if (stk == NULL)
376      stk = palloc_array(pstack_t<pstr_t *>, 17);
377   pstr_t *p;
378   unsigned sn= ((32 - countleadbits(n)) + 1) / 2;
379   unsigned size = sizeof(pstr_t) + (1<<(sn * 2)) + 1;
380   if (stk[sn].empty())
381      p = (pstr_t *) palloc_array(char, size);
382   else
383   {
384      //printf("%u %u\n", sn, (unsigned) stk[sn].count());
385      p = stk[sn].pop();
386   }
387
388   //  str_t *p = (str_t *) _mm_malloc(size, 8);
389   p->init(n);
390   return p;
391}
392template<typename F>
393void pstring_t<F>::resetmem()
394{
395   if (stk != NULL)
396   {
397      for (unsigned i=0; i<=16; i++)
398      {
399         for (; stk[i].count() > 0; )
400            pfree_array(stk[i].pop());
401      }
402      pfree_array(stk);
403      stk = NULL;
404   }
405}
406
407
408#else
409template<typename F>
410void pstring_t<F>::sfree(pstr_t *s)
411{
412   s->m_ref_count--;
413   if (s->m_ref_count == 0 && s != &m_zero)
414   {
415314      pfree_array(((char *)s));
416315      //_mm_free(((char *)s));
417316   }
r249094r249095
432331{
433332   // Release the 0 string
434333}
435#endif
436334
437
438335// ----------------------------------------------------------------------------------------
439336// pstring ...
440337// ----------------------------------------------------------------------------------------
trunk/src/emu/netlist/plib/pstring.h
r249094r249095
2222   struct pstr_t
2323   {
2424      //str_t() : m_ref_count(1), m_len(0) { m_str[0] = 0; }
25      pstr_t(const unsigned alen)
25      pstr_t(const int alen)
2626      {
2727         init(alen);
2828      }
29      void init(const unsigned alen)
29      void init(const int alen)
3030      {
3131            m_ref_count = 1;
3232            m_len = alen;
3333            m_str[0] = 0;
3434      }
3535      char *str() { return &m_str[0]; }
36      unsigned len() const  { return m_len; }
36      int len() const  { return m_len; }
3737      int m_ref_count;
3838   private:
39      unsigned m_len;
39      int m_len;
4040      char m_str[1];
4141   };
4242
r249094r249095
548548class pfmt_writer_t
549549{
550550public:
551   pfmt_writer_t() : m_enabled(true) { }
551   pfmt_writer_t()  { }
552552   virtual ~pfmt_writer_t() { }
553553
554554   ATTR_COLD void operator ()(const char *fmt) const
555555   {
556      if (build_enabled && m_enabled) vdowrite(fmt);
556      if (build_enabled) vdowrite(fmt);
557557   }
558558
559559   template<typename T1>
560560   ATTR_COLD void operator ()(const char *fmt, const T1 &v1) const
561561   {
562      if (build_enabled && m_enabled) vdowrite(pfmt(fmt)(v1));
562      if (build_enabled) vdowrite(pfmt(fmt)(v1));
563563   }
564564
565565   template<typename T1, typename T2>
566566   ATTR_COLD void operator ()(const char *fmt, const T1 &v1, const T2 &v2) const
567567   {
568      if (build_enabled && m_enabled) vdowrite(pfmt(fmt)(v1)(v2));
568      if (build_enabled) vdowrite(pfmt(fmt)(v1)(v2));
569569   }
570570
571571   template<typename T1, typename T2, typename T3>
572572   ATTR_COLD void operator ()(const char *fmt, const T1 &v1, const T2 &v2, const T3 &v3) const
573573   {
574      if (build_enabled && m_enabled) vdowrite(pfmt(fmt)(v1)(v2)(v3));
574      if (build_enabled) vdowrite(pfmt(fmt)(v1)(v2)(v3));
575575   }
576576
577577   template<typename T1, typename T2, typename T3, typename T4>
578578   ATTR_COLD void operator ()(const char *fmt, const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4) const
579579   {
580      if (build_enabled && m_enabled) vdowrite(pfmt(fmt)(v1)(v2)(v3)(v4));
580      if (build_enabled) vdowrite(pfmt(fmt)(v1)(v2)(v3)(v4));
581581   }
582582
583583   template<typename T1, typename T2, typename T3, typename T4, typename T5>
584584   ATTR_COLD void operator ()(const char *fmt, const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5) const
585585   {
586      if (build_enabled && m_enabled) vdowrite(pfmt(fmt)(v1)(v2)(v3)(v4)(v5));
586      if (build_enabled) vdowrite(pfmt(fmt)(v1)(v2)(v3)(v4)(v5));
587587   }
588588
589   void set_enabled(const bool v)
590   {
591      m_enabled = v;
592   }
593
594   bool is_enabled() const { return m_enabled; }
595
596589protected:
597590   virtual void vdowrite(const pstring &ls) const {}
598591
599private:
600   bool m_enabled;
601
602592};
603593
604594template <plog_level L, bool build_enabled = true>
trunk/src/emu/netlist/solver/nld_solver.h
r249094r249095
135135   ATTR_COLD int get_net_idx(net_t *net);
136136
137137   inline eSolverType type() const { return m_type; }
138   plog_base<NL_DEBUG> &log() { return netlist().log(); }
138   const plog_base<NL_DEBUG> &log() const { return netlist().log(); }
139139
140140   virtual void log_stats();
141141
trunk/src/emu/sound/c352.c
r249094r249095
1313    Supports 8-bit linear and 8-bit muLaw samples
1414    Output: digital, 16 bit, 4 channels
1515    Output sample rate is the input clock / (288 * 2).
16   
17    superctr: The clock divider appears to be configurable for each system.
18    Below is a list of the divider values followed by the systems that use it.
19   
20    * 228: System 11.
21    * 288: System 22, Super 22, NB-1/2, ND-1, FL.
22    * 296: System 23, Super 23.
23    * 332: System 12.
2416 */
2517
2618#include "emu.h"
r249094r249095
476468
477469void c352_device::device_start()
478470{
479   int i;
471   int i, divider;
480472   double x_max = 32752.0;
481473   double y_max = 127.0;
482474   double u = 10.0;
r249094r249095
484476   // find our direct access
485477   m_direct = &space().direct();
486478
487   m_sample_rate_base = clock() / m_divider;
479   switch(m_divider)
480   {
481      case C352_DIVIDER_228:
482         divider=228;
483         break;
484      case C352_DIVIDER_288:
485      default:
486         divider=288;
487         break;
488      case C352_DIVIDER_332:
489         divider=332;
490         break;
491   }
488492
493   m_sample_rate_base = clock() / divider;
494
489495   m_stream = machine().sound().stream_alloc(*this, 0, 4, m_sample_rate_base);
490496
491497   // generate mulaw table for mulaw format samples
trunk/src/emu/sound/c352.h
r249094r249095
66#define __C352_H__
77
88//**************************************************************************
9//  CONSTANTS
10//**************************************************************************
11
12enum
13{
14   C352_DIVIDER_228 = 0,
15   C352_DIVIDER_288 = 1,
16   C352_DIVIDER_332 = 2
17};
18
19//**************************************************************************
920//  INTERFACE CONFIGURATION MACROS
1021//**************************************************************************
1122
trunk/src/emu/sound/l7a1045_l6028_dsp_a.c
r249094r249095
11// license:LGPL-2.1+
2// copyright-holders:David Haywood, Angelo Salese, ElSemi
2// copyright-holders:David Haywood, Angelo Salese, ElSemi, Andrew Gardner, Andrew Zaferakis
33/***************************************************************************
44
55    L7A1045 L6028 DSP-A
trunk/src/emu/sound/l7a1045_l6028_dsp_a.h
r249094r249095
11// license:LGPL-2.1+
2// copyright-holders:David Haywood, Angelo Salese, ElSemi
2// copyright-holders:David Haywood, Angelo Salese, ElSemi, Andrew Gardner, Andrew Zaferakis
33//**************************************************************************
44//  TYPE DEFINITIONS
55//**************************************************************************
trunk/src/emu/sound/tms5110.c
r249094r249095
1414
1515     Todo:
1616        - implement CS
17        - implement missing commands
1718        - TMS5110_CMD_TEST_TALK is only partially implemented
1819
1920     TMS5100:
r249094r249095
7879//define INTERP_SHIFT / (1<<m_coeff->interp_coeff[m_IP])
7980
8081/* Other hacks */
81/* HACK: if defined, outputs the low 4 bits of the lattice filter to the i/o
82/* HACK?: if defined, outputs the low 4 bits of the lattice filter to the i/o
8283 * or clip logic, even though the real hardware doesn't do this, partially verified by decap */
8384#undef ALLOW_4_LSB
8485
85/* forces m_TALK active instantly whenever m_SPEN would be activated, causing speech delay to be reduced by up to one frame time */
86/* for some reason, this hack makes snmath behave marginally more accurate to hardware, though it does not match the patent */
87#define FAST_START_HACK 1
8886
89
9087/* *****configuration of chip connection stuff***** */
9188/* must be defined; if 0, output the waveform as if it was tapped on the speaker pin as usual, if 1, output the waveform as if it was tapped on the i/o pin (volume is much lower in the latter case) */
9289#define FORCE_DIGITAL 0
r249094r249095
215212{
216213   save_item(NAME(m_variant));
217214
215   save_item(NAME(m_fifo));
216   save_item(NAME(m_fifo_head));
217   save_item(NAME(m_fifo_tail));
218   save_item(NAME(m_fifo_count));
219
218220   save_item(NAME(m_PDC));
219221   save_item(NAME(m_CTL_pins));
220222   save_item(NAME(m_SPEN));
r249094r249095
239241   save_item(NAME(m_old_frame_pitch_idx));
240242   save_item(NAME(m_old_frame_k_idx));
241243   save_item(NAME(m_old_zpar));
242   save_item(NAME(m_old_uv_zpar));
243244#endif
244245   save_item(NAME(m_current_energy));
245246   save_item(NAME(m_current_pitch));
r249094r249095
309310}
310311#endif
311312
313
312314/******************************************************************************************
313315
314     extract_bits -- extract a specific number of bits from the VSM
316     FIFO_data_write -- handle bit data write to the TMS5110 (as a result of toggling M0 pin)
315317
316318******************************************************************************************/
319void tms5110_device::FIFO_data_write(int data)
320{
321   /* add this bit to the FIFO */
322   if (m_fifo_count < FIFO_SIZE)
323   {
324      m_fifo[m_fifo_tail] = (data&1); /* set bit to 1 or 0 */
317325
326      m_fifo_tail = (m_fifo_tail + 1) % FIFO_SIZE;
327      m_fifo_count++;
328
329      if (DEBUG_5110) logerror("Added bit to FIFO (size=%2d)\n", m_fifo_count);
330   }
331   else
332   {
333      if (DEBUG_5110) logerror("Ran out of room in the FIFO!\n");
334   }
335}
336
337/******************************************************************************************
338
339     extract_bits -- extract a specific number of bits from the FIFO
340
341******************************************************************************************/
342
318343int tms5110_device::extract_bits(int count)
319344{
320345   int val = 0;
321   if (DEBUG_5110) logerror("requesting %d bits", count);
322   for (int i = 0; i < count; i++)
346   if (DEBUG_5110) logerror("requesting %d bits from fifo: ", count);
347   while (count--)
323348   {
324      val = (val<<1) | new_int_read();
325      if (DEBUG_5110) logerror("bit read: %d\n", val&1);
349      val = (val << 1) | (m_fifo[m_fifo_head] & 1);
350      m_fifo_count--;
351      m_fifo_head = (m_fifo_head + 1) % FIFO_SIZE;
326352   }
327353   if (DEBUG_5110) logerror("returning: %02x\n", val);
328354   return val;
329355}
330356
357void tms5110_device::request_bits(int no)
358{
359   for (int i = 0; i < no; i++)
360   {
361      UINT8 data = new_int_read();
362      if (DEBUG_5110) logerror("bit added to fifo: %d\n", data);
363      FIFO_data_write(data);
364   }
365}
331366
332367void tms5110_device::perform_dummy_read()
333368{
r249094r249095
354389   int i, bitout;
355390   INT32 this_sample;
356391
392   /* if we're not speaking, fill with nothingness */
393   if (!m_TALKD)
394      goto empty;
395
357396   /* loop until the buffer is full or we've stopped speaking */
358   while (size > 0)
397   while ((size > 0) && m_TALKD)
359398   {
360      if(m_TALKD) // speaking
399      /* if it is the appropriate time to update the old energy/pitch indices,
400       * i.e. when IP=7, PC=12, T=17, subcycle=2, do so. Since IP=7 PC=12 T=17
401       * is JUST BEFORE the transition to IP=0 PC=0 T=0 sybcycle=(0 or 1),
402       * which happens 4 T-cycles later), we change on the latter.
403       * The indices are updated here ~12 PCs before the new frame is applied.
404       */
405      /** TODO: the patents 4331836, 4335277, and 4419540 disagree about the timing of this **/
406      if ((m_IP == 0) && (m_PC == 0) && (m_subcycle < 2))
361407      {
362         /* if we're ready for a new frame to be applied, i.e. when IP=0, PC=12, Sub=1
363          * (In reality, the frame was really loaded incrementally during the entire IP=0
364          * PC=x time period, but it doesn't affect anything until IP=0 PC=12 happens)
365          */
366         if ((m_IP == 0) && (m_PC == 12) && (m_subcycle == 1))
367         {
368            // HACK for regression testing, be sure to comment out before release!
369            //m_RNG = 0x1234;
370            // end HACK
408         m_OLDE = (m_new_frame_energy_idx == 0);
409         m_OLDP = (m_new_frame_pitch_idx == 0);
410      }
371411
412      /* if we're ready for a new frame to be applied, i.e. when IP=0, PC=12, Sub=1
413       * (In reality, the frame was really loaded incrementally during the entire IP=0
414       * PC=x time period, but it doesn't affect anything until IP=0 PC=12 happens)
415       */
416      if ((m_IP == 0) && (m_PC == 12) && (m_subcycle == 1))
417      {
418         // HACK for regression testing, be sure to comment out before release!
419         //m_RNG = 0x1234;
420         // end HACK
421
372422#ifdef PERFECT_INTERPOLATION_HACK
373            /* remember previous frame energy, pitch, and coefficients */
374            m_old_frame_energy_idx = m_new_frame_energy_idx;
375            m_old_frame_pitch_idx = m_new_frame_pitch_idx;
376            for (i = 0; i < m_coeff->num_k; i++)
377               m_old_frame_k_idx[i] = m_new_frame_k_idx[i];
423         /* remember previous frame energy, pitch, and coefficients */
424         m_old_frame_energy_idx = m_new_frame_energy_idx;
425         m_old_frame_pitch_idx = m_new_frame_pitch_idx;
426         for (i = 0; i < m_coeff->num_k; i++)
427            m_old_frame_k_idx[i] = m_new_frame_k_idx[i];
378428#endif
379429
380            /* Parse a new frame into the new_target_energy, new_target_pitch and new_target_k[] */
381            parse_frame();
382
383            // if the new frame is unvoiced (or silenced via ZPAR), be sure to zero out the k5-k10 parameters
384            // NOTE: this is probably the bug the tms5100/tmc0280 has, pre-rev D, I think.
385            // GUESS: Pre-rev D versions start zeroing k5-k10 immediately upon new frame load regardless of interpolation inhibit
386            // I.e. ZPAR = /TALKD || (PC>5&&P=0)
387            // GUESS: D and later versions only start or stop zeroing k5-k10 at the IP7->IP0 transition AFTER the frame
388            // I.e. ZPAR = /TALKD || (PC>5&&OLDP)
389#ifdef PERFECT_INTERPOLATION_HACK
390            m_old_uv_zpar = m_uv_zpar;
391            m_old_zpar = m_zpar; // unset old zpar on new frame
430         /* Parse a new frame into the new_target_energy, new_target_pitch and new_target_k[] */
431         parse_frame();
432#ifdef DEBUG_PARSE_FRAME_DUMP
433         fprintf(stderr,"\n");
392434#endif
393            m_zpar = 0;
394            //m_uv_zpar = (OLD_FRAME_UNVOICED_FLAG||m_zpar); // GUESS: fixed version in tmc0280d/tms5100a/cd280x/tms5110
395            m_uv_zpar = (NEW_FRAME_UNVOICED_FLAG||m_zpar); // GUESS: buggy version in tmc0280/tms5100
435         /* if the new frame is unvoiced (or silenced via ZPAR), be sure to zero out the k5-k10 parameters */
436         m_uv_zpar = NEW_FRAME_UNVOICED_FLAG | m_zpar;
396437
397            /* if the new frame is a stop frame, unset both TALK and SPEN (via TCON). TALKD remains active while the energy is ramping to 0. */
398            if (NEW_FRAME_STOP_FLAG == 1)
399            {
400               m_TALK = m_SPEN = 0;
401            }
438         /* if the new frame is a stop frame, unset both TALK and SPEN. TALKD remains active while the energy is ramping to 0. */
439         if (NEW_FRAME_STOP_FLAG == 1)
440         {
441            m_TALK = m_SPEN = 0;
442         }
402443
403            /* in all cases where interpolation would be inhibited, set the inhibit flag; otherwise clear it.
404               Interpolation inhibit cases:
405             * Old frame was voiced, new is unvoiced
406             * Old frame was silence/zero energy, new has nonzero energy
407             * Old frame was unvoiced, new is voiced (note this is the case on the patent but may not be correct on the real final chip)
408             */
409            if ( ((OLD_FRAME_UNVOICED_FLAG == 0) && (NEW_FRAME_UNVOICED_FLAG == 1))
410               || ((OLD_FRAME_UNVOICED_FLAG == 1) && (NEW_FRAME_UNVOICED_FLAG == 0)) /* this line needs further investigation, starwars tie fighters may sound better without it */
411               || ((OLD_FRAME_SILENCE_FLAG == 1) && (NEW_FRAME_SILENCE_FLAG == 0)) )
412               m_inhibit = 1;
413            else // normal frame, normal interpolation
414               m_inhibit = 0;
444         /* in all cases where interpolation would be inhibited, set the inhibit flag; otherwise clear it.
445            Interpolation inhibit cases:
446          * Old frame was voiced, new is unvoiced
447          * Old frame was silence/zero energy, new has nonzero energy
448          * Old frame was unvoiced, new is voiced (note this is the case on the patent but may not be correct on the real final chip)
449          */
450         if ( ((OLD_FRAME_UNVOICED_FLAG == 0) && (NEW_FRAME_UNVOICED_FLAG == 1))
451            || ((OLD_FRAME_UNVOICED_FLAG == 1) && (NEW_FRAME_UNVOICED_FLAG == 0)) /* this line needs further investigation, starwars tie fighters may sound better without it */
452            || ((OLD_FRAME_SILENCE_FLAG == 1) && (NEW_FRAME_SILENCE_FLAG == 0)) )
453            m_inhibit = 1;
454         else // normal frame, normal interpolation
455            m_inhibit = 0;
415456
416457#ifdef DEBUG_GENERATION
417            /* Debug info for current parsed frame */
418            fprintf(stderr, "OLDE: %d; OLDP: %d; ", m_OLDE, m_OLDP);
419            fprintf(stderr,"Processing new frame: ");
420            if (m_inhibit == 0)
421               fprintf(stderr, "Normal Frame\n");
422            else
423               fprintf(stderr,"Interpolation Inhibited\n");
424            fprintf(stderr,"*** current Energy, Pitch and Ks =      %04d,   %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d\n",m_current_energy, m_current_pitch, m_current_k[0], m_current_k[1], m_current_k[2], m_current_k[3], m_current_k[4], m_current_k[5], m_current_k[6], m_current_k[7], m_current_k[8], m_current_k[9]);
425            fprintf(stderr,"*** target Energy(idx), Pitch, and Ks = %04d(%x),%04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d\n",
426               (m_coeff->energytable[m_new_frame_energy_idx] * (1-m_zpar)),
427               m_new_frame_energy_idx,
428               (m_coeff->pitchtable[m_new_frame_pitch_idx] * (1-m_zpar)),
429               (m_coeff->ktable[0][m_new_frame_k_idx[0]] * (1-m_zpar)),
430               (m_coeff->ktable[1][m_new_frame_k_idx[1]] * (1-m_zpar)),
431               (m_coeff->ktable[2][m_new_frame_k_idx[2]] * (1-m_zpar)),
432               (m_coeff->ktable[3][m_new_frame_k_idx[3]] * (1-m_zpar)),
433               (m_coeff->ktable[4][m_new_frame_k_idx[4]] * (1-m_uv_zpar)),
434               (m_coeff->ktable[5][m_new_frame_k_idx[5]] * (1-m_uv_zpar)),
435               (m_coeff->ktable[6][m_new_frame_k_idx[6]] * (1-m_uv_zpar)),
436               (m_coeff->ktable[7][m_new_frame_k_idx[7]] * (1-m_uv_zpar)),
437               (m_coeff->ktable[8][m_new_frame_k_idx[8]] * (1-m_uv_zpar)),
438               (m_coeff->ktable[9][m_new_frame_k_idx[9]] * (1-m_uv_zpar)) );
458         /* Debug info for current parsed frame */
459         fprintf(stderr, "OLDE: %d; OLDP: %d; ", m_OLDE, m_OLDP);
460         fprintf(stderr,"Processing frame: ");
461         if (m_inhibit == 0)
462            fprintf(stderr, "Normal Frame\n");
463         else
464            fprintf(stderr,"Interpolation Inhibited\n");
465         fprintf(stderr,"*** current Energy, Pitch and Ks =      %04d,   %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d\n",m_current_energy, m_current_pitch, m_current_k[0], m_current_k[1], m_current_k[2], m_current_k[3], m_current_k[4], m_current_k[5], m_current_k[6], m_current_k[7], m_current_k[8], m_current_k[9]);
466         fprintf(stderr,"*** target Energy(idx), Pitch, and Ks = %04d(%x),%04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d\n",
467            (m_coeff->energytable[m_new_frame_energy_idx] * (1-m_zpar)),
468            m_new_frame_energy_idx,
469            (m_coeff->pitchtable[m_new_frame_pitch_idx] * (1-m_zpar)),
470            (m_coeff->ktable[0][m_new_frame_k_idx[0]] * (1-m_zpar)),
471            (m_coeff->ktable[1][m_new_frame_k_idx[1]] * (1-m_zpar)),
472            (m_coeff->ktable[2][m_new_frame_k_idx[2]] * (1-m_zpar)),
473            (m_coeff->ktable[3][m_new_frame_k_idx[3]] * (1-m_zpar)),
474            (m_coeff->ktable[4][m_new_frame_k_idx[4]] * (1-m_uv_zpar)),
475            (m_coeff->ktable[5][m_new_frame_k_idx[5]] * (1-m_uv_zpar)),
476            (m_coeff->ktable[6][m_new_frame_k_idx[6]] * (1-m_uv_zpar)),
477            (m_coeff->ktable[7][m_new_frame_k_idx[7]] * (1-m_uv_zpar)),
478            (m_coeff->ktable[8][m_new_frame_k_idx[8]] * (1-m_uv_zpar)),
479            (m_coeff->ktable[9][m_new_frame_k_idx[9]] * (1-m_uv_zpar)) );
439480#endif
440481
482      }
483      else // Not a new frame, just interpolate the existing frame.
484      {
485         int inhibit_state = ((m_inhibit==1)&&(m_IP != 0)); // disable inhibit when reaching the last interp period, but don't overwrite the m_inhibit value
486#ifdef PERFECT_INTERPOLATION_HACK
487         int samples_per_frame = m_subc_reload?175:266; // either (13 A cycles + 12 B cycles) * 7 interps for normal SPEAK/SPKEXT, or (13*2 A cycles + 12 B cycles) * 7 interps for SPKSLOW
488         //int samples_per_frame = m_subc_reload?200:304; // either (13 A cycles + 12 B cycles) * 8 interps for normal SPEAK/SPKEXT, or (13*2 A cycles + 12 B cycles) * 8 interps for SPKSLOW
489         int current_sample = (m_subcycle - m_subc_reload)+(m_PC*(3-m_subc_reload))+((m_subc_reload?25:38)*((m_IP-1)&7));
490         //fprintf(stderr, "CS: %03d", current_sample);
491         // reset the current energy, pitch, etc to what it was at frame start
492         m_current_energy = (m_coeff->energytable[m_old_frame_energy_idx] * (1-m_zpar));
493         m_current_pitch = (m_coeff->pitchtable[m_old_frame_pitch_idx] * (1-m_old_zpar));
494         for (i = 0; i < 4; i++)
495            m_current_k[i] = (m_coeff->ktable[i][m_old_frame_k_idx[i]] * (1-m_old_zpar));
496         for (i = 4; i < m_coeff->num_k; i++)
497            m_current_k[i] = (m_coeff->ktable[i][m_old_frame_k_idx[i]] * (1-m_uv_zpar));
498         // now adjust each value to be exactly correct for each of the samples per frame
499         if (m_IP != 0) // if we're still interpolating...
500         {
501            m_current_energy += ((((m_coeff->energytable[m_new_frame_energy_idx] * (1-m_zpar)) - m_current_energy)*(1-inhibit_state))*current_sample)/samples_per_frame;
502            m_current_pitch += ((((m_coeff->pitchtable[m_new_frame_pitch_idx] * (1-m_zpar)) - m_current_pitch)*(1-inhibit_state))*current_sample)/samples_per_frame;
503            for (i = 0; i < m_coeff->num_k; i++)
504               m_current_k[i] += ((((m_coeff->ktable[i][m_new_frame_k_idx[i]] * (1-((i<4)?m_zpar:m_uv_zpar))) - m_current_k[i])*(1-inhibit_state))*current_sample)/samples_per_frame;
441505         }
442         else // Not a new frame, just interpolate the existing frame.
506         else // we're done, play this frame for 1/8 frame.
443507         {
444            int inhibit_state = ((m_inhibit==1)&&(m_IP != 0)); // disable inhibit when reaching the last interp period, but don't overwrite the m_inhibit value
445#ifdef PERFECT_INTERPOLATION_HACK
446            int samples_per_frame = m_subc_reload?175:266; // either (13 A cycles + 12 B cycles) * 7 interps for normal SPEAK/SPKEXT, or (13*2 A cycles + 12 B cycles) * 7 interps for SPKSLOW
447            //int samples_per_frame = m_subc_reload?200:304; // either (13 A cycles + 12 B cycles) * 8 interps for normal SPEAK/SPKEXT, or (13*2 A cycles + 12 B cycles) * 8 interps for SPKSLOW
448            int current_sample = (m_subcycle - m_subc_reload)+(m_PC*(3-m_subc_reload))+((m_subc_reload?25:38)*((m_IP-1)&7));
449            //fprintf(stderr, "CS: %03d", current_sample);
450            // reset the current energy, pitch, etc to what it was at frame start
451            m_current_energy = (m_coeff->energytable[m_old_frame_energy_idx] * (1-m_old_zpar));
452            m_current_pitch = (m_coeff->pitchtable[m_old_frame_pitch_idx] * (1-m_old_zpar));
508            m_current_energy = (m_coeff->energytable[m_new_frame_energy_idx] * (1-m_zpar));
509            m_current_pitch = (m_coeff->pitchtable[m_new_frame_pitch_idx] * (1-m_zpar));
453510            for (i = 0; i < m_coeff->num_k; i++)
454               m_current_k[i] = (m_coeff->ktable[i][m_old_frame_k_idx[i]] * (1-((i<4)?m_old_zpar:m_old_uv_zpar)));
455            // now adjust each value to be exactly correct for each of the samples per frame
456            if (m_IP != 0) // if we're still interpolating...
457            {
458               m_current_energy = (m_current_energy + (((m_coeff->energytable[m_new_frame_energy_idx] - m_current_energy)*(1-inhibit_state))*current_sample)/samples_per_frame)*(1-m_zpar);
459               m_current_pitch = (m_current_pitch + (((m_coeff->pitchtable[m_new_frame_pitch_idx] - m_current_pitch)*(1-inhibit_state))*current_sample)/samples_per_frame)*(1-m_zpar);
460               for (i = 0; i < m_coeff->num_k; i++)
461                  m_current_k[i] = (m_current_k[i] + (((m_coeff->ktable[i][m_new_frame_k_idx[i]] - m_current_k[i])*(1-inhibit_state))*current_sample)/samples_per_frame)*(1-((i<4)?m_zpar:m_uv_zpar));
462            }
463            else // we're done, play this frame for 1/8 frame.
464            {
465               m_current_energy = (m_coeff->energytable[m_new_frame_energy_idx] * (1-m_zpar));
466               m_current_pitch = (m_coeff->pitchtable[m_new_frame_pitch_idx] * (1-m_zpar));
467               for (i = 0; i < m_coeff->num_k; i++)
468                  m_current_k[i] = (m_coeff->ktable[i][m_new_frame_k_idx[i]] * (1-((i<4)?m_zpar:m_uv_zpar)));
469            }
511               m_current_k[i] = (m_coeff->ktable[i][m_new_frame_k_idx[i]] * (1-((i<4)?m_zpar:m_uv_zpar)));
512         }
470513#else
471            //Updates to parameters only happen on subcycle '2' (B cycle) of PCs.
472            if (m_subcycle == 2)
514         //Updates to parameters only happen on subcycle '2' (B cycle) of PCs.
515         if (m_subcycle == 2)
516         {
517            switch(m_PC)
473518            {
474               switch(m_PC)
475               {
476                  case 0: /* PC = 0, B cycle, write updated energy */
477                  m_current_energy = (m_current_energy + (((m_coeff->energytable[m_new_frame_energy_idx] - m_current_energy)*(1-inhibit_state)) INTERP_SHIFT))*(1-m_zpar);
478                  break;
479                  case 1: /* PC = 1, B cycle, write updated pitch */
480                  m_current_pitch = (m_current_pitch + (((m_coeff->pitchtable[m_new_frame_pitch_idx] - m_current_pitch)*(1-inhibit_state)) INTERP_SHIFT))*(1-m_zpar);
481                  break;
482                  case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11:
483                  /* PC = 2 through 11, B cycle, write updated K1 through K10 */
484                  m_current_k[m_PC-2] = (m_current_k[m_PC-2] + (((m_coeff->ktable[m_PC-2][m_new_frame_k_idx[m_PC-2]] - m_current_k[m_PC-2])*(1-inhibit_state)) INTERP_SHIFT))*(((m_PC-2)>4)?(1-m_uv_zpar):(1-m_zpar));
485                  break;
486                  case 12: /* PC = 12 */
487                  /* we should NEVER reach this point, PC=12 doesn't have a subcycle 2 */
488                  break;
489               }
519               case 0: /* PC = 0, B cycle, write updated energy */
520               m_current_energy += ((((m_coeff->energytable[m_new_frame_energy_idx] * (1-m_zpar)) - m_current_energy)*(1-inhibit_state)) INTERP_SHIFT);
521               break;
522               case 1: /* PC = 1, B cycle, write updated pitch */
523               m_current_pitch += ((((m_coeff->pitchtable[m_new_frame_pitch_idx] * (1-m_zpar)) - m_current_pitch)*(1-inhibit_state)) INTERP_SHIFT);
524               break;
525               case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11:
526               /* PC = 2 through 11, B cycle, write updated K1 through K10 */
527               m_current_k[m_PC-2] += ((((m_coeff->ktable[m_PC-2][m_new_frame_k_idx[m_PC-2]] * (1-(((m_PC-2)<4)?m_zpar:m_uv_zpar))) - m_current_k[m_PC-2])*(1-inhibit_state)) INTERP_SHIFT);
528               break;
529               case 12: /* PC = 12, do nothing */
530               break;
490531            }
532         }
491533#endif
492         }
534      }
493535
494         // calculate the output
495         if (OLD_FRAME_UNVOICED_FLAG == 1)
496         {
497            // generate unvoiced samples here
498            if (m_RNG & 1)
499               m_excitation_data = ~0x3F; /* according to the patent it is (either + or -) half of the maximum value in the chirp table, so either 01000000(0x40) or 11000000(0xC0)*/
500            else
501               m_excitation_data = 0x40;
502         }
503         else /* (OLD_FRAME_UNVOICED_FLAG == 0) */
504         {
505            // generate voiced samples here
506            /* US patent 4331836 Figure 14B shows, and logic would hold, that a pitch based chirp
507             * function has a chirp/peak and then a long chain of zeroes.
508             * The last entry of the chirp rom is at address 0b110011 (51d), the 52nd sample,
509             * and if the address reaches that point the ADDRESS incrementer is
510             * disabled, forcing all samples beyond 51d to be == 51d
511             */
512            if (m_pitch_count >= 51)
513               m_excitation_data = (INT8)m_coeff->chirptable[51];
514            else /*m_pitch_count < 51*/
515               m_excitation_data = (INT8)m_coeff->chirptable[m_pitch_count];
516         }
536      // calculate the output
537      if (OLD_FRAME_UNVOICED_FLAG == 1)
538      {
539         // generate unvoiced samples here
540         if (m_RNG & 1)
541            m_excitation_data = ~0x3F; /* according to the patent it is (either + or -) half of the maximum value in the chirp table, so either 01000000(0x40) or 11000000(0xC0)*/
542         else
543            m_excitation_data = 0x40;
544      }
545      else /* (OLD_FRAME_UNVOICED_FLAG == 0) */
546      {
547         // generate voiced samples here
548         /* US patent 4331836 Figure 14B shows, and logic would hold, that a pitch based chirp
549          * function has a chirp/peak and then a long chain of zeroes.
550          * The last entry of the chirp rom is at address 0b110011 (51d), the 52nd sample,
551          * and if the address reaches that point the ADDRESS incrementer is
552          * disabled, forcing all samples beyond 51d to be == 51d
553          */
554         if (m_pitch_count >= 51)
555            m_excitation_data = (INT8)m_coeff->chirptable[51];
556         else /*m_pitch_count < 51*/
557            m_excitation_data = (INT8)m_coeff->chirptable[m_pitch_count];
558      }
517559
518         // Update LFSR *20* times every sample (once per T cycle), like patent shows
519         for (i=0; i<20; i++)
520         {
521            bitout = ((m_RNG >> 12) & 1) ^
522                  ((m_RNG >>  3) & 1) ^
523                  ((m_RNG >>  2) & 1) ^
524                  ((m_RNG >>  0) & 1);
525            m_RNG <<= 1;
526            m_RNG |= bitout;
527         }
528         this_sample = lattice_filter(); /* execute lattice filter */
560      // Update LFSR *20* times every sample (once per T cycle), like patent shows
561   for (i=0; i<20; i++)
562   {
563      bitout = ((m_RNG >> 12) & 1) ^
564            ((m_RNG >>  3) & 1) ^
565            ((m_RNG >>  2) & 1) ^
566            ((m_RNG >>  0) & 1);
567      m_RNG <<= 1;
568      m_RNG |= bitout;
569   }
570      this_sample = lattice_filter(); /* execute lattice filter */
529571#ifdef DEBUG_GENERATION_VERBOSE
530         //fprintf(stderr,"C:%01d; ",m_subcycle);
531         fprintf(stderr,"IP:%01d PC:%02d X:%04d E:%03d P:%03d Pc:%03d ",m_IP, m_PC, m_excitation_data, m_current_energy, m_current_pitch, m_pitch_count);
532         //fprintf(stderr,"X:%04d E:%03d P:%03d Pc:%03d ", m_excitation_data, m_current_energy, m_current_pitch, m_pitch_count);
533         for (i=0; i<10; i++)
534            fprintf(stderr,"K%d:%04d ", i+1, m_current_k[i]);
535         fprintf(stderr,"Out:%06d ", this_sample);
536//#ifdef PERFECT_INTERPOLATION_HACK
537//         fprintf(stderr,"%d%d%d%d",m_old_zpar,m_zpar,m_old_uv_zpar,m_uv_zpar);
538//#else
539//         fprintf(stderr,"x%dx%d",m_zpar,m_uv_zpar);
540//#endif
541         fprintf(stderr,"\n");
572      //fprintf(stderr,"C:%01d; ",m_subcycle);
573      fprintf(stderr,"IP:%01d PC:%02d X:%04d E:%03d P:%03d Pc:%03d ",m_IP, m_PC, m_excitation_data, m_current_energy, m_current_pitch, m_pitch_count);
574      //fprintf(stderr,"X:%04d E:%03d P:%03d Pc:%03d ", m_excitation_data, m_current_energy, m_current_pitch, m_pitch_count);
575      for (i=0; i<10; i++)
576         fprintf(stderr,"K%d:%04d ", i+1, m_current_k[i]);
577      fprintf(stderr,"Out:%06d", this_sample);
578      fprintf(stderr,"\n");
542579#endif
543         /* next, force result to 14 bits (since its possible that the addition at the final (k1) stage of the lattice overflowed) */
544         while (this_sample > 16383) this_sample -= 32768;
545         while (this_sample < -16384) this_sample += 32768;
546         if (m_digital_select == 0) // analog SPK pin output is only 8 bits, with clipping
547            buffer[buf_count] = clip_analog(this_sample);
548         else // digital I/O pin output is 12 bits
549         {
580      /* next, force result to 14 bits (since its possible that the addition at the final (k1) stage of the lattice overflowed) */
581      while (this_sample > 16383) this_sample -= 32768;
582      while (this_sample < -16384) this_sample += 32768;
583      if (m_digital_select == 0) // analog SPK pin output is only 8 bits, with clipping
584         buffer[buf_count] = clip_analog(this_sample);
585      else // digital I/O pin output is 12 bits
586      {
550587#ifdef ALLOW_4_LSB
551            // input:  ssss ssss ssss ssss ssnn nnnn nnnn nnnn
552            // N taps:                       ^                 = 0x2000;
553            // output: ssss ssss ssss ssss snnn nnnn nnnn nnnN
554            buffer[buf_count] = (this_sample<<1)|((this_sample&0x2000)>>13);
588         // input:  ssss ssss ssss ssss ssnn nnnn nnnn nnnn
589         // N taps:                       ^                 = 0x2000;
590         // output: ssss ssss ssss ssss snnn nnnn nnnn nnnN
591         buffer[buf_count] = (this_sample<<1)|((this_sample&0x2000)>>13);
555592#else
556            this_sample &= ~0xF;
557            // input:  ssss ssss ssss ssss ssnn nnnn nnnn 0000
558            // N taps:                       ^^ ^^^            = 0x3E00;
559            // output: ssss ssss ssss ssss snnn nnnn nnnN NNNN
560            buffer[buf_count] = (this_sample<<1)|((this_sample&0x3E00)>>9);
593         this_sample &= ~0xF;
594         // input:  ssss ssss ssss ssss ssnn nnnn nnnn 0000
595         // N taps:                       ^^ ^^^            = 0x3E00;
596         // output: ssss ssss ssss ssss snnn nnnn nnnN NNNN
597         buffer[buf_count] = (this_sample<<1)|((this_sample&0x3E00)>>9);
561598#endif
562         }
563         // Update all counts
599      }
600      // Update all counts
564601
565         m_subcycle++;
566         if ((m_subcycle == 2) && (m_PC == 12)) // RESETF3
602      m_subcycle++;
603      if ((m_subcycle == 2) && (m_PC == 12)) // RESETF3
604      {
605         /* Circuit 412 in the patent acts a reset, resetting the pitch counter to 0
606          * if INHIBIT was true during the most recent frame transition.
607          * The exact time this occurs is betwen IP=7, PC=12 sub=0, T=t12
608          * and m_IP = 0, PC=0 sub=0, T=t12, a period of exactly 20 cycles,
609          * which overlaps the time OLDE and OLDP are updated at IP=7 PC=12 T17
610          * (and hence INHIBIT itself 2 t-cycles later). We do it here because it is
611          * convenient and should make no difference in output.
612          */
613         if ((m_IP == 7)&&(m_inhibit==1)) m_pitch_zero = 1;
614         if ((m_IP == 0)&&(m_pitch_zero==1)) m_pitch_zero = 0;
615#ifdef PERFECT_INTERPOLATION_HACK
616         m_old_zpar = m_zpar;
617#endif
618         m_zpar = 0; /* this gets effectively reset by resetf3, same signal which resets m_PC to 0 */
619         if (m_IP == 7) // RESETL4
567620         {
568            /* Circuit 412 in the patent acts a reset, resetting the pitch counter to 0
569             * if INHIBIT was true during the most recent frame transition.
570             * The exact time this occurs is betwen IP=7, PC=12 sub=0, T=t12
571             * and m_IP = 0, PC=0 sub=0, T=t12, a period of exactly 20 cycles,
572             * which overlaps the time OLDE and OLDP are updated at IP=7 PC=12 T17
573             * (and hence INHIBIT itself 2 t-cycles later). We do it here because it is
574             * convenient and should make no difference in output.
575             */
576            if ((m_IP == 7)&&(m_inhibit==1)) m_pitch_zero = 1;
577            if ((m_IP == 0)&&(m_pitch_zero==1)) m_pitch_zero = 0;
578            if (m_IP == 7) // RESETL4
579            {
580               // Latch OLDE and OLDP
581               OLD_FRAME_SILENCE_FLAG = NEW_FRAME_SILENCE_FLAG; // m_OLDE
582               OLD_FRAME_UNVOICED_FLAG = NEW_FRAME_UNVOICED_FLAG; // m_OLDP
583               /* if TALK was clear last frame, halt speech now, since TALKD (latched from TALK on new frame) just went inactive. */
621            /* if TALK was clear last frame, halt speech now, since TALKD (latched from TALK on new frame) just went inactive. */
584622#ifdef DEBUG_GENERATION
585               if (m_TALK == 0)
586                  fprintf(stderr,"tms5110_process: processing frame: TALKD = 0 caused by stop frame or buffer empty, halting speech.\n");
623            if (m_TALK == 0)
624               fprintf(stderr,"tms5110_process: processing frame: TALKD = 0 caused by stop frame or buffer empty, halting speech.\n");
587625#endif
588               m_TALKD = m_TALK; // TALKD is latched from TALK
589               m_TALK = m_SPEN; // TALK is latched from SPEN
590            }
591            m_subcycle = m_subc_reload;
592            m_PC = 0;
593            m_IP++;
594            m_IP&=0x7;
626            m_TALKD = m_TALK; // TALKD is latched from TALK
627            m_TALK = m_SPEN; // TALK is latched from SPEN
595628         }
596         else if (m_subcycle == 3)
597         {
598            m_subcycle = m_subc_reload;
599            m_PC++;
600         }
601         m_pitch_count++;
602         if ((m_pitch_count >= m_current_pitch)||(m_pitch_zero == 1)) m_pitch_count = 0;
603         m_pitch_count &= 0x1FF;
629         m_subcycle = m_subc_reload;
630         m_PC = 0;
631         m_IP++;
632         m_IP&=0x7;
604633      }
605      else // m_TALKD == 0
634      else if (m_subcycle == 3)
606635      {
607         m_subcycle++;
608         if ((m_subcycle == 2) && (m_PC == 12)) // RESETF3
636         m_subcycle = m_subc_reload;
637         m_PC++;
638      }
639      m_pitch_count++;
640      if ((m_pitch_count >= m_current_pitch)||(m_pitch_zero == 1)) m_pitch_count = 0;
641      m_pitch_count &= 0x1FF;
642      buf_count++;
643      size--;
644   }
645
646empty:
647
648   while (size > 0)
649   {
650      m_subcycle++;
651      if ((m_subcycle == 2) && (m_PC == 12)) // RESETF3
652      {
653         if (m_IP == 7) // RESETL4
609654         {
610            if (m_IP == 7) // RESETL4
611            {
612               m_TALKD = m_TALK; // TALKD is latched from TALK
613               m_TALK = m_SPEN; // TALK is latched from SPEN
614            }
615            m_subcycle = m_subc_reload;
616            m_PC = 0;
617            m_IP++;
618            m_IP&=0x7;
655            m_TALKD = m_TALK; // TALKD is latched from TALK
656            m_TALK = m_SPEN; // TALK is latched from SPEN
619657         }
620         else if (m_subcycle == 3)
621         {
622            m_subcycle = m_subc_reload;
623            m_PC++;
624         }
625         buffer[buf_count] = -1; /* should be just -1; actual chip outputs -1 every idle sample; (cf note in data sheet, p 10, table 4) */
658         m_subcycle = m_subc_reload;
659         m_PC = 0;
660         m_IP++;
661         m_IP&=0x7;
626662      }
627   buf_count++;
628   size--;
663      else if (m_subcycle == 3)
664      {
665         m_subcycle = m_subc_reload;
666         m_PC++;
667      }
668      buffer[buf_count] = -1; /* should be just -1; actual chip outputs -1 every idle sample; (cf note in data sheet, p 10, table 4) */
669      buf_count++;
670      size--;
629671   }
630672}
631673
r249094r249095
855897#endif
856898               perform_dummy_read();
857899               m_SPEN = 1; /* start immediately */
858#ifdef FAST_START_HACK
859               m_TALK = 1;
860#endif
861900               /* clear out variables before speaking */
862901               m_zpar = 1; // zero all the parameters
863               m_uv_zpar = 1; // zero k4-k10 as well
864               m_OLDE = 1; // 'silence/zpar' frames are zero energy
865               m_OLDP = 1; // 'silence/zpar' frames are zero pitch
866#ifdef PERFECT_INTERPOLATION_HACK
867               m_old_zpar = 1; // zero all the old parameters
868               m_old_uv_zpar = 1; // zero old k4-k10 as well
869#endif
870902               m_subc_reload = 0; // SPKSLOW means this is 0
903               m_subcycle = m_subc_reload;
904               m_PC = 0;
905               m_IP = 0;
871906               break;
872907
873908            case TMS5110_CMD_READ_BIT:
r249094r249095
881916#ifdef DEBUG_COMMAND_DUMP
882917                  fprintf(stderr,"actually reading a bit now\n");
883918#endif
919                  request_bits(1);
884920                  m_CTL_buffer >>= 1;
885921                  m_CTL_buffer |= (extract_bits(1)<<3);
886922                  m_CTL_buffer &= 0xF;
r249094r249095
893929#endif
894930               perform_dummy_read();
895931               m_SPEN = 1; /* start immediately */
896#ifdef FAST_START_HACK
897               m_TALK = 1;
898#endif
899932               /* clear out variables before speaking */
900933               m_zpar = 1; // zero all the parameters
901               m_uv_zpar = 1; // zero k4-k10 as well
902               m_OLDE = 1; // 'silence/zpar' frames are zero energy
903               m_OLDP = 1; // 'silence/zpar' frames are zero pitch
904#ifdef PERFECT_INTERPOLATION_HACK
905               m_old_zpar = 1; // zero all the old parameters
906               m_old_uv_zpar = 1; // zero old k4-k10 as well
907#endif
908934               m_subc_reload = 1; // SPEAK means this is 1
935               m_subcycle = m_subc_reload;
936               m_PC = 0;
937               m_IP = 0;
909938               break;
910939
911940            case TMS5110_CMD_READ_BRANCH:
r249094r249095
950979
951980void tms5110_device::parse_frame()
952981{
953   int i, rep_flag;
982   int bits, i, rep_flag;
983   /** TODO: get rid of bits handling here and move into extract_bits (as in tms5220.c) **/
984   /* count the total number of bits available */
985   bits = m_fifo_count;
954986
987   /* attempt to extract the energy index */
988   bits -= m_coeff->energy_bits;
989   if (bits < 0)
990   {
991      request_bits( -bits ); /* toggle M0 to receive needed bits */
992      bits = 0;
993   }
955994   // attempt to extract the energy index
956995   m_new_frame_energy_idx = extract_bits(m_coeff->energy_bits);
957996#ifdef DEBUG_PARSE_FRAME_DUMP
r249094r249095
959998   fprintf(stderr," ");
960999#endif
9611000
1001   /* if the energy index is 0 or 15, we're done
1002
1003   if ((indx == 0) || (indx == 15))
1004   {
1005       if (DEBUG_5110) logerror("  (4-bit energy=%d frame)\n",m_new_energy);
1006
1007   // clear the k's
1008       if (indx == 0)
1009       {
1010           for (i = 0; i < m_coeff->num_k; i++)
1011               m_new_k[i] = 0;
1012       }
1013
1014       // clear fifo if stop frame encountered
1015       if (indx == 15)
1016       {
1017           if (DEBUG_5110) logerror("  (4-bit energy=%d STOP frame)\n",m_new_energy);
1018           m_fifo_head = m_fifo_tail = m_fifo_count = 0;
1019       }
1020       return;
1021   }*/
9621022   // if the energy index is 0 or 15, we're done
9631023   if ((m_new_frame_energy_idx == 0) || (m_new_frame_energy_idx == 15))
9641024      return;
9651025
1026
1027   /* attempt to extract the repeat flag */
1028   bits -= 1;
1029   if (bits < 0)
1030   {
1031      request_bits( -bits ); /* toggle M0 to receive needed bits */
1032      bits = 0;
1033   }
9661034   rep_flag = extract_bits(1);
9671035#ifdef DEBUG_PARSE_FRAME_DUMP
9681036   printbits(rep_flag, 1);
9691037   fprintf(stderr," ");
9701038#endif
9711039
1040   /* attempt to extract the pitch */
1041   bits -= m_coeff->pitch_bits;
1042   if (bits < 0)
1043   {
1044      request_bits( -bits ); /* toggle M0 to receive needed bits */
1045      bits = 0;
1046   }
9721047   m_new_frame_pitch_idx = extract_bits(m_coeff->pitch_bits);
9731048#ifdef DEBUG_PARSE_FRAME_DUMP
9741049   printbits(m_new_frame_pitch_idx,m_coeff->pitch_bits);
r249094r249095
9811056   // extract first 4 K coefficients
9821057   for (i = 0; i < 4; i++)
9831058   {
1059      /* attempt to extract 4 K's */
1060      bits -= m_coeff->kbits[i];
1061      if (bits < 0)
1062      {
1063         request_bits( -bits ); /* toggle M0 to receive needed bits */
1064         bits = 0;
1065      }
9841066      m_new_frame_k_idx[i] = extract_bits(m_coeff->kbits[i]);
9851067#ifdef DEBUG_PARSE_FRAME_DUMP
9861068      printbits(m_new_frame_k_idx[i],m_coeff->kbits[i]);
r249094r249095
9981080   // If we got here, we need the remaining 6 K's
9991081   for (i = 4; i < m_coeff->num_k; i++)
10001082   {
1083      bits -= m_coeff->kbits[i];
1084      if (bits < 0)
1085      {
1086         request_bits( -bits ); /* toggle M0 to receive needed bits */
1087         bits = 0;
1088      }
10011089      m_new_frame_k_idx[i] = extract_bits(m_coeff->kbits[i]);
10021090#ifdef DEBUG_PARSE_FRAME_DUMP
10031091      printbits(m_new_frame_k_idx[i],m_coeff->kbits[i]);
10041092      fprintf(stderr," ");
10051093#endif
10061094   }
1007#ifdef DEBUG_PARSE_FRAME_DUMP
1008         fprintf(stderr,"\n");
1009#endif
10101095#ifdef VERBOSE
1096   if (m_speak_external)
1097      logerror("Parsed a frame successfully in FIFO - %d bits remaining\n", (m_fifo_count*8)-(m_fifo_bits_taken));
1098   else
10111099      logerror("Parsed a frame successfully in ROM\n");
10121100#endif
10131101   return;
r249094r249095
11511239void tms5110_device::device_reset()
11521240{
11531241   m_digital_select = FORCE_DIGITAL; // assume analog output
1242   /* initialize the FIFO */
1243   memset(m_fifo, 0, sizeof(m_fifo));
1244   m_fifo_head = m_fifo_tail = m_fifo_count = 0;
11541245
11551246   /* initialize the chip state */
11561247   m_SPEN = m_TALK = m_TALKD = 0;
r249094r249095
11631254#ifdef PERFECT_INTERPOLATION_HACK
11641255   m_old_frame_energy_idx = m_old_frame_pitch_idx = 0;
11651256   memset(m_old_frame_k_idx, 0, sizeof(m_old_frame_k_idx));
1166   m_old_zpar = m_old_uv_zpar = 0;
1257   m_old_zpar = 0;
11671258#endif
11681259   m_new_frame_energy_idx = m_current_energy = m_previous_energy = 0;
11691260   m_new_frame_pitch_idx = m_current_pitch = 0;
r249094r249095
13001391}
13011392
13021393
1394
13031395/******************************************************************************
13041396
1397     tms5110_ready_r -- return the not ready status from the sound chip
1398
1399******************************************************************************/
1400
1401int tms5110_device::ready_r()
1402{
1403   /* bring up to date first */
1404   m_stream->update();
1405   return (m_fifo_count < FIFO_SIZE-1);
1406}
1407
1408
1409
1410/******************************************************************************
1411
13051412     tms5110_update -- update the sound chip so that it is in sync with CPU execution
13061413
13071414******************************************************************************/
trunk/src/emu/sound/tms5110.h
r249094r249095
77
88#include "emu.h"
99
10/* HACK: if defined, uses impossibly perfect 'straight line' interpolation */
11#undef PERFECT_INTERPOLATION_HACK
10#define FIFO_SIZE               64 // TODO: technically the tms51xx chips don't have a fifo at all
1211
1312/* TMS5110 commands */
1413                              /* CTL8  CTL4  CTL2  CTL1  |   PDC's  */
r249094r249095
1615#define TMS5110_CMD_RESET        (0) /*    0     0     0     x  |     1    */
1716#define TMS5110_CMD_LOAD_ADDRESS (2) /*    0     0     1     x  |     2    */
1817#define TMS5110_CMD_OUTPUT       (4) /*    0     1     0     x  |     3    */
19#define TMS5110_CMD_SPKSLOW      (6) /*    0     1     1     x  |     1    | Note: this command is undocumented on the datasheets, it only appears on the patents. It might not actually work properly on some of the real chips as manufactured. Acts the same as CMD_SPEAK, but makes the interpolator take three A cycles whereever it would normally only take one, effectively making speech of any given word take twice as long as normal. */
18#define TMS5110_CMD_SPKSLOW      (6) /*    0     1     1     x  |     1    | Note: this command is undocumented on the datasheets, it only appears on the patents. It might not actually work properly on some of the real chips as manufactured. Acts the same as CMD_SPEAK, but makes the interpolator take two A cycles whereever it would normally only take one, effectively making speech of any given word take about twice as long as normal. */
2019#define TMS5110_CMD_READ_BIT     (8) /*    1     0     0     x  |     1    */
2120#define TMS5110_CMD_SPEAK       (10) /*    1     0     1     x  |     1    */
2221#define TMS5110_CMD_READ_BRANCH (12) /*    1     1     0     x  |     1    */
r249094r249095
6564    */
6665   DECLARE_READ8_MEMBER( romclk_hack_r );
6766
67   int ready_r();
6868   void set_frequency(int frequency);
6969
7070   int _speech_rom_read_bit();
r249094r249095
9393   void new_int_write_addr(UINT8 addr);
9494   UINT8 new_int_read();
9595   void register_for_save_states();
96   void FIFO_data_write(int data);
9697   int extract_bits(int count);
98   void request_bits(int no);
9799   void perform_dummy_read();
98100   INT32 lattice_filter();
99101   void process(INT16 *buffer, unsigned int size);
r249094r249095
107109   /* coefficient tables */
108110   const struct tms5100_coeffs *m_coeff;
109111
112   /* these contain data that describes the 4 bit "FIFO" */
113   UINT8 m_fifo[FIFO_SIZE];
114   UINT8 m_fifo_head;
115   UINT8 m_fifo_tail;
116   UINT8 m_fifo_count;
117
110118   /* these contain global status bits */
111119   UINT8 m_PDC;
112120   UINT8 m_CTL_pins;
r249094r249095
154162   UINT8 m_old_frame_pitch_idx;
155163   UINT8 m_old_frame_k_idx[10];
156164   UINT8 m_old_zpar;
157   UINT8 m_old_uv_zpar;
158165
159166   INT32 m_current_energy;
160167   INT32 m_current_pitch;
trunk/src/emu/sound/tms5220.c
r249094r249095
4848
4949TODO:
5050    * Ever since the big rewrite, there are glitches on certain frame transitions
51      for example in the word 'rid' during the eprom attract mode,
51      for example in the word 'robots' during the eprom attract mode,
5252      I (LN) am not entirely sure why the real chip doesn't have these as well.
5353      Needs more real hardware testing/dumps for comparison.
54    * Ever since the timing rewrite, the above problem is slightly worse. This
55      time, however, it is probably a 'real' bug, which I (LN) am in the process
56      of tracking down.
57      i.e. the word 'congratulations' in victory when you get a high score.
5458    * Implement a ready callback for pc interfaces
5559    - this will be quite a challenge since for it to be really accurate
5660      the whole emulation has to run in sync (lots of timers) with the
r249094r249095
5862    * If a command is still executing, /READY will be kept high until the command has
5963      finished if the next command is written.
6064    * tomcat has a 5220 which is not hooked up at all
65    * Is the TS=0 forcing energy to 0 for next frame in the interpolator actually correct? I'm (LN) guessing no. The patent schematics state that TS=0 shuts off the output dac completely, though doesn't affect the I/O pin.
6166
6267Pedantic detail from observation of real chip:
6368The 5200 and 5220 chips outputs the following coefficients over PROMOUT while
r249094r249095
262267//define INTERP_SHIFT / (1<<m_coeff->interp_coeff[m_IP])
263268
264269/* Other hacks */
265/* HACK: if defined, outputs the low 4 bits of the lattice filter to the i/o
270/* HACK?: if defined, outputs the low 4 bits of the lattice filter to the i/o
266271 * or clip logic, even though the real hardware doesn't do this, partially verified by decap */
267272#undef ALLOW_4_LSB
268273
269/* forces m_TALK active instantly whenever m_SPEN would be activated, causing speech delay to be reduced by up to one frame time */
270/* for some reason, this hack makes victory behave better, though it does not match the patent */
271#define FAST_START_HACK 1
272274
273
274275/* *****configuration of chip connection stuff***** */
275276/* must be defined; if 0, output the waveform as if it was tapped on the speaker pin as usual, if 1, output the waveform as if it was tapped on the i/o pin (volume is much lower in the latter case) */
276277#define FORCE_DIGITAL 0
r249094r249095
360361   save_item(NAME(m_fifo_count));
361362   save_item(NAME(m_fifo_bits_taken));
362363
363   save_item(NAME(m_previous_TALK_STATUS));
364   save_item(NAME(m_SPEN));
365   save_item(NAME(m_DDIS));
366   save_item(NAME(m_TALK));
367   save_item(NAME(m_TALKD));
364   save_item(NAME(m_speaking_now));
365   save_item(NAME(m_speak_external));
366   save_item(NAME(m_talk_status));
368367   save_item(NAME(m_buffer_low));
369368   save_item(NAME(m_buffer_empty));
370369   save_item(NAME(m_irq_pin));
r249094r249095
385384   save_item(NAME(m_current_pitch));
386385   save_item(NAME(m_current_k));
387386
387   save_item(NAME(m_target_energy));
388   save_item(NAME(m_target_pitch));
389   save_item(NAME(m_target_k));
390
388391   save_item(NAME(m_previous_energy));
389392
390393   save_item(NAME(m_subcycle));
r249094r249095
392395   save_item(NAME(m_PC));
393396   save_item(NAME(m_IP));
394397   save_item(NAME(m_inhibit));
395   save_item(NAME(m_uv_zpar));
396   save_item(NAME(m_zpar));
397   save_item(NAME(m_pitch_zero));
398398   save_item(NAME(m_c_variant_rate));
399399   save_item(NAME(m_pitch_count));
400400
r249094r249095
465465
466466void tms5220_device::data_write(int data)
467467{
468   int old_buffer_low = m_buffer_low;
469468#ifdef DEBUG_DUMP_INPUT_DATA
470469   fprintf(stdout, "%c",data);
471470#endif
472   if (m_DDIS) // If we're in speak external mode
471   if (m_speak_external) // If we're in speak external mode
473472   {
474473      // add this byte to the FIFO
475474      if (m_fifo_count < FIFO_SIZE)
r249094r249095
478477         m_fifo_tail = (m_fifo_tail + 1) % FIFO_SIZE;
479478         m_fifo_count++;
480479#ifdef DEBUG_FIFO
481         fprintf(stderr,"data_write: Added byte to FIFO (current count=%2d)\n", m_fifo_count);
480         logerror("data_write: Added byte to FIFO (current count=%2d)\n", m_fifo_count);
482481#endif
483482         update_fifo_status_and_ints();
484         // if we just unset buffer low with that last write, and SPEN *was* zero (see circuit 251, sheet 12)
485         if ((m_SPEN == 0) && ((old_buffer_low == 1) && (m_buffer_low == 0))) // MUST HAVE EDGE DETECT
483         if ((m_talk_status == 0) && (m_buffer_low == 0)) // we just unset buffer low with that last write, and talk status *was* zero...
486484         {
487            int i;
485         int i;
488486#ifdef DEBUG_FIFO
489            fprintf(stderr,"data_write triggered SPEN to go active!\n");
487         logerror("data_write triggered talk status to go active!\n");
490488#endif
491            // ...then we now have enough bytes to start talking; set zpar and clear out the new frame parameters (it will become old frame just before the first call to parse_frame() )
492            m_zpar = 1;
493            m_uv_zpar = 1; // zero k4-k10 as well
494            m_OLDE = 1; // 'silence/zpar' frames are zero energy
495            m_OLDP = 1; // 'silence/zpar' frames are zero pitch
496#ifdef PERFECT_INTERPOLATION_HACK
497            m_old_zpar = 1; // zero all the old parameters
498            m_old_uv_zpar = 1; // zero old k4-k10 as well
499#endif
500            m_SPEN = 1;
501#ifdef FAST_START_HACK
502            m_TALK = 1;
503#endif
489            // ...then we now have enough bytes to start talking; clear out the new frame parameters (it will become old frame just before the first call to parse_frame() )
490            // TODO: the 3 lines below (and others) are needed for victory to not fail its selftest due to a sample ending too late, may require additional investigation
491            m_subcycle = m_subc_reload;
492            m_PC = 0;
493            m_IP = reload_table[m_c_variant_rate&0x3]; // is this correct? should this be always 7 instead, so that the new frame is loaded quickly?
504494            m_new_frame_energy_idx = 0;
505495            m_new_frame_pitch_idx = 0;
506496            for (i = 0; i < 4; i++)
r249094r249095
509499               m_new_frame_k_idx[i] = 0xF;
510500            for (i = 7; i < m_coeff->num_k; i++)
511501               m_new_frame_k_idx[i] = 0x7;
512
502            m_talk_status = m_speaking_now = 1;
513503         }
514504      }
515505      else
516506      {
517507#ifdef DEBUG_FIFO
518         fprintf(stderr,"data_write: Ran out of room in the tms52xx FIFO! this should never happen!\n");
508         logerror("data_write: Ran out of room in the tms52xx FIFO! this should never happen!\n");
519509         // at this point, /READY should remain HIGH/inactive until the fifo has at least one byte open in it.
520510#endif
521511      }
522512
523513
524514   }
525   else //(! m_DDIS)
515   else //(! m_speak_external)
526516      // R Nabet : we parse commands at once.  It is necessary for such commands as read.
527517      process_command(data);
528518}
r249094r249095
570560      m_buffer_low = 0;
571561
572562   /* BE is set if neither byte 15 nor 14 of the fifo are in use; this
573   translates to having fifo_count equal to exactly 0
574   */
563   translates to having fifo_count equal to exactly 0 */
575564   if (m_fifo_count == 0)
576565   {
577566      // generate an interrupt if necessary; if /BE was inactive and is now active, set int.
578567      if (!m_buffer_empty)
579568         set_interrupt_state(1);
580569      m_buffer_empty = 1;
581      m_TALK = m_SPEN = 0; // /BE being active clears the TALK(TCON) status which in turn clears SPEN
582570   }
583571   else
584572      m_buffer_empty = 0;
585573
586   // generate an interrupt if /TS was active, and is now inactive.
587   // also, in this case, regardless if DDIS was set, unset it.
588   if (m_previous_TALK_STATUS == 1 && (TALK_STATUS == 0))
574   /* TS is talk status and is set elsewhere in the fifo parser and in
575   the SPEAK command handler; however, if /BE is true during speak external
576   mode, it is immediately unset here. */
577   if ((m_speak_external == 1) && (m_buffer_empty == 1))
589578   {
590#ifdef VERBOSE
591      fprintf(stderr,"Talk status WAS 1, is now 0, unsetting DDIS and firing an interrupt!\n");
592#endif
593      set_interrupt_state(1);
594      m_DDIS = 0;
579      // generate an interrupt: /TS was active, and is now inactive.
580      if (m_talk_status == 1)
581      {
582         m_talk_status = m_speak_external = 0;
583         set_interrupt_state(1);
584      }
595585   }
596   m_previous_TALK_STATUS = TALK_STATUS;
597
586   /* Note that TS being unset will also generate an interrupt when a STOP
587   frame is encountered; this is handled in the sample generator code and not here */
598588}
599589
600590/**********************************************************************************************
r249094r249095
607597{
608598   int val = 0;
609599
610   if (m_DDIS)
600   if (m_speak_external)
611601   {
612602      // extract from FIFO
613603      while (count--)
r249094r249095
653643      /* clear the interrupt pin on status read */
654644      set_interrupt_state(0);
655645#ifdef DEBUG_PIN_READS
656      fprintf(stderr,"Status read: TS=%d BL=%d BE=%d\n", TALK_STATUS, m_buffer_low, m_buffer_empty);
646      logerror("Status read: TS=%d BL=%d BE=%d\n", m_talk_status, m_buffer_low, m_buffer_empty);
657647#endif
658648
659      return (TALK_STATUS << 7) | (m_buffer_low << 6) | (m_buffer_empty << 5);
649      return (m_talk_status << 7) | (m_buffer_low << 6) | (m_buffer_empty << 5);
660650   }
661651}
662652
r249094r249095
670660int tms5220_device::ready_read()
671661{
672662#ifdef DEBUG_PIN_READS
673   fprintf(stderr,"ready_read: ready pin read, io_ready is %d, fifo count is %d, DDIS(speak external) is %d\n", m_io_ready, m_fifo_count, m_DDIS);
663   logerror("ready_read: ready pin read, io_ready is %d, fifo count is %d\n", m_io_ready, m_fifo_count);
674664#endif
675   return ((m_fifo_count < FIFO_SIZE)||(!m_DDIS)) && m_io_ready;
665   return ((m_fifo_count < FIFO_SIZE)||(!m_speak_external)) && m_io_ready;
676666}
677667
678668
r249094r249095
728718int tms5220_device::int_read()
729719{
730720#ifdef DEBUG_PIN_READS
731   fprintf(stderr,"int_read: irq pin read, state is %d\n", m_irq_pin);
721   logerror("int_read: irq pin read, state is %d\n", m_irq_pin);
732722#endif
733723   return m_irq_pin;
734724}
r249094r249095
743733void tms5220_device::process(INT16 *buffer, unsigned int size)
744734{
745735   int buf_count=0;
746   int i, bitout;
736   int i, bitout, zpar;
747737   INT32 this_sample;
748738
749#ifdef VERBOSE
750   fprintf(stderr,"process called with size of %d; IP=%d, PC=%d, subcycle=%d, m_SPEN=%d, m_TALK=%d, m_TALKD=%d\n", size, m_IP, m_PC, m_subcycle, m_SPEN, m_TALK, m_TALKD);
751#endif
739   /* the following gotos are probably safe to remove */
740   /* if we're empty and still not speaking, fill with nothingness */
741   if (!m_speaking_now)
742      goto empty;
752743
744   /* if speak external is set, but talk status is not (yet) set,
745   wait for buffer low to clear */
746   if (!m_talk_status && m_speak_external && m_buffer_low)
747      goto empty;
748
753749   /* loop until the buffer is full or we've stopped speaking */
754   while (size > 0)
750   while ((size > 0) && m_speaking_now)
755751   {
756      if(m_TALKD) // speaking
752      /* if it is the appropriate time to update the old energy/pitch indices,
753       * i.e. when IP=7, PC=12, T=17, subcycle=2, do so. Since IP=7 PC=12 T=17
754       * is JUST BEFORE the transition to IP=0 PC=0 T=0 sybcycle=(0 or 1),
755       * which happens 4 T-cycles later), we change on the latter.
756       * The indices are updated here ~12 PCs before the new frame is applied.
757       */
758      /** TODO: the patents 4331836, 4335277, and 4419540 disagree about the timing of this **/
759      if ((m_IP == 0) && (m_PC == 0) && (m_subcycle < 2))
757760      {
758         /* if we're ready for a new frame to be applied, i.e. when IP=0, PC=12, Sub=1
759         * (In reality, the frame was really loaded incrementally during the entire IP=0
760         * PC=x time period, but it doesn't affect anything until IP=0 PC=12 happens)
761         */
762         if ((m_IP == 0) && (m_PC == 12) && (m_subcycle == 1))
763         {
764            // HACK for regression testing, be sure to comment out before release!
765            //m_RNG = 0x1234;
766            // end HACK
761         m_OLDE = (m_new_frame_energy_idx == 0);
762         m_OLDP = (m_new_frame_pitch_idx == 0);
763      }
767764
768            /* appropriately override the interp count if needed; this will be incremented after the frame parse! */
769            m_IP = reload_table[m_c_variant_rate&0x3];
765      /* if we're ready for a new frame to be applied, i.e. when IP=0, PC=12, Sub=1
766       * (In reality, the frame was really loaded incrementally during the entire IP=0
767       * PC=x time period, but it doesn't affect anything until IP=0 PC=12 happens)
768       */
769      if ((m_IP == 0) && (m_PC == 12) && (m_subcycle == 1))
770      {
771         // HACK for regression testing, be sure to comment out before release!
772         //m_RNG = 0x1234;
773         // end HACK
770774
775         /* appropriately override the interp count if needed; this will be incremented after the frame parse! */
776         m_IP = reload_table[m_c_variant_rate&0x3];
777
771778#ifdef PERFECT_INTERPOLATION_HACK
772            /* remember previous frame energy, pitch, and coefficients */
773            m_old_frame_energy_idx = m_new_frame_energy_idx;
774            m_old_frame_pitch_idx = m_new_frame_pitch_idx;
775            for (i = 0; i < m_coeff->num_k; i++)
776               m_old_frame_k_idx[i] = m_new_frame_k_idx[i];
779         /* remember previous frame energy, pitch, and coefficients */
780         m_old_frame_energy_idx = m_new_frame_energy_idx;
781         m_old_frame_pitch_idx = m_new_frame_pitch_idx;
782         for (i = 0; i < m_coeff->num_k; i++)
783            m_old_frame_k_idx[i] = m_new_frame_k_idx[i];
777784#endif
778785
779            /* Parse a new frame into the new_target_energy, new_target_pitch and new_target_k[] */
780            parse_frame();
786         /* if the talk status was clear last frame, halt speech now. */
787         if (m_talk_status == 0)
788         {
789#ifdef DEBUG_GENERATION
790            fprintf(stderr,"tms5220_process: processing frame: talk status = 0 caused by stop frame or buffer empty, halting speech.\n");
791#endif
792            if (m_speaking_now == 1) // we're done, set all coeffs to idle state but keep going for a bit...
793            {
794               /**TODO: should index clearing be done here, or elsewhere? **/
795               m_new_frame_energy_idx = 0;
796               m_new_frame_pitch_idx = 0;
797               for (i = 0; i < 4; i++)
798                  m_new_frame_k_idx[i] = 0;
799               for (i = 4; i < 7; i++)
800                  m_new_frame_k_idx[i] = 0xF;
801               for (i = 7; i < m_coeff->num_k; i++)
802                  m_new_frame_k_idx[i] = 0x7;
803               m_speaking_now = 2; // wait 8 extra interp periods before shutting down so we can interpolate everything to zero state
804            }
805            else // m_speaking_now == 2 // now we're really done.
806            {
807               m_speaking_now = 0; // finally halt speech
808               goto empty;
809            }
810         }
781811
782            // if the new frame is unvoiced (or silenced via ZPAR), be sure to zero out the k5-k10 parameters
783            // NOTE: this is probably the bug the tms5100/tmc0280 has, pre-rev D, I think.
784            // GUESS: Pre-rev D versions start zeroing k5-k10 immediately upon new frame load regardless of interpolation inhibit
785            // I.e. ZPAR = /TALKD || (PC>5&&P=0)
786            // GUESS: D and later versions only start or stop zeroing k5-k10 at the IP7->IP0 transition AFTER the frame
787            // I.e. ZPAR = /TALKD || (PC>5&&OLDP)
788#ifdef PERFECT_INTERPOLATION_HACK
789            m_old_uv_zpar = m_uv_zpar;
790            m_old_zpar = m_zpar; // unset old zpar on new frame
812
813         /* Parse a new frame into the new_target_energy, new_target_pitch and new_target_k[],
814          * but only if we're not just about to end speech */
815         if (m_speaking_now == 1) parse_frame();
816#ifdef DEBUG_PARSE_FRAME_DUMP
817         fprintf(stderr,"\n");
791818#endif
792            m_zpar = 0;
793            //m_uv_zpar = (OLD_FRAME_UNVOICED_FLAG||m_zpar); // GUESS: fixed version in tmc0280d/tms5100a/cd280x/tms5110
794            m_uv_zpar = (NEW_FRAME_UNVOICED_FLAG||m_zpar); // GUESS: buggy version in tmc0280/tms5100
795819
796            /* if the new frame is a stop frame, unset both TALK and SPEN (via TCON). TALKD remains active while the energy is ramping to 0. */
797            if (NEW_FRAME_STOP_FLAG == 1)
820         /* if the new frame is a stop frame, set an interrupt and set talk status to 0 */
821         /** TODO: investigate this later! **/
822         if (NEW_FRAME_STOP_FLAG == 1)
798823            {
799               m_TALK = m_SPEN = 0;
824               m_talk_status = m_speak_external = 0;
825               set_interrupt_state(1);
826               update_fifo_status_and_ints();
800827            }
801828
802            /* in all cases where interpolation would be inhibited, set the inhibit flag; otherwise clear it.
803            Interpolation inhibit cases:
804            * Old frame was voiced, new is unvoiced
805            * Old frame was silence/zero energy, new has nonzero energy
806            * Old frame was unvoiced, new is voiced
807            * Old frame was unvoiced, new frame is silence/zero energy (unique to tms52xx)
808            */
809            if ( ((OLD_FRAME_UNVOICED_FLAG == 0) && (NEW_FRAME_UNVOICED_FLAG == 1))
810               || ((OLD_FRAME_UNVOICED_FLAG == 1) && (NEW_FRAME_UNVOICED_FLAG == 0))
811               || ((OLD_FRAME_SILENCE_FLAG == 1) && (NEW_FRAME_SILENCE_FLAG == 0))
812               || ((OLD_FRAME_UNVOICED_FLAG == 1) && (NEW_FRAME_SILENCE_FLAG == 1)) )
813               m_inhibit = 1;
814            else // normal frame, normal interpolation
815               m_inhibit = 0;
829         /* in all cases where interpolation would be inhibited, set the inhibit flag; otherwise clear it.
830            Interpolation inhibit cases:
831          * Old frame was voiced, new is unvoiced
832          * Old frame was silence/zero energy, new has nonzero energy
833          * Old frame was unvoiced, new is voiced
834          * Old frame was unvoiced, new frame is silence/zero energy (unique to tms52xx)
835          */
836         if ( ((OLD_FRAME_UNVOICED_FLAG == 0) && (NEW_FRAME_UNVOICED_FLAG == 1))
837            || ((OLD_FRAME_UNVOICED_FLAG == 1) && (NEW_FRAME_UNVOICED_FLAG == 0))
838            || ((OLD_FRAME_SILENCE_FLAG == 1) && (NEW_FRAME_SILENCE_FLAG == 0))
839            || ((OLD_FRAME_UNVOICED_FLAG == 1) && (NEW_FRAME_SILENCE_FLAG == 1)) )
840            m_inhibit = 1;
841         else // normal frame, normal interpolation
842            m_inhibit = 0;
816843
844         /* load new frame targets from tables, using parsed indices */
845         m_target_energy = m_coeff->energytable[m_new_frame_energy_idx];
846         m_target_pitch = m_coeff->pitchtable[m_new_frame_pitch_idx];
847         zpar = NEW_FRAME_UNVOICED_FLAG; // find out if parameters k5-k10 should be zeroed
848         for (i = 0; i < 4; i++)
849            m_target_k[i] = m_coeff->ktable[i][m_new_frame_k_idx[i]];
850         for (i = 4; i < m_coeff->num_k; i++)
851            m_target_k[i] = (m_coeff->ktable[i][m_new_frame_k_idx[i]] * (1-zpar));
852
817853#ifdef DEBUG_GENERATION
818            /* Debug info for current parsed frame */
819            fprintf(stderr, "OLDE: %d; OLDP: %d; ", m_OLDE, m_OLDP);
820            fprintf(stderr,"Processing new frame: ");
821            if (m_inhibit == 0)
822               fprintf(stderr, "Normal Frame\n");
823            else
824               fprintf(stderr,"Interpolation Inhibited\n");
825            fprintf(stderr,"*** current Energy, Pitch and Ks =      %04d,   %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d\n",m_current_energy, m_current_pitch, m_current_k[0], m_current_k[1], m_current_k[2], m_current_k[3], m_current_k[4], m_current_k[5], m_current_k[6], m_current_k[7], m_current_k[8], m_current_k[9]);
826            fprintf(stderr,"*** target Energy(idx), Pitch, and Ks = %04d(%x),%04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d\n",
827               (m_coeff->energytable[m_new_frame_energy_idx] * (1-m_zpar)),
828               m_new_frame_energy_idx,
829               (m_coeff->pitchtable[m_new_frame_pitch_idx] * (1-m_zpar)),
830               (m_coeff->ktable[0][m_new_frame_k_idx[0]] * (1-m_zpar)),
831               (m_coeff->ktable[1][m_new_frame_k_idx[1]] * (1-m_zpar)),
832               (m_coeff->ktable[2][m_new_frame_k_idx[2]] * (1-m_zpar)),
833               (m_coeff->ktable[3][m_new_frame_k_idx[3]] * (1-m_zpar)),
834               (m_coeff->ktable[4][m_new_frame_k_idx[4]] * (1-m_uv_zpar)),
835               (m_coeff->ktable[5][m_new_frame_k_idx[5]] * (1-m_uv_zpar)),
836               (m_coeff->ktable[6][m_new_frame_k_idx[6]] * (1-m_uv_zpar)),
837               (m_coeff->ktable[7][m_new_frame_k_idx[7]] * (1-m_uv_zpar)),
838               (m_coeff->ktable[8][m_new_frame_k_idx[8]] * (1-m_uv_zpar)),
839               (m_coeff->ktable[9][m_new_frame_k_idx[9]] * (1-m_uv_zpar)) );
854         /* Debug info for current parsed frame */
855         fprintf(stderr, "OLDE: %d; OLDP: %d; ", m_OLDE, m_OLDP);
856         fprintf(stderr,"Processing frame: ");
857         if (m_inhibit == 0)
858            fprintf(stderr, "Normal Frame\n");
859         else
860            fprintf(stderr,"Interpolation Inhibited\n");
861         fprintf(stderr,"*** current Energy, Pitch and Ks =      %04d,   %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d\n",m_current_energy, m_current_pitch, m_current_k[0], m_current_k[1], m_current_k[2], m_current_k[3], m_current_k[4], m_current_k[5], m_current_k[6], m_current_k[7], m_current_k[8], m_current_k[9]);
862         fprintf(stderr,"*** target Energy(idx), Pitch, and Ks = %04d(%x),%04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d, %04d\n",m_target_energy, m_new_frame_energy_idx, m_target_pitch, m_target_k[0], m_target_k[1], m_target_k[2], m_target_k[3], m_target_k[4], m_target_k[5], m_target_k[6], m_target_k[7], m_target_k[8], m_target_k[9]);
840863#endif
841864
842         }
843         else // Not a new frame, just interpolate the existing frame.
865         /* if TS is now 0, ramp the energy down to 0. Is this really correct to hardware? */
866         if (m_talk_status == 0)
844867         {
845            int inhibit_state = ((m_inhibit==1)&&(m_IP != 0)); // disable inhibit when reaching the last interp period, but don't overwrite the m_inhibit value
846#ifdef PERFECT_INTERPOLATION_HACK
847            int samples_per_frame = m_subc_reload?175:266; // either (13 A cycles + 12 B cycles) * 7 interps for normal SPEAK/SPKEXT, or (13*2 A cycles + 12 B cycles) * 7 interps for SPKSLOW
848            //int samples_per_frame = m_subc_reload?200:304; // either (13 A cycles + 12 B cycles) * 8 interps for normal SPEAK/SPKEXT, or (13*2 A cycles + 12 B cycles) * 8 interps for SPKSLOW
849            int current_sample = (m_subcycle - m_subc_reload)+(m_PC*(3-m_subc_reload))+((m_subc_reload?25:38)*((m_IP-1)&7));
850            //fprintf(stderr, "CS: %03d", current_sample);
851            // reset the current energy, pitch, etc to what it was at frame start
852            m_current_energy = (m_coeff->energytable[m_old_frame_energy_idx] * (1-m_old_zpar));
853            m_current_pitch = (m_coeff->pitchtable[m_old_frame_pitch_idx] * (1-m_old_zpar));
854            for (i = 0; i < m_coeff->num_k; i++)
855               m_current_k[i] = (m_coeff->ktable[i][m_old_frame_k_idx[i]] * (1-((i<4)?m_old_zpar:m_old_uv_zpar)));
856            // now adjust each value to be exactly correct for each of the samples per frame
857            if (m_IP != 0) // if we're still interpolating...
858            {
859               m_current_energy = (m_current_energy + (((m_coeff->energytable[m_new_frame_energy_idx] - m_current_energy)*(1-inhibit_state))*current_sample)/samples_per_frame)*(1-m_zpar);
860               m_current_pitch = (m_current_pitch + (((m_coeff->pitchtable[m_new_frame_pitch_idx] - m_current_pitch)*(1-inhibit_state))*current_sample)/samples_per_frame)*(1-m_zpar);
861               for (i = 0; i < m_coeff->num_k; i++)
862                  m_current_k[i] = (m_current_k[i] + (((m_coeff->ktable[i][m_new_frame_k_idx[i]] - m_current_k[i])*(1-inhibit_state))*current_sample)/samples_per_frame)*(1-((i<4)?m_zpar:m_uv_zpar));
863            }
864            else // we're done, play this frame for 1/8 frame.
865            {
866               m_current_energy = (m_coeff->energytable[m_new_frame_energy_idx] * (1-m_zpar));
867               m_current_pitch = (m_coeff->pitchtable[m_new_frame_pitch_idx] * (1-m_zpar));
868               for (i = 0; i < m_coeff->num_k; i++)
869                  m_current_k[i] = (m_coeff->ktable[i][m_new_frame_k_idx[i]] * (1-((i<4)?m_zpar:m_uv_zpar)));
870            }
871#else
872            //Updates to parameters only happen on subcycle '2' (B cycle) of PCs.
873            if (m_subcycle == 2)
874            {
875               switch(m_PC)
876               {
877                  case 0: /* PC = 0, B cycle, write updated energy */
878                  m_current_energy = (m_current_energy + (((m_coeff->energytable[m_new_frame_energy_idx] - m_current_energy)*(1-inhibit_state)) INTERP_SHIFT))*(1-m_zpar);
879                  break;
880                  case 1: /* PC = 1, B cycle, write updated pitch */
881                  m_current_pitch = (m_current_pitch + (((m_coeff->pitchtable[m_new_frame_pitch_idx] - m_current_pitch)*(1-inhibit_state)) INTERP_SHIFT))*(1-m_zpar);
882                  break;
883                  case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11:
884                  /* PC = 2 through 11, B cycle, write updated K1 through K10 */
885                  m_current_k[m_PC-2] = (m_current_k[m_PC-2] + (((m_coeff->ktable[m_PC-2][m_new_frame_k_idx[m_PC-2]] - m_current_k[m_PC-2])*(1-inhibit_state)) INTERP_SHIFT))*(((m_PC-2)>4)?(1-m_uv_zpar):(1-m_zpar));
886                  break;
887                  case 12: /* PC = 12 */
888                  /* we should NEVER reach this point, PC=12 doesn't have a subcycle 2 */
889                  break;
890               }
891            }
868#ifdef DEBUG_GENERATION
869            fprintf(stderr,"Talk status is 0, forcing target energy to 0\n");
892870#endif
871            m_target_energy = 0;
893872         }
873      }
874      else // Not a new frame, just interpolate the existing frame.
875      {
876         int inhibit_state = ((m_inhibit==1)&&(m_IP != 0)); // disable inhibit when reaching the last interp period, but don't overwrite the m_inhibit value
877#ifdef PERFECT_INTERPOLATION_HACK
878         int samples_per_frame = m_subc_reload?175:266; // either (13 A cycles + 12 B cycles) * 7 interps for normal SPEAK/SPKEXT, or (13*2 A cycles + 12 B cycles) * 7 interps for SPKSLOW
879         //int samples_per_frame = m_subc_reload?200:304; // either (13 A cycles + 12 B cycles) * 8 interps for normal SPEAK/SPKEXT, or (13*2 A cycles + 12 B cycles) * 8 interps for SPKSLOW
880         int current_sample = (m_subcycle - m_subc_reload)+(m_PC*(3-m_subc_reload))+((m_subc_reload?25:38)*((m_IP-1)&7));
894881
895         // calculate the output
896         if (OLD_FRAME_UNVOICED_FLAG == 1)
882         zpar = OLD_FRAME_UNVOICED_FLAG;
883         //fprintf(stderr, "CS: %03d", current_sample);
884         // reset the current energy, pitch, etc to what it was at frame start
885         m_current_energy = m_coeff->energytable[m_old_frame_energy_idx];
886         m_current_pitch = m_coeff->pitchtable[m_old_frame_pitch_idx];
887         for (i = 0; i < 4; i++)
888            m_current_k[i] = m_coeff->ktable[i][m_old_frame_k_idx[i]];
889         for (i = 4; i < m_coeff->num_k; i++)
890            m_current_k[i] = (m_coeff->ktable[i][m_old_frame_k_idx[i]] * (1-zpar));
891         // now adjust each value to be exactly correct for each of the samples per frame
892         if (m_IP != 0) // if we're still interpolating...
897893         {
898            // generate unvoiced samples here
899            if (m_RNG & 1)
900               m_excitation_data = ~0x3F; /* according to the patent it is (either + or -) half of the maximum value in the chirp table, so either 01000000(0x40) or 11000000(0xC0)*/
901            else
902               m_excitation_data = 0x40;
894            m_current_energy += (((m_target_energy - m_current_energy)*(1-inhibit_state))*current_sample)/samples_per_frame;
895            m_current_pitch += (((m_target_pitch - m_current_pitch)*(1-inhibit_state))*current_sample)/samples_per_frame;
896            for (i = 0; i < m_coeff->num_k; i++)
897               m_current_k[i] += (((m_target_k[i] - m_current_k[i])*(1-inhibit_state))*current_sample)/samples_per_frame;
903898         }
904         else /* (OLD_FRAME_UNVOICED_FLAG == 0) */
899         else // we're done, play this frame for 1/8 frame.
905900         {
906            // generate voiced samples here
907            /* US patent 4331836 Figure 14B shows, and logic would hold, that a pitch based chirp
908            * function has a chirp/peak and then a long chain of zeroes.
909            * The last entry of the chirp rom is at address 0b110011 (51d), the 52nd sample,
910            * and if the address reaches that point the ADDRESS incrementer is
911            * disabled, forcing all samples beyond 51d to be == 51d
912            */
913            if (m_pitch_count >= 51)
914               m_excitation_data = (INT8)m_coeff->chirptable[51];
915            else /*m_pitch_count < 51*/
916               m_excitation_data = (INT8)m_coeff->chirptable[m_pitch_count];
901            m_current_energy = m_target_energy;
902            m_current_pitch = m_target_pitch;
903            for (i = 0; i < m_coeff->num_k; i++)
904               m_current_k[i] = m_target_k[i];
917905         }
918
919         // Update LFSR *20* times every sample (once per T cycle), like patent shows
920         for (i=0; i<20; i++)
906#else
907         //Updates to parameters only happen on subcycle '2' (B cycle) of PCs.
908         if (m_subcycle == 2)
921909         {
922            bitout = ((m_RNG >> 12) & 1) ^
923                  ((m_RNG >>  3) & 1) ^
924                  ((m_RNG >>  2) & 1) ^
925                  ((m_RNG >>  0) & 1);
926            m_RNG <<= 1;
927            m_RNG |= bitout;
910            switch(m_PC)
911            {
912               case 0: /* PC = 0, B cycle, write updated energy */
913               m_current_energy += (((m_target_energy - m_current_energy)*(1-inhibit_state)) INTERP_SHIFT);
914               break;
915               case 1: /* PC = 1, B cycle, write updated pitch */
916               m_current_pitch += (((m_target_pitch - m_current_pitch)*(1-inhibit_state)) INTERP_SHIFT);
917               break;
918               case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11:
919               /* PC = 2 through 11, B cycle, write updated K1 through K10 */
920               m_current_k[m_PC-2] += (((m_target_k[m_PC-2] - m_current_k[m_PC-2])*(1-inhibit_state)) INTERP_SHIFT);
921               break;
922               case 12: /* PC = 12, do nothing */
923               break;
924            }
928925         }
929         this_sample = lattice_filter(); /* execute lattice filter */
926#endif
927      }
928
929      // calculate the output
930      if (OLD_FRAME_UNVOICED_FLAG == 1)
931      {
932         // generate unvoiced samples here
933         if (m_RNG & 1)
934            m_excitation_data = ~0x3F; /* according to the patent it is (either + or -) half of the maximum value in the chirp table, so either 01000000(0x40) or 11000000(0xC0)*/
935         else
936            m_excitation_data = 0x40;
937      }
938      else /* (OLD_FRAME_UNVOICED_FLAG == 0) */
939      {
940         // generate voiced samples here
941         /* US patent 4331836 Figure 14B shows, and logic would hold, that a pitch based chirp
942          * function has a chirp/peak and then a long chain of zeroes.
943          * The last entry of the chirp rom is at address 0b110011 (51d), the 52nd sample,
944          * and if the address reaches that point the ADDRESS incrementer is
945          * disabled, forcing all samples beyond 51d to be == 51d
946          */
947         if (m_pitch_count >= 51)
948            m_excitation_data = (INT8)m_coeff->chirptable[51];
949         else /*m_pitch_count < 51*/
950            m_excitation_data = (INT8)m_coeff->chirptable[m_pitch_count];
951      }
952
953      // Update LFSR *20* times every sample (once per T cycle), like patent shows
954   for (i=0; i<20; i++)
955   {
956      bitout = ((m_RNG >> 12) & 1) ^
957            ((m_RNG >>  3) & 1) ^
958            ((m_RNG >>  2) & 1) ^
959            ((m_RNG >>  0) & 1);
960      m_RNG <<= 1;
961      m_RNG |= bitout;
962   }
963      this_sample = lattice_filter(); /* execute lattice filter */
930964#ifdef DEBUG_GENERATION_VERBOSE
931         //fprintf(stderr,"C:%01d; ",m_subcycle);
932         fprintf(stderr,"IP:%01d PC:%02d X:%04d E:%03d P:%03d Pc:%03d ",m_IP, m_PC, m_excitation_data, m_current_energy, m_current_pitch, m_pitch_count);
933         //fprintf(stderr,"X:%04d E:%03d P:%03d Pc:%03d ", m_excitation_data, m_current_energy, m_current_pitch, m_pitch_count);
934         for (i=0; i<10; i++)
935            fprintf(stderr,"K%d:%04d ", i+1, m_current_k[i]);
936         fprintf(stderr,"Out:%06d ", this_sample);
937//#ifdef PERFECT_INTERPOLATION_HACK
938//         fprintf(stderr,"%d%d%d%d",m_old_zpar,m_zpar,m_old_uv_zpar,m_uv_zpar);
939//#else
940//         fprintf(stderr,"x%dx%d",m_zpar,m_uv_zpar);
941//#endif
942         fprintf(stderr,"\n");
965      //fprintf(stderr,"C:%01d; ",m_subcycle);
966      fprintf(stderr,"IP:%01d PC:%02d X:%04d E:%03d P:%03d Pc:%03d ",m_IP, m_PC, m_excitation_data, m_current_energy, m_current_pitch, m_pitch_count);
967      //fprintf(stderr,"X:%04d E:%03d P:%03d Pc:%03d ", m_excitation_data, m_current_energy, m_current_pitch, m_pitch_count);
968      for (i=0; i<10; i++)
969         fprintf(stderr,"K%d:%04d ", i+1, m_current_k[i]);
970      fprintf(stderr,"Out:%06d", this_sample);
971      fprintf(stderr,"\n");
943972#endif
944         /* next, force result to 14 bits (since its possible that the addition at the final (k1) stage of the lattice overflowed) */
945         while (this_sample > 16383) this_sample -= 32768;
946         while (this_sample < -16384) this_sample += 32768;
947         if (m_digital_select == 0) // analog SPK pin output is only 8 bits, with clipping
948            buffer[buf_count] = clip_analog(this_sample);
949         else // digital I/O pin output is 12 bits
950         {
973      /* next, force result to 14 bits (since its possible that the addition at the final (k1) stage of the lattice overflowed) */
974      while (this_sample > 16383) this_sample -= 32768;
975      while (this_sample < -16384) this_sample += 32768;
976      if (m_digital_select == 0) // analog SPK pin output is only 8 bits, with clipping
977         buffer[buf_count] = clip_analog(this_sample);
978      else // digital I/O pin output is 12 bits
979      {
951980#ifdef ALLOW_4_LSB
952            // input:  ssss ssss ssss ssss ssnn nnnn nnnn nnnn
953            // N taps:                       ^                 = 0x2000;
954            // output: ssss ssss ssss ssss snnn nnnn nnnn nnnN
955            buffer[buf_count] = (this_sample<<1)|((this_sample&0x2000)>>13);
981         // input:  ssss ssss ssss ssss ssnn nnnn nnnn nnnn
982         // N taps:                       ^                 = 0x2000;
983         // output: ssss ssss ssss ssss snnn nnnn nnnn nnnN
984         buffer[buf_count] = (this_sample<<1)|((this_sample&0x2000)>>13);
956985#else
957            this_sample &= ~0xF;
958            // input:  ssss ssss ssss ssss ssnn nnnn nnnn 0000
959            // N taps:                       ^^ ^^^            = 0x3E00;
960            // output: ssss ssss ssss ssss snnn nnnn nnnN NNNN
961            buffer[buf_count] = (this_sample<<1)|((this_sample&0x3E00)>>9);
986         this_sample &= ~0xF;
987         // input:  ssss ssss ssss ssss ssnn nnnn nnnn 0000
988         // N taps:                       ^^ ^^^            = 0x3E00;
989         // output: ssss ssss ssss ssss snnn nnnn nnnN NNNN
990         buffer[buf_count] = (this_sample<<1)|((this_sample&0x3E00)>>9);
962991#endif
963         }
964         // Update all counts
992      }
993      // Update all counts
965994
966         m_subcycle++;
967         if ((m_subcycle == 2) && (m_PC == 12)) // RESETF3
968         {
969            /* Circuit 412 in the patent acts a reset, resetting the pitch counter to 0
970            * if INHIBIT was true during the most recent frame transition.
971            * The exact time this occurs is betwen IP=7, PC=12 sub=0, T=t12
972            * and m_IP = 0, PC=0 sub=0, T=t12, a period of exactly 20 cycles,
973            * which overlaps the time OLDE and OLDP are updated at IP=7 PC=12 T17
974            * (and hence INHIBIT itself 2 t-cycles later). We do it here because it is
975            * convenient and should make no difference in output.
976            */
977            if ((m_IP == 7)&&(m_inhibit==1)) m_pitch_zero = 1;
978            if ((m_IP == 0)&&(m_pitch_zero==1)) m_pitch_zero = 0;
979            if (m_IP == 7) // RESETL4
980            {
981               // Latch OLDE and OLDP
982               OLD_FRAME_SILENCE_FLAG = NEW_FRAME_SILENCE_FLAG; // m_OLDE
983               OLD_FRAME_UNVOICED_FLAG = NEW_FRAME_UNVOICED_FLAG; // m_OLDP
984               /* if TALK was clear last frame, halt speech now, since TALKD (latched from TALK on new frame) just went inactive. */
985#ifdef DEBUG_GENERATION
986               fprintf(stderr,"RESETL4, about to update status: IP=%d, PC=%d, subcycle=%d, m_SPEN=%d, m_TALK=%d, m_TALKD=%d\n", m_IP, m_PC, m_subcycle, m_SPEN, m_TALK, m_TALKD);
987#endif
988#ifdef DEBUG_GENERATION
989               if (m_TALK == 0)
990                  fprintf(stderr,"tms5220_process: processing frame: TALKD = 0 caused by stop frame or buffer empty, halting speech.\n");
991#endif
992               m_TALKD = m_TALK; // TALKD is latched from TALK
993               update_fifo_status_and_ints(); // to trigger an interrupt if TALK_STATUS is now inactive
994               m_TALK = m_SPEN; // TALK is latched from SPEN
995#ifdef DEBUG_GENERATION
996               fprintf(stderr,"RESETL4, status updated: IP=%d, PC=%d, subcycle=%d, m_SPEN=%d, m_TALK=%d, m_TALKD=%d\n", m_IP, m_PC, m_subcycle, m_SPEN, m_TALK, m_TALKD);
997#endif
998            }
999            m_subcycle = m_subc_reload;
1000            m_PC = 0;
1001            m_IP++;
1002            m_IP&=0x7;
1003         }
1004         else if (m_subcycle == 3)
1005         {
1006            m_subcycle = m_subc_reload;
1007            m_PC++;
1008         }
1009         m_pitch_count++;
1010         if ((m_pitch_count >= m_current_pitch)||(m_pitch_zero == 1)) m_pitch_count = 0;
1011         m_pitch_count &= 0x1FF;
995      m_subcycle++;
996      if ((m_subcycle == 2) && (m_PC == 12))
997      {
998         /* Circuit 412 in the patent acts a reset, resetting the pitch counter to 0
999          * if INHIBIT was true during the most recent frame transition.
1000          * The exact time this occurs is betwen IP=7, PC=12 sub=0, T=t12
1001          * and m_IP = 0, PC=0 sub=0, T=t12, a period of exactly 20 cycles,
1002          * which overlaps the time OLDE and OLDP are updated at IP=7 PC=12 T17
1003          * (and hence INHIBIT itself 2 t-cycles later). We do it here because it is
1004          * convenient and should make no difference in output.
1005          */
1006         if ((m_IP == 7)&&(m_inhibit==1)) m_pitch_count = 0;
1007         m_subcycle = m_subc_reload;
1008         m_PC = 0;
1009         m_IP++;
1010         m_IP&=0x7;
10121011      }
1013      else // m_TALKD == 0
1012      else if (m_subcycle == 3)
10141013      {
1015         m_subcycle++;
1016         if ((m_subcycle == 2) && (m_PC == 12)) // RESETF3
1017         {
1018            if (m_IP == 7) // RESETL4
1019            {
1020               m_TALKD = m_TALK; // TALKD is latched from TALK
1021               m_TALK = m_SPEN; // TALK is latched from SPEN
1022            }
1023            m_subcycle = m_subc_reload;
1024            m_PC = 0;
1025            m_IP++;
1026            m_IP&=0x7;
1027         }
1028         else if (m_subcycle == 3)
1029         {
1030            m_subcycle = m_subc_reload;
1031            m_PC++;
1032         }
1033         buffer[buf_count] = -1; /* should be just -1; actual chip outputs -1 every idle sample; (cf note in data sheet, p 10, table 4) */
1014         m_subcycle = m_subc_reload;
1015         m_PC++;
10341016      }
1035   buf_count++;
1036   size--;
1017      m_pitch_count++;
1018      if (m_pitch_count >= m_current_pitch) m_pitch_count = 0;
1019      m_pitch_count &= 0x1FF;
1020      buf_count++;
1021      size--;
10371022   }
1023
1024empty:
1025
1026   while (size > 0)
1027   {
1028      m_subcycle++;
1029      if ((m_subcycle == 2) && (m_PC == 12))
1030      {
1031         m_subcycle = m_subc_reload;
1032         m_PC = 0;
1033         m_IP++;
1034         m_IP&=0x7;
1035      }
1036      else if (m_subcycle == 3)
1037      {
1038         m_subcycle = m_subc_reload;
1039         m_PC++;
1040      }
1041      buffer[buf_count] = -1; /* should be just -1; actual chip outputs -1 every idle sample; (cf note in data sheet, p 10, table 4) */
1042      buf_count++;
1043      size--;
1044   }
10381045}
10391046
10401047/**********************************************************************************************
r249094r249095
11751182
11761183void tms5220_device::process_command(unsigned char cmd)
11771184{
1178   int i;
11791185#ifdef DEBUG_COMMAND_DUMP
11801186      fprintf(stderr,"process_command called with parameter %02X\n",cmd);
11811187#endif
r249094r249095
11831189      switch (cmd & 0x70)
11841190      {
11851191      case 0x10 : /* read byte */
1186         if (TALK_STATUS == 0) /* TALKST must be clear for RDBY */
1192         if (m_talk_status == 0) /* TALKST must be clear for RDBY */
11871193         {
11881194            if (m_schedule_dummy_read)
11891195            {
r249094r249095
12051211      break;
12061212
12071213      case 0x30 : /* read and branch */
1208         if (TALK_STATUS == 0) /* TALKST must be clear for RB */
1214         if (m_talk_status == 0) /* TALKST must be clear for RB */
12091215         {
12101216#ifdef VERBOSE
1211            fprintf(stderr,"read and branch command received\n");
1217            logerror("read and branch command received\n");
12121218#endif
12131219            m_RDB_flag = FALSE;
12141220            if (m_speechrom)
r249094r249095
12171223         break;
12181224
12191225      case 0x40 : /* load address */
1220         if (TALK_STATUS == 0) /* TALKST must be clear for LA */
1226         if (m_talk_status == 0) /* TALKST must be clear for LA */
12211227         {
12221228            /* tms5220 data sheet says that if we load only one 4-bit nibble, it won't work.
12231229               This code does not care about this. */
r249094r249095
12341240            if (m_speechrom)
12351241               m_speechrom->read(1);
12361242         }
1237         m_SPEN = 1;
1238#ifdef FAST_START_HACK
1239         m_TALK = 1;
1240#endif
1241         m_DDIS = 0;
1242         m_zpar = 1; // zero all the parameters
1243         m_uv_zpar = 1; // zero k4-k10 as well
1244         m_OLDE = 1; // 'silence/zpar' frames are zero energy
1245         m_OLDP = 1; // 'silence/zpar' frames are zero pitch
1246#ifdef PERFECT_INTERPOLATION_HACK
1247         m_old_zpar = 1; // zero all the old parameters
1248         m_old_uv_zpar = 1; // zero old k4-k10 as well
1249#endif
1250         // following is semi-hack but matches idle state observed on chip
1243         m_speaking_now = 1;
1244         m_speak_external = 0;
1245         m_talk_status = 1;  /* start immediately */
1246         /* clear out variables before speaking */
1247         // TODO: similar to the victory case described above, but for VSM speech
1248         m_subcycle = m_subc_reload;
1249         m_PC = 0;
1250         m_IP = reload_table[m_c_variant_rate&0x3];
12511251         m_new_frame_energy_idx = 0;
12521252         m_new_frame_pitch_idx = 0;
1253         int i;
12531254         for (i = 0; i < 4; i++)
12541255            m_new_frame_k_idx[i] = 0;
12551256         for (i = 4; i < 7; i++)
r249094r249095
12591260         break;
12601261
12611262      case 0x60 : /* speak external */
1262         // SPKEXT going active activates SPKEE which clears the fifo
1263         //SPKEXT going active activates SPKEE which clears the fifo
12631264         m_fifo_head = m_fifo_tail = m_fifo_count = m_fifo_bits_taken = 0;
1264         // SPEN is enabled when the fifo passes half full (falling edge of BL signal)
1265         m_DDIS = 1;
1266         m_zpar = 1; // zero all the parameters
1267         m_uv_zpar = 1; // zero k4-k10 as well
1268         m_OLDE = 1; // 'silence/zpar' frames are zero energy
1269         m_OLDP = 1; // 'silence/zpar' frames are zero pitch
1270#ifdef PERFECT_INTERPOLATION_HACK
1271         m_old_zpar = 1; // zero all the old parameters
1272         m_old_uv_zpar = 1; // zero old k4-k10 as well
1273#endif
1274         // following is semi-hack but matches idle state observed on chip
1275         m_new_frame_energy_idx = 0;
1276         m_new_frame_pitch_idx = 0;
1277         for (i = 0; i < 4; i++)
1278            m_new_frame_k_idx[i] = 0;
1279         for (i = 4; i < 7; i++)
1280            m_new_frame_k_idx[i] = 0xF;
1281         for (i = 7; i < m_coeff->num_k; i++)
1282            m_new_frame_k_idx[i] = 0x7;
1265         m_speak_external = 1;
12831266         m_RDB_flag = FALSE;
12841267         break;
12851268
r249094r249095
13251308   m_IP = reload_table[m_c_variant_rate&0x3];
13261309
13271310   update_fifo_status_and_ints();
1328   if (m_DDIS && m_buffer_empty) goto ranout;
1311   if (!m_talk_status) goto ranout;
13291312
13301313   // attempt to extract the energy index
13311314   m_new_frame_energy_idx = extract_bits(m_coeff->energy_bits);
r249094r249095
13341317   fprintf(stderr," ");
13351318#endif
13361319   update_fifo_status_and_ints();
1337   if (m_DDIS && m_buffer_empty) goto ranout;
1320   if (!m_talk_status) goto ranout;
13381321   // if the energy index is 0 or 15, we're done
13391322   if ((m_new_frame_energy_idx == 0) || (m_new_frame_energy_idx == 15))
13401323      return;
r249094r249095
13541337   fprintf(stderr," ");
13551338#endif
13561339   update_fifo_status_and_ints();
1357   if (m_DDIS && m_buffer_empty) goto ranout;
1340   if (!m_talk_status) goto ranout;
13581341   // if this is a repeat frame, just do nothing, it will reuse the old coefficients
13591342   if (rep_flag)
13601343      return;
r249094r249095
13681351      fprintf(stderr," ");
13691352#endif
13701353      update_fifo_status_and_ints();
1371      if (m_DDIS && m_buffer_empty) goto ranout;
1354      if (!m_talk_status) goto ranout;
13721355   }
13731356
13741357   // if the pitch index was zero, we only need 4 K's...
r249094r249095
13871370      fprintf(stderr," ");
13881371#endif
13891372      update_fifo_status_and_ints();
1390      if (m_DDIS && m_buffer_empty) goto ranout;
1373      if (!m_talk_status) goto ranout;
13911374   }
1392#ifdef DEBUG_PARSE_FRAME_DUMP
1393         fprintf(stderr,"\n");
1394#endif
13951375#ifdef VERBOSE
1396   if (m_DDIS)
1397      fprintf(stderr,"Parsed a frame successfully in FIFO - %d bits remaining\n", (m_fifo_count*8)-(m_fifo_bits_taken));
1376   if (m_speak_external)
1377      logerror("Parsed a frame successfully in FIFO - %d bits remaining\n", (m_fifo_count*8)-(m_fifo_bits_taken));
13981378   else
1399      fprintf(stderr,"Parsed a frame successfully in ROM\n");
1379      logerror("Parsed a frame successfully in ROM\n");
14001380#endif
14011381   return;
14021382
14031383   ranout:
14041384#ifdef DEBUG_FRAME_ERRORS
1405   fprintf(stderr,"Ran out of bits on a parse!\n");
1385   logerror("Ran out of bits on a parse!\n");
14061386#endif
14071387   return;
14081388}
r249094r249095
14171397{
14181398   if (!TMS5220_IS_52xx) return; // bail out if not a 52xx chip, since there's no int pin
14191399#ifdef DEBUG_PIN_READS
1420   fprintf(stderr,"irq pin set to state %d\n", state);
1400   logerror("irq pin set to state %d\n", state);
14211401#endif
14221402   if (!m_irq_handler.isnull() && state != m_irq_pin)
14231403      m_irq_handler(!state);
r249094r249095
14341414{
14351415   int state = ready_read();
14361416#ifdef DEBUG_PIN_READS
1437   fprintf(stderr,"ready pin set to state %d\n", state);
1417   logerror("ready pin set to state %d\n", state);
14381418#endif
14391419   if (!m_readyq_handler.isnull() && state != m_ready_pin)
14401420      m_readyq_handler(!state);
r249094r249095
15341514
15351515   /* initialize the chip state */
15361516   /* Note that we do not actually clear IRQ on start-up : IRQ is even raised if m_buffer_empty or m_buffer_low are 0 */
1537   m_SPEN = m_DDIS = m_TALK = m_TALKD = m_previous_TALK_STATUS = m_irq_pin = m_ready_pin = 0;
1517   m_speaking_now = m_speak_external = m_talk_status = m_irq_pin = m_ready_pin = 0;
15381518   set_interrupt_state(0);
15391519   update_ready_state();
15401520   m_buffer_empty = m_buffer_low = 1;
r249094r249095
15451525#ifdef PERFECT_INTERPOLATION_HACK
15461526   m_old_frame_energy_idx = m_old_frame_pitch_idx = 0;
15471527   memset(m_old_frame_k_idx, 0, sizeof(m_old_frame_k_idx));
1548   m_old_zpar = 0;
15491528#endif
1550   m_new_frame_energy_idx = m_current_energy =  m_previous_energy = 0;
1551   m_new_frame_pitch_idx = m_current_pitch = 0;
1552   m_zpar = m_uv_zpar = 0;
1529   m_new_frame_energy_idx = m_current_energy = m_target_energy = m_previous_energy = 0;
1530   m_new_frame_pitch_idx = m_current_pitch = m_target_pitch = 0;
15531531   memset(m_new_frame_k_idx, 0, sizeof(m_new_frame_k_idx));
15541532   memset(m_current_k, 0, sizeof(m_current_k));
1533   memset(m_target_k, 0, sizeof(m_target_k));
15551534
15561535   /* initialize the sample generators */
15571536   m_inhibit = 1;
r249094r249095
15951574            /* Write */
15961575            /* bring up to date first */
15971576#ifdef DEBUG_IO_READY
1598            fprintf(stderr,"Serviced write: %02x\n", m_write_latch);
1577            logerror("Serviced write: %02x\n", m_write_latch);
15991578            //fprintf(stderr, "Processed write data: %02X\n", m_write_latch);
16001579#endif
16011580            m_stream->update();
r249094r249095
16311610   m_true_timing = 1;
16321611   state &= 0x01;
16331612#ifdef DEBUG_RS_WS
1634   fprintf(stderr,"/RS written with data: %d\n", state);
1613   logerror("/RS written with data: %d\n", state);
16351614#endif
16361615   new_val = (m_rs_ws & 0x01) | (state<<1);
16371616   if (new_val != m_rs_ws)
r249094r249095
16441623#ifdef DEBUG_RS_WS
16451624         else
16461625            /* illegal */
1647            fprintf(stderr,"tms5220_rs_w: illegal\n");
1626            logerror("tms5220_rs_w: illegal\n");
16481627#endif
16491628         return;
16501629      }
r249094r249095
16621641      {
16631642         /* high to low - schedule ready cycle */
16641643#ifdef DEBUG_RS_WS
1665         fprintf(stderr,"Scheduling ready cycle for /RS...\n");
1644         logerror("Scheduling ready cycle for /RS...\n");
16661645#endif
16671646         /* upon /RS being activated, /READY goes inactive after 100 nsec from data sheet, through 3 asynchronous gates on patent. This is effectively within one clock, so we immediately set io_ready to 0 and activate the callback. */
16681647         m_io_ready = 0;
r249094r249095
16831662   m_true_timing = 1;
16841663   state &= 0x01;
16851664#ifdef DEBUG_RS_WS
1686   fprintf(stderr,"/WS written with data: %d\n", state);
1665   logerror("/WS written with data: %d\n", state);
16871666#endif
16881667   new_val = (m_rs_ws & 0x02) | (state<<0);
16891668   if (new_val != m_rs_ws)
r249094r249095
16961675#ifdef DEBUG_RS_WS
16971676         else
16981677            /* illegal */
1699            fprintf(stderr,"tms5220_ws_w: illegal\n");
1678            logerror("tms5220_ws_w: illegal\n");
17001679#endif
17011680         return;
17021681      }
r249094r249095
17141693      {
17151694         /* high to low - schedule ready cycle */
17161695#ifdef DEBUG_RS_WS
1717         fprintf(stderr,"Scheduling ready cycle for /WS...\n");
1696         logerror("Scheduling ready cycle for /WS...\n");
17181697#endif
17191698         /* upon /WS being activated, /READY goes inactive after 100 nsec from data sheet, through 3 asynchronous gates on patent. This is effectively within one clock, so we immediately set io_ready to 0 and activate the callback. */
17201699         m_io_ready = 0;
r249094r249095
17471726   if (space.debugger_access()) return;
17481727
17491728#ifdef DEBUG_RS_WS
1750   fprintf(stderr,"tms5220_data_w: data %02x\n", data);
1729   logerror("tms5220_data_w: data %02x\n", data);
17511730#endif
17521731   if (!m_true_timing)
17531732   {
r249094r249095
17601739      /* actually in a write ? */
17611740#ifdef DEBUG_RS_WS
17621741      if (!(m_rs_ws == 0x02))
1763         fprintf(stderr,"tms5220_data_w: data written outside ws, status: %02x!\n", m_rs_ws);
1742         logerror("tms5220_data_w: data written outside ws, status: %02x!\n", m_rs_ws);
17641743#endif
17651744      m_write_latch = data;
17661745   }
r249094r249095
17921771         return m_read_latch;
17931772#ifdef DEBUG_RS_WS
17941773      else
1795         fprintf(stderr,"tms5220_status_r: data read outside rs!\n");
1774         logerror("tms5220_status_r: data read outside rs!\n");
17961775#endif
17971776      return 0xff;
17981777   }
trunk/src/emu/sound/tms5220.h
r249094r249095
105105
106106
107107   /* these contain global status bits */
108   UINT8 m_previous_TALK_STATUS;      /* this is the OLD value of TALK_STATUS (i.e. previous value of m_SPEN|m_TALKD), needed for generating interrupts on a falling TALK_STATUS edge */
109   UINT8 m_SPEN;             /* set on speak(or speak external and BL falling edge) command, cleared on stop command, reset command, or buffer out */
110   UINT8 m_DDIS;             /* If 1, DDIS is 1, i.e. Speak External command in progress, writes go to FIFO. */
111   UINT8 m_TALK;             /* set on SPEN & RESETL4(pc12->pc0 transition), cleared on stop command or reset command */
112#define TALK_STATUS (m_SPEN|m_TALKD)
113   UINT8 m_TALKD;            /* TALK(TCON) value, latched every RESETL4 */
108   UINT8 m_speaking_now;     /* True only if actual speech is being generated right now. Is set when a speak vsm command happens OR when speak external happens and buffer low becomes nontrue; Is cleared when speech halts after the last stop frame or the last frame after talk status is otherwise cleared.*/
109   UINT8 m_speak_external;   /* If 1, DDIS is 1, i.e. Speak External command in progress, writes go to FIFO. */
110   UINT8 m_talk_status;      /* If 1, TS status bit is 1, i.e. speak or speak external is in progress and we have not encountered a stop frame yet; talk_status differs from speaking_now in that speaking_now is set as soon as a speak or speak external command is started; talk_status does NOT go active until after 8 bytes are written to the fifo on a speak external command, otherwise the two are the same. TS is cleared by 3 things: 1. when a STOP command has just been processed as a new frame in the speech stream; 2. if the fifo runs out in speak external mode; 3. on power-up/during a reset command; When it gets cleared, speak_external is also cleared, an interrupt is generated, and speaking_now will be cleared when the next frame starts. */
114111   UINT8 m_buffer_low;       /* If 1, FIFO has less than 8 bytes in it */
115112   UINT8 m_buffer_empty;     /* If 1, FIFO is empty */
116113   UINT8 m_irq_pin;          /* state of the IRQ pin (output) */
r249094r249095
135132   INT16 m_current_energy;
136133   INT16 m_current_pitch;
137134   INT16 m_current_k[10];
135
136   INT16 m_target_energy;
137   INT16 m_target_pitch;
138   INT16 m_target_k[10];
138139#else
139140   UINT8 m_old_frame_energy_idx;
140141   UINT8 m_old_frame_pitch_idx;
141142   UINT8 m_old_frame_k_idx[10];
142   UINT8 m_old_zpar;
143   UINT8 m_old_uv_zpar;
144143
145144   INT32 m_current_energy;
146145   INT32 m_current_pitch;
147146   INT32 m_current_k[10];
147
148   INT32 m_target_energy;
149   INT32 m_target_pitch;
150   INT32 m_target_k[10];
148151#endif
149152
150153   UINT16 m_previous_energy; /* needed for lattice filter to match patent */
r249094r249095
152155   UINT8 m_subcycle;         /* contains the current subcycle for a given PC: 0 is A' (only used on SPKSLOW mode on 51xx), 1 is A, 2 is B */
153156   UINT8 m_subc_reload;      /* contains 1 for normal speech, 0 when SPKSLOW is active */
154157   UINT8 m_PC;               /* current parameter counter (what param is being interpolated), ranges from 0 to 12 */
155   /* NOTE: the interpolation period counts 1,2,3,4,5,6,7,0 for divide by 8,8,8,4,4,2,2,1 */
158   /* TODO/NOTE: the current interpolation period, counts 1,2,3,4,5,6,7,0 for divide by 8,8,8,4,4,2,2,1 */
156159   UINT8 m_IP;               /* the current interpolation period */
157160   UINT8 m_inhibit;          /* If 1, interpolation is inhibited until the DIV1 period */
158   UINT8 m_uv_zpar;          /* If 1, zero k5 thru k10 coefficients */
159   UINT8 m_zpar;             /* If 1, zero ALL parameters. */
160   UINT8 m_pitch_zero;       /* circuit 412; pitch is forced to zero under certain circumstances */
161161   UINT8 m_c_variant_rate;    /* only relevant for tms5220C's multi frame rate feature; is the actual 4 bit value written on a 0x2* or 0x0* command */
162162   UINT16 m_pitch_count;     /* pitch counter; provides chirp rom address */
163163
164164   INT32 m_u[11];
165165   INT32 m_x[10];
166166
167   UINT16 m_RNG;             /* the random noise generator configuration is: 1 + x + x^3 + x^4 + x^13 TODO: no it isn't */
167   UINT16 m_RNG;             /* the random noise generator configuration is: 1 + x + x^3 + x^4 + x^13 */
168168   INT16 m_excitation_data;
169169
170170   /* R Nabet : These have been added to emulate speech Roms */
trunk/src/emu/video/poly.h
r249094r249095
3434
3535#pragma once
3636
37#ifndef __POLY_H__
38#define __POLY_H__
37#ifndef __POLYNEW_H__
38#define __POLYNEW_H__
3939
4040#include <limits.h>
4141
r249094r249095
11721172   return nextout - outv;
11731173}
11741174
1175#endif  // __POLY_H__
1175#endif  // __POLYNEW_H__
trunk/src/emu/video/polylgcy.h
r249094r249095
3434
3535#pragma once
3636
37#ifndef __POLYLGCY_H__
38#define __POLYLGCY_H__
37#ifndef __POLYNEW_H__
38#define __POLYNEW_H__
3939
4040
4141/***************************************************************************
r249094r249095
152152int poly_zclip_if_less(int numverts, const poly_vertex *v, poly_vertex *outv, int paramcount, float clipval);
153153
154154
155#endif  /* __POLYLGCY_H__ */
155#endif  /* __POLY_H__ */
trunk/src/mame/arcade.lst
r249094r249095
82208220nbajamte3       // (c) 1994 Midway
82218221nbajamten       // (c) 1995 Midway
82228222revx            // (c) 1994 Midway
8223revxp5          // (c) 1994 Midway
82248223mk3             // (c) 1994 Midway
82258224mk3r20          // (c) 1994 Midway
82268225mk3r10          // (c) 1994 Midway
r249094r249095
95669565magicbubb       // (c) Yun Sung
95679566shocking        // (c) 1997 Yun Sung
95689567shockingk       // (c) 1997 Yun Sung
9569shockingko      // (c) 1997 Yun Sung
95709568bombkick        // (c) 1998 Yun Sung
95719569bombkicka       // (c) 1998 Yun Sung
95729570nmg5            // (c) 1998 Yun Sung
trunk/src/mame/audio/hng64.c
r249094r249095
11// license:LGPL-2.1+
2// copyright-holders:David Haywood, Angelo Salese, ElSemi, Andrew Gardner
2// copyright-holders:David Haywood, Angelo Salese, ElSemi, Andrew Gardner, Andrew Zaferakis
33/* Hyper NeoGeo 64 Audio */
44
55// uses a V53A ( == V33A with extra peripherals eg. DMA, Timers, MMU giving virtual 24-bit address space etc.)
trunk/src/mame/drivers/cps1.c
r249094r249095
95449544   ROM_LOAD( "sou1",         0x0000, 0x0117, CRC(84f4b2fe) SHA1(dcc9e86cc36316fe42eace02d6df75d08bc8bb6d) )
95459545
95469546   ROM_REGION( 0x0200, "bboardplds", 0 )
9547   ROM_LOAD( "va63b.1a",     0x0000, 0x0117, CRC(132ab7c5) SHA1(54b78b02cdd9430c90e2289d42585ee71cf71cdc) )
9547   ROM_LOAD( "va63b.1a",     0x0000, 0x0117, BAD_DUMP CRC(38540e86) SHA1(86e0aba363108f80a8eff84b99d11528ad6db099) ) /* Handcrafted but works on actual US PCB.  Redump needed */
95489548   ROM_LOAD( "iob1.12d",     0x0000, 0x0117, CRC(3abc0700) SHA1(973043aa46ec6d5d1db20dc9d5937005a0f9f6ae) )
95499549   ROM_LOAD( "bprg1.11d",    0x0000, 0x0117, CRC(31793da7) SHA1(400fa7ac517421c978c1ee7773c30b9ed0c5d3f3) )
95509550ROM_END
r249094r249095
96309630   ROM_LOAD( "sou1",         0x0000, 0x0117, CRC(84f4b2fe) SHA1(dcc9e86cc36316fe42eace02d6df75d08bc8bb6d) )
96319631
96329632   ROM_REGION( 0x0200, "bboardplds", 0 )
9633   ROM_LOAD( "va63b.1a",     0x0000, 0x0117, CRC(132ab7c5) SHA1(54b78b02cdd9430c90e2289d42585ee71cf71cdc) )
9633   ROM_LOAD( "va63b.1a",     0x0000, 0x0117, BAD_DUMP CRC(38540e86) SHA1(86e0aba363108f80a8eff84b99d11528ad6db099) ) /* Handcrafted but works on actual US PCB.  Redump needed */
96349634   ROM_LOAD( "iob1.12d",     0x0000, 0x0117, CRC(3abc0700) SHA1(973043aa46ec6d5d1db20dc9d5937005a0f9f6ae) )
96359635   ROM_LOAD( "bprg1.11d",    0x0000, 0x0117, CRC(31793da7) SHA1(400fa7ac517421c978c1ee7773c30b9ed0c5d3f3) )
96369636
trunk/src/mame/drivers/deco32.c
r249094r249095
223223
224224                   PROM.9J     Fujitsu MB7124 compatible with 82S147  Labelled 'LN-00'
225225
226Night Slashers
227Data East, 1993
228               
229DE-0395-1   DEC-22VO
230|-----------------------------------------------------|
231| TA8205AH  6164            |-----|   2M-16M*   MBH-07|
232|            02-  HuC6280A  | 52  |   MBH-09    MBH-06|
233|           YM2151          |     |   2M-16M*   MBH-05|
234|     YM3012      32.220MHz |-----|   MBH-08    MBH-04|
235|  JP1   MBH-11   93C45     |-----|             MBH-03|
236|CN2     MBH-10             | 52  |             MBH-02|
237|  M6295(1)                 |     |                   |
238|     M6295(2)              |-----|                   |
239|      |-----|                       |-----|          |
240|J     | 104 |    |-----|  |-----|   | 52  |          |
241|A     |     |    | 153 |  | 113 |   |     |          |
242|M     |-----|    |     |  |     |   |-----|          |
243|M                |-----|  |-----|            28MHz   |
244|A  |-----|                                           |
245|   | 99  |  VM-02                                    |
246|   |     |  LN-00             |-----| 6164    MBH-01 |
247|   |-----|                    | 74  | 6164           |
248|                              |     |         MBH-00 |
249|      |-----|  |-----|        |-----|                |
250|      | 113 |  | 200 |        |-----| 6164           |
251|      |     |  |     |        | 141 | 6164           |
252|      |-----|  |-----|        |     |  VE-01A        |
253|TEST_SW                       |-----|  VE-00 |-----| |
254|                                             | 156 | |
255|  CN4      LH52250  LH52250     01-          |     | |
256|  CN3      LH52250  LH52250     00-          |-----| |
257|-----------------------------------------------------|
258226
259NOTE: Program EPROMs did NOT have regional letter codes, just 00, 01 & 02
260227
261Same PCB as shown below for Fighter's History, but populated with more
262chips as needed. It is worth noting that Night Slashers uses the encryption
263features of the 156 chip where as Fighter's History does not.
264
265*****************************************************************************************************
266
267228Fighter's History
268229Data East, 1993
269230
r249094r249095
300261|  CN3*     LH52250  LH52250   LE00           |-----| |
301262|-----------------------------------------------------|
302263
303
304264Very similar to the DE-0396-0 described below with the notable exceptions:
305265  The sound area reworked to use the HuC6280A instead of a standard Z80
306266  Uses the larger 113 instead of the 153 chips, however both PCBs have
r249094r249095
25122472
25132473/**********************************************************************************/
25142474
2515ROM_START( captaven ) /* DE-0351-x PCB (x=3 or 4) */
2475ROM_START( captaven )
25162476   ROM_REGION(0x100000, "maincpu", 0 ) /* ARM 32 bit code */
25172477   ROM_LOAD32_BYTE( "hn_00-4.1e",  0x000000, 0x20000, CRC(147fb094) SHA1(6bd759c42f4b7f9e1c3f2d3ece0b3ec72de1a982) )
25182478   ROM_LOAD32_BYTE( "hn_01-4.1h",  0x000001, 0x20000, CRC(11ecdb95) SHA1(832b56f05ae7e15e67fbdd321da8c1cc5e7629a0) )
r249094r249095
25622522
25632523   ROM_REGION(0x80000, "oki1", 0 )
25642524   ROM_LOAD( "man-11.16k", 0x000000,  0x80000,  CRC(0dc60a4c) SHA1(4d0daa6a0272852a37f341a0cdc48baee0ad9dd8) )
2565
2566   ROM_REGION( 0x0600, "plds", 0 )
2567   ROM_LOAD( "ts-00.4h",  0x0000, 0x0117, CRC(ebc2908e) SHA1(dca14a55abd1d88ee09092d4122614e55c3e7f53) )
2568   ROM_LOAD( "ts-01.5h",  0x0200, 0x0117, CRC(c776a980) SHA1(cd4bdcfb755f561fefa4c88fab5d6d2397332aa7) )
2569   ROM_LOAD( "ts-02.12l", 0x0400, 0x01bf, CRC(6f26528c) SHA1(2cf869b2a789a9b0646162a61c147bcbb13c9141) )
25702525ROM_END
25712526
2572ROM_START( captavena ) /* DE-0351-x PCB (x=3 or 4) */
2527ROM_START( captavena )
25732528   ROM_REGION(0x100000, "maincpu", 0 ) /* ARM 32 bit code */
25742529   ROM_LOAD32_BYTE( "hn_00.e1",    0x000000, 0x20000, CRC(12dd0c71) SHA1(77bd0e5f1b105ec70de5e76cb9c8138f02a496be) )
25752530   ROM_LOAD32_BYTE( "hn_01.h1",    0x000001, 0x20000, CRC(ac5ea492) SHA1(e08fa2b3e3a40cba6dcdf07049d67056d59ed72a) )
r249094r249095
26192574
26202575   ROM_REGION(0x80000, "oki1", 0 )
26212576   ROM_LOAD( "man-11.16k", 0x000000,  0x80000,  CRC(0dc60a4c) SHA1(4d0daa6a0272852a37f341a0cdc48baee0ad9dd8) )
2622
2623   ROM_REGION( 0x0600, "plds", 0 )
2624   ROM_LOAD( "ts-00.4h",  0x0000, 0x0117, CRC(ebc2908e) SHA1(dca14a55abd1d88ee09092d4122614e55c3e7f53) )
2625   ROM_LOAD( "ts-01.5h",  0x0200, 0x0117, CRC(c776a980) SHA1(cd4bdcfb755f561fefa4c88fab5d6d2397332aa7) )
2626   ROM_LOAD( "ts-02.12l", 0x0400, 0x01bf, CRC(6f26528c) SHA1(2cf869b2a789a9b0646162a61c147bcbb13c9141) )
26272577ROM_END
26282578
2629ROM_START( captavene ) /* DE-0351-x PCB (x=3 or 4) */
2579ROM_START( captavene )
26302580   ROM_REGION(0x100000, "maincpu", 0 ) /* ARM 32 bit code */
26312581   ROM_LOAD32_BYTE( "hg_00-4.1e",  0x000000, 0x20000, CRC(7008d43c) SHA1(a39143e13075ebc58ecc576391f04d2649675dfb) )
26322582   ROM_LOAD32_BYTE( "hg_01-4.1h",  0x000001, 0x20000, CRC(53dc1042) SHA1(4547ad20e5bc3b9cedae53f73f1628fa3493aafa) )
r249094r249095
26782628   ROM_LOAD( "man-11.16k", 0x000000,  0x80000,  CRC(0dc60a4c) SHA1(4d0daa6a0272852a37f341a0cdc48baee0ad9dd8) )
26792629
26802630   ROM_REGION( 0x0800, "plds", 0 )
2681   ROM_LOAD( "ts-00.4h",  0x0000, 0x0117, CRC(ebc2908e) SHA1(dca14a55abd1d88ee09092d4122614e55c3e7f53) )
2682   ROM_LOAD( "ts-01.5h",  0x0200, 0x0117, CRC(c776a980) SHA1(cd4bdcfb755f561fefa4c88fab5d6d2397332aa7) )
2683   ROM_LOAD( "ts-02.12l", 0x0400, 0x01bf, CRC(6f26528c) SHA1(2cf869b2a789a9b0646162a61c147bcbb13c9141) )
2631   ROM_LOAD( "pal16l8a.12l", 0x0000, 0x0104, NO_DUMP ) /* PAL is read protected */
2632   ROM_LOAD( "pal16l8a.4h",  0x0200, 0x0104, NO_DUMP ) /* PAL is read protected */
2633   ROM_LOAD( "pal16l8a.5h",  0x0400, 0x0104, NO_DUMP ) /* PAL is read protected */
26842634   ROM_LOAD( "pal16r8b.14c", 0x0600, 0x0104, NO_DUMP ) /* PAL is read protected */
26852635ROM_END
26862636
2687ROM_START( captavenu ) /* DE-0351-x PCB (x=3 or 4) */
2637ROM_START( captavenu )
26882638   ROM_REGION(0x100000, "maincpu", 0 ) /* ARM 32 bit code */
26892639   ROM_LOAD32_BYTE( "hh_00-19.1e", 0x000000, 0x20000, CRC(08b870e0) SHA1(44c837e3c5dfc9764d89b0ebb3e9b7a40fe4d76f) )
26902640   ROM_LOAD32_BYTE( "hh_01-19.1h", 0x000001, 0x20000, CRC(0dc0feca) SHA1(cb1c97aac59dabcf6c37bc1562cf2f62bca951f1) )
r249094r249095
27342684
27352685   ROM_REGION(0x80000, "oki1", 0 )
27362686   ROM_LOAD( "man-11.16k", 0x000000,  0x80000,  CRC(0dc60a4c) SHA1(4d0daa6a0272852a37f341a0cdc48baee0ad9dd8) )
2737
2738   ROM_REGION( 0x0600, "plds", 0 )
2739   ROM_LOAD( "ts-00.4h",  0x0000, 0x0117, CRC(ebc2908e) SHA1(dca14a55abd1d88ee09092d4122614e55c3e7f53) )
2740   ROM_LOAD( "ts-01.5h",  0x0200, 0x0117, CRC(c776a980) SHA1(cd4bdcfb755f561fefa4c88fab5d6d2397332aa7) )
2741   ROM_LOAD( "ts-02.12l", 0x0400, 0x01bf, CRC(6f26528c) SHA1(2cf869b2a789a9b0646162a61c147bcbb13c9141) )
27422687ROM_END
27432688
2744ROM_START( captavenuu ) /* DE-0351-x PCB (x=3 or 4) */
2689ROM_START( captavenuu )
27452690   ROM_REGION(0x100000, "maincpu", 0 ) /* ARM 32 bit code */
27462691   ROM_LOAD32_BYTE( "hh-00.1e",    0x000000, 0x20000, CRC(c34da654) SHA1(a1988a6a45991db6dee10b484049f6703b4671c9) )
27472692   ROM_LOAD32_BYTE( "hh-01.1h",    0x000001, 0x20000, CRC(55abe63f) SHA1(98772eff3ebb5a4f243c7a77d398eb142d1505cb) )
r249094r249095
27912736
27922737   ROM_REGION(0x80000, "oki1", 0 )
27932738   ROM_LOAD( "man-11.16k", 0x000000,  0x80000,  CRC(0dc60a4c) SHA1(4d0daa6a0272852a37f341a0cdc48baee0ad9dd8) )
2794
2795   ROM_REGION( 0x0600, "plds", 0 )
2796   ROM_LOAD( "ts-00.4h",  0x0000, 0x0117, CRC(ebc2908e) SHA1(dca14a55abd1d88ee09092d4122614e55c3e7f53) )
2797   ROM_LOAD( "ts-01.5h",  0x0200, 0x0117, CRC(c776a980) SHA1(cd4bdcfb755f561fefa4c88fab5d6d2397332aa7) )
2798   ROM_LOAD( "ts-02.12l", 0x0400, 0x01bf, CRC(6f26528c) SHA1(2cf869b2a789a9b0646162a61c147bcbb13c9141) )
27992739ROM_END
28002740
2801ROM_START( captavenua ) /* DE-0351-x PCB (x=3 or 4) */
2741ROM_START( captavenua )
28022742   ROM_REGION(0x100000, "maincpu", 0 ) /* ARM 32 bit code */
28032743   ROM_LOAD32_BYTE( "hh_00-4.2e",   0x000000, 0x20000, CRC(0e1acc05) SHA1(7eb6206efad233f9f4ee51102f9fe6b58f0719ea) )
28042744   ROM_LOAD32_BYTE( "hh_01-4.2h",   0x000001, 0x20000, CRC(4ff0351d) SHA1(15fc2662ff0d32986c4d4d074b985ad853da34e1) )
r249094r249095
28482788
28492789   ROM_REGION(0x80000, "oki1", 0 )
28502790   ROM_LOAD( "man-11.16k", 0x000000,  0x80000,  CRC(0dc60a4c) SHA1(4d0daa6a0272852a37f341a0cdc48baee0ad9dd8) )
2851
2852   ROM_REGION( 0x0600, "plds", 0 )
2853   ROM_LOAD( "ts-00.4h",  0x0000, 0x0117, CRC(ebc2908e) SHA1(dca14a55abd1d88ee09092d4122614e55c3e7f53) )
2854   ROM_LOAD( "ts-01.5h",  0x0200, 0x0117, CRC(c776a980) SHA1(cd4bdcfb755f561fefa4c88fab5d6d2397332aa7) )
2855   ROM_LOAD( "ts-02.12l", 0x0400, 0x01bf, CRC(6f26528c) SHA1(2cf869b2a789a9b0646162a61c147bcbb13c9141) )
28562791ROM_END
28572792
2858ROM_START( captavenj ) /* DE-0351-x PCB (x=3 or 4) */
2793ROM_START( captavenj )
28592794   ROM_REGION(0x100000, "maincpu", 0 ) /* ARM 32 bit code */
28602795   ROM_LOAD32_BYTE( "hj_00-2.1e",  0x000000, 0x20000, CRC(10b1faaf) SHA1(9d76885200a846b4751c8d44ff591e2aff7c4148) )
28612796   ROM_LOAD32_BYTE( "hj_01-2.1h",  0x000001, 0x20000, CRC(62c59f27) SHA1(20bbb7f3ff63a8c795686c1d56d51e90305daa77) )
r249094r249095
29052840
29062841   ROM_REGION(0x80000, "oki1", 0 )
29072842   ROM_LOAD( "man-11.16k", 0x000000,  0x80000,  CRC(0dc60a4c) SHA1(4d0daa6a0272852a37f341a0cdc48baee0ad9dd8) )
2908
2909   ROM_REGION( 0x0600, "plds", 0 )
2910   ROM_LOAD( "ts-00.4h",  0x0000, 0x0117, CRC(ebc2908e) SHA1(dca14a55abd1d88ee09092d4122614e55c3e7f53) )
2911   ROM_LOAD( "ts-01.5h",  0x0200, 0x0117, CRC(c776a980) SHA1(cd4bdcfb755f561fefa4c88fab5d6d2397332aa7) )
2912   ROM_LOAD( "ts-02.12l", 0x0400, 0x01bf, CRC(6f26528c) SHA1(2cf869b2a789a9b0646162a61c147bcbb13c9141) )
29132843ROM_END
29142844
29152845ROM_START( dragngun )
r249094r249095
30923022   ROM_LOAD( "kt-00.8j",  0,  512,  CRC(7294354b) SHA1(14fe42ad5d26d022c0fe9a46a4a9017af2296f40) ) /* MB7124H type prom */
30933023
30943024   ROM_REGION( 0x0400, "plds", 0 )
3095   ROM_LOAD( "ve-00.3d",  0x0000, 0x0117, CRC(384d316c) SHA1(61b50c695d4210c199cf6f7bbe50c8a5ecd1d21c) )
3096   ROM_LOAD( "ve-01.4d",  0x0200, 0x0117, CRC(4ba7e6a9) SHA1(b65d696a3519e792df226f9f148c759cdb0e1e43) )
3025   ROM_LOAD( "ve-00.3d",  0x0000, 0x0104, NO_DUMP ) /* PAL16L8 is read protected */
3026   ROM_LOAD( "ve-01.4d",  0x0200, 0x0104, NO_DUMP ) /* PAL16L8 is read protected */
30973027ROM_END
30983028
30993029ROM_START( fghthista ) /* DE-0380-2 PCB */
r249094r249095
31263056   ROM_LOAD( "kt-00.8j",  0,  512,  CRC(7294354b) SHA1(14fe42ad5d26d022c0fe9a46a4a9017af2296f40) ) /* MB7124H type prom */
31273057
31283058   ROM_REGION( 0x0400, "plds", 0 )
3129   ROM_LOAD( "ve-00.3d",  0x0000, 0x0117, CRC(384d316c) SHA1(61b50c695d4210c199cf6f7bbe50c8a5ecd1d21c) )
3130   ROM_LOAD( "ve-01.4d",  0x0200, 0x0117, CRC(4ba7e6a9) SHA1(b65d696a3519e792df226f9f148c759cdb0e1e43) )
3131   /* PAL16L8BCN at 8J is unpopulated */
3059   ROM_LOAD( "ve-00.3d",  0x0000, 0x0104, NO_DUMP ) /* PAL16L8 is read protected */
3060   ROM_LOAD( "ve-01.4d",  0x0200, 0x0104, NO_DUMP ) /* PAL16L8 is read protected */
31323061ROM_END
31333062
31343063ROM_START( fghthistu ) /* DE-0396-0 PCB */
r249094r249095
31613090   ROM_LOAD( "kt-00.8j",  0,  512,  CRC(7294354b) SHA1(14fe42ad5d26d022c0fe9a46a4a9017af2296f40) ) /* MB7124H type prom */
31623091
31633092   ROM_REGION( 0x0400, "plds", 0 )
3164   ROM_LOAD( "ve-00.3d",  0x0000, 0x0117, CRC(384d316c) SHA1(61b50c695d4210c199cf6f7bbe50c8a5ecd1d21c) )
3165   ROM_LOAD( "ve-01.4d",  0x0200, 0x0117, CRC(4ba7e6a9) SHA1(b65d696a3519e792df226f9f148c759cdb0e1e43) )
3166   /* PAL16L8BCN at 8J is unpopulated */
3093   ROM_LOAD( "ve-00.3d",  0x0000, 0x0104, NO_DUMP ) /* PAL16L8 is read protected */
3094   ROM_LOAD( "ve-01.4d",  0x0200, 0x0104, NO_DUMP ) /* PAL16L8 is read protected */
31673095ROM_END
31683096
31693097ROM_START( fghthistua ) /* DE-0395-1 PCB */
r249094r249095
31963124   ROM_LOAD( "kt-00.8j",  0,  512,  CRC(7294354b) SHA1(14fe42ad5d26d022c0fe9a46a4a9017af2296f40) ) /* MB7124H type prom */
31973125
31983126   ROM_REGION( 0x0400, "plds", 0 )
3199   ROM_LOAD( "ve-00.3d",  0x0000, 0x0117, CRC(384d316c) SHA1(61b50c695d4210c199cf6f7bbe50c8a5ecd1d21c) )
3200   ROM_LOAD( "ve-01a.4d", 0x0200, 0x0117, CRC(109613c8) SHA1(5991e010c1bc2a827c8ee2c85a9b40e00a3167b3) )
3201   /* PAL16L8BCN at 8J is unpopulated */
3127   ROM_LOAD( "ve-00.3d",  0x0000, 0x0104, NO_DUMP ) /* PAL16L8 is read protected */
3128   ROM_LOAD( "ve-01a.4d", 0x0200, 0x0104, NO_DUMP ) /* PAL16L8 is read protected */
32023129ROM_END
32033130
32043131ROM_START( fghthistub ) /* DE-0395-1 PCB */
r249094r249095
32313158   ROM_LOAD( "kt-00.8j",  0,  512,  CRC(7294354b) SHA1(14fe42ad5d26d022c0fe9a46a4a9017af2296f40) ) /* MB7124H type prom */
32323159
32333160   ROM_REGION( 0x0400, "plds", 0 )
3234   ROM_LOAD( "ve-00.3d",  0x0000, 0x0117, CRC(384d316c) SHA1(61b50c695d4210c199cf6f7bbe50c8a5ecd1d21c) )
3235   ROM_LOAD( "ve-01a.4d", 0x0200, 0x0117, CRC(109613c8) SHA1(5991e010c1bc2a827c8ee2c85a9b40e00a3167b3) )
3236   /* PAL16L8BCN at 8J is unpopulated */
3161   ROM_LOAD( "ve-00.3d",  0x0000, 0x0104, NO_DUMP ) /* PAL16L8 is read protected */
3162   ROM_LOAD( "ve-01a.4d", 0x0200, 0x0104, NO_DUMP ) /* PAL16L8 is read protected */
32373163ROM_END
32383164
32393165ROM_START( fghthistuc ) /* DE-0380-2 PCB */
r249094r249095
32663192   ROM_LOAD( "kt-00.8j",  0,  512,  CRC(7294354b) SHA1(14fe42ad5d26d022c0fe9a46a4a9017af2296f40) ) /* MB7124H type prom */
32673193
32683194   ROM_REGION( 0x0400, "plds", 0 )
3269   ROM_LOAD( "ve-00.3d",  0x0000, 0x0117, CRC(384d316c) SHA1(61b50c695d4210c199cf6f7bbe50c8a5ecd1d21c) )
3270   ROM_LOAD( "ve-01.4d",  0x0200, 0x0117, CRC(4ba7e6a9) SHA1(b65d696a3519e792df226f9f148c759cdb0e1e43) )
3271   /* PAL16L8BCN at 8J is unpopulated */
3195   ROM_LOAD( "ve-00.3d",  0x0000, 0x0104, NO_DUMP ) /* PAL16L8 is read protected */
3196   ROM_LOAD( "ve-01.4d",  0x0200, 0x0104, NO_DUMP ) /* PAL16L8 is read protected */
32723197ROM_END
32733198
32743199ROM_START( fghthistj ) /* DE-0395-1 PCB */
r249094r249095
33013226   ROM_LOAD( "kt-00.8j",  0,  512,  CRC(7294354b) SHA1(14fe42ad5d26d022c0fe9a46a4a9017af2296f40) ) /* MB7124H type prom */
33023227
33033228   ROM_REGION( 0x0400, "plds", 0 )
3304   ROM_LOAD( "ve-00.3d",  0x0000, 0x0117, CRC(384d316c) SHA1(61b50c695d4210c199cf6f7bbe50c8a5ecd1d21c) )
3305   ROM_LOAD( "ve-01a.4d", 0x0200, 0x0117, CRC(109613c8) SHA1(5991e010c1bc2a827c8ee2c85a9b40e00a3167b3) )
3306   /* PAL16L8BCN at 8J is unpopulated */
3229   ROM_LOAD( "ve-00.3d",  0x0000, 0x0104, NO_DUMP ) /* PAL16L8 is read protected */
3230   ROM_LOAD( "ve-01a.4d", 0x0200, 0x0104, NO_DUMP ) /* PAL16L8 is read protected */
33073231ROM_END
33083232
33093233ROM_START( fghthistja ) /* DE-0380-2 PCB */
r249094r249095
33363260   ROM_LOAD( "kt-00.8j",  0,  512,  CRC(7294354b) SHA1(14fe42ad5d26d022c0fe9a46a4a9017af2296f40) ) /* MB7124H type prom */
33373261
33383262   ROM_REGION( 0x0400, "plds", 0 )
3339   ROM_LOAD( "ve-00.3d",  0x0000, 0x0117, CRC(384d316c) SHA1(61b50c695d4210c199cf6f7bbe50c8a5ecd1d21c) )
3340   ROM_LOAD( "ve-01.4d",  0x0200, 0x0117, CRC(4ba7e6a9) SHA1(b65d696a3519e792df226f9f148c759cdb0e1e43) )
3341   /* PAL16L8BCN at 8J is unpopulated */
3263   ROM_LOAD( "ve-00.3d",  0x0000, 0x0104, NO_DUMP ) /* PAL16L8 is read protected */
3264   ROM_LOAD( "ve-01.4d",  0x0200, 0x0104, NO_DUMP ) /* PAL16L8 is read protected */
33423265ROM_END
33433266
33443267ROM_START( fghthistjb ) /* DE-0380-1 PCB */
r249094r249095
33713294   ROM_LOAD( "kt-00.8j",  0,  512,  CRC(7294354b) SHA1(14fe42ad5d26d022c0fe9a46a4a9017af2296f40) ) /* MB7124H type prom */
33723295
33733296   ROM_REGION( 0x0400, "plds", 0 )
3374   ROM_LOAD( "ve-00.3d",  0x0000, 0x0117, CRC(384d316c) SHA1(61b50c695d4210c199cf6f7bbe50c8a5ecd1d21c) )
3375   ROM_LOAD( "ve-01.4d",  0x0200, 0x0117, CRC(4ba7e6a9) SHA1(b65d696a3519e792df226f9f148c759cdb0e1e43) )
3376   /* PAL16L8BCN at 8J is unpopulated */
3297   ROM_LOAD( "ve-00.3d",  0x0000, 0x0104, NO_DUMP ) /* PAL16L8 is read protected */
3298   ROM_LOAD( "ve-01.4d",  0x0200, 0x0104, NO_DUMP ) /* PAL16L8 is read protected */
33773299ROM_END
33783300
33793301ROM_START( lockload ) /* Board No. DE-0420-1 + Bottom board DE-0421-0 slightly different hardware, a unique PCB and not a Dragongun conversion */
r249094r249095
37513673   ROM_LOAD( "eeprom-tattass.bin", 0x0000, 0x0400, CRC(7140f40c) SHA1(4fb7897933046b6adaf00b4626d5fd23d0e8a666) )
37523674ROM_END
37533675
3754ROM_START( nslasher ) /* DE-0397-0 PCB */
3676ROM_START( nslasher )
37553677   ROM_REGION(0x100000, "maincpu", 0 ) /* Encrypted ARM 32 bit code */
37563678   ROM_LOAD32_WORD( "mainprg.1f", 0x000000, 0x80000, CRC(507acbae) SHA1(329a2bb244f2f3adb8d75cab5aa2dcb129d70712) )
37573679   ROM_LOAD32_WORD( "mainprg.2f", 0x000002, 0x80000, CRC(931fc7ee) SHA1(54eb12abfa3f332ce9b43a45ec424aaee88641a6) )
r249094r249095
37593681   ROM_REGION(0x10000, "audiocpu", 0 ) /* Sound CPU */
37603682   ROM_LOAD( "sndprg.17l",  0x00000,  0x10000,  CRC(18939e92) SHA1(50b37a78d9d2259d4b140dd17393c4e5ca92bca5) )
37613683
3684
37623685   ROM_REGION( 0x200000, "gfx1", 0 )
37633686   ROM_LOAD( "mbh-00.8c",  0x000000,  0x200000,  CRC(a877f8a3) SHA1(79253525f360a73161894f31e211e4d6b38d307a) ) /* Encrypted tiles */
37643687
r249094r249095
37853708
37863709   ROM_REGION(0x200, "prom", 0 )
37873710   ROM_LOAD( "ln-00.j7", 0x000000,  0x200, CRC(5e83eaf3) SHA1(95f5eb8e56dff6c2dce7c39a6dd458bfc38fe1cf) )
3788
3789   ROM_REGION( 0x0600, "plds", 0 )
3790   ROM_LOAD( "vm-00.3d",  0x0000, 0x0117, NO_DUMP ) /* 16L8ACN is read protected */
3791   ROM_LOAD( "vm-01.4d",  0x0200, 0x0117, NO_DUMP ) /* 16L8ACN is read protected */
3792   ROM_LOAD( "vm-02.8j",  0x0400, 0x0117, CRC(53692426) SHA1(b8f8cf6b1f6b637fcd1fcd62474e637f5d4a6901) )
37933711ROM_END
37943712
3795ROM_START( nslasherj ) /* DE-0397-0 PCB */
3713ROM_START( nslasherj )
37963714   ROM_REGION(0x100000, "maincpu", 0 ) /* Encrypted ARM 32 bit code */
37973715   ROM_LOAD32_WORD( "lx-00.1f", 0x000000, 0x80000, CRC(6ed5fb88) SHA1(84350da7939a479968a523c84e254e3ee54b8da2) )
37983716   ROM_LOAD32_WORD( "lx-01.2f", 0x000002, 0x80000, CRC(a6df2152) SHA1(6fe7e0b2e71c5f807951dcc81a6a3cff55247961) )
r249094r249095
38263744
38273745   ROM_REGION(0x200, "prom", 0 )
38283746   ROM_LOAD( "ln-00.j7", 0x000000,  0x200, CRC(5e83eaf3) SHA1(95f5eb8e56dff6c2dce7c39a6dd458bfc38fe1cf) )
3829
3830   ROM_REGION( 0x0600, "plds", 0 )
3831   ROM_LOAD( "vm-00.3d",  0x0000, 0x0117, NO_DUMP ) /* 16L8ACN is read protected */
3832   ROM_LOAD( "vm-01.4d",  0x0200, 0x0117, NO_DUMP ) /* 16L8ACN is read protected */
3833   ROM_LOAD( "vm-02.8j",  0x0400, 0x0117, CRC(53692426) SHA1(b8f8cf6b1f6b637fcd1fcd62474e637f5d4a6901) )
38343747ROM_END
38353748
3836ROM_START( nslashers ) /* DE-0397-0 PCB */
3749ROM_START( nslashers )
38373750   ROM_REGION(0x100000, "maincpu", 0 ) /* Encrypted ARM 32 bit code */
38383751   ROM_LOAD32_WORD( "ly-00.1f", 0x000000, 0x80000, CRC(fa0646f9) SHA1(7f9633bda230a0ced59171cdc5ab40a6d56c3d34) )
38393752   ROM_LOAD32_WORD( "ly-01.2f", 0x000002, 0x80000, CRC(ae508149) SHA1(3592949e5fb2770adb9c9daa4e38c4e75f3e2554) )
r249094r249095
38673780
38683781   ROM_REGION(0x200, "prom", 0 )
38693782   ROM_LOAD( "ln-00.j7", 0x000000,  0x200, CRC(5e83eaf3) SHA1(95f5eb8e56dff6c2dce7c39a6dd458bfc38fe1cf) )
3870
3871   ROM_REGION( 0x0600, "plds", 0 )
3872   ROM_LOAD( "vm-00.3d",  0x0000, 0x0117, NO_DUMP ) /* 16L8ACN is read protected */
3873   ROM_LOAD( "vm-01.4d",  0x0200, 0x0117, NO_DUMP ) /* 16L8ACN is read protected */
3874   ROM_LOAD( "vm-02.8j",  0x0400, 0x0117, CRC(53692426) SHA1(b8f8cf6b1f6b637fcd1fcd62474e637f5d4a6901) )
38753783ROM_END
38763784
3877ROM_START( nslasheru ) /* DE-0395-1 PCB */
3785ROM_START( nslasheru )
38783786   ROM_REGION(0x100000, "maincpu", 0 ) /* Encrypted ARM 32 bit code */
38793787   ROM_LOAD32_WORD( "00.f1", 0x000000, 0x80000, CRC(944f3329) SHA1(7e7909e203b9752de3d3d798c6f84ac6ae824a07) )
38803788   ROM_LOAD32_WORD( "01.f2", 0x000002, 0x80000, CRC(ac12d18a) SHA1(7cd4e843bf575c70c5c39a8afa78b803106f59b0) )
r249094r249095
39083816
39093817   ROM_REGION(0x200, "prom", 0 )
39103818   ROM_LOAD( "ln-00.j7", 0x000000,  0x200, CRC(5e83eaf3) SHA1(95f5eb8e56dff6c2dce7c39a6dd458bfc38fe1cf) )
3911
3912   ROM_REGION( 0x0600, "plds", 0 )
3913   ROM_LOAD( "ve-00.3d",  0x0000, 0x0117, CRC(384d316c) SHA1(61b50c695d4210c199cf6f7bbe50c8a5ecd1d21c) )
3914   ROM_LOAD( "ve-01a.4d", 0x0200, 0x0117, CRC(109613c8) SHA1(5991e010c1bc2a827c8ee2c85a9b40e00a3167b3) )
3915   ROM_LOAD( "vm-02.8j",  0x0400, 0x0117, CRC(53692426) SHA1(b8f8cf6b1f6b637fcd1fcd62474e637f5d4a6901) )
39163819ROM_END
39173820
39183821DRIVER_INIT_MEMBER(deco32_state,captaven)
r249094r249095
40753978GAME( 1991, captavenua, captaven, captaven, captaven, deco32_state,   captaven,  ROT0, "Data East Corporation", "Captain America and The Avengers (US Rev 1.4)", MACHINE_SUPPORTS_SAVE )
40763979GAME( 1991, captavenj,  captaven, captaven, captaven, deco32_state,   captaven,  ROT0, "Data East Corporation", "Captain America and The Avengers (Japan Rev 0.2)", MACHINE_SUPPORTS_SAVE )
40773980
4078// DE-0396-0 PCB sets (Z80 for sound)
3981// DE-0396-0 PCB sets (uses a Z80)
40793982GAME( 1993, fghthistu,  fghthist, fghthistz,fghthist, deco32_state,   fghthist,  ROT0, "Data East Corporation", "Fighter's History (US ver 42-09, DE-0396-0 PCB)", MACHINE_SUPPORTS_SAVE )
4080// DE-0395-1 PCB sets (HuC6280 for sound)
3983// DE-0395-1 PCB sets
40813984GAME( 1993, fghthistua, fghthist, fghthsta, fghthist, deco32_state,   fghthist,  ROT0, "Data East Corporation", "Fighter's History (US ver 42-06, DE-0395-1 PCB)", MACHINE_SUPPORTS_SAVE )
40823985GAME( 1993, fghthistub, fghthist, fghthsta, fghthist, deco32_state,   fghthist,  ROT0, "Data East Corporation", "Fighter's History (US ver 42-05, DE-0395-1 PCB)", MACHINE_SUPPORTS_SAVE )
40833986GAME( 1993, fghthistj,  fghthist, fghthsta, fghthist, deco32_state,   fghthist,  ROT0, "Data East Corporation", "Fighter's History (Japan ver 41-07, DE-0395-1 PCB)", MACHINE_SUPPORTS_SAVE )
4084// DE-0380-2 PCB sets (HuC6280 for sound)
3987// DE-0380-2 PCB sets
40853988GAME( 1993, fghthist,   0,        fghthist, fghthist, deco32_state,   fghthist,  ROT0, "Data East Corporation", "Fighter's History (World ver 43-07, DE-0380-2 PCB)", MACHINE_SUPPORTS_SAVE )
40863989GAME( 1993, fghthista,  fghthist, fghthist, fghthist, deco32_state,   fghthist,  ROT0, "Data East Corporation", "Fighter's History (World ver 43-05, DE-0380-2 PCB)", MACHINE_SUPPORTS_SAVE )
40873990GAME( 1993, fghthistuc, fghthist, fghthist, fghthist, deco32_state,   fghthist,  ROT0, "Data East Corporation", "Fighter's History (US ver 42-03, DE-0380-2 PCB)", MACHINE_SUPPORTS_SAVE )
40883991GAME( 1993, fghthistja, fghthist, fghthist, fghthist, deco32_state,   fghthist,  ROT0, "Data East Corporation", "Fighter's History (Japan ver 41-05, DE-0380-2 PCB)", MACHINE_SUPPORTS_SAVE )
4089// DE-0380-1 PCB sets (HuC6280 for sound)
3992// DE-0380-1 PCB sets
40903993GAME( 1993, fghthistjb, fghthist, fghthist, fghthist, deco32_state,   fghthist,  ROT0, "Data East Corporation", "Fighter's History (Japan ver 41-04, DE-0380-1 PCB)", MACHINE_SUPPORTS_SAVE )
40913994
4092// DE-0397-0 PCB sets (Z80 for sound)
4093GAME( 1994, nslasher,   0,        nslasher, nslasher, deco32_state,   nslasher,  ROT0, "Data East Corporation", "Night Slashers (Korea Rev 1.3, DE-0397-0 PCB)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
4094GAME( 1994, nslasherj,  nslasher, nslasher, nslasher, deco32_state,   nslasher,  ROT0, "Data East Corporation", "Night Slashers (Japan Rev 1.2, DE-0397-0 PCB)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
4095GAME( 1994, nslashers,  nslasher, nslasher, nslasher, deco32_state,   nslasher,  ROT0, "Data East Corporation", "Night Slashers (Over Sea Rev 1.2, DE-0397-0 PCB)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
4096// DE-0395-1 PCB sets (HuC6280 for sound)
4097GAME( 1994, nslasheru,  nslasher, nslasheru,nslasher, deco32_state,   nslasher,  ROT0, "Data East Corporation", "Night Slashers (US Rev 1.2, DE-0395-1 PCB)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
3995GAME( 1994, nslasher,   0,        nslasher, nslasher, deco32_state,   nslasher,  ROT0, "Data East Corporation", "Night Slashers (Korea Rev 1.3)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
3996GAME( 1994, nslasherj,  nslasher, nslasher, nslasher, deco32_state,   nslasher,  ROT0, "Data East Corporation", "Night Slashers (Japan Rev 1.2)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
3997GAME( 1994, nslashers,  nslasher, nslasher, nslasher, deco32_state,   nslasher,  ROT0, "Data East Corporation", "Night Slashers (Over Sea Rev 1.2)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
3998GAME( 1994, nslasheru,  nslasher, nslasheru,nslasher, deco32_state,   nslasher,  ROT0, "Data East Corporation", "Night Slashers (US Rev 1.2, HuC6280 Sound CPU)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
40983999
40994000GAME( 1994, tattass,    0,        tattass,  tattass,  deco32_state,   tattass,   ROT0, "Data East Pinball",     "Tattoo Assassins (US prototype)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
41004001GAME( 1994, tattassa,   tattass,  tattass,  tattass,  deco32_state,   tattass,   ROT0, "Data East Pinball",     "Tattoo Assassins (Asia prototype)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
trunk/src/mame/drivers/fcrash.c
r249094r249095
29582958
29592959GAME( 1992, sf2b,      sf2,      sf2b,      sf2mdt,   cps_state, sf2b,     ROT0,   "bootleg", "Street Fighter II: The World Warrior (bootleg)",  MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) //910204 - based on World version
29602960
2961GAME( 1992, sf2m9,     sf2ce,    sf2m1,     sf2,      cps_state, sf2m1,    ROT0,   "bootleg", "Street Fighter II': Champion Edition (M9, bootleg)",  MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) // 920313 ETC
2961GAME( 1992, sf2m9,     sf2ce,    sf2m1,     sf2,      cps_state, dinopic,  ROT0,   "bootleg", "Street Fighter II': Champion Edition (M9, bootleg)",  MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) // 920313 ETC
29622962
29632963GAME( 1993, slampic,   slammast, slampic,   slammast, cps_state, dinopic,  ROT0,   "bootleg", "Saturday Night Slam Masters (bootleg with PIC16c57)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) // 930713 ETC
29642964
trunk/src/mame/drivers/galastrm.c
r249094r249095
252252   { 0, 8, 16, 24 },
253253   { 32, 33, 34, 35, 36, 37, 38, 39, 0, 1, 2, 3, 4, 5, 6, 7 },
254254   { 0*64, 1*64,  2*64,  3*64,  4*64,  5*64,  6*64,  7*64,
255     8*64, 9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64 },
255      8*64, 9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64 },
256256   64*16   /* every sprite takes 128 consecutive bytes */
257257};
258258
trunk/src/mame/drivers/groundfx.c
r249094r249095
245245   PORT_BIT( 0xff, 0x7f, IPT_AD_STICK_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_REVERSE PORT_PLAYER(1)
246246
247247   PORT_START("AN1")   /* IN 3, accel */
248   PORT_BIT( 0xff, 0x00, IPT_AD_STICK_Y ) PORT_SENSITIVITY(20) PORT_KEYDELTA(10) PORT_PLAYER(1)
248   PORT_BIT( 0xff, 0xff, IPT_AD_STICK_Y ) PORT_SENSITIVITY(20) PORT_KEYDELTA(10) PORT_PLAYER(1)
249249
250250   PORT_START("AN2")   /* IN 4, sound volume */
251251   PORT_BIT( 0xff, 0x00, IPT_AD_STICK_X ) PORT_SENSITIVITY(20) PORT_KEYDELTA(10) PORT_REVERSE PORT_PLAYER(2)
trunk/src/mame/drivers/hng64.c
r249094r249095
11// license:LGPL-2.1+
2// copyright-holders:David Haywood, Angelo Salese, ElSemi, Andrew Gardner
2// copyright-holders:David Haywood, Angelo Salese, ElSemi, Andrew Gardner, Andrew Zaferakis
33/* Hyper NeoGeo 64
44
55Driver by David Haywood, ElSemi, Andrew Gardner and Angelo Salese
6Rasterizing code provided in part by Andrew Zaferakis.
67
78
89Notes:
trunk/src/mame/drivers/lethalj.c
r249094r249095
681681
682682ROM_START( lethalj )
683683   ROM_REGION16_LE( 0x100000, "user1", 0 )     /* 34010 code */
684   ROM_LOAD16_BYTE( "lethal_vc8_2.3.vc8",  0x000000, 0x080000, CRC(8d568e1d) SHA1(e4dd3794789f9ccd7be8374978a3336f2b79136f) ) /* Labeled as LETHAL VC8 2.3, also found labeled as VC-8 */
685   ROM_LOAD16_BYTE( "lethal_vc9_2.3.vc9",  0x000001, 0x080000, CRC(8f22add4) SHA1(e773d3ae9cf512810fc266e784d21ed115c8830c) ) /* Labeled as LETHAL VC9 2.3, also found labeled as VC-9 */
684   ROM_LOAD16_BYTE( "vc8",  0x000000, 0x080000, CRC(8d568e1d) SHA1(e4dd3794789f9ccd7be8374978a3336f2b79136f) )
685   ROM_LOAD16_BYTE( "vc9",  0x000001, 0x080000, CRC(8f22add4) SHA1(e773d3ae9cf512810fc266e784d21ed115c8830c) )
686686
687687   ROM_REGION16_LE( 0x600000, "gfx1", 0 )          /* graphics data */
688   ROM_LOAD16_BYTE( "gr1.gr1",             0x000000, 0x100000, CRC(27f7b244) SHA1(628b29c066e217e1fe54553ea3ed98f86735e262) ) /* These had non specific GRx labels, also found labeled as GR-x */
689   ROM_LOAD16_BYTE( "gr2.gr2",             0x000001, 0x100000, CRC(1f25d3ab) SHA1(bdb8a3c546cdee9a5630c47b9c5079a956e8a093) )
690   ROM_LOAD16_BYTE( "gr4.gr4",             0x200000, 0x100000, CRC(c5838b4c) SHA1(9ad03d0f316eb31fdf0ca6f65c02a27d3406d072) )
691   ROM_LOAD16_BYTE( "gr3.gr3",             0x200001, 0x100000, CRC(ba9fa057) SHA1(db6f11a8964870f04f94fef6f1b1a58168a942ad) )
692   ROM_LOAD16_BYTE( "lethal_gr6_2.3.gr6",  0x400000, 0x100000, CRC(51c99b85) SHA1(9a23bf21a73d2884b49c64a8f42c288534c79dc5) ) /* Labeled as LETHAL GR6 2.3, also found labeled as GR-6 */
693   ROM_LOAD16_BYTE( "lethal_gr5_2.3.gr5",  0x400001, 0x100000, CRC(80dda9b5) SHA1(d8a79cad112bc7d9e4ba31a950e4807581f3bf46) ) /* Labeled as LETHAL GR5 2.3, also found labeled as GR-5 */
688   ROM_LOAD16_BYTE( "gr1",  0x000000, 0x100000, CRC(27f7b244) SHA1(628b29c066e217e1fe54553ea3ed98f86735e262) )
689   ROM_LOAD16_BYTE( "gr2",  0x000001, 0x100000, CRC(1f25d3ab) SHA1(bdb8a3c546cdee9a5630c47b9c5079a956e8a093) )
690   ROM_LOAD16_BYTE( "gr4",  0x200000, 0x100000, CRC(c5838b4c) SHA1(9ad03d0f316eb31fdf0ca6f65c02a27d3406d072) )
691   ROM_LOAD16_BYTE( "gr3",  0x200001, 0x100000, CRC(ba9fa057) SHA1(db6f11a8964870f04f94fef6f1b1a58168a942ad) )
692   ROM_LOAD16_BYTE( "gr6",  0x400000, 0x100000, CRC(51c99b85) SHA1(9a23bf21a73d2884b49c64a8f42c288534c79dc5) )
693   ROM_LOAD16_BYTE( "gr5",  0x400001, 0x100000, CRC(80dda9b5) SHA1(d8a79cad112bc7d9e4ba31a950e4807581f3bf46) )
694694
695695   ROM_REGION( 0x40000, "oki1", 0 )                /* sound data */
696696   ROM_LOAD( "sound1.u20", 0x00000, 0x40000, CRC(7d93ca66) SHA1(9e1dc0efa5d0f770c7e1f10de56fbf5620dea437) )
r249094r249095
10071007 *
10081008 *************************************/
10091009
1010GAME( 1996, lethalj,   0,        lethalj,  lethalj,   driver_device, 0,        ROT0,  "The Game Room", "Lethal Justice (Version 2.3)", 0 )
1010GAME( 1996, lethalj,   0,        lethalj,  lethalj,   driver_device, 0,        ROT0,  "The Game Room", "Lethal Justice", 0 )
10111011GAME( 1996, franticf,  0,        gameroom, franticf,  driver_device, 0,        ROT0,  "The Game Room", "Frantic Fred", MACHINE_NOT_WORKING )
10121012GAME( 1997, eggventr,  0,        gameroom, eggventr,  driver_device, 0,        ROT0,  "The Game Room", "Egg Venture (Release 10)", 0 )
10131013GAME( 1997, eggventr8, eggventr, gameroom, eggventr,  driver_device, 0,        ROT0,  "The Game Room", "Egg Venture (Release 8)", 0 )
trunk/src/mame/drivers/midxunit.c
r249094r249095
345345   ROM_LOAD( "a-17721.u955", 0x200, 0x117, CRC(033fe902) SHA1(6efb4e519ed3c9d49fff046a679762b506b3a75b) )
346346ROM_END
347347
348ROM_START( revxp5 )
349   ROM_REGION16_LE( 0x1000000, "dcs", ROMREGION_ERASEFF )  /* sound data */
350   ROM_LOAD16_BYTE( "revx_snd.2", 0x000000, 0x80000, CRC(4ed9e803) SHA1(ba50f1beb9f2a2cf5110897209b5e9a2951ff165) )
351   ROM_LOAD16_BYTE( "revx_snd.3", 0x200000, 0x80000, CRC(af8f253b) SHA1(25a0000cab177378070f7a6e3c7378fe87fad63e) )
352   ROM_LOAD16_BYTE( "revx_snd.4", 0x400000, 0x80000, CRC(3ccce59c) SHA1(e81a31d64c64e7b1d25f178c53da3d68453c203c) )
353   ROM_LOAD16_BYTE( "revx_snd.5", 0x600000, 0x80000, CRC(a0438006) SHA1(560d216d21cb8073dbee0fd20ebe589932a9144e) )
354   ROM_LOAD16_BYTE( "revx_snd.6", 0x800000, 0x80000, CRC(b7b34f60) SHA1(3b9682c6a00fa3bdb47e69d8e8ceccc244ee55b5) )
355   ROM_LOAD16_BYTE( "revx_snd.7", 0xa00000, 0x80000, CRC(6795fd88) SHA1(7c3790730a8b99b63112c851318b1c7e4989e5e0) )
356   ROM_LOAD16_BYTE( "revx_snd.8", 0xc00000, 0x80000, CRC(793a7eb5) SHA1(4b1f81b68f95cedf1b356ef362d1eb37acc74b16) )
357   ROM_LOAD16_BYTE( "revx_snd.9", 0xe00000, 0x80000, CRC(14ddbea1) SHA1(8dba9dc5529ea77c4312ea61f825bf9062ffc6c3) )
358348
359   ROM_REGION16_LE( 0x200000, "maincpu", 0 )   /* 34020 code */
360   ROM_LOAD32_BYTE( "revx_p5.51",  0x00000, 0x80000, CRC(f3877eee) SHA1(7a4fdce36edddd35308c107c992ce626a2c9eb8c) )
361   ROM_LOAD32_BYTE( "revx_p5.52",  0x00001, 0x80000, CRC(199a54d8) SHA1(45319437e11176d4926c00c95c372098203a32a3) )
362   ROM_LOAD32_BYTE( "revx_p5.53",  0x00002, 0x80000, CRC(fcfcf72a) SHA1(b471afb416e3d348b046b0b40f497d27b0afa470) )
363   ROM_LOAD32_BYTE( "revx_p5.54",  0x00003, 0x80000, CRC(fd684c31) SHA1(db3453792e4d9fc375297d030f0b3f9cc3cad925) )
364349
365   ROM_REGION( 0x2000, "pic", 0 )
366   ROM_LOAD( "revx_16c57.bin", 0x0000000, 0x2000, CRC(eb8a8649) SHA1(a1e1d0b7a5e9802e8f889eb7e719259656dc8133) )
367
368   ROM_REGION( 0x1000000, "gfxrom", 0 )
369   ROM_LOAD32_BYTE( "revx.120", 0x0000000, 0x80000, CRC(523af1f0) SHA1(a67c0fd757e860fc1c1236945952a295b4d5df5a) )
370   ROM_LOAD32_BYTE( "revx.121", 0x0000001, 0x80000, CRC(78201d93) SHA1(fb0b8f887eec433f7624f387d7fb6f633ea30d7c) )
371   ROM_LOAD32_BYTE( "revx.122", 0x0000002, 0x80000, CRC(2cf36144) SHA1(22ed0eefa2c7c836811fac5f717c3f38254eabc2) )
372   ROM_LOAD32_BYTE( "revx.123", 0x0000003, 0x80000, CRC(6912e1fb) SHA1(416f0de711d80e9182ede524c568c5095b1bec61) )
373
374   ROM_LOAD32_BYTE( "revx.110", 0x0200000, 0x80000, CRC(e3f7f0af) SHA1(5877d9f488b0f4362a9482007c3ff7f4589a036f) )
375   ROM_LOAD32_BYTE( "revx.111", 0x0200001, 0x80000, CRC(49fe1a69) SHA1(9ae54b461f0524c034fbcb6fcd3fd5ccb5d7265a) )
376   ROM_LOAD32_BYTE( "revx.112", 0x0200002, 0x80000, CRC(7e3ba175) SHA1(dd2fe90988b544f67dbe6151282fd80d49631388) )
377   ROM_LOAD32_BYTE( "revx.113", 0x0200003, 0x80000, CRC(c0817583) SHA1(2f866e5888e212b245984344950d0e1fb8957a73) )
378
379   ROM_LOAD32_BYTE( "revx.101", 0x0400000, 0x80000, CRC(5a08272a) SHA1(17da3c9d71114f5fdbf50281a942be3da3b6f564) )
380   ROM_LOAD32_BYTE( "revx.102", 0x0400001, 0x80000, CRC(11d567d2) SHA1(7ebe6fd39a0335e1fdda150d2dc86c3eaab17b2e) )
381   ROM_LOAD32_BYTE( "revx.103", 0x0400002, 0x80000, CRC(d338e63b) SHA1(0a038217542667b3a01ecbcad824ee18c084f293) )
382   ROM_LOAD32_BYTE( "revx.104", 0x0400003, 0x80000, CRC(f7b701ee) SHA1(0fc5886e5857326bee7272d5d482a878cbcea83c) )
383
384   ROM_LOAD32_BYTE( "revx.91",  0x0600000, 0x80000, CRC(52a63713) SHA1(dcc0ff3596bd5d273a8d4fd33b0b9b9d588d8354) )
385   ROM_LOAD32_BYTE( "revx.92",  0x0600001, 0x80000, CRC(fae3621b) SHA1(715d41ea789c0c724baa5bd90f6f0f06b9cb1c64) )
386   ROM_LOAD32_BYTE( "revx.93",  0x0600002, 0x80000, CRC(7065cf95) SHA1(6c5888da099e51c4b1c592721c5027c899cf52e3) )
387   ROM_LOAD32_BYTE( "revx.94",  0x0600003, 0x80000, CRC(600d5b98) SHA1(6aef98c91f87390c0759fe71a272a3ccadd71066) )
388
389   ROM_LOAD32_BYTE( "revx.81",  0x0800000, 0x80000, CRC(729eacb1) SHA1(d130162ae22b99c84abfbe014c4e23e20afb757f) )
390   ROM_LOAD32_BYTE( "revx.82",  0x0800001, 0x80000, CRC(19acb904) SHA1(516059b516bc5b1669c9eb085e0cdcdee520dff0) )
391   ROM_LOAD32_BYTE( "revx.83",  0x0800002, 0x80000, CRC(0e223456) SHA1(1eedbd667f4a214533d1c22ca5312ecf2d4a3ab4) )
392   ROM_LOAD32_BYTE( "revx.84",  0x0800003, 0x80000, CRC(d3de0192) SHA1(2d22c5bac07a7411f326691167c7c70eba4b371f) )
393
394   ROM_LOAD32_BYTE( "revx.71",  0x0a00000, 0x80000, CRC(2b29fddb) SHA1(57b71e5c18b56bf58216e690fdefa6d30d88d34a) )
395   ROM_LOAD32_BYTE( "revx.72",  0x0a00001, 0x80000, CRC(2680281b) SHA1(d1ae0701d20166a00d8733d9d12246c140a5fb96) )
396   ROM_LOAD32_BYTE( "revx.73",  0x0a00002, 0x80000, CRC(420bde4d) SHA1(0f010cdeddb59631a5420dddfc142c50c2a1e65a) )
397   ROM_LOAD32_BYTE( "revx.74",  0x0a00003, 0x80000, CRC(26627410) SHA1(a612121554549afff5c8e8c54774ca7b0220eda8) )
398
399   ROM_LOAD32_BYTE( "revx.63",  0x0c00000, 0x80000, CRC(3066e3f3) SHA1(25548923db111bd6c6cff44bfb63cb9eb2ef0b53) )
400   ROM_LOAD32_BYTE( "revx.64",  0x0c00001, 0x80000, CRC(c33f5309) SHA1(6bb333f563ea66c4c862ffd5fb91fb5e1b919fe8) )
401   ROM_LOAD32_BYTE( "revx.65",  0x0c00002, 0x80000, CRC(6eee3e71) SHA1(0ef22732e0e2bb5207559decd43f90d1e338ad7b) )
402   ROM_LOAD32_BYTE( "revx.66",  0x0c00003, 0x80000, CRC(b43d6fff) SHA1(87584e7aeea9d52a43023d40c359591ff6342e84) )
403   
404   ROM_LOAD32_BYTE( "revx_p5.51",  0xe00000, 0x80000, CRC(f3877eee) SHA1(7a4fdce36edddd35308c107c992ce626a2c9eb8c) )
405   ROM_LOAD32_BYTE( "revx_p5.52",  0xe00001, 0x80000, CRC(199a54d8) SHA1(45319437e11176d4926c00c95c372098203a32a3) )
406   ROM_LOAD32_BYTE( "revx_p5.53",  0xe00002, 0x80000, CRC(fcfcf72a) SHA1(b471afb416e3d348b046b0b40f497d27b0afa470) )
407   ROM_LOAD32_BYTE( "revx_p5.54",  0xe00003, 0x80000, CRC(fd684c31) SHA1(db3453792e4d9fc375297d030f0b3f9cc3cad925) )
408
409   ROM_REGION( 0x400, "plds", 0 )
410   ROM_LOAD( "a-17722.u1",   0x000, 0x117, CRC(054de7a3) SHA1(bb7abaec50ed704c03b44d5d54296898f7c80d38) )
411   ROM_LOAD( "a-17721.u955", 0x200, 0x117, CRC(033fe902) SHA1(6efb4e519ed3c9d49fff046a679762b506b3a75b) )
412ROM_END
413
414
415
416350/*************************************
417351 *
418352 *  Game drivers
419353 *
420354 *************************************/
421355
422GAME( 1994, revx,     0,    midxunit, revx, midxunit_state, revx, ROT0, "Midway",   "Revolution X (rev 1.0 6/16/94)", MACHINE_SUPPORTS_SAVE )
423GAME( 1994, revxp5,   revx, midxunit, revx, midxunit_state, revx, ROT0, "Midway",   "Revolution X (prototype, rev 5.0 5/23/94)", MACHINE_SUPPORTS_SAVE )
356GAME( 1994, revx,   0,         midxunit, revx, midxunit_state, revx, ROT0, "Midway",   "Revolution X (Rev. 1.0 6/16/94)", MACHINE_SUPPORTS_SAVE )
trunk/src/mame/drivers/model2.c
r249094r249095
59855985
59865986
59875987// Model 2 (TGPs, Model 1 sound board)
5988GAME( 1993, daytona,         0, model2o, daytona, driver_device, 0,        ROT0, "Sega",   "Daytona USA (Japan, Revision A)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
5989GAME( 1993, daytonase, daytona, model2o, daytona, driver_device, 0,        ROT0, "Sega",   "Daytona USA Special Edition (Japan, Revision A)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
5990GAME( 1993, daytona93, daytona, model2o, daytona, driver_device, 0,        ROT0, "Sega",   "Daytona USA Deluxe '93", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
5991GAME( 1993, daytonas,  daytona, model2o, daytona, driver_device, 0,        ROT0, "Sega",   "Daytona USA (With Saturn Adverts)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
5992GAME( 1993, daytonat,  daytona, model2o, daytona, driver_device, 0,        ROT0, "Sega",   "Daytona USA (Japan, Turbo hack, set 1)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
5993GAME( 1993, daytonata, daytona, model2o, daytona, driver_device, 0,        ROT0, "Sega",   "Daytona USA (Japan, Turbo hack, set 2)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
5994GAME( 1993, daytonam,  daytona, model2o, daytona, model2_state,  daytonam, ROT0, "Sega",   "Daytona USA (Japan, To The MAXX)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
5995GAME( 1994, desert,          0, model2o, desert,  driver_device, 0,        ROT0, "Sega / Martin Marietta", "Desert Tank", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
5996GAME( 1994, vcop,            0, model2o, vcop,    driver_device, 0,        ROT0, "Sega",   "Virtua Cop (Revision B)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
5997GAME( 1994, vcopa,        vcop, model2o, vcop,    driver_device, 0,        ROT0, "Sega",   "Virtua Cop (Revision A)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
5988GAME( 1993, daytona,         0, model2o, daytona, driver_device, 0,       ROT0, "Sega",   "Daytona USA (Japan, Revision A)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
5989GAME( 1993, daytonase, daytona, model2o, daytona, driver_device, 0,       ROT0, "Sega",   "Daytona USA Special Edition (Japan, Revision A)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
5990GAME( 1993, daytona93, daytona, model2o, daytona, driver_device, 0,       ROT0, "Sega",   "Daytona USA Deluxe '93", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
5991GAME( 1993, daytonas,  daytona, model2o, daytona, driver_device, 0,       ROT0, "Sega",   "Daytona USA (With Saturn Adverts)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
5992GAME( 1993, daytonat,  daytona, model2o, daytona, driver_device, 0,       ROT0, "Sega",   "Daytona USA (Japan, Turbo hack, set 1)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
5993GAME( 1993, daytonata, daytona, model2o, daytona, driver_device, 0,       ROT0, "Sega",   "Daytona USA (Japan, Turbo hack, set 2)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
5994GAME( 1993, daytonam,  daytona, model2o, daytona, model2_state,  daytonam,ROT0, "Sega",   "Daytona USA (Japan, To The MAXX)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
5995GAME( 1994, desert,          0, model2o, desert,  driver_device, 0,       ROT0, "Sega / Martin Marietta", "Desert Tank", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
5996GAME( 1994, vcop,            0, model2o, vcop,    driver_device, 0,       ROT0, "Sega",   "Virtua Cop (Revision B)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
5997GAME( 1994, vcopa,        vcop, model2o, vcop,    driver_device, 0,       ROT0, "Sega",   "Virtua Cop (Revision A)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
59985998
59995999// Model 2A-CRX (TGPs, SCSP sound board)
6000GAME( 1995, manxtt,          0, manxttdx,     manxtt,   driver_device, 0,       ROT0, "Sega",   "Manx TT Superbike - DX (Revision D)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
6001GAME( 1995, manxttc,         0, model2a,      manxtt,   driver_device, 0,       ROT0, "Sega",   "Manx TT Superbike - Twin (Revision C)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
6002GAME( 1995, srallyc,         0, srallyc,      srallyc,  model2_state,  srallyc, ROT0, "Sega",   "Sega Rally Championship - TWIN (Revision C)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
6003GAME( 1995, srallycb,  srallyc, srallyc,      srallyc,  model2_state,  srallyc, ROT0, "Sega",   "Sega Rally Championship - TWIN (Revision B)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
6004GAME( 1995, srallyca,  srallyc, srallyc,      srallyc,  model2_state,  srallyc, ROT0, "Sega",   "Sega Rally Championship - DX (Revision A)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
6005GAME( 1995, vf2,             0, model2a,      model2,   driver_device, 0,       ROT0, "Sega",   "Virtua Fighter 2 (Version 2.1)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
6006GAME( 1995, vf2b,          vf2, model2a,      model2,   driver_device, 0,       ROT0, "Sega",   "Virtua Fighter 2 (Revision B)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
6007GAME( 1995, vf2a,          vf2, model2a,      model2,   driver_device, 0,       ROT0, "Sega",   "Virtua Fighter 2 (Revision A)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
6008GAME( 1995, vf2o,          vf2, model2a,      model2,   driver_device, 0,       ROT0, "Sega",   "Virtua Fighter 2", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
6009GAME( 1995, vcop2,           0, model2a,      vcop2,    driver_device, 0,       ROT0, "Sega",   "Virtua Cop 2", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
6010GAME( 1995, skytargt,        0, model2a,      skytargt, driver_device, 0,       ROT0, "Sega",   "Sky Target", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
6011GAME( 1996, doaa,          doa, model2a_0229, model2,   model2_state,  doa,     ROT0, "Sega",   "Dead or Alive (Model 2A, Revision A)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
6012GAME( 1997, zeroguna,  zerogun, model2a_5881, model2,   model2_state,  zerogun, ROT0, "Psikyo", "Zero Gunner (Export, Model 2A)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
6013GAME( 1997, zerogunaj, zerogun, model2a_5881, model2,   model2_state,  zerogun, ROT0, "Psikyo", "Zero Gunner (Japan, Model 2A)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
6014GAME( 1997, motoraid,        0, model2a,      manxtt,   driver_device, 0,       ROT0, "Sega",   "Motor Raid - Twin", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
6015GAME( 1998, dynamcop,        0, model2a_5881, model2,   model2_state,  genprot, ROT0, "Sega",   "Dynamite Cop (Export, Model 2A)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
6016GAME( 1998, dyndeka2, dynamcop, model2a_5881, model2,   model2_state,  genprot, ROT0, "Sega",   "Dynamite Deka 2 (Japan, Model 2A)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
6017GAME( 1998, pltkidsa,  pltkids, model2a_5881, model2,   model2_state,  pltkids, ROT0, "Psikyo", "Pilot Kids (Model 2A)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
6000GAME( 1995, manxtt,          0, manxttdx     ,manxtt,  driver_device, 0, ROT0, "Sega", "Manx TT Superbike - DX (Revision D)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
6001GAME( 1995, manxttc,         0, model2a,      manxtt,  driver_device, 0,       ROT0, "Sega",   "Manx TT Superbike - Twin (Revision C)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
6002GAME( 1995, srallyc,         0, srallyc,      srallyc, model2_state,  srallyc, ROT0, "Sega",   "Sega Rally Championship - TWIN (Revision C)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
6003GAME( 1995, srallycb,  srallyc, srallyc,      srallyc, model2_state,  srallyc, ROT0, "Sega",   "Sega Rally Championship - TWIN (Revision B)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
6004GAME( 1995, srallyca,  srallyc, srallyc,      srallyc, model2_state,  srallyc, ROT0, "Sega",   "Sega Rally Championship - DX (Revision A)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
6005GAME( 1995, vf2,             0, model2a,      model2,  driver_device, 0,       ROT0, "Sega",   "Virtua Fighter 2 (Version 2.1)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
6006GAME( 1995, vf2b,          vf2, model2a,      model2,  driver_device, 0,       ROT0, "Sega",   "Virtua Fighter 2 (Revision B)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
6007GAME( 1995, vf2a,          vf2, model2a,      model2,  driver_device, 0,       ROT0, "Sega",   "Virtua Fighter 2 (Revision A)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
6008GAME( 1995, vf2o,          vf2, model2a,      model2,  driver_device, 0,       ROT0, "Sega",   "Virtua Fighter 2", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
6009GAME( 1995, vcop2,           0, model2a,      vcop2,   driver_device, 0,       ROT0, "Sega",   "Virtua Cop 2", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
6010GAME( 1995, skytargt,        0, model2a,      skytargt,driver_device, 0,       ROT0, "Sega",   "Sky Target", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
6011GAME( 1996, doaa,          doa, model2a_0229,  model2,  model2_state,  doa,     ROT0, "Sega",   "Dead or Alive (Model 2A, Revision A)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
6012GAME( 1997, zeroguna,  zerogun, model2a_5881, model2,  model2_state,  zerogun, ROT0, "Psikyo", "Zero Gunner (Export, Model 2A)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
6013GAME( 1997, zerogunaj, zerogun, model2a_5881, model2,  model2_state,  zerogun, ROT0, "Psikyo", "Zero Gunner (Japan, Model 2A)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
6014GAME( 1997, motoraid,        0, model2a,      manxtt,  driver_device, 0,       ROT0, "Sega",   "Motor Raid - Twin", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
6015GAME( 1998, dynamcop,        0, model2a_5881, model2,  model2_state,  genprot, ROT0, "Sega",   "Dynamite Cop (Export, Model 2A)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
6016GAME( 1998, dyndeka2, dynamcop, model2a_5881, model2,  model2_state,  genprot, ROT0, "Sega",   "Dynamite Deka 2 (Japan, Model 2A)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
6017GAME( 1998, pltkidsa,  pltkids, model2a_5881, model2,  model2_state,  pltkids, ROT0, "Psikyo", "Pilot Kids (Model 2A)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
60186018
60196019// Model 2B-CRX (SHARC, SCSP sound board)
60206020GAME( 1994, vstriker,        0, model2b,      model2,  driver_device, 0,       ROT0, "Sega",   "Virtua Striker (Revision A)", MACHINE_NOT_WORKING|MACHINE_IMPERFECT_GRAPHICS )
trunk/src/mame/drivers/model3.c
r249094r249095
11// license:BSD-3-Clause
2// copyright-holders:R. Belmont, Ville Linde
2// copyright-holders:Andrew Gardner, R. Belmont, Ville Linde
33/*
44    Sega Model 3
55    PowerPC 603e + tilemaps + Real3D 1000 + 68000 + 2x SCSP
trunk/src/mame/drivers/namcofl.c
r249094r249095
610610   MCFG_VIDEO_START_OVERRIDE(namcofl_state,namcofl)
611611
612612   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
613   MCFG_C352_ADD("c352", 48384000/2, 288)
613   MCFG_C352_ADD("c352", 48384000/2, C352_DIVIDER_288)
614614   MCFG_SOUND_ROUTE(0, "rspeaker", 1.00)
615615   MCFG_SOUND_ROUTE(1, "lspeaker", 1.00)
616616   MCFG_SOUND_ROUTE(2, "rspeaker", 1.00)
trunk/src/mame/drivers/namconb1.c
r249094r249095
11261126   MCFG_VIDEO_START_OVERRIDE(namconb1_state,namconb1)
11271127
11281128   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
1129   MCFG_C352_ADD("c352", MASTER_CLOCK/2, 288)
1129   MCFG_C352_ADD("c352", MASTER_CLOCK/2, C352_DIVIDER_288)
11301130   MCFG_SOUND_ROUTE(0, "rspeaker", 1.00)
11311131   MCFG_SOUND_ROUTE(1, "lspeaker", 1.00)
11321132   MCFG_SOUND_ROUTE(2, "rspeaker", 1.00)
r249094r249095
11631163   MCFG_VIDEO_START_OVERRIDE(namconb1_state,namconb2)
11641164
11651165   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
1166   MCFG_C352_ADD("c352", MASTER_CLOCK/2, 288)
1166   MCFG_C352_ADD("c352", MASTER_CLOCK/2, C352_DIVIDER_288)
11671167   MCFG_SOUND_ROUTE(0, "rspeaker", 1.00)
11681168   MCFG_SOUND_ROUTE(1, "lspeaker", 1.00)
11691169   MCFG_SOUND_ROUTE(2, "rspeaker", 1.00)
trunk/src/mame/drivers/namcond1.c
r249094r249095
307307   /* sound hardware */
308308   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
309309
310   MCFG_C352_ADD("c352", XTAL_49_152MHz/2, 288)
310   MCFG_C352_ADD("c352", XTAL_49_152MHz/2, C352_DIVIDER_288)
311311   MCFG_SOUND_ROUTE(0, "rspeaker", 1.00)
312312   MCFG_SOUND_ROUTE(1, "lspeaker", 1.00)
313313   MCFG_SOUND_ROUTE(2, "rspeaker", 1.00)
trunk/src/mame/drivers/namcos11.c
r249094r249095
571571
572572   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
573573
574   MCFG_C352_ADD("c352", 20013200, 228)
574   MCFG_C352_ADD("c352", 20013200, C352_DIVIDER_228)
575575   MCFG_SOUND_ROUTE(0, "rspeaker", 1.00)
576576   MCFG_SOUND_ROUTE(1, "lspeaker", 1.00)
577577   MCFG_SOUND_ROUTE(2, "rspeaker", 1.00)
trunk/src/mame/drivers/namcos12.c
r249094r249095
16221622   /* sound hardware */
16231623   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
16241624
1625   MCFG_C352_ADD("c352", 29168000, 332)
1625   MCFG_C352_ADD("c352", 29168000, C352_DIVIDER_332)
16261626   MCFG_SOUND_ROUTE(0, "rspeaker", 1.00)
16271627   MCFG_SOUND_ROUTE(1, "lspeaker", 1.00)
16281628   MCFG_SOUND_ROUTE(2, "rspeaker", 1.00)
trunk/src/mame/drivers/namcos22.c
r249094r249095
37813781   /* sound hardware */
37823782   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
37833783
3784   MCFG_C352_ADD("c352", SS22_MASTER_CLOCK/2, 288)
3784   MCFG_C352_ADD("c352", SS22_MASTER_CLOCK/2, C352_DIVIDER_288)
37853785   MCFG_SOUND_ROUTE(0, "rspeaker", 1.00)
37863786   MCFG_SOUND_ROUTE(1, "lspeaker", 1.00)
37873787   MCFG_SOUND_ROUTE(2, "rspeaker", 1.00)
r249094r249095
38303830   /* sound hardware */
38313831   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
38323832
3833   MCFG_C352_ADD("c352", SS22_MASTER_CLOCK/2, 288)
3833   MCFG_C352_ADD("c352", SS22_MASTER_CLOCK/2, C352_DIVIDER_288)
38343834   MCFG_SOUND_ROUTE(0, "rspeaker", 1.00)
38353835   MCFG_SOUND_ROUTE(1, "lspeaker", 1.00)
38363836   MCFG_SOUND_ROUTE(2, "rspeaker", 1.00)
trunk/src/mame/drivers/namcos23.c
r249094r249095
12341234
12351235#include "emu.h"
12361236#include <float.h>
1237#include "video/poly.h"
1237#include "video/polylgcy.h"
12381238#include "cpu/mips/mips3.h"
12391239#include "cpu/h8/h83002.h"
12401240#include "cpu/h8/h83337.h"
r249094r249095
12471247#define JVSCLOCK    (XTAL_14_7456MHz)
12481248#define H8CLOCK     (16737350)      /* from 2061 */
12491249#define BUSCLOCK    (16737350*2)    /* 33MHz CPU bus clock / input */
1250#define C352CLOCK   (25992000)  /* measured at 25.992MHz from 2061 pin 9  */
1251#define C352DIV      (296)
1250#define C352CLOCK   (25992000)  /* measured at 25.992MHz from 2061 pin 9 (System 12 uses a divider of 332) */
12521251#define VSYNC1      (59.8824)
12531252#define VSYNC2      (59.915)
12541253#define HSYNC       (16666150)
r249094r249095
12641263
12651264enum { MODEL, FLUSH };
12661265
1267enum { RENDER_MAX_ENTRIES = 1000, POLY_MAX_ENTRIES = 10000 };
1268
12691266struct namcos23_render_entry
12701267{
12711268   int type;
r249094r249095
12891286   UINT32 (*texture_lookup)(running_machine &machine, const pen_t *pens, float x, float y);
12901287};
12911288
1292class namcos23_state;
1293
1294class namcos23_renderer : public poly_manager<float, namcos23_render_data, 4, POLY_MAX_ENTRIES>
1295{
1296public:
1297    namcos23_renderer(namcos23_state &state);
1298   
1299    void render_flush(bitmap_rgb32& bitmap);
1300    void render_scanline(INT32 scanline, const extent_t& extent, const namcos23_render_data& object, int threadid);
1301   
1302private:
1303    namcos23_state& m_state;
1304    bitmap_rgb32 m_bitmap;
1305};
1306
1307typedef namcos23_renderer::vertex_t poly_vertex;
1308
13091289struct namcos23_poly_entry
13101290{
13111291   namcos23_render_data rd;
r249094r249095
13151295   poly_vertex pv[16];
13161296};
13171297
1298enum { RENDER_MAX_ENTRIES = 1000, POLY_MAX_ENTRIES = 10000 };
13181299
1300
13191301struct c417_t
13201302{
13211303   UINT16 ram[0x10000];
r249094r249095
13611343
13621344struct render_t
13631345{
1364    namcos23_renderer *polymgr;
1346   legacy_poly_manager *polymgr;
13651347   int cur;
13661348   int poly_count;
13671349   int count[2];
r249094r249095
15571539   void render_apply_matrot(INT32 xi, INT32 yi, INT32 zi, const namcos23_render_entry *re, INT32 &x, INT32 &y, INT32 &z);
15581540   void render_project(poly_vertex &pv);
15591541   void render_one_model(const namcos23_render_entry *re);
1542   void render_flush(bitmap_rgb32 &bitmap);
15601543   void render_run(bitmap_rgb32 &bitmap);
15611544};
15621545
r249094r249095
15831566
15841567***************************************************************************/
15851568
1586namcos23_renderer::namcos23_renderer(namcos23_state &state)
1587    : poly_manager<float, namcos23_render_data, 4, POLY_MAX_ENTRIES>(state.machine()),
1588      m_state(state),
1589      m_bitmap(state.m_screen->width(), state.m_screen->height())
1590{}
1591
15921569// 3D hardware, to throw at least in part in video/namcos23.c
15931570
15941571inline INT32 namcos23_state::u32_to_s24(UINT32 v)
r249094r249095
18791856
18801857
18811858
1882void namcos23_renderer::render_scanline(INT32 scanline, const extent_t& extent, const namcos23_render_data& object, int threadid)
1859static void render_scanline(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
18831860{
1884   const namcos23_render_data& rd = object;
1861   const namcos23_render_data *rd = (const namcos23_render_data *)extradata;
18851862
1886   float w = extent.param[0].start;
1887   float u = extent.param[1].start;
1888   float v = extent.param[2].start;
1889   float l = extent.param[3].start;
1890   float dw = extent.param[0].dpdx;
1891   float du = extent.param[1].dpdx;
1892   float dv = extent.param[2].dpdx;
1893   float dl = extent.param[3].dpdx;
1894   UINT32 *img = &m_bitmap.pix32(scanline, extent.startx);
1863   float w = extent->param[0].start;
1864   float u = extent->param[1].start;
1865   float v = extent->param[2].start;
1866   float l = extent->param[3].start;
1867   float dw = extent->param[0].dpdx;
1868   float du = extent->param[1].dpdx;
1869   float dv = extent->param[2].dpdx;
1870   float dl = extent->param[3].dpdx;
1871   bitmap_rgb32 *bitmap = (bitmap_rgb32 *)dest;
1872   UINT32 *img = &bitmap->pix32(scanline, extent->startx);
18951873
1896   for(int x = extent.startx; x < extent.stopx; x++) {
1874   for(int x = extent->startx; x < extent->stopx; x++) {
18971875      float z = w ? 1/w : 0;
1898      UINT32 pcol = rd.texture_lookup(*rd.machine, rd.pens, u*z, v*z);
1876      UINT32 pcol = rd->texture_lookup(*rd->machine, rd->pens, u*z, v*z);
18991877      float ll = l*z;
19001878      *img = (light(pcol >> 16, ll) << 16) | (light(pcol >> 8, ll) << 8) | light(pcol, ll);
19011879
r249094r249095
20342012
20352013      namcos23_poly_entry *p = render.polys + render.poly_count;
20362014
2037      p->vertex_count = render.polymgr->zclip_if_less(ne, pv, p->pv, 4, 0.001f);
2015      p->vertex_count = poly_zclip_if_less(ne, pv, p->pv, 4, 0.001f);
20382016
20392017      if(p->vertex_count >= 3) {
20402018         for(int i=0; i<p->vertex_count; i++) {
r249094r249095
20682046   return p1->zkey < p2->zkey ? 1 : p1->zkey > p2->zkey ? -1 : 0;
20692047}
20702048
2071void namcos23_renderer::render_flush(bitmap_rgb32& bitmap)
2049void namcos23_state::render_flush(bitmap_rgb32 &bitmap)
20722050{
2073   render_t &render = m_state.m_render;
2051   render_t &render = m_render;
20742052
20752053   if(!render.poly_count)
20762054      return;
r249094r249095
20842062
20852063   for(int i=0; i<render.poly_count; i++) {
20862064      const namcos23_poly_entry *p = render.poly_order[i];
2087        namcos23_render_data& extra = render.polymgr->object_data_alloc();
2088        extra = p->rd;
2089       
2090        if (p->vertex_count == 3)
2091            render_triangle(scissor, render_delegate(FUNC(namcos23_renderer::render_scanline), this), 4, p->pv[0], p->pv[1], p->pv[2]);
2092        else if (p->vertex_count == 4)
2093            render_polygon<4>(scissor, render_delegate(FUNC(namcos23_renderer::render_scanline), this), 4, p->pv);
2094        else if (p->vertex_count == 5)
2095            render_polygon<5>(scissor, render_delegate(FUNC(namcos23_renderer::render_scanline), this), 4, p->pv);
2065      namcos23_render_data *rd = (namcos23_render_data *)poly_get_extra_data(render.polymgr);
2066      *rd = p->rd;
2067      poly_render_triangle_fan(render.polymgr, &bitmap, scissor, render_scanline, 4, p->vertex_count, p->pv);
20962068   }
20972069   render.poly_count = 0;
2098   
2099    copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, scissor);
21002070}
21012071
21022072void namcos23_state::render_run(bitmap_rgb32 &bitmap)
r249094r249095
21112081         render_one_model(re);
21122082         break;
21132083      case FLUSH:
2114         render.polymgr->render_flush(bitmap);
2084         render_flush(bitmap);
21152085         break;
21162086      }
21172087      re++;
21182088   }
2119   render.polymgr->render_flush(bitmap);
2120    render.polymgr->wait();
2089   render_flush(bitmap);
2090
2091   poly_wait(render.polymgr, "render_run");
21212092}
21222093
21232094
r249094r249095
21892160   m_bgtilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(namcos23_state::TextTilemapGetInfo),this), TILEMAP_SCAN_ROWS, 16, 16, 64, 64);
21902161   m_bgtilemap->set_transparent_pen(0xf);
21912162   m_bgtilemap->set_scrolldx(860, 860);
2192    m_render.polymgr = auto_alloc(machine(), namcos23_renderer(*this));
2163   m_render.polymgr = poly_alloc(machine(), 10000, sizeof(namcos23_render_data), 0);
21932164}
21942165
21952166
r249094r249095
33493320   /* sound hardware */
33503321   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
33513322
3352   MCFG_C352_ADD("c352", C352CLOCK, C352DIV)
3323   MCFG_C352_ADD("c352", C352CLOCK, C352_DIVIDER_332)
33533324   MCFG_SOUND_ROUTE(0, "rspeaker", 1.00)
33543325   MCFG_SOUND_ROUTE(1, "lspeaker", 1.00)
33553326   MCFG_SOUND_ROUTE(2, "rspeaker", 1.00)
r249094r249095
34183389   /* sound hardware */
34193390   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
34203391
3421   MCFG_C352_ADD("c352", C352CLOCK, C352DIV)
3392   MCFG_C352_ADD("c352", C352CLOCK, C352_DIVIDER_332)
34223393   MCFG_SOUND_ROUTE(0, "rspeaker", 1.00)
34233394   MCFG_SOUND_ROUTE(1, "lspeaker", 1.00)
34243395   MCFG_SOUND_ROUTE(2, "rspeaker", 1.00)
r249094r249095
34983469   /* sound hardware */
34993470   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
35003471
3501   MCFG_C352_ADD("c352", C352CLOCK, C352DIV)
3472   MCFG_C352_ADD("c352", C352CLOCK, C352_DIVIDER_332)
35023473   MCFG_SOUND_ROUTE(0, "rspeaker", 1.00)
35033474   MCFG_SOUND_ROUTE(1, "lspeaker", 1.00)
35043475   MCFG_SOUND_ROUTE(2, "rspeaker", 1.00)
trunk/src/mame/drivers/quantum.c
r249094r249095
1212    Known bugs:
1313        * none at this time
1414
15NOTE: The Atari 136002-125 PROM in the sets below wasn't dumped from an actual
16     Quantum PCB. It is assumed all Atari 136002-125 PROMs are the same data.
17
1815****************************************************************************
1916
2017    Memory map
r249094r249095
336333   ROM_LOAD16_BYTE( "136016.110",   0x010001, 0x002000, CRC(acb50363) SHA1(9efa9ca88efdd2d5e212bd537903892b67b4fe53) )
337334   /* AVG PROM */
338335   ROM_REGION( 0x100, "user1", 0 )
339   ROM_LOAD( "136002-125.6h",   0x0000, 0x0100, CRC(5903af03) SHA1(24bc0366f394ad0ec486919212e38be0f08d0239) )
340
341   ROM_REGION( 0x200, "plds", 0 )
342   ROM_LOAD( "cf2038n.1b",   0x0000, 0x00eb, CRC(b372fa4f) SHA1(a60b51849e9f691b412ae4c4afc834ff93d8a30f) ) /* Original chip is a 82S153, schematics refer to this chip as 137290-001 */
336   ROM_LOAD( "136002-125.6h",   0x0000, 0x0100, BAD_DUMP CRC(5903af03) SHA1(24bc0366f394ad0ec486919212e38be0f08d0239) )
343337ROM_END
344338
345339
r249094r249095
357351   ROM_LOAD16_BYTE( "136016.110",   0x010001, 0x002000, CRC(acb50363) SHA1(9efa9ca88efdd2d5e212bd537903892b67b4fe53) )
358352   /* AVG PROM */
359353   ROM_REGION( 0x100, "user1", 0 )
360   ROM_LOAD( "136002-125.6h",   0x0000, 0x0100, CRC(5903af03) SHA1(24bc0366f394ad0ec486919212e38be0f08d0239) )
361
362   ROM_REGION( 0x200, "plds", 0 )
363   ROM_LOAD( "cf2038n.1b",   0x0000, 0x00eb, CRC(b372fa4f) SHA1(a60b51849e9f691b412ae4c4afc834ff93d8a30f) ) /* Original chip is a 82S153, schematics refer to this chip as 137290-001 */
354   ROM_LOAD( "136002-125.6h",   0x0000, 0x0100, BAD_DUMP CRC(5903af03) SHA1(24bc0366f394ad0ec486919212e38be0f08d0239) )
364355ROM_END
365356
366357
r249094r249095
378369   ROM_LOAD16_BYTE( "quantump.3l",  0x010001, 0x002000, CRC(e19de844) SHA1(cb4f9d80807b26d6b95405b2d830799984667f54) )
379370   /* AVG PROM */
380371   ROM_REGION( 0x100, "user1", 0 )
381   ROM_LOAD( "136002-125.6h",   0x0000, 0x0100, CRC(5903af03) SHA1(24bc0366f394ad0ec486919212e38be0f08d0239) )
382
383   ROM_REGION( 0x200, "plds", 0 )
384   ROM_LOAD( "cf2038n.1b",   0x0000, 0x00eb, CRC(b372fa4f) SHA1(a60b51849e9f691b412ae4c4afc834ff93d8a30f) ) /* Original chip is a 82S153, schematics refer to this chip as 137290-001 */
372   ROM_LOAD( "136002-125.6h",   0x0000, 0x0100, BAD_DUMP CRC(5903af03) SHA1(24bc0366f394ad0ec486919212e38be0f08d0239) )
385373ROM_END
386374
387375
trunk/src/mame/drivers/yunsun16.c
r249094r249095
928928
929929ROM_END
930930
931ROM_START( shockingko )
932931
933   ROM_REGION( 0x080000, "maincpu", 0 )        /* 68000 Code */
934   ROM_LOAD16_BYTE( "shoc_kor.u33", 0x000000, 0x040000, CRC(646303ec) SHA1(d01264f8495fdea882a9d75129665a67a9acfc42) )
935   ROM_LOAD16_BYTE( "shoc_kor.u32", 0x000001, 0x040000, CRC(6d9ac2f2) SHA1(2374cc053233940d5da610ec95539b43dfbeef3b) )
936
937   ROM_REGION( 0x200000*8, "gfx1", ROMREGION_ERASEFF ) /* 16x16x8 */
938   ROMX_LOAD( "shoc_kor.u67", 0x000000, 0x080000, CRC(e30fb2c4) SHA1(0d33a1593d7ebcd5da6971a04c3300c0b4eef219) , ROM_GROUPWORD | ROM_SKIP(6))
939   ROMX_LOAD( "shoc_kor.u68", 0x000002, 0x080000, CRC(7d702538) SHA1(ae4c8ca6f172e204589f2f70ca114f7c38e7cabd) , ROM_GROUPWORD | ROM_SKIP(6))
940   ROMX_LOAD( "shoc_kor.u69", 0x000004, 0x080000, CRC(97447fec) SHA1(e52184f96b2337ccbef130ada21a959c8bc1d73b) , ROM_GROUPWORD | ROM_SKIP(6))
941   ROMX_LOAD( "shoc_kor.u70", 0x000006, 0x080000, CRC(1b1f7895) SHA1(939c386dbef82e4833b7038e7c603d2ec67fa23e) , ROM_GROUPWORD | ROM_SKIP(6))
942
943   ROM_REGION( 0x100000, "gfx2", 0 )   /* 16x16x4 */
944   ROM_LOAD( "shoc_kor.u20", 0x000000, 0x040000, CRC(9f729220) SHA1(3206c87c7aebd8912d3486225ccae0a6e3b2061e) )
945   ROM_LOAD( "shoc_kor.u21", 0x040000, 0x040000, CRC(cde84679) SHA1(261a6570449bce22458c49edee427dda6dc504b7) )
946   ROM_LOAD( "shoc_kor.u22", 0x080000, 0x040000, CRC(61fe98ab) SHA1(745fe3b9d513b8e10c405d9ba2e055de1a261e33) )
947   ROM_LOAD( "shoc_kor.u23", 0x0c0000, 0x040000, CRC(50c29191) SHA1(bb2c22f2f452ca0940e98df6efc754c7522696bd) )
948
949   ROM_REGION( 0x080000, "oki", 0 )    /* Samples */
950   ROM_LOAD( "yunsun16.131", 0x000000, 0x080000, CRC(d0a1bb8c) SHA1(10f33521bd6031ed73ee5c7be1382165925aa8f8) )
951
952ROM_END
953
954
955932/***************************************************************************
956933
957934                       Bomb Kick  -  Yun Sung, 1998
r249094r249095
1014991
1015992***************************************************************************/
1016993
1017GAME( 199?, magicbub,   0,        magicbub, magicbub, yunsun16_state, magicbub, ROT0,   "Yun Sung", "Magic Bubble",                              MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )
1018GAME( 199?, magicbuba,  magicbub, magicbub, magicbua, yunsun16_state, magicbub, ROT0,   "Yun Sung", "Magic Bubble (Adult version, YS-1302 PCB)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )
1019GAME( 199?, magicbubb,  magicbub, shocking, magicbua, driver_device,  0,        ROT0,   "Yun Sung", "Magic Bubble (Adult version, YS-0211 PCB)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )
1020GAME( 1996, paprazzi,   0,        shocking, paprazzi, driver_device,  0,        ROT270, "Yun Sung", "Paparazzi",                                 MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )
1021GAME( 1997, shocking,   0,        shocking, shocking, driver_device,  0,        ROT0,   "Yun Sung", "Shocking",                                  MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )
1022GAME( 1997, shockingk,  shocking, shocking, shocking, driver_device,  0,        ROT0,   "Yun Sung", "Shocking (Korea, set 1)",                   MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )
1023GAME( 1997, shockingko, shocking, shocking, shocking, driver_device,  0,        ROT0,   "Yun Sung", "Shocking (Korea, set 2)",                   MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )
1024GAME( 1998, bombkick,   0,        shocking, bombkick, driver_device,  0,        ROT0,   "Yun Sung", "Bomb Kick (set 1)",                         MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )
1025GAME( 1998, bombkicka,  bombkick, shocking, bombkick, driver_device,  0,        ROT0,   "Yun Sung", "Bomb Kick (set 2)",                         MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )
994GAME( 199?, magicbub,  0,        magicbub, magicbub, yunsun16_state, magicbub, ROT0,   "Yun Sung", "Magic Bubble",                              MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )
995GAME( 199?, magicbuba, magicbub, magicbub, magicbua, yunsun16_state, magicbub, ROT0,   "Yun Sung", "Magic Bubble (Adult version, YS-1302 PCB)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )
996GAME( 199?, magicbubb, magicbub, shocking, magicbua, driver_device,  0,        ROT0,   "Yun Sung", "Magic Bubble (Adult version, YS-0211 PCB)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )
997GAME( 1996, paprazzi,  0,        shocking, paprazzi, driver_device,  0,        ROT270, "Yun Sung", "Paparazzi",                                 MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )
998GAME( 1997, shocking,  0,        shocking, shocking, driver_device,  0,        ROT0,   "Yun Sung", "Shocking",                                  MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )
999GAME( 1997, shockingk, shocking, shocking, shocking, driver_device,  0,        ROT0,   "Yun Sung", "Shocking (Korea)",                          MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )
1000GAME( 1998, bombkick,  0,        shocking, bombkick, driver_device,  0,        ROT0,   "Yun Sung", "Bomb Kick (set 1)",                         MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )
1001GAME( 1998, bombkicka, bombkick, shocking, bombkick, driver_device,  0,        ROT0,   "Yun Sung", "Bomb Kick (set 2)",                         MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )
trunk/src/mame/drivers/zaccaria.c
r249094r249095
506506   MCFG_CPU_ADD("maincpu", Z80,XTAL_18_432MHz/6)   /* verified on pcb */
507507   MCFG_CPU_PROGRAM_MAP(main_map)
508508   MCFG_CPU_VBLANK_INT_DRIVER("screen", zaccaria_state,  vblank_irq)
509//   MCFG_QUANTUM_TIME(attotime::from_hz(1000000))
509   MCFG_QUANTUM_TIME(attotime::from_hz(1000000))
510510
511511   MCFG_CPU_ADD("audiocpu", M6802,XTAL_3_579545MHz) /* verified on pcb */
512512   MCFG_CPU_PROGRAM_MAP(sound_map_1)
513513   MCFG_CPU_PERIODIC_INT_DRIVER(zaccaria_state, cb1_toggle, (double)XTAL_3_579545MHz/4096)
514//   MCFG_QUANTUM_TIME(attotime::from_hz(1000000))
514   MCFG_QUANTUM_TIME(attotime::from_hz(1000000))
515515
516516   MCFG_CPU_ADD("audio2", M6802,XTAL_3_579545MHz) /* verified on pcb */
517517   MCFG_CPU_PROGRAM_MAP(sound_map_2)
518//   MCFG_QUANTUM_TIME(attotime::from_hz(1000000))
518   MCFG_QUANTUM_TIME(attotime::from_hz(1000000))
519519
520520   MCFG_DEVICE_ADD("ppi8255", I8255A, 0)
521521   MCFG_I8255_IN_PORTA_CB(IOPORT("P1"))
trunk/src/mame/includes/chihiro.h
r249094r249095
185185      memset(pfifo, 0, sizeof(pfifo));
186186      memset(pcrtc, 0, sizeof(pcrtc));
187187      memset(pmc, 0, sizeof(pmc));
188      memset(pgraph, 0, sizeof(pgraph));
189188      memset(ramin, 0, sizeof(ramin));
190189      computedilated();
191190      objectdata = &(object_data_alloc());
r249094r249095
195194      enabled_vertex_attributes = 0;
196195      indexesleft_count = 0;
197196      vertex_pipeline = 4;
198      color_mask = 0xffffffff;
199197      alpha_test_enabled = false;
200198      alpha_reference = 0;
201199      alpha_func = nv2a_renderer::ALWAYS;
r249094r249095
240238   }
241239   DECLARE_READ32_MEMBER(geforce_r);
242240   DECLARE_WRITE32_MEMBER(geforce_w);
243   void vblank_callback(screen_device &screen, bool state);
241   bool vblank_callback(screen_device &screen, bool state);
244242   UINT32 screen_update_callback(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
245   bool update_interrupts();
246   void set_interrupt_device(pic8259_device *device);
247243
248244   void render_texture_simple(INT32 scanline, const extent_t &extent, const nvidia_object_data &extradata, int threadid);
249245   void render_color(INT32 scanline, const extent_t &extent, const nvidia_object_data &extradata, int threadid);
r249094r249095
307303   UINT32 pfifo[0x2000 / 4];
308304   UINT32 pcrtc[0x1000 / 4];
309305   UINT32 pmc[0x1000 / 4];
310   UINT32 pgraph[0x2000 / 4];
311306   UINT32 ramin[0x100000 / 4];
312307   UINT32 dma_offset[2];
313308   UINT32 dma_size[2];
314309   UINT8 *basemempointer;
315   pic8259_device *interruptdevice;
316310   rectangle limits_rendertarget;
317311   UINT32 pitch_rendertarget;
318312   UINT32 pitch_depthbuffer;
r249094r249095
447441      int used;
448442      osd_lock *lock;
449443   } combiner;
450   UINT32 color_mask;
451444   bool alpha_test_enabled;
452445   int alpha_func;
453446   int alpha_reference;
trunk/src/mame/includes/galastrm.h
r249094r249095
11// license:???
22// copyright-holders:Hau
33#include "machine/eepromser.h"
4
5#include "video/poly.h"
4#include "video/polylgcy.h"
65#include "video/tc0100scn.h"
76#include "video/tc0480scp.h"
87
9
10class galastrm_state;
11
12struct gs_poly_data
13{
14   bitmap_ind16* texbase;
15};
16
17class galastrm_renderer : public poly_manager<float, gs_poly_data, 2, 10000>
18{
19public:
20   galastrm_renderer(galastrm_state &state);
21
22    void tc0610_draw_scanline(INT32 scanline, const extent_t& extent, const gs_poly_data& object, int threadid);
23    void tc0610_rotate_draw(bitmap_ind16 &srcbitmap, const rectangle &clip);
24   
25    bitmap_ind16 &screenbits() { return m_screenbits; }
26   
27private:
28   galastrm_state& m_state;
29    bitmap_ind16 m_screenbits;
30};
31
32
338struct gs_tempsprite
349{
3510   int gfx;
r249094r249095
8156   struct gs_tempsprite *m_spritelist;
8257   struct gs_tempsprite *m_sprite_ptr_pre;
8358   bitmap_ind16 m_tmpbitmaps;
84    galastrm_renderer *m_poly;
85   
59   bitmap_ind16 m_polybitmap;
60   legacy_poly_manager *m_poly;
8661   int m_rsxb;
8762   int m_rsyb;
8863   int m_rsxoffs;
r249094r249095
9974   virtual void video_start();
10075   UINT32 screen_update_galastrm(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
10176   INTERRUPT_GEN_MEMBER(galastrm_interrupt);
77   void galastrm_exit();
10278   void draw_sprites_pre(int x_offs, int y_offs);
10379   void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, const int *primasks, int priority);
10480   void tc0610_rotate_draw(bitmap_ind16 &bitmap, bitmap_ind16 &srcbitmap, const rectangle &clip);
trunk/src/mame/includes/hng64.h
r249094r249095
11// license:LGPL-2.1+
2// copyright-holders:David Haywood, Angelo Salese, ElSemi, Andrew Gardner
2// copyright-holders:David Haywood, Angelo Salese, ElSemi, Andrew Gardner, Andrew Zaferakis
33#include "machine/msm6242.h"
44#include "cpu/mips/mips3.h"
55#include "cpu/nec/v53.h"
trunk/src/mame/includes/model2.h
r249094r249095
11// license:BSD-3-Clause
22// copyright-holders:R. Belmont, Olivier Galibert, ElSemi, Angelo Salese
3#include "video/poly.h"
3#include "video/polylgcy.h"
44#include "audio/dsbz80.h"
55#include "audio/segam1audio.h"
66#include "machine/eepromser.h"
r249094r249095
99#include "machine/315-5881_crypt.h"
1010#include "machine/315-5838_317-0229_comp.h"
1111
12class model2_renderer;
1312struct raster_state;
1413struct geo_state;
1514
15
1616class model2_state : public driver_device
1717{
1818public:
r249094r249095
107107   int m_jnet_time_out;
108108   UINT32 m_geo_read_start_address;
109109   UINT32 m_geo_write_start_address;
110   model2_renderer *m_poly;
110   legacy_poly_manager *m_poly;
111111   raster_state *m_raster;
112112   geo_state *m_geo;
113113   bitmap_rgb32 m_sys24_bitmap;
r249094r249095
219219   TIMER_DEVICE_CALLBACK_MEMBER(model2_timer_cb);
220220   TIMER_DEVICE_CALLBACK_MEMBER(model2_interrupt);
221221   TIMER_DEVICE_CALLBACK_MEMBER(model2c_interrupt);
222   void model2_exit();
222223   DECLARE_WRITE8_MEMBER(scsp_irq);
223224   DECLARE_READ_LINE_MEMBER(copro_tgp_fifoin_pop_ok);
224225   DECLARE_READ32_MEMBER(copro_tgp_fifoin_pop);
r249094r249095
236237   void model2_3d_frame_end( bitmap_rgb32 &bitmap, const rectangle &cliprect );
237238};
238239
239
240/*****************************
241 *
242 * Modern polygon renderer
243 *
244 *****************************/
245
246struct m2_poly_extra_data
247{
248   model2_state *  state;
249   UINT32      lumabase;
250   UINT32      colorbase;
251   UINT32 *    texsheet;
252   UINT32      texwidth;
253   UINT32      texheight;
254   UINT32      texx, texy;
255   UINT8       texmirrorx;
256   UINT8       texmirrory;
257};
258
259
260INLINE UINT16 get_texel( UINT32 base_x, UINT32 base_y, int x, int y, UINT32 *sheet )
261{
262   UINT32  baseoffs = ((base_y/2)*512)+(base_x/2);
263   UINT32  texeloffs = ((y/2)*512)+(x/2);
264   UINT32  offset = baseoffs + texeloffs;
265   UINT32  texel = sheet[offset>>1];
266
267   if ( offset & 1 )
268      texel >>= 16;
269
270   if ( (y & 1) == 0 )
271      texel >>= 8;
272
273   if ( (x & 1) == 0 )
274      texel >>= 4;
275
276   return (texel & 0x0f);
277}
278
279struct triangle;
280
281class model2_renderer : public poly_manager<float, m2_poly_extra_data, 4, 4000>
282{
283   
284public:
285    typedef void (model2_renderer::*scanline_render_func)(INT32 scanline, const extent_t& extent, const m2_poly_extra_data& object, int threadid);
286   
287public:
288    model2_renderer(model2_state& state)
289        : poly_manager<float, m2_poly_extra_data, 4, 4000>(state.machine())
290        , m_state(state)
291        , m_destmap(state.m_screen->width(), state.m_screen->height())
292    {
293        m_renderfuncs[0] = &model2_renderer::model2_3d_render_0;
294        m_renderfuncs[1] = &model2_renderer::model2_3d_render_1;
295        m_renderfuncs[2] = &model2_renderer::model2_3d_render_2;
296        m_renderfuncs[3] = &model2_renderer::model2_3d_render_3;
297        m_renderfuncs[4] = &model2_renderer::model2_3d_render_4;
298        m_renderfuncs[5] = &model2_renderer::model2_3d_render_5;
299        m_renderfuncs[6] = &model2_renderer::model2_3d_render_6;
300        m_renderfuncs[7] = &model2_renderer::model2_3d_render_7;
301    }
302   
303    bitmap_rgb32& destmap() { return m_destmap; }
304   
305    void model2_3d_render(triangle *tri, const rectangle &cliprect);
306   
307    /* checker = 0, textured = 0, transparent = 0 */
308    #define MODEL2_FUNC 0
309    #define MODEL2_FUNC_NAME    model2_3d_render_0
310    #include "video/model2rd.inc"
311    #undef MODEL2_FUNC
312    #undef MODEL2_FUNC_NAME
313   
314    /* checker = 0, textured = 0, translucent = 1 */
315    #define MODEL2_FUNC 1
316    #define MODEL2_FUNC_NAME    model2_3d_render_1
317    #include "video/model2rd.inc"
318    #undef MODEL2_FUNC
319    #undef MODEL2_FUNC_NAME
320   
321    /* checker = 0, textured = 1, translucent = 0 */
322    #define MODEL2_FUNC 2
323    #define MODEL2_FUNC_NAME    model2_3d_render_2
324    #include "video/model2rd.inc"
325    #undef MODEL2_FUNC
326    #undef MODEL2_FUNC_NAME
327   
328    /* checker = 0, textured = 1, translucent = 1 */
329    #define MODEL2_FUNC 3
330    #define MODEL2_FUNC_NAME    model2_3d_render_3
331    #include "video/model2rd.inc"
332    #undef MODEL2_FUNC
333    #undef MODEL2_FUNC_NAME
334   
335    /* checker = 1, textured = 0, translucent = 0 */
336    #define MODEL2_FUNC 4
337    #define MODEL2_FUNC_NAME    model2_3d_render_4
338    #include "video/model2rd.inc"
339    #undef MODEL2_FUNC
340    #undef MODEL2_FUNC_NAME
341   
342    /* checker = 1, textured = 0, translucent = 1 */
343    #define MODEL2_FUNC 5
344    #define MODEL2_FUNC_NAME    model2_3d_render_5
345    #include "video/model2rd.inc"
346    #undef MODEL2_FUNC
347    #undef MODEL2_FUNC_NAME
348   
349    /* checker = 1, textured = 1, translucent = 0 */
350    #define MODEL2_FUNC 6
351    #define MODEL2_FUNC_NAME    model2_3d_render_6
352    #include "video/model2rd.inc"
353    #undef MODEL2_FUNC
354    #undef MODEL2_FUNC_NAME
355   
356    /* checker = 1, textured = 1, translucent = 1 */
357    #define MODEL2_FUNC 7
358    #define MODEL2_FUNC_NAME    model2_3d_render_7
359    #include "video/model2rd.inc"
360    #undef MODEL2_FUNC
361    #undef MODEL2_FUNC_NAME
362
363    scanline_render_func m_renderfuncs[8];
364   
365private:
366    model2_state& m_state;
367    bitmap_rgb32 m_destmap;
368};
369
370typedef model2_renderer::vertex_t poly_vertex;
371
372
373/*******************************************
374 *
375 *  Basic Data Types
376 *
377 *******************************************/
378
379struct plane
380{
381   poly_vertex normal;
382   float       distance;
383};
384
385struct texture_parameter
386{
387   float   diffuse;
388   float   ambient;
389   UINT32  specular_control;
390   float   specular_scale;
391};
392
393struct triangle
394{
395   void *              next;
396   poly_vertex         v[3];
397   UINT16              z;
398   UINT16              texheader[4];
399   UINT8               luma;
400   INT16               viewport[4];
401   INT16               center[2];
402};
403
404struct quad_m2
405{
406   poly_vertex         v[4];
407   UINT16              z;
408   UINT16              texheader[4];
409   UINT8               luma;
410};
411
412
413
414240/*----------- defined in video/model2.c -----------*/
415241void model2_3d_set_zclip( running_machine &machine, UINT8 clip );
trunk/src/mame/includes/model3.h
r249094r249095
11// license:BSD-3-Clause
2// copyright-holders:R. Belmont, Ville Linde
2// copyright-holders:Andrew Gardner, R. Belmont, Ville Linde
33#include "video/poly.h"
44#include "bus/scsi/scsi.h"
55#include "machine/53c810.h"
trunk/src/mame/machine/hng64_net.c
r249094r249095
11// license:LGPL-2.1+
2// copyright-holders:David Haywood, Angelo Salese, ElSemi, Andrew Gardner
2// copyright-holders:David Haywood, Angelo Salese, ElSemi, Andrew Gardner, Andrew Zaferakis
33/* HNG64 Communication / Network CPU */
44
55// this is driven by a KL5C80A12CFP which is basically a super-charged Z80
trunk/src/mame/machine/model3.c
r249094r249095
11// license:BSD-3-Clause
2// copyright-holders:R. Belmont, Ville Linde
2// copyright-holders:Andrew Gardner, R. Belmont, Ville Linde
33/*
44
55  machine/model3.c: functions emulating various aspects of the Model 3 hardware
trunk/src/mame/machine/namco62.c
r249094r249095
11// license:BSD-3-Clause
2// copyright-holders:Philip Bennett
2// copyright-holders:Philip Bennett, Andrew Gardner
33/***************************************************************************
44
55    Namco 62XX
trunk/src/mame/machine/namco62.h
r249094r249095
11// license:BSD-3-Clause
2// copyright-holders:Philip Bennett
2// copyright-holders:Philip Bennett, Andrew Gardner
33#ifndef NAMCO62_H
44#define NAMCO62_H
55
trunk/src/mame/machine/xbox.c
r249094r249095
465465
466466void xbox_base_state::vblank_callback(screen_device &screen, bool state)
467467{
468   nvidia_nv2a->vblank_callback(screen, state);
468   if (nvidia_nv2a->vblank_callback(screen, state))
469      xbox_base_devs.pic8259_1->ir3_w(1); // IRQ 3
470   else
471      xbox_base_devs.pic8259_1->ir3_w(0); // IRQ 3
469472}
470473
471474UINT32 xbox_base_state::screen_update_callback(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
r249094r249095
14571460   if (machine().debug_flags & DEBUG_FLAG_ENABLED)
14581461      debug_console_register_command(machine(), "xbox", CMDFLAG_NONE, 0, 1, 4, xbox_debug_commands);
14591462   memset(&ohcist, 0, sizeof(ohcist));
1460   // PIC challenge handshake data
1461   pic16lc_buffer[0x1c] = 0x0c;
1462   pic16lc_buffer[0x1d] = 0x0d;
1463   pic16lc_buffer[0x1e] = 0x0e;
1464   pic16lc_buffer[0x1f] = 0x0f;
14651463#ifdef USB_ENABLED
14661464   ohcist.hc_regs[HcRevision] = 0x10;
14671465   ohcist.hc_regs[HcFmInterval] = 0x2edf;
r249094r249095
14851483   save_item(NAME(smbusst.rw));
14861484   save_item(NAME(smbusst.words));
14871485   save_item(NAME(pic16lc_buffer));
1488   nvidia_nv2a->set_interrupt_device(xbox_base_devs.pic8259_1);
14891486   nvidia_nv2a->start(&m_maincpu->space());
14901487   nvidia_nv2a->savestate_items();
14911488}
trunk/src/mame/mess.lst
r249094r249095
13411341canonv20f
13421342canonv20g
13431343canonv20s
1344canons80
13451344mx10
13461345mx101
13471346mx15
r249094r249095
26062605eacc
26072606argo
26082607applix
2608mzr8105
26092609fccpu1
2610261068ksbc
26112611lcmate2
r249094r249095
26522652vax785
26532653ms0515
26542654ie15
2655dvk_kcgd
26562655dvk_ksm
26572656dvk_ksm01
26582657asmapro
trunk/src/mame/video/chihiro.c
r249094r249095
33#include "emu.h"
44#include "video/poly.h"
55#include "bitmap.h"
6#include "machine/pic8259.h"
76#include "includes/chihiro.h"
87
98//#define LOG_NV2A
r249094r249095
946945UINT32 nv2a_renderer::geforce_object_offset(UINT32 handle)
947946{
948947   UINT32 h = ((((handle >> 11) ^ handle) >> 11) ^ handle) & 0x7ff;
949   UINT32 o = (pfifo[0x210 / 4] & 0x1ff) << 8; // 0x1ff is not certain
948   UINT32 o = (pfifo[0x210 / 4] & 0x1f) << 8; // or 12 ?
950949   UINT32 e = o + h * 8; // at 0xfd000000+0x00700000
951950   UINT32 w;
952951
953   if (ramin[e / 4] != handle) {
954      // this should never happen
955      for (UINT32 aa = o / 4; aa < (sizeof(ramin) / 4); aa = aa + 2) {
956         if (ramin[aa] == handle) {
957            e = aa * 4;
958         }
959      }
960   }
952   if (ramin[e / 4] != handle)
953      e = 0;
961954   w = ramin[e / 4 + 1];
962   return (w & 0xffff) * 0x10; // 0xffff is not certain
955   return (w & 0xffff) * 0x10;
963956}
964957
965958void nv2a_renderer::geforce_read_dma_object(UINT32 handle, UINT32 &offset, UINT32 &size)
r249094r249095
12531246      addr = rendertarget + (dilated0[dilate_rendertarget][x] + dilated1[dilate_rendertarget][y]);
12541247   else // type_rendertarget == LINEAR*/
12551248      addr = rendertarget + (pitch_rendertarget / 4)*y + x;
1256   fbcolor = 0;
1257   if (color_mask != 0)
1258      fbcolor = *addr;
1249   fbcolor = *addr;
12591250   daddr=depthbuffer + (pitch_depthbuffer / 4)*y + x;
12601251   deptsten = *daddr;
12611252   c[3] = color >> 24;
r249094r249095
17811772            break;
17821773      }
17831774   }
1784   if (color_mask != 0) {
1785      UINT32 fbcolor_tmp;
1786
1787      fbcolor_tmp = (c[3] << 24) | (c[2] << 16) | (c[1] << 8) | c[0];
1788      *addr = (fbcolor & ~color_mask) | (fbcolor_tmp & color_mask);
1789   }
1775   fbcolor = (c[3] << 24) | (c[2] << 16) | (c[1] << 8) | c[0];
1776   *addr = fbcolor;
17901777   if (depth_write_enabled)
17911778      dep = depth;
17921779   deptsten = (dep << 8) | sten;
r249094r249095
22462233   maddress = method * 4;
22472234   data = space.read_dword(address);
22482235   channel[chanel][subchannel].object.method[method] = data;
2249#ifdef LOG_NV2A
2250   printf("A:%08X MTHD:%08X D:%08X\n\r",address,maddress,data);
2251#endif
22522236   if (maddress == 0x17fc) {
22532237      indexesleft_count = 0;
22542238      indexesleft_first = 0;
r249094r249095
22862270         }
22872271         wait();
22882272      }
2289      else if (type == nv2a_renderer::TRIANGLE_FAN) {
2290         vertex_nv vert[3];
2291         vertex_t xy[3];
2292
2293         read_vertices_0x1810(space, vert, offset, 2);
2294         convert_vertices_poly(vert, xy, 2);
2295         count = count - 2;
2296         offset = offset + 2;
2297         for (n = 0; n <= count; n++) {
2298            read_vertices_0x1810(space, vert + (((n + 1) & 1) + 1), offset + n, 1);
2299            convert_vertices_poly(vert + (((n + 1) & 1) + 1), xy + (((n + 1) & 1) + 1), 1);
2300            render_triangle(limits_rendertarget, renderspans, 4 + 4 * 2, xy[0], xy[(~(n + 1) & 1) + 1], xy[((n + 1) & 1) + 1]);
2301         }
2302         wait();
2303      }
23042273      else if (type == nv2a_renderer::TRIANGLE_STRIP) {
23052274         vertex_nv vert[4];
23062275         vertex_t xy[4];
r249094r249095
23422311      // each dword after 1800 contains two 16 bit index values to select the vartices
23432312      // each dword after 1808 contains a 32 bit index value to select the vartices
23442313      type = channel[chanel][subchannel].object.method[0x17fc / 4];
2314#ifdef LOG_NV2A
2315      printf("vertex %d %d %d\n\r", type, offset, count);
2316#endif
23452317      if (type == nv2a_renderer::QUADS) {
23462318         while (1) {
23472319            vertex_nv vert[4];
r249094r249095
23602332            render_polygon<4>(limits_rendertarget, renderspans, 4 + 4 * 2, xy); // 4 rgba, 4 texture units 2 uv
23612333         }
23622334      }
2363      else if (type == nv2a_renderer::TRIANGLE_FAN) {
2364         if ((countlen * mult + indexesleft_count) >= 3) {
2365            vertex_nv vert[3];
2366            vertex_t xy[3];
2367            int c, count;
2368
2369            if (mult == 1)
2370               c = read_vertices_0x1808(space, vert, address, 2);
2371            else
2372               c = read_vertices_0x1800(space, vert, address, 2);
2373            convert_vertices_poly(vert, xy, 2);
2374            address = address + c * 4;
2375            countlen = countlen - c;
2376            count = countlen * mult + indexesleft_count;
2377            for (n = 1; n <= count; n++) {
2378               if (mult == 1)
2379                  c = read_vertices_0x1808(space, vert + ((n & 1) + 1), address, 1);
2380               else
2381                  c = read_vertices_0x1800(space, vert + ((n & 1) + 1), address, 1);
2382
2383               convert_vertices_poly(vert + ((n & 1) + 1), xy + ((n & 1) + 1), 1);
2384               address = address + c * 4;
2385               countlen = countlen - c;
2386               render_triangle(limits_rendertarget, renderspans, 4 + 4 * 2, xy[0], xy[(~n & 1) + 1], xy[(n & 1) + 1]);
2387            }
2388            wait();
2389         }
2390      }
23912335      else if (type == nv2a_renderer::TRIANGLES) {
23922336         while (1) {
23932337            vertex_nv vert[3];
r249094r249095
25022446         }
25032447         wait();
25042448      }
2505      else if (type == nv2a_renderer::TRIANGLES) {
2506         while (countlen > 0) {
2507            vertex_nv vert[3];
2508            vertex_t xy[3];
2509            int c;
2510
2511            c = read_vertices_0x1818(space, vert, address, 3);
2512            convert_vertices_poly(vert, xy, 3);
2513            countlen = countlen - c;
2514            if (countlen < 0) {
2515               logerror("Method 0x1818 missing %d words to draw a complete primitive\n", -countlen);
2516               countlen = 0;
2517               break;
2518            }
2519            address = address + c * 3;
2520            render_triangle(limits_rendertarget, renderspans, 4 + 4 * 2, xy[0], xy[1], xy[2]); // 4 rgba, 4 texture units 2 uv
2521         }
2522      }
25232449      else if (type == nv2a_renderer::TRIANGLE_STRIP) {
25242450         vertex_nv vert[4];
25252451         vertex_t xy[4];
r249094r249095
26872613         // clear colors
26882614         UINT32 color = channel[chanel][subchannel].object.method[0x1d90 / 4];
26892615         bm.fill(color);
2690#ifdef LOG_NV2A
2691         printf("clearscreen\n\r");
2692#endif
2616         //printf("clearscreen\n\r");
26932617      }
26942618      if ((data & 0x03) == 3) {
26952619         bitmap_rgb32 bm(depthbuffer, (limits_rendertarget.right() + 1) * m, (limits_rendertarget.bottom() + 1) * m, pitch_rendertarget / 4); // why *2 ?
r249094r249095
27252649      dilate_rendertarget = dilatechose[(log2width_rendertarget << 4) + log2height_rendertarget];
27262650   }
27272651   if (maddress == 0x020c) {
2652      // line size ?
27282653      pitch_rendertarget=data & 0xffff;
27292654      pitch_depthbuffer=(data >> 16) & 0xffff;
2730#ifdef LOG_NV2A
2731      printf("Pitch color %04X zbuffer %04X\n\r",pitch_rendertarget,pitch_depthbuffer);
2732#endif
2655      //printf("Pitch color %04X zbuffer %04X\n\r",pitch_rendertarget,pitch_depthbuffer);
27332656      countlen--;
27342657   }
27352658   if (maddress == 0x0100) {
2736      countlen--;
2737      if (data != 0) {
2738         pgraph[0x704 / 4] = 0x100;
2739         pgraph[0x708 / 4] = data;
2740         pgraph[0x100 / 4] |= 1;
2741         pgraph[0x108 / 4] |= 1;
2742         if (update_interrupts() == true)
2743            interruptdevice->ir3_w(1); // IRQ 3
2744         else
2745            interruptdevice->ir3_w(0); // IRQ 3
2746         return 2;
2659      // just temporarily
2660      if ((data & 0x1f) == 1) {
2661         data = data >> 5;
2662         data = data & 0x0ffffff0;
2663         displayedtarget = (UINT32 *)direct_access_ptr(data);
27472664      }
2748      else
2749         return 0;
27502665   }
27512666   if (maddress == 0x0130) {
27522667      countlen--;
r249094r249095
27552670      else
27562671         return 0;
27572672   }
2758   if (maddress == 0x1d8c) {
2759      countlen--;
2760      // it is used to specify the clear value for the depth buffer (zbuffer)
2761      // but also as a parameter for interrupt routines
2762      pgraph[0x1a88 / 4] = data;
2763   }
2764   if (maddress == 0x1d90) {
2765      countlen--;
2766      // it is used to specify the clear value for the color buffer
2767      // but also as a parameter for interrupt routines
2768      pgraph[0x186c / 4] = data;
2769   }
27702673   if (maddress == 0x0210) {
27712674      // framebuffer offset ?
27722675      rendertarget = (UINT32 *)direct_access_ptr(data);
2773#ifdef LOG_NV2A
2774      printf("Render target at %08X\n\r", data);
2775#endif
2676      //printf("Render target at %08X\n\r",data);
27762677      countlen--;
27772678   }
27782679   if (maddress == 0x0214) {
27792680      // zbuffer offset ?
27802681      depthbuffer = (UINT32 *)direct_access_ptr(data);
2781#ifdef LOG_NV2A
2782      printf("Depth buffer at %08X\n\r",data);
2783#endif
2682      //printf("Depth buffer at %08X\n\r",data);
27842683      if ((data == 0) || (data > 0x7ffffffc))
27852684         depth_write_enabled = false;
27862685      else if (channel[chanel][subchannel].object.method[0x035c / 4] != 0)
r249094r249095
28102709   if (maddress == 0x0354) {
28112710      depth_function = data;
28122711   }
2813   if (maddress == 0x0358) {
2814      //color_mask = data;
2815      if (data & 0x000000ff)
2816         data |= 0x000000ff;
2817      if (data & 0x0000ff00)
2818         data |= 0x0000ff00;
2819      if (data & 0x00ff0000)
2820         data |= 0x00ff0000;
2821      if (data & 0xff000000)
2822         data |= 0xff000000;
2823      color_mask = data;
2824   }
28252712   if (maddress == 0x035c) {
28262713      UINT32 g = channel[chanel][subchannel].object.method[0x0214 / 4];
28272714      depth_write_enabled = data != 0;
r249094r249095
37613648   combiner.function_Aop3 = MAX(MIN((combiner.function_Aop3 + biasa) * scalea, 1.0f), -1.0f);
37623649}
37633650
3764void nv2a_renderer::vblank_callback(screen_device &screen, bool state)
3651bool nv2a_renderer::vblank_callback(screen_device &screen, bool state)
37653652{
3766#ifdef LOG_NV2A
3767   printf("vblank_callback\n\r");
3768#endif
3769   if ((state == true) && (puller_waiting == 1)) {
3770      puller_waiting = 0;
3771      puller_timer_work(NULL, 0);
3772   }
3773   if (state == true) {
3653   //printf("vblank_callback\n\r");
3654   if (state == true)
37743655      pcrtc[0x100 / 4] |= 1;
3775      pcrtc[0x808 / 4] |= 0x10000;
3776   }
3777   else {
3778      pcrtc[0x100 / 4] &= ~1;
3779      pcrtc[0x808 / 4] &= ~0x10000;
3780   }
3781   if (update_interrupts() == true)
3782      interruptdevice->ir3_w(1); // IRQ 3
37833656   else
3784      interruptdevice->ir3_w(0); // IRQ 3
3785}
3786
3787bool nv2a_renderer::update_interrupts()
3788{
3657      pcrtc[0x100 / 4] &= ~1;
37893658   if (pcrtc[0x100 / 4] & pcrtc[0x140 / 4])
37903659      pmc[0x100 / 4] |= 0x1000000;
37913660   else
37923661      pmc[0x100 / 4] &= ~0x1000000;
3793   if (pgraph[0x100 / 4] & pgraph[0x140 / 4])
3794      pmc[0x100 / 4] |= 0x1000;
3795   else
3796      pmc[0x100 / 4] &= ~0x1000;
3797   if (((pmc[0x100 / 4] & 0x7fffffff) && (pmc[0x140 / 4] & 1)) || ((pmc[0x100 / 4] & 0x80000000) && (pmc[0x140 / 4] & 2))) {
3662   if ((state == true) && (puller_waiting == 1)) {
3663      puller_waiting = 0;
3664      puller_timer_work(NULL, 0);
3665   }
3666   if ((pmc[0x100 / 4] != 0) && (pmc[0x140 / 4] != 0)) {
37983667      // send interrupt
37993668      return true;
38003669   }
r249094r249095
38233692   int countlen;
38243693   int ret;
38253694   address_space *space = puller_space;
3826#ifdef LOG_NV2A
3827   UINT32 subch;
3828#endif
38293695
38303696   chanel = puller_channel;
38313697   subchannel = puller_subchannel;
r249094r249095
38823748            }
38833749            if (ret != 0) {
38843750               puller_timer->enable(false);
3885               puller_waiting = ret;
3751               puller_waiting = 1;
38863752               return;
38873753            }
38883754         }
r249094r249095
39813847      //logerror("NV_2A: read PRAMIN[%06X] value %08X\n",offset*4-0x00700000,ret);
39823848   }
39833849   else if ((offset >= 0x00400000 / 4) && (offset < 0x00402000 / 4)) {
3984      ret = pgraph[offset - 0x00400000 / 4];
39853850      //logerror("NV_2A: read PGRAPH[%06X] value %08X\n",offset*4-0x00400000,ret);
39863851   }
39873852   else if ((offset >= 0x00600000 / 4) && (offset < 0x00601000 / 4)) {
r249094r249095
40053870      //logerror("NV_2A: read channel[%02X,%d,%04X]=%08X\n",chanel,subchannel,suboffset*4,ret);
40063871      return ret;
40073872   }
3873   else
3874   {
3875      /* nothing */
3876   }
40083877   //logerror("NV_2A: read at %08X mask %08X value %08X\n",0xfd000000+offset*4,mem_mask,ret);
40093878   return ret;
40103879}
40113880
40123881WRITE32_MEMBER(nv2a_renderer::geforce_w)
40133882{
4014   UINT32 old;
4015   bool update_int;
4016
4017   update_int = false;
40183883   if ((offset >= 0x00101000 / 4) && (offset < 0x00102000 / 4)) {
40193884      //logerror("NV_2A: write STRAPS[%06X] mask %08X value %08X\n",offset*4-0x00101000,mem_mask,data);
40203885   }
r249094r249095
40333898      //logerror("NV_2A: write PRAMIN[%06X]=%08X\n",offset*4-0x00700000,data & mem_mask);
40343899   }
40353900   else if ((offset >= 0x00400000 / 4) && (offset < 0x00402000 / 4)) {
4036      int e = offset - 0x00400000 / 4;
4037      if (e >= (sizeof(pgraph) / sizeof(UINT32)))
4038         return;
4039      old = pgraph[e];
4040      COMBINE_DATA(pgraph + e);
4041      if (e == 0x100 / 4) {
4042         pgraph[e] = old & ~data;
4043         if (data & 1)
4044            pgraph[0x108 / 4] = 0;
4045         update_int = true;
4046      }
4047      if (e == 0x140 / 4)
4048         update_int = true;
4049      if (e == 0x720 / 4) {
4050         if ((data & 1) && (puller_waiting == 2)) {
4051            puller_waiting = 0;
4052            puller_timer->enable();
4053            puller_timer->adjust(attotime::zero);
4054         }
4055      }
4056      if ((e >= 0x900 / 4) && (e < 0xa00 / 4))
4057         pgraph[e] = 0;
40583901      //logerror("NV_2A: write PGRAPH[%06X]=%08X\n",offset*4-0x00400000,data & mem_mask);
40593902   }
40603903   else if ((offset >= 0x00600000 / 4) && (offset < 0x00601000 / 4)) {
40613904      int e = offset - 0x00600000 / 4;
40623905      if (e >= (sizeof(pcrtc) / sizeof(UINT32)))
40633906         return;
4064      old = pcrtc[e];
40653907      COMBINE_DATA(pcrtc + e);
4066      if (e == 0x100 / 4) {
4067         pcrtc[e] = old & ~data;
4068         update_int = true;
4069      }
4070      if (e == 0x140 / 4)
4071         update_int = true;
40723908      if (e == 0x800 / 4) {
4073         displayedtarget = (UINT32 *)direct_access_ptr(pcrtc[e]);
4074#ifdef LOG_NV2A
4075         printf("crtc buffer %08X\n\r", data);
4076#endif
3909         displayedtarget = (UINT32 *)direct_access_ptr(data);
3910         //printf("crtc buffer %08X\n\r", data);
40773911      }
40783912      //logerror("NV_2A: write PCRTC[%06X]=%08X\n",offset*4-0x00600000,data & mem_mask);
40793913   }
r249094r249095
40883922      // 32 channels size 0x10000 each, 8 subchannels per channel size 0x2000 each
40893923      int chanel, subchannel, suboffset;
40903924      //int method, count, handle, objclass;
3925#ifdef LOG_NV2A
3926      int subch;
3927#endif
40913928
40923929      suboffset = offset - 0x00800000 / 4;
40933930      chanel = (suboffset >> (16 - 2)) & 31;
r249094r249095
41223959   }
41233960   //else
41243961   //      logerror("NV_2A: write at %08X mask %08X value %08X\n",0xfd000000+offset*4,mem_mask,data);
4125   if (update_int == true) {
4126      if (update_interrupts() == true)
4127         interruptdevice->ir3_w(1); // IRQ 3
4128      else
4129         interruptdevice->ir3_w(0); // IRQ 3
4130   }
41313962}
41323963
41333964void nv2a_renderer::savestate_items()
r249094r249095
41403971   puller_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(nv2a_renderer::puller_timer_work), this), (void *)"NV2A Puller Timer");
41413972   puller_timer->enable(false);
41423973}
4143
4144void nv2a_renderer::set_interrupt_device(pic8259_device *device)
4145{
4146   interruptdevice = device;
4147}
trunk/src/mame/video/deco16ic.c
r249094r249095
3636    Pocket Gal DX               MAZ     102     52,71           56              104         153
3737    Boogie Wings                MBD     102     52,52,71,71     141, 141        104         113,99,200
38381   Double Wings                MBE     102     52              141             104
393   Fighter's History DE-0380-0 MBF     156     52              56, 74          75          153,153,200,170
393   Fighter's History DE-0380-0 MBF     156     52              56, 74          [Scratched] 153,153,200,170
40403   Fighter's History DE-0395-1 MBF     156     52              56, 74          75          113,113,200
41413   Fighter's History DE-0396-0 MBF     156     52              74, 141         75          153,153,200
4242    Heavy Smash                 MBG     156     52              141                         153,153,153
43    Night Slashers DE-0397-0    MBH     156     52,52,52        74, 141         104         153,153,153,99,200
44    Night Slashers DE-0395-1    MBH     156     52,52,52        74, 141         104         113,113,153,99,200
43    Night Slashers              MBH     156     52(*3)          74, 141         104         153(*3),99,200
4544    Locked N Loaded             MBM     101     ?               74, 74          146         113,186,187
4645    Joe & Mac Return            MBN     156     52              141                         223,223
47462   Charlie Ninja               MBR     156     52              141                         223,223
4847    World Cup Volleyball 95     MBX     156     52              141             ?
4948    Backfire!                   MBZ     156     52,52           141, 141        ?           153,153,223
502*  Ganbare! Gonta!! 2          MCB     156     52              141                         223,223
492*  Ganbare Gonta               MCB     156     52              141                         223,223
5150    Chain Reaction/Magical Drop MCC     156     52              141                         223,223
5251    Dunk Dream 95               MCE     156     [MLC]           [MLC]
53522   Osman/Cannon Dancer         MCF     156     52              141                         223,223
r249094r249095
6160
6261Note 1: Mitchell game on DECO PCB board number DEC-22V0 (S-NK-3220)
6362Note 2: Mitchell games on DECO PCB board number MT5601-0
64Note 3: Fighter's History uses the 156 Encrypted ARM cpu with the encryption disabled
63Note 3: Fighter's History was released on 3 different PCBs, DE-0396-0, DE-0395-1 & DE-0380-2
64        Fighter's History seems to use the 156 Encrypted ARM cpu with the encryption disabled
6565Note *: Ganbare! Gonta!! 2 / Lady Killer Part 2 - Party Time
6666
67Note: A version of Night Slashers runs on the DE-0395-1 using the 156 encryption, while a version
68      of Fighter's History also runs on the DE-0395-1 PCB without using the 156 encryption
69
7067    Custom chip 59  = 68000 cpu
7168    Custom chip 101 = Arm6 cpu
7269    Custom chip 113 = Alpha blending
trunk/src/mame/video/galastrm.c
r249094r249095
11// license:???
22// copyright-holders:Hau
33#include "emu.h"
4#include "video/polylgcy.h"
45#include "includes/galastrm.h"
56
67#define X_OFFSET 96
78#define Y_OFFSET 60
89
9struct polyVert
10struct gs_poly_extra_data
1011{
12   bitmap_ind16 *texbase;
13};
14
15struct polygon
16{
1117   float x;
1218   float y;
1319   float z;
1420};
1521
22/******************************************************************/
1623
17galastrm_renderer::galastrm_renderer(galastrm_state& state)
18    : poly_manager<float, gs_poly_data, 2, 10000>(state.machine())
19    , m_state(state)
20    , m_screenbits(state.m_screen->width(), state.m_screen->height())
24void galastrm_state::galastrm_exit()
2125{
22   
26   poly_free(m_poly);
2327}
2428
25
26/******************************************************************/
27
2829void galastrm_state::video_start()
2930{
3031   m_spritelist = auto_alloc_array(machine(), struct gs_tempsprite, 0x4000);
3132
32    m_poly = auto_alloc(machine(), galastrm_renderer(*this));
33   m_screen->register_screen_bitmap(m_tmpbitmaps);
34   m_screen->register_screen_bitmap(m_polybitmap);
3335
34    m_screen->register_screen_bitmap(m_tmpbitmaps);
35    m_screen->register_screen_bitmap(m_poly->screenbits());
36   m_poly = poly_alloc(machine(), 16, sizeof(gs_poly_extra_data), POLYFLAG_ALLOW_QUADS);
37   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(galastrm_state::galastrm_exit), this));
3638}
3739
38
3940/************************************************************
4041            SPRITE DRAW ROUTINES
4142
r249094r249095
184185         m_sprite_ptr_pre++;
185186      }
186187      if (bad_chunks)
187            logerror("Sprite number %04x had %02x invalid chunks\n",tilenum,bad_chunks);
188logerror("Sprite number %04x had %02x invalid chunks\n",tilenum,bad_chunks);
188189   }
189190}
190191
r249094r249095
214215                POLYGON RENDERER
215216**************************************************************/
216217
217void galastrm_renderer::tc0610_draw_scanline(INT32 scanline, const extent_t& extent, const gs_poly_data& object, int threadid)
218static void tc0610_draw_scanline(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
218219{
219    UINT16 *framebuffer = &m_screenbits.pix16(scanline);
220   const INT32 dudx = extent.param[0].dpdx;
221   const INT32 dvdx = extent.param[1].dpdx;
220   const gs_poly_extra_data *extra = (const gs_poly_extra_data *)extradata;
221   bitmap_ind16 *destmap = (bitmap_ind16 *)dest;
222   UINT16 *framebuffer = &destmap->pix16(scanline);
223   bitmap_ind16 *texbase = extra->texbase;
224   int startx = extent->startx;
225   int stopx = extent->stopx;
226   INT32 u = extent->param[0].start;
227   INT32 v = extent->param[1].start;
228   INT32 dudx = extent->param[0].dpdx;
229   INT32 dvdx = extent->param[1].dpdx;
230   int x;
222231
223    INT32 u = extent.param[0].start;
224   INT32 v = extent.param[1].start;
225   for (int x = extent.startx; x < extent.stopx; x++)
232   for (x = startx; x < stopx; x++)
226233   {
227      framebuffer[x] = object.texbase->pix16(v >> 16, u >> 16);
234      framebuffer[x] = texbase->pix16(v >> 16, u >> 16);
228235      u += dudx;
229236      v += dvdx;
230237   }
231238}
232239
233void galastrm_renderer::tc0610_rotate_draw(bitmap_ind16 &srcbitmap, const rectangle &clip)
240void galastrm_state::tc0610_rotate_draw(bitmap_ind16 &bitmap, bitmap_ind16 &srcbitmap, const rectangle &clip)
234241{
235   vertex_t vert[4];
236   int rsx = m_state.m_tc0610_ctrl_reg[1][0];
237   int rsy = m_state.m_tc0610_ctrl_reg[1][1];
238   const int rzx = m_state.m_tc0610_ctrl_reg[1][2];
239   const int rzy = m_state.m_tc0610_ctrl_reg[1][3];
240   const int ryx = m_state.m_tc0610_ctrl_reg[1][5];
241   const int ryy = m_state.m_tc0610_ctrl_reg[1][4];
242   gs_poly_extra_data *extra = (gs_poly_extra_data *)poly_get_extra_data(m_poly);
243   poly_draw_scanline_func callback;
244   poly_vertex vert[4];
245   int rsx = m_tc0610_ctrl_reg[1][0];
246   int rsy = m_tc0610_ctrl_reg[1][1];
247   const int rzx = m_tc0610_ctrl_reg[1][2];
248   const int rzy = m_tc0610_ctrl_reg[1][3];
249   const int ryx = m_tc0610_ctrl_reg[1][5];
250   const int ryy = m_tc0610_ctrl_reg[1][4];
242251   const int lx  = srcbitmap.width();
243252   const int ly  = srcbitmap.height();
244253
245254   int yx, /*yy,*/ zx, zy, pxx, pxy, pyx, pyy;
246255   float /*ssn, scs, ysn, ycs,*/ zsn, zcs;
247256
257
248258   pxx = 0;
249259   pxy = 0;
250260   pyx = 0;
r249094r249095
271281   zcs = ((float)pxx/4096.0f) / (float)(lx / 2);
272282
273283
274   if ((rsx == -240 && rsy == 1072) || !m_state.m_tc0610_ctrl_reg[1][7])
284   if ((rsx == -240 && rsy == 1072) || !m_tc0610_ctrl_reg[1][7])
275285   {
276      m_state.m_rsxoffs = 0;
277      m_state.m_rsyoffs = 0;
286      m_rsxoffs = 0;
287      m_rsyoffs = 0;
278288   }
279289   else
280290   {
281      if (rsx > m_state.m_rsxb && m_state.m_rsxb < 0 && rsx-m_state.m_rsxb > 0x8000)
291      if (rsx > m_rsxb && m_rsxb < 0 && rsx-m_rsxb > 0x8000)
282292      {
283         if (m_state.m_rsxoffs == 0)
284            m_state.m_rsxoffs = -0x10000;
293         if (m_rsxoffs == 0)
294            m_rsxoffs = -0x10000;
285295         else
286            m_state.m_rsxoffs = 0;
296            m_rsxoffs = 0;
287297      }
288      if (rsx < m_state.m_rsxb && m_state.m_rsxb > 0 && m_state.m_rsxb-rsx > 0x8000)
298      if (rsx < m_rsxb && m_rsxb > 0 && m_rsxb-rsx > 0x8000)
289299      {
290         if (m_state.m_rsxoffs == 0)
291            m_state.m_rsxoffs = 0x10000-1;
300         if (m_rsxoffs == 0)
301            m_rsxoffs = 0x10000-1;
292302         else
293            m_state.m_rsxoffs = 0;
303            m_rsxoffs = 0;
294304      }
295      if (rsy > m_state.m_rsyb && m_state.m_rsyb < 0 && rsy-m_state.m_rsyb > 0x8000)
305      if (rsy > m_rsyb && m_rsyb < 0 && rsy-m_rsyb > 0x8000)
296306      {
297         if (m_state.m_rsyoffs == 0)
298            m_state.m_rsyoffs = -0x10000;
307         if (m_rsyoffs == 0)
308            m_rsyoffs = -0x10000;
299309         else
300            m_state.m_rsyoffs = 0;
310            m_rsyoffs = 0;
301311      }
302      if (rsy < m_state.m_rsyb && m_state.m_rsyb > 0 && m_state.m_rsyb-rsy > 0x8000)
312      if (rsy < m_rsyb && m_rsyb > 0 && m_rsyb-rsy > 0x8000)
303313      {
304         if (m_state.m_rsyoffs == 0)
305            m_state.m_rsyoffs = 0x10000-1;
314         if (m_rsyoffs == 0)
315            m_rsyoffs = 0x10000-1;
306316         else
307            m_state.m_rsyoffs = 0;
317            m_rsyoffs = 0;
308318      }
309319   }
310   m_state.m_rsxb = rsx;
311   m_state.m_rsyb = rsy;
312   if (m_state.m_rsxoffs) rsx += m_state.m_rsxoffs;
313   if (m_state.m_rsyoffs) rsy += m_state.m_rsyoffs;
314   if (rsx < -0x14000 || rsx >= 0x14000) m_state.m_rsxoffs = 0;
315   if (rsy < -0x14000 || rsy >= 0x14000) m_state.m_rsyoffs = 0;
320   m_rsxb = rsx;
321   m_rsyb = rsy;
322   if (m_rsxoffs) rsx += m_rsxoffs;
323   if (m_rsyoffs) rsy += m_rsyoffs;
324   if (rsx < -0x14000 || rsx >= 0x14000) m_rsxoffs = 0;
325   if (rsy < -0x14000 || rsy >= 0x14000) m_rsyoffs = 0;
316326
317327
318328   pxx = 0;
r249094r249095
326336   //ysn = 0.0;
327337   //ycs = 0.0;
328338
329   if (m_state.m_tc0610_ctrl_reg[1][7])
339   if (m_tc0610_ctrl_reg[1][7])
330340   {
331341      if (ryx != 0 || ryy != 0)
332342      {
r249094r249095
372382      //scs = ((float)pyy/65536.0) / (float)(ly / 2);
373383   }
374384
385
375386   {
376      polyVert tmpz[4];
387      polygon tmpz[4];
388
377389      tmpz[0].x = ((float)(-zx)  * zcs) - ((float)(-zy)  * zsn);
378390      tmpz[0].y = ((float)(-zx)  * zsn) + ((float)(-zy)  * zcs);
379391      tmpz[0].z = 0.0;
r249094r249095
387399      tmpz[3].y = ((float)(zx-1) * zsn) + ((float)(-zy)  * zcs);
388400      tmpz[3].z = 0.0;
389401
402
390403      vert[0].x = tmpz[0].x + (float)(lx / 2);
391404      vert[0].y = tmpz[0].y + (float)(ly / 2);
392405      vert[1].x = tmpz[1].x + (float)(lx / 2);
r249094r249095
406419   vert[3].p[0] = (float)(lx - 1) * 65536.0f;
407420   vert[3].p[1] = 0.0;
408421
409    gs_poly_data& extra = object_data_alloc();
410    extra.texbase = &srcbitmap;
411   
412    render_polygon<4>(clip, render_delegate(FUNC(galastrm_renderer::tc0610_draw_scanline), this), 2, vert);
413    wait();
422   extra->texbase = &srcbitmap;
423   callback = tc0610_draw_scanline;
424   poly_render_quad(m_poly, &bitmap, clip, callback, 2, &vert[0], &vert[1], &vert[2], &vert[3]);
414425}
415426
416427/**************************************************************
r249094r249095
522533         {
523534            pri = &priority_bitmap.pix8(y, x);
524535            if (!(*pri & 0x02) && m_tmpbitmaps.pix16(y, x))
525               *pri |= 0x04;
536                  *pri |= 0x04;
526537         }
527538      }
528539   }
r249094r249095
530541   draw_sprites_pre(42-X_OFFSET, -571+Y_OFFSET);
531542   draw_sprites(screen,m_tmpbitmaps,clip,primasks,1);
532543
533    copybitmap_trans(bitmap, m_poly->screenbits(), 0,0, 0,0, cliprect, 0);
534   m_poly->screenbits().fill(0, clip);
535    m_poly->tc0610_rotate_draw(m_tmpbitmaps, cliprect);
536   
544   copybitmap_trans(bitmap,m_polybitmap,0,0, 0,0,cliprect,0);
545   m_polybitmap.fill(0, clip);
546   tc0610_rotate_draw(m_polybitmap,m_tmpbitmaps,cliprect);
547
537548   priority_bitmap.fill(0, cliprect);
538549   draw_sprites(screen,bitmap,cliprect,primasks,0);
539550
trunk/src/mame/video/hng64.c
r249094r249095
11// license:LGPL-2.1+
2// copyright-holders:David Haywood, Angelo Salese, ElSemi, Andrew Gardner
2// copyright-holders:David Haywood, Angelo Salese, ElSemi, Andrew Gardner, Andrew Zaferakis
33#include "emu.h"
44#include "drawgfxm.h"
55#include "includes/hng64.h"
trunk/src/mame/video/hng64_sprite.c
r249094r249095
11// license:LGPL-2.1+
2// copyright-holders:David Haywood, Angelo Salese, ElSemi, Andrew Gardner
2// copyright-holders:David Haywood, Angelo Salese, ElSemi, Andrew Gardner, Andrew Zaferakis
33
44/* Hyper NeoGeo 64 Sprite bits */
55
trunk/src/mame/video/midzeus2.c
r249094r249095
99#include "emu.h"
1010#include "cpu/tms32031/tms32031.h"
1111#include "includes/midzeus.h"
12#include "video/poly.h"
12#include "video/polylgcy.h"
1313#include "video/rgbutil.h"
1414
1515
r249094r249095
5050};
5151
5252
53/*************************************
54 *
55 *  Polygon renderer
56 *
57 *************************************/
5853
59class midzeus2_renderer : public poly_manager<float, mz2_poly_extra_data, 4, 10000>
60{
61public:
62   midzeus2_renderer(midzeus2_state &state);
63
64    void render_poly_8bit(INT32 scanline, const extent_t& extent, const mz2_poly_extra_data& object, int threadid);
65   
66    void zeus2_draw_quad(const UINT32 *databuffer, UINT32 texoffs, int logit);
67   
68private:
69   midzeus2_state& m_state;
70};
71
72typedef midzeus2_renderer::vertex_t poly_vertex;
73typedef midzeus2_renderer::extent_t poly_extent;
74
75midzeus2_renderer::midzeus2_renderer(midzeus2_state &state)
76    : poly_manager<float, mz2_poly_extra_data, 4, 10000>(state.machine())
77    , m_state(state)
78{
79   
80}
81
82
8354/*************************************
8455 *
8556 *  Global variables
8657 *
8758 *************************************/
8859
89static midzeus2_renderer* poly;
60static legacy_poly_manager *poly;
9061static UINT8 log_fifo;
9162
9263static UINT32 zeus_fifo[20];
r249094r249095
12899
129100/*************************************
130101 *
102 *  Function prototypes
103 *
104 *************************************/
105
106static void render_poly_8bit(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid);
107
108/*************************************
109 *
131110 *  Macros
132111 *
133112 *************************************/
r249094r249095
279258   waveram[1] = auto_alloc_array(machine(), UINT32, WAVERAM1_WIDTH * WAVERAM1_HEIGHT * 12/4);
280259
281260   /* initialize polygon engine */
282    poly = auto_alloc(machine(), midzeus2_renderer(*this));
283   
261   poly = poly_alloc(machine(), 10000, sizeof(mz2_poly_extra_data), POLYFLAG_ALLOW_QUADS);
262
284263   /* we need to cleanup on exit */
285264   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(midzeus2_state::exit_handler2), this));
286265
r249094r249095
356335}
357336#endif
358337
338   poly_free(poly);
359339}
360340
361341
r249094r249095
370350{
371351   int x, y;
372352
373    poly->wait();
374   
353   poly_wait(poly, "VIDEO_UPDATE");
354
375355if (machine().input().code_pressed(KEYCODE_UP)) { zbase += 1.0f; popmessage("Zbase = %f", (double) zbase); }
376356if (machine().input().code_pressed(KEYCODE_DOWN)) { zbase -= 1.0f; popmessage("Zbase = %f", (double) zbase); }
377357
r249094r249095
10271007                  break;
10281008
10291009               case 0x38:  /* crusnexo/thegrid */
1030                  poly->zeus2_draw_quad(databuffer, texoffs, logit);
1010                  zeus2_draw_quad(databuffer, texoffs, logit);
10311011                  break;
10321012
10331013               default:
r249094r249095
10561036 *
10571037 *************************************/
10581038
1059void midzeus2_renderer::zeus2_draw_quad(const UINT32 *databuffer, UINT32 texoffs, int logit)
1039void midzeus2_state::zeus2_draw_quad(const UINT32 *databuffer, UINT32 texoffs, int logit)
10601040{
1041   poly_draw_scanline_func callback;
1042   mz2_poly_extra_data *extra;
10611043   poly_vertex clipvert[8];
10621044   poly_vertex vert[4];
10631045//  float uscale, vscale;
r249094r249095
10821064//if (machine().input().code_pressed(KEYCODE_O) && (texoffs & 0xffff) == 0x119) return;
10831065//if (machine().input().code_pressed(KEYCODE_L) && (texoffs & 0x100)) return;
10841066
1067   callback = render_poly_8bit;
1068
10851069/*
108610700   38800000
108710711   x2 | x1
r249094r249095
11951179      }
11961180   }
11971181
1198   numverts = poly->zclip_if_less(4, &vert[0], &clipvert[0], 4, 1.0f / 512.0f / 4.0f);
1182   numverts = poly_zclip_if_less(4, &vert[0], &clipvert[0], 4, 1.0f / 512.0f / 4.0f);
11991183   if (numverts < 3)
12001184      return;
12011185
r249094r249095
12261210         clipvert[i].y += 0.0005f;
12271211   }
12281212
1229    mz2_poly_extra_data& extra = poly->object_data_alloc();
1213   extra = (mz2_poly_extra_data *)poly_get_extra_data(poly);
12301214   switch (texmode)
12311215   {
12321216      case 0x01d:     /* crusnexo: RHS of score bar */
r249094r249095
12381222      case 0x95d:     /* crusnexo */
12391223      case 0xc1d:     /* crusnexo */
12401224      case 0xc5d:     /* crusnexo */
1241         extra.texwidth = 256;
1225         extra->texwidth = 256;
12421226         break;
12431227
12441228      case 0x059:     /* crusnexo */
12451229      case 0x0d9:     /* crusnexo */
12461230      case 0x119:     /* crusnexo: license plates */
12471231      case 0x159:     /* crusnexo */
1248         extra.texwidth = 128;
1232         extra->texwidth = 128;
12491233         break;
12501234
12511235      case 0x055:     /* crusnexo */
12521236      case 0x155:     /* crusnexo */
1253         extra.texwidth = 64;
1237         extra->texwidth = 64;
12541238         break;
12551239
12561240      default:
r249094r249095
12651249      }
12661250   }
12671251
1268   extra.solidcolor = 0;//m_zeusbase[0x00] & 0x7fff;
1269   extra.zoffset = 0;//m_zeusbase[0x7e] >> 16;
1270   extra.alpha = 0;//m_zeusbase[0x4e];
1271   extra.transcolor = 0x100;//((databuffer[1] >> 16) & 1) ? 0 : 0x100;
1272   extra.texbase = WAVERAM_BLOCK0(zeus_texbase);
1273   extra.palbase = waveram0_ptr_from_expanded_addr(m_state.m_zeusbase[0x41]);
1252   extra->solidcolor = 0;//m_zeusbase[0x00] & 0x7fff;
1253   extra->zoffset = 0;//m_zeusbase[0x7e] >> 16;
1254   extra->alpha = 0;//m_zeusbase[0x4e];
1255   extra->transcolor = 0x100;//((databuffer[1] >> 16) & 1) ? 0 : 0x100;
1256   extra->texbase = WAVERAM_BLOCK0(zeus_texbase);
1257   extra->palbase = waveram0_ptr_from_expanded_addr(m_zeusbase[0x41]);
12741258
1275    // Note: Before being converted to the "poly.h" interface, this used to call the polylgcy function
1276    //       poly_render_quad_fan.  The behavior seems to be the same as it once was after a few short
1277    //       tests, but the (numverts == 5) statement below may actually be a quad fan instead of a 5-sided
1278    //       polygon.
1279    if (numverts == 3)
1280        render_triangle(zeus_cliprect, render_delegate(FUNC(midzeus2_renderer::render_poly_8bit), this), 4, clipvert[0], clipvert[1], clipvert[2]);
1281    else if (numverts == 4)
1282        render_polygon<4>(zeus_cliprect, render_delegate(FUNC(midzeus2_renderer::render_poly_8bit), this), 4, clipvert);
1283    else if (numverts == 5)
1284        render_polygon<5>(zeus_cliprect, render_delegate(FUNC(midzeus2_renderer::render_poly_8bit), this), 4, clipvert);
1259   poly_render_quad_fan(poly, NULL, zeus_cliprect, callback, 4, numverts, &clipvert[0]);
12851260}
12861261
12871262
r249094r249095
12921267 *
12931268 *************************************/
12941269
1295void midzeus2_renderer::render_poly_8bit(INT32 scanline, const extent_t& extent, const mz2_poly_extra_data& object, int threadid)
1270static void render_poly_8bit(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
12961271{
1297   INT32 curz = extent.param[0].start;
1298   INT32 curu = extent.param[1].start;
1299   INT32 curv = extent.param[2].start;
1300//  INT32 curi = extent.param[3].start;
1301   INT32 dzdx = extent.param[0].dpdx;
1302   INT32 dudx = extent.param[1].dpdx;
1303   INT32 dvdx = extent.param[2].dpdx;
1304//  INT32 didx = extent.param[3].dpdx;
1305   const void *texbase = object.texbase;
1306   const void *palbase = object.palbase;
1307   UINT16 transcolor = object.transcolor;
1308   int texwidth = object.texwidth;
1272   const mz2_poly_extra_data *extra = (const mz2_poly_extra_data *)extradata;
1273   INT32 curz = extent->param[0].start;
1274   INT32 curu = extent->param[1].start;
1275   INT32 curv = extent->param[2].start;
1276//  INT32 curi = extent->param[3].start;
1277   INT32 dzdx = extent->param[0].dpdx;
1278   INT32 dudx = extent->param[1].dpdx;
1279   INT32 dvdx = extent->param[2].dpdx;
1280//  INT32 didx = extent->param[3].dpdx;
1281   const void *texbase = extra->texbase;
1282   const void *palbase = extra->palbase;
1283   UINT16 transcolor = extra->transcolor;
1284   int texwidth = extra->texwidth;
13091285   int x;
13101286
1311   for (x = extent.startx; x < extent.stopx; x++)
1287   for (x = extent->startx; x < extent->stopx; x++)
13121288   {
13131289      UINT16 *depthptr = WAVERAM_PTRDEPTH(zeus_renderbase, scanline, x);
1314      INT32 depth = (curz >> 16) + object.zoffset;
1290      INT32 depth = (curz >> 16) + extra->zoffset;
13151291      if (depth > 0x7fff) depth = 0x7fff;
13161292      if (depth >= 0 && depth <= *depthptr)
13171293      {
trunk/src/mame/video/model2.c
r249094r249095
8989*********************************************************************************************************************************/
9090#include "emu.h"
9191#include "video/segaic24.h"
92#include "video/polylgcy.h"
9293#include "includes/model2.h"
9394
9495#define MODEL2_VIDEO_DEBUG 0
r249094r249095
101102
102103/*******************************************
103104 *
105 *  Basic Data Types
106 *
107 *******************************************/
108
109struct plane
110{
111   poly_vertex normal;
112   float       distance;
113};
114
115struct texture_parameter
116{
117   float   diffuse;
118   float   ambient;
119   UINT32  specular_control;
120   float   specular_scale;
121};
122
123struct triangle
124{
125   void *              next;
126   poly_vertex         v[3];
127   UINT16              z;
128   UINT16              texheader[4];
129   UINT8               luma;
130   INT16               viewport[4];
131   INT16               center[2];
132};
133
134struct quad_m2
135{
136   poly_vertex         v[4];
137   UINT16              z;
138   UINT16              texheader[4];
139   UINT8               luma;
140};
141
142struct m2_poly_extra_data
143{
144   model2_state *  state;
145   UINT32      lumabase;
146   UINT32      colorbase;
147   UINT32 *    texsheet;
148   UINT32      texwidth;
149   UINT32      texheight;
150   UINT32      texx, texy;
151   UINT8       texmirrorx;
152   UINT8       texmirrory;
153};
154
155
156/*******************************************
157 *
104158 *  Generic 3D Math Functions
105159 *
106160 *******************************************/
r249094r249095
780834}
781835
782836/***********************************************************************************************/
783   
837
838INLINE UINT16 get_texel( UINT32 base_x, UINT32 base_y, int x, int y, UINT32 *sheet )
839{
840   UINT32  baseoffs = ((base_y/2)*512)+(base_x/2);
841   UINT32  texeloffs = ((y/2)*512)+(x/2);
842   UINT32  offset = baseoffs + texeloffs;
843   UINT32  texel = sheet[offset>>1];
844
845   if ( offset & 1 )
846      texel >>= 16;
847
848   if ( (y & 1) == 0 )
849      texel >>= 8;
850
851   if ( (x & 1) == 0 )
852      texel >>= 4;
853
854   return (texel & 0x0f);
855}
856
857/* checker = 0, textured = 0, transparent = 0 */
858#define MODEL2_FUNC 0
859#define MODEL2_FUNC_NAME    model2_3d_render_0
860#include "model2rd.inc"
861#undef MODEL2_FUNC
862#undef MODEL2_FUNC_NAME
863
864/* checker = 0, textured = 0, translucent = 1 */
865#define MODEL2_FUNC 1
866#define MODEL2_FUNC_NAME    model2_3d_render_1
867#include "model2rd.inc"
868#undef MODEL2_FUNC
869#undef MODEL2_FUNC_NAME
870
871/* checker = 0, textured = 1, translucent = 0 */
872#define MODEL2_FUNC 2
873#define MODEL2_FUNC_NAME    model2_3d_render_2
874#include "model2rd.inc"
875#undef MODEL2_FUNC
876#undef MODEL2_FUNC_NAME
877
878/* checker = 0, textured = 1, translucent = 1 */
879#define MODEL2_FUNC 3
880#define MODEL2_FUNC_NAME    model2_3d_render_3
881#include "model2rd.inc"
882#undef MODEL2_FUNC
883#undef MODEL2_FUNC_NAME
884
885/* checker = 1, textured = 0, translucent = 0 */
886#define MODEL2_FUNC 4
887#define MODEL2_FUNC_NAME    model2_3d_render_4
888#include "model2rd.inc"
889#undef MODEL2_FUNC
890#undef MODEL2_FUNC_NAME
891
892/* checker = 1, textured = 0, translucent = 1 */
893#define MODEL2_FUNC 5
894#define MODEL2_FUNC_NAME    model2_3d_render_5
895#include "model2rd.inc"
896#undef MODEL2_FUNC
897#undef MODEL2_FUNC_NAME
898
899/* checker = 1, textured = 1, translucent = 0 */
900#define MODEL2_FUNC 6
901#define MODEL2_FUNC_NAME    model2_3d_render_6
902#include "model2rd.inc"
903#undef MODEL2_FUNC
904#undef MODEL2_FUNC_NAME
905
906/* checker = 1, textured = 1, translucent = 1 */
907#define MODEL2_FUNC 7
908#define MODEL2_FUNC_NAME    model2_3d_render_7
909#include "model2rd.inc"
910#undef MODEL2_FUNC
911#undef MODEL2_FUNC_NAME
912
784913/***********************************************************************************************/
785914
786void model2_renderer::model2_3d_render(triangle *tri, const rectangle &cliprect)
915static const poly_draw_scanline_func render_funcs[8] =
787916{
788   model2_renderer *poly = m_state.m_poly;
789    m2_poly_extra_data& extra = poly->object_data_alloc();
790   UINT8 renderer;
917   model2_3d_render_0, /* checker = 0, textured = 0, translucent = 0 */
918   model2_3d_render_1, /* checker = 0, textured = 0, translucent = 1 */
919   model2_3d_render_2, /* checker = 0, textured = 1, translucent = 0 */
920   model2_3d_render_3, /* checker = 0, textured = 1, translucent = 1 */
921   model2_3d_render_4, /* checker = 1, textured = 0, translucent = 0 */
922   model2_3d_render_5, /* checker = 1, textured = 0, translucent = 1 */
923   model2_3d_render_6, /* checker = 1, textured = 1, translucent = 0 */
924   model2_3d_render_7  /* checker = 1, textured = 1, translucent = 1 */
925};
791926
927static void model2_3d_render( model2_state *state, bitmap_rgb32 &bitmap, triangle *tri, const rectangle &cliprect )
928{
929   legacy_poly_manager *poly = state->m_poly;
930   m2_poly_extra_data *extra = (m2_poly_extra_data *)poly_get_extra_data(poly);
931   UINT8       renderer;
932
792933   /* select renderer based on attributes (bit15 = checker, bit14 = textured, bit13 = transparent */
793934   renderer = (tri->texheader[0] >> 13) & 7;
794935
r249094r249095
796937   rectangle vp(tri->viewport[0] - 8, tri->viewport[2] - 8, (384-tri->viewport[3])+90, (384-tri->viewport[1])+90);
797938   vp &= cliprect;
798939
799   extra.state = &m_state;
800   extra.lumabase = ((tri->texheader[1] & 0xFF) << 7) + ((tri->luma >> 5) ^ 0x7);
801   extra.colorbase = (tri->texheader[3] >> 6) & 0x3FF;
940   extra->state = state;
941   extra->lumabase = ((tri->texheader[1] & 0xFF) << 7) + ((tri->luma >> 5) ^ 0x7);
942   extra->colorbase = (tri->texheader[3] >> 6) & 0x3FF;
802943
803944   if (renderer & 2)
804945   {
805      extra.texwidth = 32 << ((tri->texheader[0] >> 0) & 0x7);
806      extra.texheight = 32 << ((tri->texheader[0] >> 3) & 0x7);
807      extra.texx = 32 * ((tri->texheader[2] >> 0) & 0x1f);
808      extra.texy = 32 * (((tri->texheader[2] >> 6) & 0x1f) + ( tri->texheader[2] & 0x20 ));
946      extra->texwidth = 32 << ((tri->texheader[0] >> 0) & 0x7);
947      extra->texheight = 32 << ((tri->texheader[0] >> 3) & 0x7);
948      extra->texx = 32 * ((tri->texheader[2] >> 0) & 0x1f);
949      extra->texy = 32 * (((tri->texheader[2] >> 6) & 0x1f) + ( tri->texheader[2] & 0x20 ));
809950      /* TODO: Virtua Striker contradicts with this. */
810      extra.texmirrorx = 0;//(tri->texheader[0] >> 9) & 1;
811      extra.texmirrory = 0;//(tri->texheader[0] >> 8) & 1;
812      extra.texsheet = (tri->texheader[2] & 0x1000) ? m_state.m_textureram1 : m_state.m_textureram0;
951      extra->texmirrorx = 0;//(tri->texheader[0] >> 9) & 1;
952      extra->texmirrory = 0;//(tri->texheader[0] >> 8) & 1;
953      extra->texsheet = (tri->texheader[2] & 0x1000) ? state->m_textureram1 : state->m_textureram0;
813954
814955      tri->v[0].pz = 1.0f / (1.0f + tri->v[0].pz);
815956      tri->v[0].pu = tri->v[0].pu * tri->v[0].pz * (1.0f / 8.0f);
r249094r249095
821962      tri->v[2].pu = tri->v[2].pu * tri->v[2].pz * (1.0f / 8.0f);
822963      tri->v[2].pv = tri->v[2].pv * tri->v[2].pz * (1.0f / 8.0f);
823964
824        // Note : The class model2_renderer has an array of function pointers in it named m_renderfuncs, in theory this simply
825        //        needs to be passed into the render_triangle function as such model2_renderer::m_renderfuncs[renderer], but
826        //        I was unable to make it work when converting to the new polygon rasterizer interface.
827        switch (renderer)
828        {
829        case 0: render_triangle(vp, render_delegate(FUNC(model2_renderer::model2_3d_render_0), this), 3, tri->v[0], tri->v[1], tri->v[2]); break;
830        case 1: render_triangle(vp, render_delegate(FUNC(model2_renderer::model2_3d_render_1), this), 3, tri->v[0], tri->v[1], tri->v[2]); break;
831        case 2: render_triangle(vp, render_delegate(FUNC(model2_renderer::model2_3d_render_2), this), 3, tri->v[0], tri->v[1], tri->v[2]); break;
832        case 3: render_triangle(vp, render_delegate(FUNC(model2_renderer::model2_3d_render_3), this), 3, tri->v[0], tri->v[1], tri->v[2]); break;
833        case 4: render_triangle(vp, render_delegate(FUNC(model2_renderer::model2_3d_render_4), this), 3, tri->v[0], tri->v[1], tri->v[2]); break;
834        case 5: render_triangle(vp, render_delegate(FUNC(model2_renderer::model2_3d_render_5), this), 3, tri->v[0], tri->v[1], tri->v[2]); break;
835        case 6: render_triangle(vp, render_delegate(FUNC(model2_renderer::model2_3d_render_6), this), 3, tri->v[0], tri->v[1], tri->v[2]); break;
836        case 7: render_triangle(vp, render_delegate(FUNC(model2_renderer::model2_3d_render_7), this), 3, tri->v[0], tri->v[1], tri->v[2]); break;
837        }
965      poly_render_triangle(poly, &bitmap, vp, render_funcs[renderer], 3, &tri->v[0], &tri->v[1], &tri->v[2]);
838966   }
839967   else
840    {
841        switch (renderer)
842        {
843        case 0: render_triangle(vp, render_delegate(FUNC(model2_renderer::model2_3d_render_0), this), 0, tri->v[0], tri->v[1], tri->v[2]); break;
844        case 1: render_triangle(vp, render_delegate(FUNC(model2_renderer::model2_3d_render_1), this), 0, tri->v[0], tri->v[1], tri->v[2]); break;
845        case 2: render_triangle(vp, render_delegate(FUNC(model2_renderer::model2_3d_render_2), this), 0, tri->v[0], tri->v[1], tri->v[2]); break;
846        case 3: render_triangle(vp, render_delegate(FUNC(model2_renderer::model2_3d_render_3), this), 0, tri->v[0], tri->v[1], tri->v[2]); break;
847        case 4: render_triangle(vp, render_delegate(FUNC(model2_renderer::model2_3d_render_4), this), 0, tri->v[0], tri->v[1], tri->v[2]); break;
848        case 5: render_triangle(vp, render_delegate(FUNC(model2_renderer::model2_3d_render_5), this), 0, tri->v[0], tri->v[1], tri->v[2]); break;
849        case 6: render_triangle(vp, render_delegate(FUNC(model2_renderer::model2_3d_render_6), this), 0, tri->v[0], tri->v[1], tri->v[2]); break;
850        case 7: render_triangle(vp, render_delegate(FUNC(model2_renderer::model2_3d_render_7), this), 0, tri->v[0], tri->v[1], tri->v[2]); break;
851        }
852    }
968      poly_render_triangle(poly, &bitmap, vp, render_funcs[renderer], 0, &tri->v[0], &tri->v[1], &tri->v[2]);
853969}
854970
855971/*
r249094r249095
9031019void model2_state::model2_3d_frame_end( bitmap_rgb32 &bitmap, const rectangle &cliprect )
9041020{
9051021   raster_state *raster = m_raster;
906   INT32 z;
1022   INT32       z;
9071023
9081024   /* if we have nothing to render, bail */
9091025   if ( raster->tri_list_index == 0 )
r249094r249095
9471063   }
9481064#endif
9491065
950    m_poly->destmap().fill(0x00000000, cliprect);
951   
9521066   /* go through the Z levels, and render each bucket */
9531067   for( z = raster->max_z; z >= raster->min_z; z-- )
9541068   {
r249094r249095
9631077         {
9641078            /* project and render */
9651079            model2_3d_project( tri );
966            m_poly->model2_3d_render(tri, cliprect);
1080            model2_3d_render( this, bitmap, tri, cliprect );
9671081
9681082            tri = (triangle *)tri->next;
9691083         }
9701084      }
9711085   }
972   m_poly->wait("End of frame");
973   
974    copybitmap_trans(bitmap, m_poly->destmap(), 0, 0, 0, 0, cliprect, 0x00000000);
1086   poly_wait(m_poly, "End of frame");
9751087}
9761088
9771089/* 3D Rasterizer main data input port */
r249094r249095
25822694/***********************************************************************************************/
25832695
25842696
2697void model2_state::model2_exit()
2698{
2699   poly_free(m_poly);
2700}
2701
25852702VIDEO_START_MEMBER(model2_state,model2)
25862703{
25872704   const rectangle &visarea = m_screen->visible_area();
r249094r249095
25902707
25912708   m_sys24_bitmap.allocate(width, height+4);
25922709
2593    m_poly = auto_alloc(machine(), model2_renderer(*this));
2710   m_poly = poly_alloc(machine(), 4000, sizeof(m2_poly_extra_data), 0);
2711   machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(model2_state::model2_exit), this));
25942712
25952713   /* initialize the hardware rasterizer */
25962714   model2_3d_init( machine(), (UINT16*)memregion("user3")->base() );
trunk/src/mame/video/model2rd.inc
r249094r249095
5656
5757#ifndef MODEL2_TEXTURED
5858/* non-textured render path */
59void MODEL2_FUNC_NAME(INT32 scanline, const extent_t& extent, const m2_poly_extra_data& object, int threadid)
59static void MODEL2_FUNC_NAME(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
6060{
6161#if !defined( MODEL2_TRANSLUCENT)
62   model2_state *state = object.state;
63   bitmap_rgb32 *destmap = (bitmap_rgb32 *)&m_destmap;
62   const m2_poly_extra_data *extra = (const m2_poly_extra_data *)extradata;
63   model2_state *state = extra->state;
64   bitmap_rgb32 *destmap = (bitmap_rgb32 *)dest;
6465   UINT32 *p = &destmap->pix32(scanline);
6566
6667   /* extract color information */
r249094r249095
6869   const UINT16 *colortable_g = (const UINT16 *)&state->m_colorxlat[0x4000/4];
6970   const UINT16 *colortable_b = (const UINT16 *)&state->m_colorxlat[0x8000/4];
7071   const UINT16 *lumaram = (const UINT16 *)state->m_lumaram.target();
71   UINT32  lumabase = object.lumabase;
72   UINT32  color = object.colorbase;
72   UINT32  lumabase = extra->lumabase;
73   UINT32  color = extra->colorbase;
7374   UINT8   luma;
7475   UINT32  tr, tg, tb;
7576   int     x;
r249094r249095
9798   /* build the final color */
9899   color = rgb_t(tr, tg, tb);
99100
100   for(x = extent.startx; x < extent.stopx; x++)
101   for(x = extent->startx; x < extent->stopx; x++)
101102#if defined(MODEL2_CHECKER)
102103      if ((x^scanline) & 1) p[x] = color;
103104#else
r249094r249095
108109
109110#else
110111/* textured render path */
111void MODEL2_FUNC_NAME(INT32 scanline, const extent_t& extent, const m2_poly_extra_data& object, int threadid)
112static void MODEL2_FUNC_NAME(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
112113{
113   model2_state *state = object.state;
114   bitmap_rgb32 *destmap = (bitmap_rgb32 *)&m_destmap;
114   const m2_poly_extra_data *extra = (const m2_poly_extra_data *)extradata;
115   model2_state *state = extra->state;
116   bitmap_rgb32 *destmap = (bitmap_rgb32 *)dest;
115117   UINT32 *p = &destmap->pix32(scanline);
116118
117   UINT32  tex_width = object.texwidth;
118   UINT32  tex_height = object.texheight;
119   UINT32  tex_width = extra->texwidth;
120   UINT32  tex_height = extra->texheight;
119121
120122   /* extract color information */
121123   const UINT16 *colortable_r = (const UINT16 *)&state->m_colorxlat[0x0000/4];
122124   const UINT16 *colortable_g = (const UINT16 *)&state->m_colorxlat[0x4000/4];
123125   const UINT16 *colortable_b = (const UINT16 *)&state->m_colorxlat[0x8000/4];
124126   const UINT16 *lumaram = (const UINT16 *)state->m_lumaram.target();
125   UINT32  colorbase = object.colorbase;
126   UINT32  lumabase = object.lumabase;
127   UINT32  tex_x = object.texx;
128   UINT32  tex_y = object.texy;
127   UINT32  colorbase = extra->colorbase;
128   UINT32  lumabase = extra->lumabase;
129   UINT32  tex_x = extra->texx;
130   UINT32  tex_y = extra->texy;
129131   UINT32  tex_x_mask, tex_y_mask;
130   UINT32  tex_mirr_x = object.texmirrorx;
131   UINT32  tex_mirr_y = object.texmirrory;
132   UINT32 *sheet = object.texsheet;
133   float ooz = extent.param[0].start;
134   float uoz = extent.param[1].start;
135   float voz = extent.param[2].start;
136   float dooz = extent.param[0].dpdx;
137   float duoz = extent.param[1].dpdx;
138   float dvoz = extent.param[2].dpdx;
132   UINT32  tex_mirr_x = extra->texmirrorx;
133   UINT32  tex_mirr_y = extra->texmirrory;
134   UINT32 *sheet = extra->texsheet;
135   float ooz = extent->param[0].start;
136   float uoz = extent->param[1].start;
137   float voz = extent->param[2].start;
138   float dooz = extent->param[0].dpdx;
139   float duoz = extent->param[1].dpdx;
140   float dvoz = extent->param[2].dpdx;
139141   int     x;
140142
141143   tex_x_mask  = tex_width - 1;
r249094r249095
147149   colortable_g += ((colorbase >>  5) & 0x1f) << 8;
148150   colortable_b += ((colorbase >> 10) & 0x1f) << 8;
149151
150   for(x = extent.startx; x < extent.stopx; x++, uoz += duoz, voz += dvoz, ooz += dooz)
152   for(x = extent->startx; x < extent->stopx; x++, uoz += duoz, voz += dvoz, ooz += dooz)
151153   {
152154      float z = recip_approx(ooz) * 256.0f;
153155      INT32 u = uoz * z;
trunk/src/mame/video/model3.c
r249094r249095
11// license:BSD-3-Clause
2// copyright-holders:R. Belmont, Ville Linde
2// copyright-holders:Andrew Gardner, R. Belmont, Ville Linde
33#include "emu.h"
44#include "video/poly.h"
55#include "video/rgbutil.h"
trunk/src/mame/video/namcos22.c
r249094r249095
4343#include "includes/namcos22.h"
4444
4545
46// poly constructor
46// polynew constructor
4747namcos22_renderer::namcos22_renderer(namcos22_state &state)
4848   : poly_manager<float, namcos22_object_data, 4, 8000>(state.machine()),
4949      m_state(state)
r249094r249095
6363
6464/*********************************************************************************************/
6565
66// poly scanline callbacks
66// polynew scanline callbacks
6767void namcos22_renderer::renderscanline_uvi_full(INT32 scanline, const extent_t &extent, const namcos22_object_data &extra, int threadid)
6868{
6969   float z = extent.param[0].start;
trunk/src/mess/drivers/asst128.c
r249094r249095
5858
5959void asst128_state::machine_start()
6060{
61   memory_region* font = memregion(":board0:cga_mc1502:gfx1");
62   memcpy(font->base(), memregion("maincpu")->base()+0xffa6e, 0x0400);
63   memcpy(font->base()+0x0400, memregion("maincpu")->base()+0xf4000, 0x0400);
61   memory_region* font = memregion(":isa_cga:cga_mc1502:gfx1");
62   memcpy(font->base(), memregion("gfx1")->base(), 0x2000);
6463}
6564
6665WRITE8_MEMBER(asst128_state::asst128_fdc_dor_w)
r249094r249095
108107   asst128_mb_device::static_set_cputag(*device, "maincpu");
109108   MCFG_DEVICE_INPUT_DEFAULTS(asst128)
110109
111//   MCFG_DEVICE_REMOVE("mb:dma8237")
112
113110   MCFG_DEVICE_REMOVE("mb:cassette")
114111   MCFG_CASSETTE_ADD("mb:cassette")
115112   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED)
116113
117   MCFG_ISA8_SLOT_ADD("mb:isa", "board0", pc_isa8_cards, "cga_mc1502", true)
118   MCFG_ISA8_SLOT_ADD("mb:isa", "board1", pc_isa8_cards, "lpt", true)
114   MCFG_ISA8_SLOT_ADD("mb:isa", "isa_cga", pc_isa8_cards, "cga_mc1502", true)
115   MCFG_ISA8_SLOT_ADD("mb:isa", "isa_lpt", pc_isa8_cards, "lpt", true)
116   MCFG_ISA8_SLOT_ADD("mb:isa", "isa_com", pc_isa8_cards, "com", true)
119117
120118   MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_IBM_PC_XT_83)
121119
r249094r249095
126124
127125   MCFG_PC_JOY_ADD("pc_joy")
128126
127   /* internal ram */
129128   MCFG_RAM_ADD(RAM_TAG)
130129   MCFG_RAM_DEFAULT_SIZE("640K")
131130MACHINE_CONFIG_END
132131
133132ROM_START( asst128 )
134133   ROM_REGION16_LE(0x100000,"maincpu", 0)
135   ROM_LOAD( "extbios.bin",      0xf4000, 0x2000, CRC(e3bf22de) SHA1(d4319edc82c0015ca0adc6c8771e887659717e62))
136   ROM_LOAD( "basic.bin",        0xf6000, 0x8000, CRC(a4ec66f6) SHA1(80e934986022681ccde180e92aa108e716c4f19b))
137   ROM_LOAD( "mainbios.bin",     0xfe000, 0x2000, CRC(8426cbf5) SHA1(41d14137ffa651977041da22aa8071c0f7854158))
138
139   // XXX needs dumping
134   ROM_DEFAULT_BIOS("floppy")
135   /* BASIC ROM taken from IBM 5150 and needs dumping */
136   ROM_LOAD( "basic-1.10.rom",    0xf6000, 0x8000, CRC(ebacb791) SHA1(07449ebca18f979b9ab748582b736e402f2bf940))
137   ROM_LOAD( "asf400-f600.bin",   0xf4000, 0x2000, CRC(e3bf22de) SHA1(d4319edc82c0015ca0adc6c8771e887659717e62))
138   ROM_SYSTEM_BIOS(0, "floppy", "3rd party floppy support")
139   ROMX_LOAD( "rombios7.bin",     0xfc001, 0x2000, CRC(7d7c8d6a) SHA1(a731a65ee547f1d78cfc91461f38166da014f3dc), ROM_SKIP(1) | ROM_BIOS(1))
140   ROMX_LOAD( "rombios8.bin",     0xfc000, 0x2000, CRC(ba304663) SHA1(b2533b8f8240f72b7315f27c7b64f95ac52687ca), ROM_SKIP(1) | ROM_BIOS(1))
141   ROM_SYSTEM_BIOS(1, "stock", "cassette-only BIOS?")
142   ROMX_LOAD( "mainbios.bin",     0xfe000, 0x2000, CRC(8426cbf5) SHA1(41d14137ffa651977041da22aa8071c0f7854158), ROM_BIOS(2))
140143   ROM_REGION(0x2000,"gfx1", ROMREGION_ERASE00)
141   ROM_LOAD( "asst128cg.bin", 0, 0x2000, NO_DUMP )
144   ROM_COPY( "maincpu", 0xffa6e, 0x0000, 0x0400 )
145   ROM_COPY( "maincpu", 0xfc000, 0x0400, 0x0400 )
142146ROM_END
143147
144148/*    YEAR  NAME        PARENT      COMPAT      MACHINE     INPUT       INIT        COMPANY            FULLNAME */
trunk/src/mess/drivers/at.c
r249094r249095
264264
265265
266266static INPUT_PORTS_START( atcga )
267   PORT_START("DSW0")
268   PORT_DIPNAME( 0xc0, 0x40, "Number of floppy drives")
269   PORT_DIPSETTING(    0x00, "1" )
270   PORT_DIPSETTING(    0x40, "2" )
271   PORT_DIPSETTING(    0x80, "3" )
272   PORT_DIPSETTING(    0xc0, "4" )
273   PORT_DIPNAME( 0x30, 0x00, "Graphics adapter")
274   PORT_DIPSETTING(    0x00, "EGA/VGA" )
275   PORT_DIPSETTING(    0x10, "Color 40x25" )
276   PORT_DIPSETTING(    0x20, "Color 80x25" )
277   PORT_DIPSETTING(    0x30, "Monochrome" )
278   PORT_DIPNAME( 0x0c, 0x0c, "RAM banks")
279   PORT_DIPSETTING(    0x00, "1 - 16  64 256K" )
280   PORT_DIPSETTING(    0x04, "2 - 32 128 512K" )
281   PORT_DIPSETTING(    0x08, "3 - 48 192 576K" )
282   PORT_DIPSETTING(    0x0c, "4 - 64 256 640K" )
283   PORT_DIPNAME( 0x02, 0x00, "80387 installed")
284   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
285   PORT_DIPSETTING(    0x02, DEF_STR( Yes ) )
286   PORT_DIPNAME( 0x01, 0x01, "Floppy installed")
287   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
288   PORT_DIPSETTING(    0x01, DEF_STR( Yes ) )
267289INPUT_PORTS_END
268290
269291static INPUT_PORTS_START( atvga )
r249094r249095
280302   PORT_DIPNAME( 0x01, 0x01, "VGA 4")
281303   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
282304   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
305
306   PORT_START("DSW0")
307   PORT_DIPNAME( 0xc0, 0x40, "Number of floppy drives")
308   PORT_DIPSETTING(    0x00, "1" )
309   PORT_DIPSETTING(    0x40, "2" )
310   PORT_DIPSETTING(    0x80, "3" )
311   PORT_DIPSETTING(    0xc0, "4" )
312   PORT_DIPNAME( 0x30, 0x00, "Graphics adapter")
313   PORT_DIPSETTING(    0x00, "EGA/VGA" )
314   PORT_DIPSETTING(    0x10, "Color 40x25" )
315   PORT_DIPSETTING(    0x20, "Color 80x25" )
316   PORT_DIPSETTING(    0x30, "Monochrome" )
317   PORT_DIPNAME( 0x0c, 0x0c, "RAM banks")
318   PORT_DIPSETTING(    0x00, "1 - 16  64 256K" )
319   PORT_DIPSETTING(    0x04, "2 - 32 128 512K" )
320   PORT_DIPSETTING(    0x08, "3 - 48 192 576K" )
321   PORT_DIPSETTING(    0x0c, "4 - 64 256 640K" )
322   PORT_DIPNAME( 0x02, 0x00, "80387 installed")
323   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
324   PORT_DIPSETTING(    0x02, DEF_STR( Yes ) )
325   PORT_DIPNAME( 0x01, 0x01, "Floppy installed")
326   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
327   PORT_DIPSETTING(    0x01, DEF_STR( Yes ) )
283328INPUT_PORTS_END
284329
285330WRITE_LINE_MEMBER( at_state::at_mc146818_irq )
trunk/src/mess/drivers/besta.c
r249094r249095
1010
1111#include "emu.h"
1212#include "cpu/m68000/m68000.h"
13#include "machine/68230pit.h"
1413#include "machine/terminal.h"
1514
1615#define VERBOSE_DBG 1       /* general debug messages */
r249094r249095
3332   besta_state(const machine_config &mconfig, device_type type, const char *tag)
3433      : driver_device(mconfig, type, tag),
3534      m_maincpu(*this, "maincpu"),
36      m_pit1 (*this, "pit1"),
37      m_pit2 (*this, "pit2"),
3835      m_terminal(*this, TERMINAL_TAG),
3936      m_p_ram(*this, "p_ram")
4037   {
r249094r249095
4744   UINT8 m_mpcc_regs[32];
4845
4946   required_device<cpu_device> m_maincpu;
50   required_device<pit68230_device> m_pit1;
51   required_device<pit68230_device> m_pit2;
5247   virtual void machine_reset();
5348
5449   required_device<generic_terminal_device> m_terminal;
r249094r249095
10196
10297static ADDRESS_MAP_START(besta_mem, AS_PROGRAM, 32, besta_state)
10398   AM_RANGE(0x00000000, 0x001fffff) AM_RAM AM_SHARE("p_ram")       // local bus DRAM, 4MB
104//   AM_RANGE(0x08010000, 0x08011fff) AM_RAM                         // unknown -- accessed by cp31dssp
105//   AM_RANGE(0xfca03500, 0xfca0350f) AM_READWRITE8(iscsi_reg_r, iscsi_reg_w, 0xffffffff)
106   AM_RANGE(0xff000000, 0xff00ffff) AM_ROM AM_REGION("user1", 0)   // actual mapping is up to 0xff03ffff
99//  AM_RANGE(0x08010000, 0x08011fff) AM_RAM                         // unknown -- accessed by cp31dssp
100   AM_RANGE(0xff000000, 0xff00ffff) AM_ROM AM_REGION("user1",0)    // actual mapping is up to 0xff03ffff
107101   AM_RANGE(0xff040000, 0xff07ffff) AM_RAM                         // onboard SRAM
108//   AM_RANGE(0xff800000, 0xff80001f) AM_DEVREADWRITE8("mpcc", mpcc68561_t, reg_r, reg_w, 0xffffffff)
109   AM_RANGE(0xff800000, 0xff80001f) AM_READWRITE8(mpcc_reg_r, mpcc_reg_w, 0xffffffff) // console
110   AM_RANGE(0xff800200, 0xff800237) AM_DEVREADWRITE8 ("pit2", pit68230_device, read, write, 0xffffffff)
111//   AM_RANGE(0xff800400, 0xff800xxx) // ??? -- shows up in cp31dssp log
112//   AM_RANGE(0xff800800, 0xff800xxx) // 68153 BIM
113//   AM_RANGE(0xff800a00, 0xff800xxx) // 62421 RTC
114   AM_RANGE(0xff800c00, 0xff800c37) AM_DEVREADWRITE8 ("pit1", pit68230_device, read, write, 0xffffffff)
115//   AM_RANGE(0xff800e00, 0xff800xxx) // PIT3?
102//  68561 MPCC (console)
103//  AM_RANGE(0xff800000, 0xff80001f) AM_DEVREADWRITE8("mpcc", mpcc68561_t, reg_r, reg_w, 0xffffffff)
104   AM_RANGE(0xff800000, 0xff80001f) AM_READWRITE8(mpcc_reg_r, mpcc_reg_w, 0xffffffff)
105//  AM_RANGE(0xff800200, 0xff800xxx) // 68230 PIT2
106//  AM_RANGE(0xff800400, 0xff800xxx) // ??? -- shows up in cp31dssp log
107//  AM_RANGE(0xff800800, 0xff800xxx) // BIM
108//  AM_RANGE(0xff800a00, 0xff800xxx) // 62421 RTC
109//  AM_RANGE(0xff800c00, 0xff800xxx) // 68230 PIT
116110ADDRESS_MAP_END
117111
118112/* Input ports */
r249094r249095
137131   MCFG_CPU_ADD("maincpu", M68030, 2*16670000)
138132   MCFG_CPU_PROGRAM_MAP(besta_mem)
139133
140   MCFG_DEVICE_ADD ("pit1", PIT68230, 16670000 / 2)   // XXX verify clock
141
142   MCFG_DEVICE_ADD ("pit2", PIT68230, 16670000 / 2)   // XXX verify clock
143
144134   MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0)
145135   MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(besta_state, kbd_put))
146136MACHINE_CONFIG_END
r249094r249095
161151/* Driver */
162152
163153/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT                 INIT    COMPANY         FULLNAME       FLAGS */
164COMP( 1988, besta88,  0,      0,     besta,     besta,   driver_device,  0,  "Sapsan", "Besta-88", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW)
154COMP( 1988, besta88,  0,      0,     besta,     besta,   driver_device,  0,  "Sapsan", "Besta-88", MACHINE_NOT_WORKING | MACHINE_NO_SOUND)
trunk/src/mess/drivers/canon_s80.c
r249094r249095
1// license:GPL2+
2// copyright-holders:FelipeSanches
3/*
4 * canon_s80.c
5 *
6 *    CANON S-80 electronic typewriter
7 *
8 * skeleton driver by:
9 *    Felipe Correa da Silva Sanches <juca@members.fsf.org>
10 *
11 * known issues:
12 *  - memory-map is uncertain
13 *  - maincpu clock is guessed
14 *  - still need to hookup the Hitachi HD44780 LCD Controller
15 *  - still lacks description of the keyboard inputs
16 *  - as well as a "paper" device to plot the output of the dot matrix print head
17 */
18
19#include "emu.h"
20#include "cpu/m6800/m6800.h"
21//#include "video/hd44780.h"
22
23class canons80_state : public driver_device
24{
25public:
26   canons80_state(const machine_config &mconfig, device_type type, const char *tag)
27         : driver_device(mconfig, type, tag)
28         { }
29
30   DECLARE_DRIVER_INIT(canons80);
31};
32
33
34static ADDRESS_MAP_START(canons80_map, AS_PROGRAM, 8, canons80_state )
35    AM_RANGE(0x0000, 0x7fff) AM_RAM
36    AM_RANGE(0x8000, 0xffff) AM_ROM
37ADDRESS_MAP_END
38
39static MACHINE_CONFIG_START( canons80, canons80_state )
40   /* basic machine hardware */
41   MCFG_CPU_ADD("maincpu", HD6301, 5000000) /* hd63a01xop 5 MHz guessed: TODO: check on PCB */
42   MCFG_CPU_PROGRAM_MAP(canons80_map)
43MACHINE_CONFIG_END
44
45DRIVER_INIT_MEMBER(canons80_state, canons80)
46{}
47
48ROM_START( canons80 )
49   ROM_REGION( 0x10000, "maincpu", 0 ) /* 6800 code */
50   ROM_LOAD( "canon_8735kx_nh4-0029_064.ic6", 0x8000, 0x8000, CRC(b6cd2ff7) SHA1(e47a136300c826e480fac1be7fc090523078a2a6) )
51ROM_END
52
53/*    YEAR  NAME      PARENT  COMPAT   MACHINE  INPUT  INIT                      COMPANY  FULLNAME                            FLAGS */
54COMP( 1988, canons80,      0,      0, canons80,     0, canons80_state, canons80, "Canon", "Canon S-80 electronic typewriter", MACHINE_NOT_WORKING | MACHINE_NO_SOUND)
trunk/src/mess/drivers/dvk_kcgd.c
r249094r249095
1/***************************************************************************
2
3    KCGD (Kontroller Cvetnogo Graficheskogo Displeya = Colour Graphics
4    Display Controller), a replacement for KSM (dvk_ksm.c) in later
5    models of DVK desktops.
6
7    MPI (Q-Bus clone) board. Interfaces with MS7004 (DEC LK201 workalike)
8    keyboard, mouse, and monochrome or color CRT.
9
10    To do:
11    - K1801VM2 CPU core (interrupts and EVNT pin, full EIS set, other insns)
12    - Everything else :-)
13
14****************************************************************************/
15
16#include "emu.h"
17
18#include "bus/rs232/rs232.h"
19#include "cpu/t11/t11.h"
20#include "machine/clock.h"
21#include "machine/ms7004.h"
22
23#define KCGD_TOTAL_HORZ 1000   // XXX verify
24#define KCGD_DISP_HORZ  800
25#define KCGD_HORZ_START 200   // XXX verify
26
27#define KCGD_TOTAL_VERT 600   // XXX verify
28#define KCGD_DISP_VERT  480
29#define KCGD_VERT_START 100   // XXX verify
30
31#define KCGD_STATUS_PAGE   0
32#define KCGD_STATUS_INTERLACE   1
33#define KCGD_STATUS_TIMER_INT   5
34#define KCGD_STATUS_MODE_INT   6
35#define KCGD_STATUS_MODE_LAST   7
36#define KCGD_STATUS_TIMER_VAL   15
37
38#define KCGD_PAGE_0   015574
39#define KCGD_PAGE_1   005574
40
41#define VERBOSE_DBG 1       /* general debug messages */
42
43#define DBG_LOG(N,M,A) \
44   do { \
45      if(VERBOSE_DBG>=N) \
46      { \
47         if( M ) \
48            logerror("%11.6f at %s: %-24s",machine().time().as_double(),machine().describe_context(),(char*)M ); \
49         logerror A; \
50      } \
51   } while (0)
52
53
54class kcgd_state : public driver_device
55{
56public:
57   kcgd_state(const machine_config &mconfig, device_type type, const char *tag) :
58      driver_device(mconfig, type, tag),
59      m_maincpu(*this, "maincpu"),
60//      m_ms7004(*this, "ms7004"),
61      m_palette(*this, "palette"),
62      m_screen(*this, "screen")
63   { }
64
65   virtual void machine_reset();
66   virtual void video_start();
67   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
68   TIMER_DEVICE_CALLBACK_MEMBER(scanline_callback);
69   DECLARE_PALETTE_INIT(kcgd);
70
71   enum
72   {
73      TIMER_ID_VSYNC_ON,
74      TIMER_ID_VSYNC_OFF,
75      TIMER_ID_500HZ
76   };
77   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
78
79   DECLARE_WRITE_LINE_MEMBER(write_keyboard_clock);
80   DECLARE_WRITE_LINE_MEMBER(write_line_clock);
81
82   DECLARE_READ16_MEMBER(vram_addr_r);
83   DECLARE_READ16_MEMBER(vram_data_r);
84   DECLARE_READ16_MEMBER(vram_mmap_r);
85   DECLARE_WRITE16_MEMBER(vram_addr_w);
86   DECLARE_WRITE16_MEMBER(vram_data_w);
87   DECLARE_WRITE16_MEMBER(vram_mmap_w);
88   DECLARE_READ16_MEMBER(status_r);
89   DECLARE_WRITE16_MEMBER(status_w);
90   DECLARE_READ8_MEMBER(palette_index_r);
91   DECLARE_READ8_MEMBER(palette_data_r);
92   DECLARE_WRITE8_MEMBER(palette_index_w);
93   DECLARE_WRITE8_MEMBER(palette_data_w);
94
95   emu_timer *m_vsync_on_timer;
96   emu_timer *m_vsync_off_timer;
97   emu_timer *m_500hz_timer;
98
99private:
100   void draw_scanline(UINT16 *p, UINT16 offset);
101   rectangle m_tmpclip;
102   bitmap_ind16 m_tmpbmp;
103
104   struct {
105      UINT16 status;   // 167770
106      UINT8 control;   // 167772
107      int palette_index, vram_addr;
108      UINT8 palette[16];
109   } m_video;
110   UINT32 *m_videoram;
111
112protected:
113   required_device<cpu_device> m_maincpu;
114//   required_device<ms7004_device> m_ms7004;
115   required_device<palette_device> m_palette;
116   required_device<screen_device> m_screen;
117};
118
119static ADDRESS_MAP_START( kcgd_mem, AS_PROGRAM, 16, kcgd_state )
120   ADDRESS_MAP_UNMAP_HIGH
121   AM_RANGE (0000000, 0077777) AM_READWRITE(vram_mmap_r, vram_mmap_w)
122   AM_RANGE (0100000, 0157777) AM_ROM
123   AM_RANGE (0160000, 0160001) AM_MIRROR(03774) AM_READWRITE(vram_addr_r, vram_addr_w)
124   AM_RANGE (0160002, 0160003) AM_MIRROR(03774) AM_READWRITE(vram_data_r, vram_data_w)
125   AM_RANGE (0167770, 0167771) AM_READWRITE(status_r, status_w)
126   AM_RANGE (0167772, 0167773) AM_READWRITE8(palette_index_r, palette_index_w, 0x00ff)   // reads always return 0
127   AM_RANGE (0167772, 0167773) AM_READWRITE8(palette_data_r, palette_data_w, 0xff00)
128//   AM_RANGE (0176560, 0176567) AM_RAM   // USART2 -- host
129//   AM_RANGE (0177560, 0177567) AM_RAM   // USART3 -- keyboard
130ADDRESS_MAP_END
131
132void kcgd_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
133{
134   switch (id)
135   {
136/*
137   case TIMER_ID_VSYNC_ON:
138      m_maincpu->set_input_line(INPUT_LINE_EVNT, ASSERT_LINE);
139      break;
140
141   case TIMER_ID_VSYNC_OFF:
142      m_maincpu->set_input_line(INPUT_LINE_EVNT, CLEAR_LINE);
143      break;
144*/
145   case TIMER_ID_500HZ:
146      m_video.status ^= (1 << KCGD_STATUS_TIMER_VAL);
147      break;
148   }
149}
150
151void kcgd_state::machine_reset()
152{
153   memset(&m_video, 0, sizeof(m_video));
154}
155
156void kcgd_state::video_start()
157{
158//   screen_device *screen = machine().device<screen_device>("screen");
159
160   // 64 kwords, word size is 17 bits
161   m_videoram = auto_alloc_array(machine(), UINT32, 65536);
162
163   m_tmpclip = rectangle(0, KCGD_DISP_HORZ-1, 0, KCGD_DISP_VERT-1);
164   m_tmpbmp.allocate(KCGD_DISP_HORZ, KCGD_DISP_VERT);
165/*
166   m_vsync_on_timer = timer_alloc(TIMER_ID_VSYNC_ON);
167   m_vsync_on_timer->adjust(screen->time_until_pos(0, 0), 0, screen->frame_period());
168
169   m_vsync_off_timer = timer_alloc(TIMER_ID_VSYNC_OFF);
170   m_vsync_off_timer->adjust(screen->time_until_pos(16, 0), 0, screen->frame_period());
171*/
172   m_500hz_timer = timer_alloc(TIMER_ID_500HZ);
173   m_500hz_timer->adjust(attotime::from_hz(500), 0, attotime::from_hz(500));
174}
175
176PALETTE_INIT_MEMBER(kcgd_state, kcgd)
177{
178   for (int i = 0; i < 16; i++)
179   {
180      palette.set_pen_color(i, i?i:255, i?i:255, i?i:255);
181   }
182}
183
184/*
185   VRAM is 128K and is word-addressable, so address fits into 16 bits.
186   Low 32K of VRAM are not used to store pixel data -- XXX.
187*/
188WRITE16_MEMBER(kcgd_state::vram_addr_w)
189{
190   DBG_LOG(3,"VRAM WA", ("%06o\n", data));
191   m_video.vram_addr = data;
192}
193
194READ16_MEMBER(kcgd_state::vram_addr_r)
195{
196   DBG_LOG(3,"VRAM RA", ("\n"));
197   return m_video.vram_addr;
198}
199
200WRITE16_MEMBER(kcgd_state::vram_data_w)
201{
202   DBG_LOG(1,"VRAM W2", ("%06o <- %04XH\n", m_video.vram_addr, data));
203   m_videoram[m_video.vram_addr] = data | (BIT(m_video.control, 7) << 16);
204}
205
206READ16_MEMBER(kcgd_state::vram_data_r)
207{
208   DBG_LOG(2,"VRAM R2", ("%06o\n", m_video.vram_addr));
209   m_video.status = (m_video.status & 0xff7f) | (BIT(m_videoram[m_video.vram_addr], 16) << 7);
210   return (UINT16) (m_videoram[m_video.vram_addr] & 0xffff);
211}
212
213WRITE16_MEMBER(kcgd_state::vram_mmap_w)
214{
215   DBG_LOG(3,"VRAM W1", ("%06o <- %04XH\n", offset, data));
216   m_videoram[offset] = data | (BIT(m_video.control, 7) << 16);
217}
218
219READ16_MEMBER(kcgd_state::vram_mmap_r)
220{
221   DBG_LOG(3,"VRAM R1", ("%06o\n", offset));
222   return (UINT16) (m_videoram[offset] & 0xffff);
223}
224
225WRITE16_MEMBER(kcgd_state::status_w)
226{
227   DBG_LOG(1,"Status W", ("data %04XH (useful %02XH)\n", data, data & 0x63));
228   // bits 7 and 15 are read-only
229   m_video.status = (m_video.status & 0x8080) | (data & 0x7f7f);
230}
231
232READ16_MEMBER(kcgd_state::status_r)
233{
234   UINT16 data = m_video.status ^ (BIT(m_video.control, 6) << 7);
235   DBG_LOG(1,"Status R", ("data %04X index %d\n", data, m_video.palette_index));
236   return data;
237}
238
239WRITE8_MEMBER(kcgd_state::palette_index_w)
240{
241   m_video.control = data;
242   m_video.palette_index = ((data >> 2) & 15);
243   DBG_LOG(1,"Palette index, Control W", ("data %02XH index %d\n", data, m_video.palette_index));
244}
245
246WRITE8_MEMBER(kcgd_state::palette_data_w)
247{
248   DBG_LOG(1,"Palette data W", ("data %02XH index %d\n", data, m_video.palette_index));
249   m_video.palette[m_video.palette_index] = data;
250   m_palette->set_pen_color(m_video.palette_index,
251      85*(data & 3), 85*((data >> 2) & 3), 85*((data >> 4) & 3));
252}
253
254READ8_MEMBER(kcgd_state::palette_index_r)
255{
256   return 0;
257}
258
259READ8_MEMBER(kcgd_state::palette_data_r)
260{
261   DBG_LOG(1,"Palette data R", ("index %d\n", m_video.palette_index));
262   return m_video.palette[m_video.palette_index];
263}
264
265/*
266    Raster sizes are:
267    - 800(400)x480 in hires(lores) 60 Hz interlaced mode
268    - 800(400)x240 in hires(lores) 30 Hz progressive mode
269
270    Video memory is 17 bits wide (bit 16 indicates hi/lo res mode for each word,
271    host writes it separately (via bit 7 in 167772).
272*/
273
274void kcgd_state::draw_scanline(UINT16 *p, UINT16 offset)
275{
276   int i;
277
278   for ( i = 0; i < 100; i++ )
279   {
280      UINT32 data = m_videoram[ offset++ ];
281      if (BIT(data, 16)) {
282         *p = ( data >> 12) & 0x0F; p++;
283         *p = ( data >> 12) & 0x0F; p++;
284         *p = ( data >> 8 ) & 0x0F; p++;
285         *p = ( data >> 8 ) & 0x0F; p++;
286         *p = ( data >> 4 ) & 0x0F; p++;
287         *p = ( data >> 4 ) & 0x0F; p++;
288         *p =   data        & 0x0F; p++;
289         *p =   data        & 0x0F; p++;
290      } else {
291         *p = 5*(( data >> 14) & 0x03); p++;
292         *p = 5*(( data >> 12) & 0x03); p++;
293         *p = 5*(( data >> 10) & 0x03); p++;
294         *p = 5*(( data >> 8 ) & 0x03); p++;
295         *p = 5*(( data >> 6 ) & 0x03); p++;
296         *p = 5*(( data >> 4 ) & 0x03); p++;
297         *p = 5*(( data >> 2 ) & 0x03); p++;
298         *p = 5*(  data        & 0x03); p++;
299      }
300   }
301}
302
303TIMER_DEVICE_CALLBACK_MEMBER(kcgd_state::scanline_callback)
304{
305   UINT16 y = m_screen->vpos(), offset;
306
307   if (y < KCGD_VERT_START) return;
308   y -= KCGD_VERT_START;
309   if (y >= KCGD_DISP_VERT) return;
310
311   offset = BIT(m_video.status, KCGD_STATUS_PAGE) ? (KCGD_PAGE_1 >> 1) : (KCGD_PAGE_0 >> 1);
312
313   DBG_LOG(2,"scanline_cb", ("frame %" I64FMT "d y %.3d page %d offset %04X *offset %04X\n",
314      m_screen->frame_number(), BIT(m_video.status, KCGD_STATUS_PAGE),
315      y, offset + y, m_videoram[offset + y]));
316
317   draw_scanline(&m_tmpbmp.pix16(y), m_videoram[offset + (KCGD_DISP_VERT-1) - y]);
318}
319
320UINT32 kcgd_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
321{
322   copybitmap(bitmap, m_tmpbmp, 0, 0, KCGD_HORZ_START, KCGD_VERT_START, cliprect);
323   return 0;
324}
325
326/* F4 Character Displayer */
327static const gfx_layout kcgd_charlayout =
328{
329   8, 10,                  /* 8x10 pixels */
330   256,                    /* 256 characters */
331   1,                      /* 1 bits per pixel */
332   { 0 },                  /* no bitplanes */
333   /* x offsets */
334   { 0, 1, 2, 3, 4, 5, 6, 7 },
335   /* y offsets */
336   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8 },
337   8*10                    /* every char takes 10 bytes */
338};
339
340static GFXDECODE_START( kcgd )
341   GFXDECODE_ENTRY("maincpu", 0112236, kcgd_charlayout, 0, 1)
342GFXDECODE_END
343
344static MACHINE_CONFIG_START( kcgd, kcgd_state )
345   MCFG_CPU_ADD("maincpu", K1801VM2, XTAL_30_8MHz/4)
346   MCFG_CPU_PROGRAM_MAP(kcgd_mem)
347   MCFG_T11_INITIAL_MODE(0100000)
348
349   MCFG_TIMER_DRIVER_ADD_PERIODIC("scantimer", kcgd_state, scanline_callback, attotime::from_hz(50*28*11)) // XXX verify
350   MCFG_TIMER_START_DELAY(attotime::from_hz(XTAL_30_8MHz/KCGD_HORZ_START))
351
352   MCFG_SCREEN_ADD("screen", RASTER)
353   MCFG_SCREEN_UPDATE_DRIVER(kcgd_state, screen_update)
354   MCFG_SCREEN_RAW_PARAMS(XTAL_30_8MHz, KCGD_TOTAL_HORZ, KCGD_HORZ_START,
355      KCGD_HORZ_START+KCGD_DISP_HORZ, KCGD_TOTAL_VERT, KCGD_VERT_START,
356      KCGD_VERT_START+KCGD_DISP_VERT);
357
358   MCFG_SCREEN_PALETTE("palette")
359   MCFG_PALETTE_ADD("palette", 16)
360   MCFG_PALETTE_INIT_OWNER(kcgd_state, kcgd)
361
362   MCFG_GFXDECODE_ADD("gfxdecode", "palette", kcgd)
363#if 0
364   MCFG_DEVICE_ADD("ms7004", MS7004, 0)
365   MCFG_MS7004_TX_HANDLER(DEVWRITELINE("i8251kbd", i8251_device, write_rxd))
366
367   MCFG_DEVICE_ADD("keyboard_clock", CLOCK, 4800*16)
368   MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(kcgd_state, write_keyboard_clock))
369#endif
370MACHINE_CONFIG_END
371
372ROM_START( dvk_kcgd )
373   ROM_REGION16_BE(0x100000,"maincpu", ROMREGION_ERASE00)
374   ROM_DEFAULT_BIOS("181")
375   ROM_SYSTEM_BIOS(0, "181", "mask 181")
376   ROMX_LOAD("kr1801re2-181.bin", 0100000, 020000, CRC(acac124f) SHA1(412c3eb71bece6f791fc5a9d707cf4692fd0b45b), ROM_BIOS(1))
377   ROM_SYSTEM_BIOS(1, "182", "mask 182")
378   ROMX_LOAD("kr1801re2-182.bin", 0100000, 020000, CRC(3ca2921a) SHA1(389b30c40ed7e41dae71d58c7bff630359a48153), ROM_BIOS(2))
379ROM_END
380
381/* Driver */
382
383/*    YEAR  NAME      PARENT  COMPAT   MACHINE    INPUT    INIT                      COMPANY     FULLNAME       FLAGS */
384COMP( 1987, dvk_kcgd, 0,      0,       kcgd,      0,       driver_device,     0,     "USSR",     "DVK KCGD",    MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW )
trunk/src/mess/drivers/force68k.c
r249094r249095
1// license:BSD-3-Clause
1// license:BSD-3-Clause
22// copyright-holders:Joakim Larsson Edstr??m
33/***************************************************************************
4 *
5 *  Force SYS68K CPU-1/CPU-6 VME SBC drivers, initially based on the 68ksbc.c
6 *
7 *  13/06/2015
8 *
9 * The info found on the links below is for a later revisions of the board I have
10 * but it is somewhat compatible so I got the system ROM up and running in terminal.
11 * My CPU-1 board has proms from 1983 and the PCB has no rev markings so probably
12 * the original or a very early design. The board real estate differs from the later
13 * CPU-1:s I found pictures of but has the same main chips and functions.
14 *
15 * http://bitsavers.trailing-edge.com/pdf/forceComputers/1988_Force_VMEbus_Products.pdf
16 * http://www.artisantg.com/info/P_wUovN.pdf
17 *
18 * Some info from those documents:
19 *
20 * Address Map
21 * ----------------------------------------------------------
22 * Address Range     Description
23 * ----------------------------------------------------------
24 * 000 000 - 000 007 Initialisation vectors from system EPROM
25 * 000 008 - 01F FFF Dynamic RAM on CPU-1 B
26 * 000 008 - 07F FFF Dynamic RAM on CPU-1 D
27 * 080 008 - 09F FFF SYSTEM EPROM Area
28 * OAO 000 - OBF FFF USER EPROMArea
29 * 0C0 041 - 0C0 043 ACIA (P3) Host
30 * 0C0 080 - 0C0 082 ACIA (P4) Terminal
31 * 0C0 101 - 0C0 103 ACIA (P5) Remote device (eg serial printer)
32 * 0C0 401 - 0C0 42F RTC
33 * OEO 001 - 0E0 035 PI/T (eg centronics printer)
34 * OEO 200 - 0E0 2FF FPU
35 * OEO 300 - 0E0 300 Reset Off
36 * OEO 380 - 0E0 380 Reset On
37 * 100 000 - FEF FFF VMEbus addresses (A24)
38 * FFO 000 - FFF FFF VMEbus Short I/O (A16)
39 * ----------------------------------------------------------
40 *
41 * Interrupt sources
42 * ----------------------------------------------------------
43 * Description                  Device  Lvl  IRQ    VME board
44 *                           /Board      Vector  Address
45 * ----------------------------------------------------------
46 * On board Sources
47 * ABORT                        Switch  7    31
48 * Real Time Clock (RTC)        58167A  6    30
49 * Parallel/Timer (PI/T)        68230   5    29
50 * Terminal ACIA                6850    4    28
51 * Remote ACIA                  6850    3    27
52 * Host ACIA                    6850    2    26
53 * ACFAIL, SYSFAIL              VME     5    29
54 * Off board Sources (other VME boards)
55 * 6 Port Serial I/O board      SIO     4    64-75  0xb00000
56 * 8 Port Serial I/O board      ISIO    4    76-83  0x960000
57 * Disk Controller              WFC     3    119    0xb01000
58 * SCSI Controller              ISCSI   4    119    0xa00000
59 * Slot 1 Controller Board      ASCU    7    31     0xb02000
60 * ----------------------------------------------------------
61 *
62 *  TODO:
63 *  - Finish 3 x ACIA6850, host and remote interface left, terminal works
64 *  - Finish 1 x 68230 Motorola, Parallel Interface / Timer as required by ROM
65 *    - Configure PIT to the Centronics device printer interface as
66 *      supported by ROM (DONE)
67 *  - Add 1 x Abort Switch
68 *  - Add 1 x Reset Switch
69 *  - Add 1 x Halt LED
70 *  - Add a jumper field device as supported by PCB
71 *  - Add configurable serial connector between ACIA:s and
72 *    - Real terminal emulator, ie rs232 "socket"
73 *    - Debug console
74 *  - Add VME bus driver
75 *
76 ****************************************************************************/
774
5    Force SYS68K CPU-1/CPU-6 VME SBC drivers, initially based on the 68ksbc.c
6
7    13/06/2015
8
9 The info found on the links below is for a later revisions of the board I have
10 but I hope it is somewhat compatible so I can get it up and running at least.
11 My CPU-1 board has proms from 1983 and no rev markings so probably the original.
12
13 http://bitsavers.trailing-edge.com/pdf/forceComputers/1988_Force_VMEbus_Products.pdf
14 http://www.artisantg.com/info/P_wUovN.pdf
15
16 Some info from those documents:
17
18Address Map
19----------------------------------------------------------
20Address Range     Description
21----------------------------------------------------------
22000 000 - 000 007 Initialisation vectors from system EPROM
23000 008 - 01F FFF Dynamic RAM on CPU-1 B
24000 008 - 07F FFF Dynamic RAM on CPU-1 D
25080 008 - 09F FFF SYSTEM EPROM Area
26OAO 000 - OBF FFF USER EPROMArea
270C0 041 - 0C0 043 ACIA (P3) Host
280C0 080 - 0C0 082 ACIA (P4) Terminal
290C0 101 - 0C0 103 ACIA (P5) Remote device (eg serial printer)
300C0 401 - 0C0 42F RTC
31OEO 001 - 0E0 035 PI/T (eg centronics printer)
32OEO 200 - 0E0 2FF FPU
33OEO 300 - 0E0 300 Reset Off
34OEO 380 - 0E0 380 Reset On
35100 000 - FEF FFF VMEbus addresses (A24)
36FFO 000 - FFF FFF VMEbus Short I/O (A16)
37----------------------------------------------------------
38
39Interrupt sources
40----------------------------------------------------------
41Description                  Device  Lvl  IRQ    VME board
42                             /Board      Vector  Address
43----------------------------------------------------------
44On board Sources
45 ABORT                        Switch  7    31
46 Real Time Clock (RTC)        58167A  6    30
47 Parallel/Timer (PI/T)        68230   5    29
48 Terminal ACIA                6850    4    28
49 Remote ACIA                  6850    3    27
50 Host ACIA                    6850    2    26
51 ACFAIL, SYSFAIL              VME     5    29
52Off board Sources (other VME boards)
53 6 Port Serial I/O board      SIO     4    64-75  0xb00000
54 8 Port Serial I/O board      ISIO    4    76-83  0x960000
55 Disk Controller              WFC     3    119    0xb01000
56 SCSI Controller              ISCSI   4    119    0xa00000
57 Slot 1 Controller Board      ASCU    7    31     0xb02000
58----------------------------------------------------------
59
6010. The VMEbus
61---------------
62The implemented VMEbus Interface includes 24 address, 16 data,
636 address modifier and the asynchronous control signals.
64A single level bus arbiter is provided to build multi master
65systems. In addition to the bus arbiter, a separate slave bus
66arbitration allows selection of the arbitration level (0-3).
67
68The address modifier range .,Short 110 Access?? can be selected
69via a jumper for variable system generation. The 7 interrupt
70request levels of the VMEbus are fully supported from the
71SYS68K1CPU-1 B/D. For multi-processing, each IRQ signal can be
72enabled/disabled via a jumper field.
73
74Additionally, the SYS68K1CPU-1 B/D supports the ACFAIL, SYSRESET,
75SYSFAIL and SYSCLK signal (16 MHz).
76
77
78    TODO:
79    - Finish 2 x ACIA6850, host and remote interface left, terminal works
80    - Finish 1 x 68230 Motorola, Parallel Interface / Timer
81      - Connect Port B to a Centronics printer interface
82    - Add 1 x Abort Switch
83    - Add configurable serial connector between ACIA:s and
84      - Real terminal emulator, ie rs232 "socket"
85      - Debug console
86    - Add VME bus driver
87
88****************************************************************************/
89
7890#include "emu.h"
7991#include "bus/rs232/rs232.h"
8092#include "cpu/m68000/m68000.h"
r249094r249095
8294#include "machine/68230pit.h"
8395#include "machine/6850acia.h"
8496#include "machine/clock.h"
85#include "bus/centronics/ctronics.h"
86#include "bus/generic/slot.h"
87#include "bus/generic/carts.h"
8897
89#define LOG(x) x
90
9198#define BAUDGEN_CLOCK XTAL_1_8432MHz
9299/*
93 * The baudrate on the Force68k CPU-1 to CPU-6 is generated by a
94 * Motorola 14411 bitrate generator, the CPU-6 documents matches the circuits
95 * that I could find on the CPU-1 board. Here how I calculated the clock for
96 * the factory settings. No need to add selectors until terminal.c supports
97 * configurable baudrates. Fortunality CPU-1 was shipped with 9600N8!
98 *
99 * From the documents:
100 *
101 * 3 RS232C interfaces, strap selectable baud rate from 110-9600 or 600-19200 baud
102 *
103 * Default Jumper Settings of B7:
104 * --------------------------------
105 * GND           10 - 11 RSA input on 14411
106 * F1 on 14411    1 - 20 Baud selector of the terminal port
107 * F1 on 14411    3 - 18 Baud selector of the host port
108 * F1 on 14411    5 - 16 Baud selector of the remote port
109 *
110 * The RSB input on the 14411 is kept high always so RSA=0, RSB=1 and a 1.8432MHz crystal
111 * generates 153600 on the F1 output pin which by default strapping is connected to all
112 * three 6850 acias on the board. These can be strapped separatelly to speedup downloads.
113 *
114 * The selectable outputs from 14411, F1-F16:
115 * X16 RSA=0,RSB=1: 153600, 115200, 76800, 57600, 38400, 28800, 19200, 9600, 4800, 3200, 2153.3, 1758.8, 1200, 921600, 1843000
116 * X64 RSA=1,RSB=1: 614400, 460800, 307200, 230400, 153600, 115200, 76800, 57600, 38400, 28800, 19200, 9600, 4800, 921600, 1843000
117 *
118 * However, the datasheet says baudrate is strapable for 110-9600 but the output is 153600
119 * so the system rom MUST setup the acia to divide by 16 to generate the correct baudrate.
120 *
121 */
100 The baudrate on the Force68k CPU-1 to CPU-6 is generated by a
101 Motorola 14411 bitrate generator, the CPU-6 documents matches the circuits
102 that I could find on the CPU-1 board. Here how I calculated the clock for
103 the factory settings. No need to add selectors until terminal.c supports
104 configurable baudrates. Fortunality CPU-1 was shipped with 9600N8!
105
106 From the documents:
107
108  3 RS232C interfaces, strap selectable baud rate from 110-9600 or 600-19200 baud
109
110  Default Jumper Settings of B7:
111  --------------------------------
112  GND           10 - 11 RSA input on 14411
113  F1 on 14411    1 - 20 Baud selector of the terminal port
114  F1 on 14411    3 - 18 Baud selector of the host port
115  F1 on 14411    5 - 16 Baud selector of the remote port
116
117 The RSB input on the 14411 is kept high always so RSA=0, RSB=1 and a 1.8432MHz crystal
118 generates 153600 on the F1 output pin which by default strapping is connected to all
119 three 6850 acias on the board. These can be strapped separatelly to speedup downloads.
120
121 The selectable outputs from 14411, F1-F16:
122 X16 RSA=0,RSB=1: 153600, 115200, 76800, 57600, 38400, 28800, 19200, 9600, 4800, 3200, 2153.3, 1758.8, 1200, 921600, 1843000
123 X64 RSA=1,RSB=1: 614400, 460800, 307200, 230400, 153600, 115200, 76800, 57600, 38400, 28800, 19200, 9600, 4800, 921600, 1843000
124
125 However, the datasheet says baudrate is strapable for 110-9600 but the output is 153600
126 so the system rom MUST setup the acia to divide by 16 to generate the correct baudrate.
127
128*/
122129#define ACIA_CLOCK (BAUDGEN_CLOCK / 12)
123130
124131class force68k_state : public driver_device
125132{
126133public:
127force68k_state(const machine_config &mconfig, device_type type, const char *tag) :
128        driver_device (mconfig, type, tag),
129        m_maincpu (*this, "maincpu"),
130        m_rtc (*this, "rtc"),
131        m_pit (*this, "pit"),
132        m_aciahost (*this, "aciahost"),
133        m_aciaterm (*this, "aciaterm"),
134        m_aciaremt (*this, "aciaremt"),
135        m_centronics (*this, "centronics")
136        , m_centronics_ack (0)
137        , m_centronics_busy (0)
138        , m_centronics_perror (0)
139        , m_centronics_select (0)
140        ,m_cart(*this, "exp_rom1")
141{
142}
134   force68k_state(const machine_config &mconfig, device_type type, const char *tag) :
135      driver_device(mconfig, type, tag),
136         //      m_rtc(*this, "rtc")
137         m_maincpu(*this, "maincpu"),
138         m_rtc(*this, "rtc"),
139         m_pit(*this, "pit"),
140         m_aciahost(*this, "aciahost"),
141         m_aciaterm(*this, "aciaterm"),
142         m_aciaremt(*this, "aciaremt")
143   {
144   }
143145
144DECLARE_READ16_MEMBER (bootvect_r);
145DECLARE_READ16_MEMBER (vme_a24_r);
146DECLARE_WRITE16_MEMBER (vme_a24_w);
147DECLARE_READ16_MEMBER (vme_a16_r);
148DECLARE_WRITE16_MEMBER (vme_a16_w);
149virtual void machine_start ();
150// clocks
151DECLARE_WRITE_LINE_MEMBER (write_aciahost_clock);
152DECLARE_WRITE_LINE_MEMBER (write_aciaterm_clock);
153DECLARE_WRITE_LINE_MEMBER (write_aciaremt_clock);
154// centronics printer interface
155DECLARE_WRITE_LINE_MEMBER (centronics_ack_w);
156DECLARE_WRITE_LINE_MEMBER (centronics_busy_w);
157DECLARE_WRITE_LINE_MEMBER (centronics_perror_w);
158DECLARE_WRITE_LINE_MEMBER (centronics_select_w);
159// User EPROM/SRAM slot(s)
160int force68k_load_cart(device_image_interface &image, generic_slot_device *slot);
161DECLARE_DEVICE_IMAGE_LOAD_MEMBER (exp1_load) { return force68k_load_cart(image, m_cart); }
162DECLARE_READ16_MEMBER (read16_rom);
146   DECLARE_READ16_MEMBER(bootvect_r);
147   virtual void machine_start();
148   DECLARE_WRITE_LINE_MEMBER(write_aciahost_clock);
149   DECLARE_WRITE_LINE_MEMBER(write_aciaterm_clock);
150   DECLARE_WRITE_LINE_MEMBER(write_aciaremt_clock);
163151
164protected:
165
166152private:
167required_device<cpu_device> m_maincpu;
168required_device<mm58167_device> m_rtc;
169required_device<pit68230_device> m_pit;
170required_device<acia6850_device> m_aciahost;
171required_device<acia6850_device> m_aciaterm;
172required_device<acia6850_device> m_aciaremt;
173optional_device<centronics_device> m_centronics;
153   required_device<cpu_device> m_maincpu;
154   required_device<mm58167_device> m_rtc;
155   required_device<pit68230_device> m_pit;
156   required_device<acia6850_device> m_aciahost;
157   required_device<acia6850_device> m_aciaterm;
158   required_device<acia6850_device> m_aciaremt;
174159
175INT32 m_centronics_ack;
176INT32 m_centronics_busy;
177INT32 m_centronics_perror;
178INT32 m_centronics_select;
179
180// Pointer to System ROMs needed by bootvect_r
181UINT16  *m_sysrom;
182UINT16  *m_usrrom;
183
184required_device<generic_slot_device> m_cart;
185
160   // Pointer to System ROMs needed by bootvect_r
161   UINT16  *m_sysrom;
186162};
187163
188static ADDRESS_MAP_START (force68k_mem, AS_PROGRAM, 16, force68k_state)
189ADDRESS_MAP_UNMAP_HIGH
190AM_RANGE (0x000000, 0x000007) AM_ROM AM_READ (bootvect_r)       /* Vectors mapped from System EPROM */
191AM_RANGE (0x000008, 0x01ffff) AM_RAM /* DRAM CPU-1B */
192//AM_RANGE (0x020000, 0x07ffff) AM_RAM /* Additional DRAM CPU-1D */
193AM_RANGE (0x080000, 0x083fff) AM_ROM /* System EPROM Area 16Kb DEBUGGER supplied as default on CPU-1B/D     */
194AM_RANGE (0x084000, 0x09ffff) AM_ROM /* System EPROM Area 112Kb additional space for System ROM     */
195//AM_RANGE (0x0a0000, 0x0bffff) AM_ROM /* User EPROM/SRAM Area, max 128Kb mapped by a cartslot  */
196AM_RANGE (0x0c0040, 0x0c0041) AM_DEVREADWRITE8 ("aciahost", acia6850_device, status_r, control_w, 0x00ff)
197AM_RANGE (0x0c0042, 0x0c0043) AM_DEVREADWRITE8 ("aciahost", acia6850_device, data_r, data_w, 0x00ff)
198AM_RANGE (0x0c0080, 0x0c0081) AM_DEVREADWRITE8 ("aciaterm", acia6850_device, status_r, control_w, 0xff00)
199AM_RANGE (0x0c0082, 0x0c0083) AM_DEVREADWRITE8 ("aciaterm", acia6850_device, data_r, data_w, 0xff00)
200AM_RANGE (0x0c0100, 0x0c0101) AM_DEVREADWRITE8 ("aciaremt", acia6850_device, status_r, control_w, 0x00ff)
201AM_RANGE (0x0c0102, 0x0c0103) AM_DEVREADWRITE8 ("aciaremt", acia6850_device, data_r, data_w, 0x00ff)
202AM_RANGE (0x0c0400, 0x0c042f) AM_DEVREADWRITE8 ("rtc", mm58167_device, read, write, 0x00ff)
203AM_RANGE (0x0e0000, 0x0e0035) AM_DEVREADWRITE8 ("pit", pit68230_device, read, write, 0x00ff)
164static ADDRESS_MAP_START(force68k_mem, AS_PROGRAM, 16, force68k_state)
165      ADDRESS_MAP_UNMAP_HIGH
166      AM_RANGE(0x000000, 0x000007) AM_ROM AM_READ(bootvect_r) /* Vectors mapped from System EPROM */
167      AM_RANGE(0x000008, 0x01ffff) AM_RAM /* DRAM */
168      AM_RANGE(0x080000, 0x09ffff) AM_ROM /* System EPROM Area */
169//  AM_RANGE(0x0a0000, 0x0bffff) AM_ROM /* User EPROM Area   */
170   AM_RANGE(0x0c0040, 0x0c0041) AM_DEVREADWRITE8("aciahost", acia6850_device, status_r, control_w, 0x00ff)
171   AM_RANGE(0x0c0042, 0x0c0043) AM_DEVREADWRITE8("aciahost", acia6850_device, data_r, data_w, 0x00ff)
172   AM_RANGE(0x0c0080, 0x0c0081) AM_DEVREADWRITE8("aciaterm", acia6850_device, status_r, control_w, 0xff00)
173   AM_RANGE(0x0c0082, 0x0c0083) AM_DEVREADWRITE8("aciaterm", acia6850_device, data_r, data_w, 0xff00)
174   AM_RANGE(0x0c0100, 0x0c0101) AM_DEVREADWRITE8("aciaremt", acia6850_device, status_r, control_w, 0x00ff)
175   AM_RANGE(0x0c0102, 0x0c0103) AM_DEVREADWRITE8("aciaremt", acia6850_device, data_r, data_w, 0x00ff)
176      AM_RANGE(0x0c0400, 0x0c042f) AM_DEVREADWRITE8("rtc", mm58167_device, read, write, 0x00ff)
177      AM_RANGE(0x0e0000, 0x0e0035) AM_DEVREADWRITE8("pit", pit68230_device, data_r, data_w, 0x00ff)
204178//      AM_RANGE(0x0e0200, 0x0e0380) AM_READWRITE(fpu_r, fpu_w) /* optional FPCP 68881 FPU interface */
205AM_RANGE(0x100000, 0xfeffff)  AM_READWRITE(vme_a24_r, vme_a24_w) /* VMEbus Rev B addresses (24 bits) */
206AM_RANGE(0xff0000, 0xffffff)  AM_READWRITE(vme_a16_r, vme_a16_w) /* VMEbus Rev B addresses (16 bits) */
179//      AM_RANGE(0x100000, 0xfeffff) /* VMEbus Rev B addresses (24 bits) */
180//      AM_RANGE(0xff0000, 0xffffff) /* VMEbus Rev B addresses (16 bits) */
207181ADDRESS_MAP_END
208182
209183/* Input ports */
210static INPUT_PORTS_START (force68k)
184static INPUT_PORTS_START( force68k )
211185INPUT_PORTS_END
212186
213/*
214 *  Centronics support
215 *
216 *  The system ROMs has support for a parallel printer interface but the signals are just routed to row A
217 *  of the VME P2 connector so no on board Centronics connector is available but assumed to be added on a
218 *  separate I/O board. After some detective work I found that the ROM works as follows:
219 *
220 *  The 'PA' (Printer Attach) command issues a <cr> on Port A and sends a strobe on H2 it then loops over
221 *  the select signal, bit 0 on Port B, and the ack signal on HS1, both to be non zero. The support is really
222 *  flawed as the strobe signal goes high instead of low ( this might assume an inverting driver on the
223 *  P2 board ) and the busy signal is not checked at all. Or I might have assumed it all wrong, but it now
224 *  works with the generic centronics printer driver. Need the printer board documentation to improve further.
225 *
226 *  When the 'PA' command is successful everything printed to screen is mirrored on the printer. Use the
227 *  'NOPA' command to stop mirroring. I had no printer ROMs so could not test it with a "real" printer.
228 *
229 *  Force CPU-1 init sequence for MC68230 PIT
230 *  -----------------------------------------
231 *  0801E6 0E0000 W 00 -> PGCR  Mode 0 (uni8), H34 dis, H12 dis, H1234 HZ
232 *  0801E6 0E0002 W 00 -> PSRR  PC4, PC5, H1S>H2S>H3S>H4S
233 *  0801E6 0E0004 W FF -> PADDR Port A all Outputs
234 *  0801E6 0E0006 W 00 -> PBDDR Port B all Inputs
235 *  0801EA 0E000C W 60 -> PACR  Port A Mode 01, pin def, dbfr H1 data rec, H2 status/int, H2 output neg, H2S clrd
236 *  0801F0 0E000E W A0 -> PBCR  Port B mode 1x, H4 output neg, H4S clrd, H3 int dis, H3 edg input, H3S set by assrt edg
237 *  0801F6 0E0000 W 30 -> PGCR  H34 enable, H12enable
238 *  0801FC 0E000E W A8 -> PBCR  +H4 asserted
239 *  08020A 0E000E W A0 -> PBCR  +H4 negated
240 *
241 *  Upon PA (Printer Attach) command enabling the Centronics printer mode
242 *  ---------------------------------------------------------------------
243 *  081DB4 0E0011 W D0 -> PADR  Data to Port A
244 *  081DB8 0E000D W 68 -> PACR  H2 output asserted Centronics Strobe
245 *  081DC0 0E000D W 60 -> PACR  H2 output negated
246 *  081DD0 0E0013 R 00 <- PBDR  Port B polled for 01 (data) & 03 (mask)
247 *
248 */
249
250/* Centronics ACK handler
251 * The centronics ack signal is expected by the ROM to arrive at H1 input line
252 */
253WRITE_LINE_MEMBER (force68k_state::centronics_ack_w)
187void force68k_state::machine_start()
254188{
255//      LOG (logerror ("centronics_ack_w(%d) %lld\n", state, m_maincpu->total_cycles ()));
256        m_centronics_ack = state;
257        m_pit->h1_set (state);
189   m_sysrom = (UINT16*)(memregion("maincpu")->base() + 0x080000);
258190}
259191
260/* Centronics BUSY handler
261 * The centronics busy signal is not used by the ROM driver afaik
262 */
263WRITE_LINE_MEMBER (force68k_state::centronics_busy_w){
264//      LOG (logerror ("centronics_busy_w(%d) %lld\n", state, m_maincpu->total_cycles ()));
265        m_centronics_busy = state;
192READ16_MEMBER(force68k_state::bootvect_r)
193{
194      return m_sysrom[offset];
266195}
267196
268/* Centronics PERROR handler
269 * The centronics perror signal is not used by the ROM driver afaik
270 */
271WRITE_LINE_MEMBER (force68k_state::centronics_perror_w){
272//      LOG (logerror ("centronics_perror_w(%d) %lld\n", state, m_maincpu->total_cycles ()));
273        m_centronics_perror = state;
197WRITE_LINE_MEMBER(force68k_state::write_aciahost_clock)
198{
199      m_aciahost->write_txc(state);
200   m_aciahost->write_rxc(state);
274201}
275202
276/* Centronics SELECT handler
277 * The centronics select signal is expected by the ROM on Port B bit 0
278 */
279WRITE_LINE_MEMBER (force68k_state::centronics_select_w){
280//      LOG (logerror ("centronics_select_w(%d) %lld\n", state, m_maincpu->total_cycles ()));
281        m_centronics_select = state;
282        m_pit->portb_setbit (0, state);
283}
284
285/* Start it up */
286void force68k_state::machine_start ()
203WRITE_LINE_MEMBER(force68k_state::write_aciaterm_clock)
287204{
288        LOG (logerror ("machine_start\n"));
289
290        save_item (NAME (m_centronics_busy));
291        save_item (NAME (m_centronics_ack));
292        save_item (NAME (m_centronics_select));
293        save_item (NAME (m_centronics_perror));
294
295        /* Setup pointer to bootvector in ROM for bootvector handler bootvect_r */
296        m_sysrom = (UINT16*)(memregion ("maincpu")->base () + 0x080000);
297
298        /* Map user ROM/RAM socket(s) */
299        if (m_cart->exists())
300        {
301                m_usrrom = (UINT16*)m_cart->get_rom_base();
302#if 0 // This should be the correct way but produces odd and even bytes swapped
303                m_maincpu->space(AS_PROGRAM).install_read_handler(0xa0000, 0xbffff, read16_delegate(FUNC(generic_slot_device::read16_rom), (generic_slot_device*)m_cart));
304#else // So we installs a custom very ineffecient handler for now until we understand hwp to solve the problem better
305                m_maincpu->space(AS_PROGRAM).install_read_handler(0xa0000, 0xbffff, read16_delegate(FUNC(force68k_state::read16_rom), this));
306#endif
307        }
205      m_aciaterm->write_txc(state);
206   m_aciaterm->write_rxc(state);
308207}
309208
310/* A very ineffecient User cart emulation of two 8 bit sockets (odd and even) */
311READ16_MEMBER (force68k_state::read16_rom){
312  offset = offset % m_cart->common_get_size("rom"); // Don't read outside buffer...
313  return ((m_usrrom [offset] << 8) & 0xff00) | ((m_usrrom [offset] >> 8) & 0x00ff);
314}
315
316/* Boot vector handler, the PCB hardwires the first 8 bytes from 0x80000 to 0x0 */
317READ16_MEMBER (force68k_state::bootvect_r){
318        return m_sysrom [offset];
319}
320
321/* 10. The VMEbus (text from board documentation)
322 * ---------------
323 * The implemented VMEbus Interface includes 24 address, 16 data,
324 * 6 address modifier and the asynchronous control signals.
325 * A single level bus arbiter is provided to build multi master
326 * systems. In addition to the bus arbiter, a separate slave bus
327 * arbitration allows selection of the arbitration level (0-3).
328 *
329 * The address modifier range .,Short 110 Access« can be selected
330 * via a jumper for variable system generation. The 7 interrupt
331 * request levels of the VMEbus are fully supported from the
332 * SYS68K1CPU-1 B/D. For multi-processing, each IRQ signal can be
333 * enabled/disabled via a jumper field.
334 *
335 * Additionally, the SYS68K1CPU-1 B/D supports the ACFAIL, SYSRESET,
336 * SYSFAIL and SYSCLK signal (16 MHz).
337 */
338
339/* Dummy VME access methods until the VME bus device is ready for use */
340READ16_MEMBER (force68k_state::vme_a24_r){
341        LOG (logerror ("vme_a24_r\n"));
342        return (UINT16) 0;
343}
344
345WRITE16_MEMBER (force68k_state::vme_a24_w){
346        LOG (logerror ("vme_a24_w\n"));
347}
348
349READ16_MEMBER (force68k_state::vme_a16_r){
350        LOG (logerror ("vme_16_r\n"));
351        return (UINT16) 0;
352}
353
354WRITE16_MEMBER (force68k_state::vme_a16_w){
355        LOG (logerror ("vme_a16_w\n"));
356}
357
358/*
359 * Serial port clock sources can all be driven by different outputs of the 14411
360 */
361WRITE_LINE_MEMBER (force68k_state::write_aciahost_clock){
362        m_aciahost->write_txc (state);
363        m_aciahost->write_rxc (state);
364}
365
366WRITE_LINE_MEMBER (force68k_state::write_aciaterm_clock){
367        m_aciaterm->write_txc (state);
368        m_aciaterm->write_rxc (state);
369}
370
371WRITE_LINE_MEMBER (force68k_state::write_aciaremt_clock){
372        m_aciaremt->write_txc (state);
373        m_aciaremt->write_rxc (state);
374}
375
376/*
377 * 4. The USER Area (Text from the board manual)
378  The USER area contains two 28 pin sockets with JEDEC compatible pin out.
379   To allow the usage of static RAM's, the access to the USER area is byte
380   oriented. Table 3. lists the usable device types.
381
382   Bits   Bytes    EPROM SRAM
383   --------------------------
384   2Kx16   4 Kbyte 2716  6116
385   4Kx16   8 Kbyte 2732
386   8Kx16  16 Kbyte 2764  6264
387   16Kx16 32 Kbyte 27128
388   32Kx16 64 Kbyte 27256
389   --------------------------
390*/
391// Implementation of static 2 x 64K EPROM in sockets J10/J11 as 16 bit wide cartridge for easier
392// software handling. TODO: make configurable according to table above.
393static MACHINE_CONFIG_FRAGMENT( fccpu1_eprom_sockets )
394        MCFG_GENERIC_CARTSLOT_ADD("exp_rom1", generic_plain_slot, "fccpu1_cart")
395        MCFG_GENERIC_EXTENSIONS("bin,rom")
396        MCFG_GENERIC_WIDTH(GENERIC_ROM16_WIDTH)
397        MCFG_GENERIC_ENDIAN(ENDIANNESS_BIG)
398        MCFG_GENERIC_LOAD(force68k_state, exp1_load)
399//      MCFG_SOFTWARE_LIST_ADD("cart_list", "fccpu1_cart")
400MACHINE_CONFIG_END
401
402/***************************
403   Rom loading functions
404****************************/
405int force68k_state::force68k_load_cart(device_image_interface &image, generic_slot_device *slot)
209WRITE_LINE_MEMBER(force68k_state::write_aciaremt_clock)
406210{
407        UINT32 size = slot->common_get_size("rom");
408
409        if (size > 0x20000) // Max 128Kb
410        {
411                LOG( printf("Cartridge size exceeding max size (128Kb): %d\n", size) );
412                image.seterror(IMAGE_ERROR_UNSPECIFIED, "Cartridge size exceeding max size (128Kb)");
413                return IMAGE_INIT_FAIL;
414        }
415
416        slot->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_BIG);
417        slot->common_load_rom(slot->get_rom_base(), size, "rom");
418       
419        return IMAGE_INIT_PASS;
211      m_aciaremt->write_txc(state);
212   m_aciaremt->write_rxc(state);
420213}
421214
422/*
423 * Machine configuration
424 */
425static MACHINE_CONFIG_START (fccpu1, force68k_state)
426/* basic machine hardware */
427MCFG_CPU_ADD ("maincpu", M68000, XTAL_16MHz / 2)
428MCFG_CPU_PROGRAM_MAP (force68k_mem)
215static MACHINE_CONFIG_START( fccpu1, force68k_state )
216   /* basic machine hardware */
217   MCFG_CPU_ADD("maincpu", M68000, XTAL_16MHz / 2)
218   MCFG_CPU_PROGRAM_MAP(force68k_mem)
429219
430/* P3/Host Port config 
431 * LO command causes ROM monitor to expect S-records on HOST port by default
432 * Implementation through nullmodem currently does not support handshakes so
433 * the ROM momitor is over-run while checking for checksums etc if used with
434 * UI mount <file> feature.
435 */
436MCFG_DEVICE_ADD ("aciahost", ACIA6850, 0)
220      /* P3/Host Port config */
221   MCFG_DEVICE_ADD("aciahost", ACIA6850, 0)
222      MCFG_DEVICE_ADD("aciahost_clock", CLOCK, ACIA_CLOCK)
223   MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(force68k_state, write_aciahost_clock))
437224
438MCFG_ACIA6850_TXD_HANDLER (DEVWRITELINE ("rs232host", rs232_port_device, write_txd))
439MCFG_ACIA6850_RTS_HANDLER (DEVWRITELINE ("rs232host", rs232_port_device, write_rts))
225      /* P4/Terminal Port config */
226   MCFG_DEVICE_ADD("aciaterm", ACIA6850, 0)
440227
441MCFG_RS232_PORT_ADD ("rs232host", default_rs232_devices, "null_modem")
442MCFG_RS232_RXD_HANDLER (DEVWRITELINE ("aciahost", acia6850_device, write_rxd))
443MCFG_RS232_CTS_HANDLER (DEVWRITELINE ("aciahost", acia6850_device, write_cts))
228   MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE("rs232trm", rs232_port_device, write_txd))
229   MCFG_ACIA6850_RTS_HANDLER(DEVWRITELINE("rs232trm", rs232_port_device, write_rts))
444230
445MCFG_DEVICE_ADD ("aciahost_clock", CLOCK, ACIA_CLOCK)
446MCFG_CLOCK_SIGNAL_HANDLER (WRITELINE (force68k_state, write_aciahost_clock))
231   MCFG_RS232_PORT_ADD("rs232trm", default_rs232_devices, "terminal")
232   MCFG_RS232_RXD_HANDLER(DEVWRITELINE("aciaterm", acia6850_device, write_rxd))
233   MCFG_RS232_CTS_HANDLER(DEVWRITELINE("aciaterm", acia6850_device, write_cts))
447234
448/* P4/Terminal Port config */
449MCFG_DEVICE_ADD ("aciaterm", ACIA6850, 0)
235      MCFG_DEVICE_ADD("aciaterm_clock", CLOCK, ACIA_CLOCK)
236   MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(force68k_state, write_aciaterm_clock))
450237
451MCFG_ACIA6850_TXD_HANDLER (DEVWRITELINE ("rs232trm", rs232_port_device, write_txd))
452MCFG_ACIA6850_RTS_HANDLER (DEVWRITELINE ("rs232trm", rs232_port_device, write_rts))
238      /* P5/Remote Port config */
239   MCFG_DEVICE_ADD("aciaremt", ACIA6850, 0)
453240
454MCFG_RS232_PORT_ADD ("rs232trm", default_rs232_devices, "terminal")
455MCFG_RS232_RXD_HANDLER (DEVWRITELINE ("aciaterm", acia6850_device, write_rxd))
456MCFG_RS232_CTS_HANDLER (DEVWRITELINE ("aciaterm", acia6850_device, write_cts))
241#define PRINTER 0
242#if PRINTER
243   MCFG_ACIA6850_TXD_HANDLER(DEVWRITELINE("rs232rmt", rs232_port_device, write_txd))
244   MCFG_ACIA6850_RTS_HANDLER(DEVWRITELINE("rs232rmt", rs232_port_device, write_rts))
457245
458MCFG_DEVICE_ADD ("aciaterm_clock", CLOCK, ACIA_CLOCK)
459MCFG_CLOCK_SIGNAL_HANDLER (WRITELINE (force68k_state, write_aciaterm_clock))
246   MCFG_RS232_PORT_ADD("rs232rmt", default_rs232_devices, "printer")
247   MCFG_RS232_RXD_HANDLER(DEVWRITELINE("aciaremt", acia6850_device, write_rxd))
248   MCFG_RS232_CTS_HANDLER(DEVWRITELINE("aciaremt", acia6850_device, write_cts))
249#endif
460250
461/* P5/Remote Port config */
462MCFG_DEVICE_ADD ("aciaremt", ACIA6850, 0)
251      MCFG_DEVICE_ADD("aciaremt_clock", CLOCK, ACIA_CLOCK)
252   MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(force68k_state, write_aciaterm_clock))
463253
464MCFG_DEVICE_ADD ("aciaremt_clock", CLOCK, ACIA_CLOCK)
465MCFG_CLOCK_SIGNAL_HANDLER (WRITELINE (force68k_state, write_aciaterm_clock))
254   /* RTC Real Time Clock device */
255   MCFG_DEVICE_ADD("rtc", MM58167, XTAL_32_768kHz)
466256
467/* RTC Real Time Clock device */
468MCFG_DEVICE_ADD ("rtc", MM58167, XTAL_32_768kHz)
257   /* PIT Parallel Interface and Timer device, assuming strapped for on board clock */
258   MCFG_DEVICE_ADD("pit", PIT68230, XTAL_16MHz / 2)
469259
470/* PIT Parallel Interface and Timer device, assuming strapped for on board clock */
471MCFG_DEVICE_ADD ("pit", PIT68230, XTAL_16MHz / 2)
472MCFG_PIT68230_PA_OUTPUT_CALLBACK (DEVWRITE8 ("cent_data_out", output_latch_device, write))
473MCFG_PIT68230_H2_CALLBACK (DEVWRITELINE ("centronics", centronics_device, write_strobe))
260MACHINE_CONFIG_END
474261
475// centronics
476MCFG_CENTRONICS_ADD ("centronics", centronics_devices, "printer")
477MCFG_CENTRONICS_ACK_HANDLER (WRITELINE (force68k_state, centronics_ack_w))
478MCFG_CENTRONICS_BUSY_HANDLER (WRITELINE (force68k_state, centronics_busy_w))
479MCFG_CENTRONICS_PERROR_HANDLER (WRITELINE (force68k_state, centronics_perror_w))
480MCFG_CENTRONICS_SELECT_HANDLER (WRITELINE (force68k_state, centronics_select_w))
481MCFG_CENTRONICS_OUTPUT_LATCH_ADD ("cent_data_out", "centronics")
262#if 0
482263
483// EPROM sockets
484MCFG_FRAGMENT_ADD(fccpu1_eprom_sockets)
264static MACHINE_CONFIG_START( fccpu6, force68k_state )
265   MCFG_CPU_ADD("maincpu", M68000, XTAL_8MHz)  /* Jumper B10 Mode B */
266   MCFG_CPU_PROGRAM_MAP(force68k_mem)
485267MACHINE_CONFIG_END
486268
487#if 0 /*
488       * CPU-6 family is device and adressmap compatible with CPU-1 but with additions
489       * such as an optional 68881 FPU
490       */
491static MACHINE_CONFIG_START (fccpu6, force68k_state)
492MCFG_CPU_ADD ("maincpu", M68000, XTAL_8MHz)         /* Jumper B10 Mode B */
493MCFG_CPU_PROGRAM_MAP (force68k_mem)
269static MACHINE_CONFIG_START( fccpu6a, force68k_state )
270   MCFG_CPU_ADD("maincpu", M68000, XTAL_12_5MHz) /* Jumper B10 Mode A */
271   MCFG_CPU_PROGRAM_MAP(force68k_mem)
494272MACHINE_CONFIG_END
495273
496static MACHINE_CONFIG_START (fccpu6a, force68k_state)
497MCFG_CPU_ADD ("maincpu", M68000, XTAL_12_5MHz)        /* Jumper B10 Mode A */
498MCFG_CPU_PROGRAM_MAP (force68k_mem)
274static MACHINE_CONFIG_START( fccpu6v, force68k_state )
275   MCFG_CPU_ADD("maincpu", M68010, XTAL_8MHz)  /* Jumper B10 Mode B */
276   MCFG_CPU_PROGRAM_MAP(force68k_mem)
499277MACHINE_CONFIG_END
500278
501static MACHINE_CONFIG_START (fccpu6v, force68k_state)
502MCFG_CPU_ADD ("maincpu", M68010, XTAL_8MHz)         /* Jumper B10 Mode B */
503MCFG_CPU_PROGRAM_MAP (force68k_mem)
279static MACHINE_CONFIG_START( fccpu6va, force68k_state )
280   MCFG_CPU_ADD("maincpu", M68010, XTAL_12_5MHz) /* Jumper B10 Mode A */
281   MCFG_CPU_PROGRAM_MAP(force68k_mem)
504282MACHINE_CONFIG_END
505283
506static MACHINE_CONFIG_START (fccpu6va, force68k_state)
507MCFG_CPU_ADD ("maincpu", M68010, XTAL_12_5MHz)        /* Jumper B10 Mode A */
508MCFG_CPU_PROGRAM_MAP (force68k_mem)
284static MACHINE_CONFIG_START( fccpu6vb, force68k_state )
285   MCFG_CPU_ADD("maincpu", M68010, XTAL_12_5MHz) /* Jumper B10 Mode A */
286   MCFG_CPU_PROGRAM_MAP(force68k_mem)
509287MACHINE_CONFIG_END
510
511static MACHINE_CONFIG_START (fccpu6vb, force68k_state)
512MCFG_CPU_ADD ("maincpu", M68010, XTAL_12_5MHz)        /* Jumper B10 Mode A */
513MCFG_CPU_PROGRAM_MAP (force68k_mem)
514MACHINE_CONFIG_END
515288#endif
516289
517290/* ROM definitions */
518ROM_START (fccpu1)
519ROM_REGION (0x1000000, "maincpu", 0)
291ROM_START( fccpu1 )
292   ROM_REGION(0x1000000, "maincpu", 0)
520293
521ROM_LOAD16_BYTE ("fccpu1V1.0L.j8.bin", 0x080001, 0x2000, CRC (3ac6f08f) SHA1 (502f6547b508d8732bd68bbbb2402d8c30fefc3b))
522ROM_LOAD16_BYTE ("fccpu1V1.0L.j9.bin", 0x080000, 0x2000, CRC (035315fb) SHA1 (90dc44d9c25d28428233e6846da6edce2d69e440))
523
524/*
525 * System ROM terminal commands
526 *
527 * COMMAND SUMMARY DESCRIPTION (From CPU-1B datasheet, ROMs were dumped
528 * from a CPU-1 board so some features might be missing or different)
529 * ---------------------------------------------------------------------------
530 * BF <address1> <address2> <data> <CR>        Block Fill memory - from addr1 through addr2 with data
531 * BM <address1> <address2> <address 3> <CR>   Block Move  - move from addr1 through addr2to addr3
532 * BR [<address> [; <count>] ... ] <CR>        Set/display Breakpoint
533 * BS <address1> <address2> <data> <CR>        Block Search - search addr1 through addr2 for data
534 * BT <address1> <address2> <CR>               Block Test of memory
535 * DC <expression> <CR>                        Data Conversion
536 * DF <CR>                                     Display Formatted registers
537 * DU [n] <address1> <address2>[<string>] <CR> Dump memory to object file
538 * GO or G [<address] <CR>                     Execute program.
539 * GD [<address] <CR>                          Go Direct
540 * GT <address> <CR>                           Exec prog: temporary breakpoint
541 * HE<CR>                                      Help; display monitor commands
542 * LO [n] [;<options] <CR>                     Load Object file
543 * MD <address> [<count>] <CR>                 Memory Display
544 * MM or M <address> [<data<][;<options>] <CR> Memory Modify
545 * MS <address> <data1 > <data2> < ... <CR>    Memory Set - starting at addr with data 1. data 2 ...
546 * NOBR [<address> ... ] <CR>                  Remove Breakpoint
547 * NOPA <CR>                                   Printer Detach (Centronics on PIT/P2)
548 * OF <CR>                                     Offset
549 * PA <CR>                                     Printer Attach (Centronics on PIT/P2)
550 * PF[n] <CR>                                  Set/display Port Format
551 * RM <CR>                                     Register Modify
552 * TM [<exit character>] <CR>                  Transparent Mode
553 * TR OR T [<count] <CR>                       Trace
554 * TT <address> <CR>                           Trace: temporary breakpoint
555 * VE [n] [<string] <CR>                       Verify memory/object file
556 * ----------------------------------------------------------------------------
557 * .AO - .A7 [<expression] <CR>                Display/set address register
558 * .00 - .07 [<expression] <CR>                Display/set data register
559 * .RO - .R6 [<expression] <CR>                Display/set offset register
560 * .PC [<expression] <CR>                      Display/set program counter
561 * .SR [<expression] <CR>                      Display/set status register
562 * .SS [<expression] <CR>                      Display/set supervisor stack
563 * .US [<expression] <CR>                      Display/set user stack
564 * ----------------------------------------------------------------------------
565 * MD <address> [<count>]; DI <CR>             Disassemble memory location
566 * MM <address>; DI <CR>                       Disassemble/Assemble memory location
567 * ----------------------------------------------------------------------------
568 * Undocumented commands found in ROM table at address 0x80308
569 * .*                                          No WHAT message displayed, no action seen.
570 */
294      ROM_LOAD16_BYTE( "fccpu1V1.0L.j8.bin", 0x080001, 0x2000, CRC(3ac6f08f) SHA1(502f6547b508d8732bd68bbbb2402d8c30fefc3b) )
295      ROM_LOAD16_BYTE( "fccpu1V1.0L.j9.bin", 0x080000, 0x2000, CRC(035315fb) SHA1(90dc44d9c25d28428233e6846da6edce2d69e440) )
296/* COMMAND SUMMARY DESCRIPTION (From CPU-1B datasheet, ROMs were dumped
297   from a CPU-1 board so some features might be missing or different)
298---------------------------------------------------------------------------
299   BF <address1> <address2> <data> <CR>        Block Fill memory - from addr1 through addr2 with data
300   BM <address1> <address2> <address 3> <CR>   Block Move  - move from addr1 through addr2to addr3
301   BR [<address> [; <count>] ... ] <CR>        Set/display Breakpoint
302   BS <address1> <address2> <data> <CR>        Block Search - search addr1 through addr2 for data
303   BT <address1> <address2> <CR>               Block Test of memory
304   DC <expression> <CR>                        Data Conversion
305   DF <CR>                                     Display Formatted registers
306   DU [n] <address1> <address2>[<string>] <CR> Dump memory to object file
307   GO [<address] <CR>                          Execute program
308   GD [<address] <CR>                          Go Direct
309   GT <address> <CR>                           Exec prog: temporary breakpoint
310   HE<CR>                                      Help; display monitor commands
311   LO [n] [;<options] <CR>                     Load Object file
312   MD <address> [<count?? <CR>                  Memory Display
313   MM <address> [<data?? [;<options?? <CR>       Memory Modify
314   MS <address> <data1 > <data2> < ... <CR>    Memory Set - starting at addr with data 1. data 2 ...
315   NOBR [<address> ... ] <CR>                  Remove Breakpoint
316   NOPA <CR>                                   Printer Detach (Centronics on PIT/P2)
317   OF <CR>                                     Offset
318   PA <CR>                                     Printer Attach (Centronics on PIT/P2)
319   PF[n] <CR>                                  Set/display Port Format
320   RM <CR>                                     Register Modify
321   TM [<exit character?? <CR>                   Transparent Mode
322   TR [<count] <CR>                            Trace
323   TT <address> <CR>                           Trace: temporary breakpoint
324   VE [n] [<string] <CR>                       Verify memory/object file
325----------------------------------------------------------------------------
326  .AO - .A7 [<expression] <CR>                 Display/set address register
327  .00 - .07 [<expression] <CR>                 Display/set data register
328  .RO - .R6 [<expression] <CR>                 Display/set offset register
329  .PC [<expression] <CR>                       Display/set program counter
330  .SR [<expression] <CR>                       Display/set status register
331  .SS [<expression] <CR>                       Display/set supervisor stack
332  .US [<expression] <CR>                       Display/set user stack
333----------------------------------------------------------------------------
334   MD <address> [<count>]; D1 <CR>             Disassemble memory location
335   MM <address>; DI <CR>                       Disassemble/Assemble memory location
336----------------------------------------------------------------------------
337*/
571338ROM_END
572339
573/*
574 * CPU-6 ROMs were generally based om VMEPROM which contained the PDOS RTOS from Eyring Research.
575 * I don't have these but if anyone can dump them and send to me I can verify that they work as expected.
576 */
577340#if 0
578ROM_START (fccpu6)
579ROM_REGION (0x1000000, "maincpu", 0)
341ROM_START( fccpu6 )
342   ROM_REGION(0x1000000, "maincpu", 0)
580343ROM_END
581344
582ROM_START (fccpu6a)
583ROM_REGION (0x1000000, "maincpu", 0)
345ROM_START( fccpu6a )
346   ROM_REGION(0x1000000, "maincpu", 0)
584347ROM_END
585348
586ROM_START (fccpu6v)
587ROM_REGION (0x1000000, "maincpu", 0)
349ROM_START( fccpu6v )
350   ROM_REGION(0x1000000, "maincpu", 0)
588351ROM_END
589352
590ROM_START (fccpu6va)
591ROM_REGION (0x1000000, "maincpu", 0)
353ROM_START( fccpu6va )
354   ROM_REGION(0x1000000, "maincpu", 0)
592355ROM_END
593356
594ROM_START (fccpu6vb)
595ROM_REGION (0x1000000, "maincpu", 0)
357ROM_START( fccpu6vb )
358   ROM_REGION(0x1000000, "maincpu", 0)
596359ROM_END
597360#endif
598361
trunk/src/mess/drivers/mc1000.c
r249094r249095
378378  +---------*---*---o V+
379379  |         |   |
380380 +-+        |   |
381 | |390K    |   |
381 | |309K    |   |
382382 | |R17     |8  |4
383383 +-+      +-------+
384384  |      7|       |3
r249094r249095
390390 | |   |  |  555  |
391391 +-+   |  |       |
392392  |    | 6|       |5
393  *----*--|       |---+
393  *----*?-|       |---+
394394  |       |       |   |
395395 ---C30   +-------+  ---C29
396 ---10n       |1     ---10n
396 ---103       |1     ---103
397397 _|_         _|_     _|_
398398 ///         ///     ///
399399
400400 Calculated properties:
401401
402402 * 99.74489795918367 Duty Cycle Percentage
403 * 367.3469387755102 Frequency in Hertz
403 * 368.1126130105722 Frequency in Hertz
404404 * 0.00000693 Seconds Low
405 * 0.00270963 Seconds High
405 * 0.0027096299999999998 Seconds High
406406
407407 */
408408
409#define MC1000_NE555_FREQ       (367) /* Hz */
409#define MC1000_NE555_FREQ       (368) /* Hz */
410410#define MC1000_NE555_DUTY_CYCLE (99.745) /* % */
411411
412412TIMER_DEVICE_CALLBACK_MEMBER(mc1000_state::ne555_tick)
trunk/src/mess/drivers/mk85.c
r249094r249095
6363
6464static MACHINE_CONFIG_START( mk85, mk85_state )
6565   /* basic machine hardware */
66   MCFG_CPU_ADD("maincpu", K1801VM2, XTAL_4MHz)
67   MCFG_T11_INITIAL_MODE(0)
66   MCFG_CPU_ADD("maincpu",T11, XTAL_4MHz)
67   MCFG_T11_INITIAL_MODE(5 << 13)         /* start from 0000 */
6868   MCFG_CPU_PROGRAM_MAP(mk85_mem)
6969
7070
trunk/src/mess/drivers/mk90.c
r249094r249095
6868
6969static MACHINE_CONFIG_START( mk90, mk90_state )
7070   /* basic machine hardware */
71   MCFG_CPU_ADD("maincpu", K1801VM2, XTAL_4MHz)
72   MCFG_T11_INITIAL_MODE(0x8000)
71   MCFG_CPU_ADD("maincpu",T11, XTAL_4MHz)
72   MCFG_T11_INITIAL_MODE(0xf600)
7373   MCFG_CPU_PROGRAM_MAP(mk90_mem)
7474
7575
trunk/src/mess/drivers/mzr8105.c
r0r249095
1// license:BSD-3-Clause
2// copyright-holders:Joakim Larsson Edstr??m
3/***************************************************************************
4 *
5 *  Mizar VME8105 rev D 3U SBC driver, initially derived from force68k.c
6 *
7 *  19/08/2015
8 *
9 * I baught this board from http://www.retrotechnology.com without documentation.
10 * It has a Motorola 68000 CPU @ 10MHz and two 27128 EPROMS with OS9 DEBUG labels
11 * and not much more except 16 or so TTLs, 2 PALs and a VME P1 connector. It is a
12 * 2 sided design so it shold be possible to trace the schematics quite easily.
13 * There is a date on the P1 Connector: "Feb 20 1987"
14 *                                                                                   
15 *       ||                                                                         
16 *       ||                                                                         
17 *       ||                                                                         
18 *       ||                                                                         
19 *       ||____________________________________________________________   ___
20 *       ||    --------------K2|U6-7432|U7-7474|U14-7405|U21-74645  |  |_|   |
21 *       ||   | 2764 - low   |-+-------+-------+--------+-----------+  | |   |
22 *       ||   | OS9 DEBUG  U4|  +---------+    +--------+---------+    | |   |
23 *       ||    --------------   |         |    |U13-7474|U20-74645|    | |   |
24 *       ||    ______________   |         |    +--------+---------+    | |   |
25 *       ||   |              |  |         |    ______________K4____    | |   |
26 *       ||   |            U3|  |         |    |U12-7438|U19-74244|    | |VME|
27 *       ||    --------------   |         |+------K6---------K3---+    | |   |
28 *       ||    ______________   |         ||U11-PAL20L10|U18-74244|    | |P1 |
29 *       ||   | 2764 - high  |  |         |+-----021102-+---------+    | |   |
30 *       ||   | OS9 DEBUG  U2|  |MC68000L10+------------+---------+    | |   |
31 *       ||   |______________|  |         ||U10-PAL14L4 |U17-74244|    | |   |
32 *       ||                     |         |+-----021001-+---------+    | |   |
33 *       ||    --------------   |         |+----+_______|U16-74244|+--+| |   |
34 *       ||   |              |  |         |XTAL |U9-7410+---------+|  || |   |
35 *       ||K1 |            U1|  |         |FOX100-------+---------+|K5||_|   |
36 *       ||    --------------   |_________|10MHz|U8-7404|U15-74148||  || |___|
37 *   ||--||--------------------------------+----+-------+---------++--+             
38 *   ||--||                                                           
39 *       ||                                                           
40 *
41 * PAL:s
42 *------
43 * The board has two PAL:s, a PAL20L10 and a PAL14L4.
44 *
45 *                        _____   _____
46 *              OD/CLK 1 |*    \_/     | 20 VCC
47 *     CPU A13    I0   2 |             | 19 O0/LR  A23
48 *  U9 7410p12    I1   3 |             | 18 O1/A0  A22
49 *     CPU *AS    I2   4 |             | 17 02/A1  U2/U4 2764p22 *OE
50 *     GND        I3   5 |             | 16 03/A2  U11 PAL20L10p6 I4
51 *     CPU A14    I4   6 |     U10     | 15 A0/O0  U11 PAL20L10p7 I5
52 *     CPU A15    I5   7 |   PAL14L4   | 14 A1/O1  U19 74LS244p11 I0b
53 *     CPU A16    I6   8 |             | 13 A2/O2  A18
54 *     CPU A17    I7   9 |             | 12 LR/O3  A20
55 *                GND 10 |_____________| 11 CLK/OD A21
56 *     
57 *                        _____   _____
58 *              OD/CLK 1 |*    \_/     | 24 VCC
59 *                I0   2 |             | 23 O0/LR     
60 *     CPU *AS    I1   3 |             | 22 O1/A0     
61 * U10 PAL14L4p3  I2   4 |             | 21 02/A1                   
62 *                I3   5 |             | 20 03/A2                   
63 * U10 PAL14L4p16 I4   6 |     U10     | 19 04/NC                   
64 * U10 PAL14L4p15 I5   7 |   PAL20L10  | 18 NC/O0                     
65 *                I6   8 |             | 17 A2/O1     
66 *                I7   9 |             | 16 A1/O2     
67 *                I8  10 |             | 15 A0/O3     
68 *                I9  11 |             | 14 LR/O4     
69 *                GND 12 |_____________| 13 CLK/OD   
70 *   
71 *  Trace is not fully completed and validated.
72 *
73 * History of Mizar
74 *-------------------
75 * Mizar was one of the first companies that released VME boards in 1982-3 together with
76 * Force Computers and Motorola. Their systems was often supported by OS9/68000 from Microware.
77 * In 1993 Mizar discontinued their OS9/CPU board product range and focused entirely on DSP
78 * boards. RTSI was founded by Mizar employees preserving the knowledge in OS9 as consultants.
79 * In 1998 Blue Wave resulted from the merger of Mizar and Loughborough Sound Images.
80 * Not much tech information availabe but I found some quotes about Mizar on the internet:
81 *
82 * From http://archive.org/stream/68micro-vol-11-num-02/V11N02_Feb1989_djvu.txt :
83 *--------------------------------------------------------------------------------
84 * " Mizar provides complete OS-9 solutions for the VMEbus. Mizar's VME CPUs
85 * offer (he functions and performance your application demands. Our single
86 * height (3U) VME processors are uniquely configurable computing engines,
87 * Through Mizar's unique MXbus™ expansion interface, standard and custom side
88 * modules can be added to basic processors to create double-height (6U) boards
89 * tor specific applications, 3U CPU options include 68010, 66020, and 63030
90 * microprocessors, up to one MB of DRAM, serial I/O, real-time clock, and
91 * mailbox interrupt support. Standard MXbus side modules include additional DRAM.
92 * SRAM, and I/O.
93 *
94 * Mizar's standard double- height (6U) processors provide additional features such
95 * as a high-speed cache to enhance 68030 performance, floating, point coprocessor
96 * support, up to four MB dual ported DRAM, VSB memory interface, Ethernet, and SCSI.
97 *
98 * Mizar also supports OS-9 with completely configured OS9 development systems and
99 * OS-9 application server systems. For more information, call Mizar today
100 *
101 * 800-635-0200 MIZAR 1419 Dunn Drive • CarrolHon, TX 75006 • 214-446-2664"
102 *
103 * Known boards from Mizar:
104 *
105 *-Comp.Os.Vxworks diguest mailing list May 1992: VxWorks Drivers Available from Mizar:
106 * EMX 7320 Serial I/O Board
107 * EMX 7550 Ethernet Controller Board (AMD 7990 Lance) MAC: 00:80:F8 MIZAR, INC.
108 * MZ 7300 Serial I/O Board (Z8530)
109 * MZ 7400 Disk Controller Board (WD 2010; WD 1772)
110 * MZ 7500 IEEE-488 (GPIB) Interface Board
111 * MZ 7810 I/O Expansion Module (6681 DUART)
112 * MZ 7831 SCSI Expansion Module (WD 33C93A)
113 * MZ 7850 Ethernet Expansion Module (WD 83C690)
114 * MZ 8505 IEEE-488 (GPIB) Interface Board"
115 *- Other sources:
116 * MZ 8000 ??
117 * MZ 8105 3U 68000 CPU board
118 * MZ 8300 3U serial board, 2 NEC 7201 (Z80 DART) and 1 AMD CTS9513 5 x 16 bit Counter/Timer
119 *
120 * From http://www.megalextoria.com/forum2/index.php?t=msg&goto=73945&
121 *--------------------------------------------------------------------
122 * Aug 20 1984 a report by James Jones from the OS/9 conferance in Des Moines:
123 * "...
124 * Mizar: is selling VME bus 68010 boards, running OS-9/68000; they also make
125 * various memory and I/O boards, disk controller boards, and and a NEC 7220-based
126 * graphics controller board...."
127 *
128 * Misc links about Mizar:
129 * http://www.vita.com/History
130 * http://www.verycomputer.com/154_e272024804bbe203_1.htm
131 * https://www.aihitdata.com/company/00814595/RTSI/overview
132 *
133 * Address Map
134 * --------------------------------------------------------------------------
135 * Address Range         Description/Assumption
136 * --------------------------------------------------------------------------
137 * 0x000000 0x01ffff   ROM because of fixed vectors
138 * 0x020000 0x03ffff   RAM because bootvector stack starts at 0x21000
139 * -- VME adresses---
140 * 0xff0000 0xff0003   Bootstrap expects to find a UPD7201 serial device here 
141 * --------------------------------------------------------------------------
142 *
143 * Interrupt sources
144 * ----------------------------------------------------------
145 * Description                  Device  Lvl  IRQ    VME board
146 *                           /Board      Vector  Address
147 * ----------------------------------------------------------
148 * On board Sources
149 *  TBD
150 * Off board Sources (other VME boards)
151 *  TBD
152 * ----------------------------------------------------------
153 *
154 *  TODO:
155 *  - Dump the ROMs (DONE)
156 *  - Setup a working address map (DONE)
157 *  - Add VME bus driver (Faked one)
158 *
159 ****************************************************************************/
160
161#include "emu.h"
162#include "cpu/m68000/m68000.h"
163#include "machine/z80dart.h"
164#include "bus/rs232/rs232.h"
165#include "machine/clock.h"
166
167#define CARDSLOT 0
168
169#if CARDSLOT // Awaiting info on how to boot the user eproms
170#include "bus/generic/slot.h"
171#include "bus/generic/carts.h"
172#endif
173
174#define LOG(x) x
175
176 
177/* These values are borrowed just to get the terminal going and should be replaced
178 * once a proper serial board hardware (ie MZ 8300) is found and emulated. */
179#define BAUDGEN_CLOCK XTAL_19_6608MHz /* fake */
180#define UPD_CLOCK (BAUDGEN_CLOCK / 128) /* This will give prompt */
181
182class mzr8105_state : public driver_device
183{
184public:
185mzr8105_state(const machine_config &mconfig, device_type type, const char *tag) :
186        driver_device (mconfig, type, tag),
187                m_maincpu (*this, "maincpu")
188                ,m_updterm(*this, "upd")
189//        ,m_cart(*this, "exp_rom1")
190{
191}
192
193DECLARE_READ16_MEMBER (vme_a24_r);
194DECLARE_WRITE16_MEMBER (vme_a24_w);
195DECLARE_READ16_MEMBER (vme_a16_r);
196DECLARE_WRITE16_MEMBER (vme_a16_w);
197virtual void machine_start ();
198DECLARE_WRITE_LINE_MEMBER (write_updterm_clock);
199
200#if CARDSLOT
201// User EPROM/SRAM slot(s)
202int mzr8105_load_cart(device_image_interface &image, generic_slot_device *slot);
203DECLARE_DEVICE_IMAGE_LOAD_MEMBER (exp1_load) { return mzr8105_load_cart(image, m_cart); }
204DECLARE_READ16_MEMBER (read16_rom);
205#endif
206
207protected:
208
209private:
210required_device<cpu_device> m_maincpu;
211required_device<upd7201_device> m_updterm;
212
213// Pointer to System ROMs needed by bootvect_r
214// UINT16  *m_sysrom;
215
216#if CARDSLOT
217UINT16  *m_usrrom;
218required_device<generic_slot_device> m_cart;
219#endif
220};
221
222static ADDRESS_MAP_START (mzr8105_mem, AS_PROGRAM, 16, mzr8105_state)
223ADDRESS_MAP_UNMAP_HIGH
224//AM_RANGE (0x000000, 0x000007) AM_ROM AM_READ (bootvect_r)       /* Not verified */
225AM_RANGE (0x000000, 0x003fff) AM_ROM /* System EPROM Area 16Kb OS9 DEBUG - not verified     */
226AM_RANGE (0x004000, 0x01ffff) AM_ROM /* System EPROM Area 112Kb for System ROM - not verified    */
227AM_RANGE (0x020000, 0x03ffff) AM_RAM /* Not verified */
228//AM_RANGE (0x0a0000, 0x0bffff) AM_ROM /* User EPROM/SRAM Area, max 128Kb mapped by a cartslot  */
229//AM_RANGE (0x0c0080, 0x0c0081) AM_DEVREADWRITE8 ("aciaterm", acia6850_device, status_r, control_w, 0xff00)
230//AM_RANGE (0x0c0082, 0x0c0083) AM_DEVREADWRITE8 ("aciaterm", acia6850_device, data_r, data_w, 0xff00)
231AM_RANGE(0x100000, 0xfeffff)  AM_READWRITE(vme_a24_r, vme_a24_w) /* VMEbus Rev B addresses (24 bits) - not verified */
232//AM_RANGE(0xff0000, 0xffffff)  AM_READWRITE(vme_a16_r, vme_a16_w) /* VMEbus Rev B addresses (16 bits) - not verified */
233// Faking a Mizar 8300 SIO BOARD in VME A16 adress space
234     AM_RANGE (0xFF0000, 0xFF0001) AM_DEVREADWRITE8("upd", upd7201_device, da_r, da_w, 0x00ff) /* Dual serial port NEC uPD7201 */
235     AM_RANGE (0xFF0002, 0xFF0003) AM_DEVREADWRITE8("upd", upd7201_device, ca_r, ca_w, 0x00ff) /* Dual serial port NEC uPD7201 */
236     AM_RANGE (0xFF0004, 0xFF0005) AM_DEVREADWRITE8("upd", upd7201_device, db_r, db_w, 0x00ff) /* Dual serial port NEC uPD7201 */
237     AM_RANGE (0xFF0006, 0xFF0007) AM_DEVREADWRITE8("upd", upd7201_device, cb_r, cb_w, 0x00ff) /* Dual serial port NEC uPD7201 */
238
239ADDRESS_MAP_END
240
241/* Input ports */
242static INPUT_PORTS_START (mzr8105)
243INPUT_PORTS_END
244
245/* Start it up */
246void mzr8105_state::machine_start ()
247{
248        LOG (logerror ("machine_start\n"));
249
250#if CARDSLOT
251        /* Map user ROM/RAM socket(s) */
252        if (m_cart->exists())
253        {
254                m_usrrom = (UINT16*)m_cart->get_rom_base();
255                m_maincpu->space(AS_PROGRAM).install_read_handler(0xa0000, 0xbffff, read16_delegate(FUNC(generic_slot_device::read16_rom), (generic_slot_device*)m_cart));
256        }
257#endif
258}
259
260/* Dummy VME access methods until the VME bus device is ready for use */
261READ16_MEMBER (mzr8105_state::vme_a24_r){
262        LOG (logerror ("vme_a24_r\n"));
263        return (UINT16) 0;
264}
265
266WRITE16_MEMBER (mzr8105_state::vme_a24_w){
267        LOG (logerror ("vme_a24_w\n"));
268}
269
270READ16_MEMBER (mzr8105_state::vme_a16_r){
271        LOG (logerror ("vme_16_r\n"));
272        return (UINT16) 0;
273}
274
275WRITE16_MEMBER (mzr8105_state::vme_a16_w){
276        LOG (logerror ("vme_a16_w\n"));
277}
278
279#if CARDSLOT
280/*
281 * 4. The USER EPROM Area
282 */
283// Implementation of static 2 x 64K EPROM in sockets U1/U3 as 16 bit wide cartridge for easier
284// software handling. TODO: make configurable according to table above.
285static MACHINE_CONFIG_FRAGMENT( mzr8105_eprom_sockets )
286        MCFG_GENERIC_CARTSLOT_ADD("exp_rom1", generic_plain_slot, "mzr8105_cart")
287        MCFG_GENERIC_EXTENSIONS("bin,rom")
288        MCFG_GENERIC_WIDTH(GENERIC_ROM16_WIDTH)
289        MCFG_GENERIC_ENDIAN(ENDIANNESS_BIG)
290        MCFG_GENERIC_LOAD(mzr8105_state, exp1_load)
291//      MCFG_SOFTWARE_LIST_ADD("cart_list", "mzr8105_cart")
292MACHINE_CONFIG_END
293
294/***************************
295   Rom loading functions
296****************************/
297int mzr8105_state::mzr8105_load_cart(device_image_interface &image, generic_slot_device *slot)
298{
299        UINT32 size = slot->common_get_size("rom");
300
301        if (size > 0x20000) // Max 128Kb - not verified
302        {
303                LOG( printf("Cartridge size exceeding max size (128Kb): %d\n", size) );
304                image.seterror(IMAGE_ERROR_UNSPECIFIED, "Cartridge size exceeding max size (128Kb)");
305                return IMAGE_INIT_FAIL;
306        }
307
308        slot->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_BIG);
309        slot->common_load_rom(slot->get_rom_base(), size, "rom");
310       
311        return IMAGE_INIT_PASS;
312}
313#endif
314
315WRITE_LINE_MEMBER (mzr8105_state::write_updterm_clock){
316        m_updterm->txca_w (state);
317        m_updterm->rxca_w (state);
318}
319
320/*
321 * Machine configuration
322 */
323static MACHINE_CONFIG_START (mzr8105, mzr8105_state)
324/* basic machine hardware */
325MCFG_CPU_ADD ("maincpu", M68000, XTAL_10MHz)
326MCFG_CPU_PROGRAM_MAP (mzr8105_mem)
327
328
329/* Terminal Port config */
330MCFG_UPD7201_ADD("upd", XTAL_4MHz, 0, 0, 0, 0 )
331MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE("rs232trm", rs232_port_device, write_txd))
332MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE("rs232trm", rs232_port_device, write_dtr))
333MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE("rs232trm", rs232_port_device, write_rts))
334
335MCFG_RS232_PORT_ADD ("rs232trm", default_rs232_devices, "terminal")
336MCFG_RS232_RXD_HANDLER (DEVWRITELINE ("upd", upd7201_device, rxa_w))
337MCFG_RS232_CTS_HANDLER (DEVWRITELINE ("upd", upd7201_device, ctsa_w))
338
339MCFG_DEVICE_ADD ("updterm_clock", CLOCK, UPD_CLOCK)
340MCFG_CLOCK_SIGNAL_HANDLER (WRITELINE (mzr8105_state, write_updterm_clock))
341
342#if CARDSLOT
343
344// EPROM sockets
345MCFG_FRAGMENT_ADD(mzr8105_eprom_sockets)
346#endif
347
348MACHINE_CONFIG_END
349
350/* ROM definitions */
351ROM_START (mzr8105)
352ROM_REGION (0x1000000, "maincpu", 0)
353
354ROM_LOAD16_BYTE ("mzros9LB.bin", 0x000001, 0x2000, CRC (7c6a354d) SHA1 (2721eb649c8046dbcb517a36a97dc0816cd133f2))
355ROM_LOAD16_BYTE ("mzros9HB.bin", 0x000000, 0x2000, CRC (d18e69a6) SHA1 (a00b68f4d649bcc09a29361f8692e52be12b3792))
356
357/*
358 * System ROM information
359 *
360 * The ROMs contains an OS9 bootloader. It is position independent but reset vector suggests that it sits flat on adress 0 (zero)
361 *
362 * We got a prompt but the command reportoair are very sparse to non OS9 users so investigation needed.
363 *
364 */
365ROM_END
366
367/* Driver */
368/*    YEAR  NAME          PARENT  COMPAT   MACHINE         INPUT     CLASS          INIT COMPANY                  FULLNAME          FLAGS */
369COMP (1987, mzr8105,      0,      0,       mzr8105,        mzr8105, driver_device, 0,   "Mizar Inc",             "Mizar VME8105", MACHINE_IS_SKELETON )
trunk/src/mess/drivers/tispeak.c
r249094r249095
487487
488488void tispeak_state::prepare_display()
489489{
490   UINT16 gridmask = (m_display_decay[15][16] != 0) ? 0xffff : 0x8000;
491   display_matrix_seg(16+1, 16, m_plate | 0x10000, m_grid & gridmask, 0x3fff);
490   display_matrix_seg(16, 16, m_plate, (m_r & 0x8000) ? m_grid : 0, 0x3fff);
492491}
493492
494493WRITE16_MEMBER(tispeak_state::snspell_write_r)
r249094r249095
501500   // R15: filament on
502501   // other bits: MCU internal use
503502   m_r = m_inp_mux = data;
504   m_grid = data & 0x81ff;
503   m_grid = data & 0x1ff;
505504   prepare_display();
506505}
507506
r249094r249095
548547{
549548   // same as default, except R13 is used for an extra digit
550549   m_r = m_inp_mux = data;
551   m_grid = data & 0xa1ff;
550   m_grid = data & 0x21ff;
552551   prepare_display();
553552}
554553
trunk/src/mess/drivers/uknc.c
r249094r249095
5858
5959static MACHINE_CONFIG_START( uknc, uknc_state )
6060   /* basic machine hardware */
61   MCFG_CPU_ADD("maincpu", K1801VM2, 8000000)
62   MCFG_T11_INITIAL_MODE(0x8000)
61   MCFG_CPU_ADD("maincpu", T11, 8000000)
62   MCFG_T11_INITIAL_MODE(0x36ff)  /* initial mode word has DAL15,14,11,8 pulled low */
6363   MCFG_CPU_PROGRAM_MAP(uknc_mem)
6464
65   MCFG_CPU_ADD("subcpu",  K1801VM2, 6000000)
66   MCFG_T11_INITIAL_MODE(0x8000)
65   MCFG_CPU_ADD("subcpu",  T11, 6000000)
66   MCFG_T11_INITIAL_MODE(0x36ff)  /* initial mode word has DAL15,14,11,8 pulled low */
6767   MCFG_CPU_PROGRAM_MAP(uknc_sub_mem)
6868
6969
trunk/src/mess/layout/fccpu1.lay
r249094r249095
1<?xml version="1.0"?>
2<!-- fccpu1.lay -->
3<!-- 2015-07-27: Initial version.  [JLE] -->
4<mamelayout version="2">
5    <element name="front">
6            <image file="front.png" />
7    </element>
8    <view name="Force Computers SYS68K/CPU-1">
9        <screen index="0">
10            <bounds left="100" top="0" right="640" bottom="480" /> 
11        </screen>
12   <bezel name="frontpanel" element="front">
13     <bounds x="0" y="0" width="36" height="480" />
14   </bezel>
15    </view>
16</mamelayout>
17
trunk/src/osd/modules/debugger/win/debugviewinfo.c
r249094r249095
1515
1616#include "strconv.h"
1717
18#include "winutil.h"
1918
20
2119// debugger view styles
2220#define DEBUG_VIEW_STYLE    WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN
2321#define DEBUG_VIEW_STYLE_EX 0
r249094r249095
5048
5149   // create the child view
5250   m_wnd = CreateWindowEx(DEBUG_VIEW_STYLE_EX, TEXT("MAMEDebugView"), NULL, DEBUG_VIEW_STYLE,
53          0, 0, 100, 100, parent, NULL, GetModuleHandleUni(), this);
51         0, 0, 100, 100, parent, NULL, GetModuleHandle(NULL), this);
5452   if (m_wnd == NULL)
5553      goto cleanup;
5654
5755   // create the scroll bars
5856   m_hscroll = CreateWindowEx(HSCROLL_STYLE_EX, TEXT("SCROLLBAR"), NULL, HSCROLL_STYLE,
59         0, 0, 100, CW_USEDEFAULT, m_wnd, NULL, GetModuleHandleUni(), this);
57         0, 0, 100, CW_USEDEFAULT, m_wnd, NULL, GetModuleHandle(NULL), this);
6058   m_vscroll = CreateWindowEx(VSCROLL_STYLE_EX, TEXT("SCROLLBAR"), NULL, VSCROLL_STYLE,
61         0, 0, CW_USEDEFAULT, 100, m_wnd, NULL, GetModuleHandleUni(), this);
59         0, 0, CW_USEDEFAULT, 100, m_wnd, NULL, GetModuleHandle(NULL), this);
6260   if ((m_hscroll == NULL) || (m_vscroll == NULL))
6361      goto cleanup;
6462
r249094r249095
256254{
257255   // create a combo box
258256   HWND const result = CreateWindowEx(COMBO_BOX_STYLE_EX, TEXT("COMBOBOX"), NULL, COMBO_BOX_STYLE,
259         0, 0, 100, 1000, parent, NULL, GetModuleHandleUni(), NULL);
257         0, 0, 100, 1000, parent, NULL, GetModuleHandle(NULL), NULL);
260258   SetWindowLongPtr(result, GWLP_USERDATA, userdata);
261259   SendMessage(result, WM_SETFONT, (WPARAM)metrics().debug_font(), (LPARAM)FALSE);
262260
r249094r249095
791789
792790      // initialize the description of the window class
793791      wc.lpszClassName    = TEXT("MAMEDebugView");
794      wc.hInstance        = GetModuleHandleUni();
792      wc.hInstance        = GetModuleHandle(NULL);
795793      wc.lpfnWndProc      = &debugview_info::static_view_proc;
796794      wc.hCursor          = LoadCursor(NULL, IDC_ARROW);
797795      wc.hIcon            = LoadIcon(wc.hInstance, MAKEINTRESOURCE(2));
r249094r249095
800798      wc.style            = 0;
801799      wc.cbClsExtra       = 0;
802800      wc.cbWndExtra       = 0;
803     
804      UnregisterClass(wc.lpszClassName, wc.hInstance);
805801
806802      // register the class; fail if we can't
807803      if (!RegisterClass(&wc))
trunk/src/osd/modules/debugger/win/debugwininfo.c
r249094r249095
1717#include "window.h"
1818#include "winutf8.h"
1919
20#include "winutil.h"
2120
22
2321bool debugwin_info::s_window_class_registered = false;
2422
2523
r249094r249095
3836   register_window_class();
3937
4038   m_wnd = win_create_window_ex_utf8(DEBUG_WINDOW_STYLE_EX, "MAMEDebugWindow", title, DEBUG_WINDOW_STYLE,
41         0, 0, 100, 100, win_window_list->m_hwnd, create_standard_menubar(), GetModuleHandleUni(), this);
39         0, 0, 100, 100, win_window_list->m_hwnd, create_standard_menubar(), GetModuleHandle(NULL), this);
4240   if (m_wnd == NULL)
4341      return;
4442
r249094r249095
582580
583581      // initialize the description of the window class
584582      wc.lpszClassName    = TEXT("MAMEDebugWindow");
585      wc.hInstance        = GetModuleHandleUni();
583      wc.hInstance        = GetModuleHandle(NULL);
586584      wc.lpfnWndProc      = &debugwin_info::static_window_proc;
587585      wc.hCursor          = LoadCursor(NULL, IDC_ARROW);
588586      wc.hIcon            = LoadIcon(wc.hInstance, MAKEINTRESOURCE(2));
r249094r249095
591589      wc.style            = 0;
592590      wc.cbClsExtra       = 0;
593591      wc.cbWndExtra       = 0;
594     
595      UnregisterClass(wc.lpszClassName, wc.hInstance);
596592
597593      // register the class; fail if we can't
598594      if (!RegisterClass(&wc))
trunk/src/osd/modules/debugger/win/editwininfo.c
r249094r249095
1313
1414#include "strconv.h"
1515
16#include "winutil.h"
1716
18
1917// edit box styles
2018#define EDIT_BOX_STYLE      WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL
2119#define EDIT_BOX_STYLE_EX   0
r249094r249095
3432
3533   // create an edit box and override its key handling
3634   m_editwnd = CreateWindowEx(EDIT_BOX_STYLE_EX, TEXT("EDIT"), NULL, EDIT_BOX_STYLE,
37         0, 0, 100, 100, window(), NULL, GetModuleHandleUni(), NULL);
35         0, 0, 100, 100, window(), NULL, GetModuleHandle(NULL), NULL);
3836   m_original_editproc = (WNDPROC)(FPTR)GetWindowLongPtr(m_editwnd, GWLP_WNDPROC);
3937   SetWindowLongPtr(m_editwnd, GWLP_USERDATA, (LONG_PTR)this);
4038   SetWindowLongPtr(m_editwnd, GWLP_WNDPROC, (LONG_PTR)&editwin_info::static_edit_proc);
trunk/src/osd/windows/input.c
r249094r249095
3838#include "strconv.h"
3939#include "config.h"
4040
41#include "winutil.h"
42
4341//============================================================
4442//  PARAMETERS
4543//============================================================
r249094r249095
11191117   int didevtype_joystick = DI8DEVCLASS_GAMECTRL;
11201118
11211119   dinput_version = DIRECTINPUT_VERSION;
1122   result = DirectInput8Create(GetModuleHandleUni(), dinput_version, IID_IDirectInput8, (void **)&dinput, NULL);
1120   result = DirectInput8Create(GetModuleHandle(NULL), dinput_version, IID_IDirectInput8, (void **)&dinput, NULL);
11231121   if (result != DI_OK)
11241122   {
11251123      dinput_version = 0;
r249094r249095
11321130
11331131   // first attempt to initialize DirectInput at the current version
11341132   dinput_version = DIRECTINPUT_VERSION;
1135   result = DirectInputCreate(GetModuleHandleUni(), dinput_version, &dinput, NULL);
1133   result = DirectInputCreate(GetModuleHandle(NULL), dinput_version, &dinput, NULL);
11361134   if (result != DI_OK)
11371135   {
11381136      // if that fails, try version 5
11391137      dinput_version = 0x0500;
1140      result = DirectInputCreate(GetModuleHandleUni(), dinput_version, &dinput, NULL);
1138      result = DirectInputCreate(GetModuleHandle(NULL), dinput_version, &dinput, NULL);
11411139      if (result != DI_OK)
11421140      {
11431141         // if that fails, try version 3
11441142         dinput_version = 0x0300;
1145         result = DirectInputCreate(GetModuleHandleUni(), dinput_version, &dinput, NULL);
1143         result = DirectInputCreate(GetModuleHandle(NULL), dinput_version, &dinput, NULL);
11461144         if (result != DI_OK)
11471145         {
11481146            dinput_version = 0;
trunk/src/osd/windows/output.c
r249094r249095
1717// MAMEOS headers
1818#include "output.h"
1919
20#include "winutil.h"
2120
2221
23
2422//============================================================
2523//  CONSTANTS
2624//============================================================
r249094r249095
103101                  1, 1,
104102                  NULL,
105103                  NULL,
106                  GetModuleHandleUni(),
104                  GetModuleHandle(NULL),
107105                  NULL);
108106   assert(output_hwnd != NULL);
109107
r249094r249095
169167
170168      // initialize the description of the window class
171169      wc.lpszClassName    = OUTPUT_WINDOW_CLASS;
172      wc.hInstance        = GetModuleHandleUni();
170      wc.hInstance        = GetModuleHandle(NULL);
173171      wc.lpfnWndProc      = output_window_proc;
174     
175      UnregisterClass(wc.lpszClassName, wc.hInstance);
176172
177173      // register the class; fail if we can't
178174      if (!RegisterClass(&wc))
trunk/src/osd/windows/window.c
r249094r249095
3535#include "config.h"
3636#include "winutf8.h"
3737
38#include "winutil.h"
39
4038extern int drawnone_init(running_machine &machine, osd_draw_callbacks *callbacks);
4139extern int drawgdi_init(running_machine &machine, osd_draw_callbacks *callbacks);
4240extern int drawdd_init(running_machine &machine, osd_draw_callbacks *callbacks);
r249094r249095
887885
888886      // initialize the description of the window class
889887      wc.lpszClassName    = TEXT("MAME");
890      wc.hInstance        = GetModuleHandleUni();
888      wc.hInstance        = GetModuleHandle(NULL);
891889      wc.lpfnWndProc      = winwindow_video_window_proc_ui;
892890      wc.hCursor          = LoadCursor(NULL, IDC_ARROW);
893891      wc.hIcon            = LoadIcon(wc.hInstance, MAKEINTRESOURCE(2));
894     
895      UnregisterClass(wc.lpszClassName, wc.hInstance);
896892
897893      // register the class; fail if we can't
898894      if (!RegisterClass(&wc))
r249094r249095
11951191                  monitorbounds.left() + 100, monitorbounds.top() + 100,
11961192                  NULL,//(win_window_list != NULL) ? win_window_list->m_hwnd : NULL,
11971193                  menu,
1198                  GetModuleHandleUni(),
1194                  GetModuleHandle(NULL),
11991195                  NULL);
12001196   if (m_hwnd == NULL)
12011197      return 1;
trunk/src/osd/windows/winmain.c
r249094r249095
13211321   dynamic_bind<PIMAGE_NT_HEADERS (WINAPI *)(PVOID)> image_nt_header(TEXT("dbghelp.dll"), "ImageNtHeader");
13221322
13231323   // start with the image base
1324   PVOID base = reinterpret_cast<PVOID>(GetModuleHandleUni());
1324   PVOID base = reinterpret_cast<PVOID>(GetModuleHandle(NULL));
13251325   assert(base != NULL);
13261326
13271327   // make sure we have the functions we need
trunk/src/osd/windows/winutil.c
r249094r249095
9292      is_first_time = FALSE;
9393
9494      // get the current module
95      module = GetModuleHandleUni();
95      module = GetModuleHandle(NULL);
9696      if (!module)
9797         return FALSE;
9898      image_ptr = (BYTE*) module;
r249094r249095
122122   }
123123   return is_gui_frontend;
124124}
125
126//-------------------------------------------------
127//  Universal way to get module handle
128//-------------------------------------------------
129
130HMODULE WINAPI GetModuleHandleUni()
131{
132   MEMORY_BASIC_INFORMATION mbi;
133   VirtualQuery((LPCVOID)GetModuleHandleUni, &mbi, sizeof(mbi));
134   return (HMODULE)mbi.AllocationBase;
135}
trunk/src/osd/windows/winutil.h
r249094r249095
1515file_error win_error_to_file_error(DWORD error);
1616osd_dir_entry_type win_attributes_to_entry_type(DWORD attributes);
1717BOOL win_is_gui_application(void);
18HMODULE WINAPI GetModuleHandleUni();
1918
2019#endif // __WINUTIL__
trunk/tests/lib/util/corestr.c
r249094r249095
11// license:BSD-3-Clause
22// copyright-holders:Miodrag Milanovic
33
4#include "gtest/gtest.h"
4#include "UnitTest++/UnitTest++.h"
55#include "corestr.h"
66
7TEST(corestr,strmakeupper)
7TEST(strmakeupper)
88{
99   std::string value = "test";
10   EXPECT_STREQ("TEST", strmakeupper(value).c_str());
10   CHECK_EQUAL("TEST", strmakeupper(value).c_str());
1111}
1212
13TEST(corestr,strmakelower)
13TEST(strmakelower)
1414{
1515   std::string value = "ValUE";
16   EXPECT_STREQ("value", strmakelower(value).c_str());
16   CHECK_EQUAL("value", strmakelower(value).c_str());
1717}
1818
19TEST(corestr,strreplace)
19TEST(strreplace)
2020{
2121   std::string value = "Main string";
22   EXPECT_EQ(1, strreplace(value,"str","aaa"));
23   EXPECT_STREQ("Main aaaing", value.c_str());
24   EXPECT_EQ(4, strreplace(value,"a","b"));
22   CHECK_EQUAL(1, strreplace(value,"str","aaa"));
23   CHECK_EQUAL("Main aaaing", value.c_str());
24   CHECK_EQUAL(4, strreplace(value,"a","b"));
2525}
2626
27TEST(corestr,strtrimspace)
27TEST(strtrimspace)
2828{
2929   std::string value = "    a value  for test  ";
30   EXPECT_STREQ("a value  for test", strtrimspace(value).c_str());
30   CHECK_EQUAL("a value  for test", strtrimspace(value).c_str());
3131   value = "\r\n\ta value  for test\r\n\n\r";
32   EXPECT_STREQ("a value  for test", strtrimspace(value).c_str());
32   CHECK_EQUAL("a value  for test", strtrimspace(value).c_str());
3333}
3434
35TEST(corestr,strreplacechr)
35TEST(strreplacechr)
3636{
3737   std::string value = "String for doing replaces";
3838   strreplacechr(value,'a','A');
3939   strreplacechr(value,'e','E');
4040   strreplacechr(value,'i','I');
4141   strreplacechr(value,'o','O');
42   EXPECT_STREQ("StrIng fOr dOIng rEplAcEs", value.c_str());
42   CHECK_EQUAL("StrIng fOr dOIng rEplAcEs", value.c_str());
4343}
4444
45TEST(corestr,strdelchr)
45TEST(strdelchr)
4646{
4747   std::string value = "String for doing deletes";
4848   strdelchr(value,'a');
4949   strdelchr(value,'e');
5050   strdelchr(value,'i');
5151   strdelchr(value,'o');
52   EXPECT_STREQ("Strng fr dng dlts", value.c_str());
52   CHECK_EQUAL("Strng fr dng dlts", value.c_str());
5353}
5454
trunk/tests/main.c
r249094r249095
11// license:BSD-3-Clause
22// copyright-holders:Miodrag Milanovic
33
4#include <stdio.h>
5#include "gtest/gtest.h"
4#include "UnitTest++/UnitTest++.h"
65
7int main(int argc, char **argv)
6int main(int, char const *[])
87{
9  testing::InitGoogleTest(&argc, argv);
10  return RUN_ALL_TESTS();
8    return UnitTest::RunAllTests();
119}
12


Previous 199869 Revisions Next


© 1997-2024 The MAME Team